ramaze.ch.oddb.org 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/LICENSE +339 -0
- data/Manifest.txt +285 -0
- data/README.txt +45 -0
- data/Rakefile +28 -0
- data/bin/admin +69 -0
- data/bin/exportd +63 -0
- data/bin/migrate +461 -0
- data/bin/oddbd +62 -0
- data/data/fulltext/data/dicts/french/fulltext.aff +1057 -0
- data/data/fulltext/data/dicts/french/fulltext.dict +91189 -0
- data/data/fulltext/data/dicts/french/fulltext.stop +135 -0
- data/data/fulltext/data/dicts/german/fulltext.aff +1233 -0
- data/data/fulltext/data/dicts/german/fulltext.dict +287574 -0
- data/data/fulltext/data/dicts/german/fulltext.stop +133 -0
- data/data/fulltext/data/german_compound/README +15 -0
- data/data/fulltext/data/german_compound/compound.pl +63 -0
- data/data/fulltext/data/german_compound/german.stop +20 -0
- data/data/fulltext/data/ispell-german-compound.tar.gz +0 -0
- data/data/fulltext/redist/dict_french/Makefile +12 -0
- data/data/fulltext/redist/dict_french/README.french +1 -0
- data/data/fulltext/redist/dict_french/dict_french.sql.in +7 -0
- data/data/fulltext/redist/dict_french/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_french/french_stem.c +1222 -0
- data/data/fulltext/redist/dict_french/french_stem.h +16 -0
- data/data/fulltext/redist/dict_french/subinclude.h +2 -0
- data/data/fulltext/redist/dict_german/Makefile +12 -0
- data/data/fulltext/redist/dict_german/README.german +1 -0
- data/data/fulltext/redist/dict_german/dict_german.sql.in +7 -0
- data/data/fulltext/redist/dict_german/dict_snowball.c +56 -0
- data/data/fulltext/redist/dict_german/german_stem.c +527 -0
- data/data/fulltext/redist/dict_german/german_stem.h +16 -0
- data/data/fulltext/redist/dict_german/subinclude.h +1 -0
- data/data/fulltext/redist/french_stem.c +1222 -0
- data/data/fulltext/redist/french_stem.h +16 -0
- data/data/fulltext/redist/german_stem.c +527 -0
- data/data/fulltext/redist/german_stem.h +16 -0
- data/lib/fixes/ruby19.rb +21 -0
- data/lib/fixes/selenium.rb +20 -0
- data/lib/fixes/singular.rb +8 -0
- data/lib/fixes/yaml.rb +13 -0
- data/lib/oddb.rb +11 -0
- data/lib/oddb/business/company.rb +18 -0
- data/lib/oddb/business/invoice.rb +75 -0
- data/lib/oddb/business/price.rb +60 -0
- data/lib/oddb/config.rb +73 -0
- data/lib/oddb/drugs.rb +16 -0
- data/lib/oddb/drugs/active_agent.rb +37 -0
- data/lib/oddb/drugs/atc.rb +53 -0
- data/lib/oddb/drugs/composition.rb +41 -0
- data/lib/oddb/drugs/ddd.rb +24 -0
- data/lib/oddb/drugs/dose.rb +107 -0
- data/lib/oddb/drugs/galenic_form.rb +21 -0
- data/lib/oddb/drugs/galenic_group.rb +17 -0
- data/lib/oddb/drugs/package.rb +87 -0
- data/lib/oddb/drugs/part.rb +56 -0
- data/lib/oddb/drugs/product.rb +25 -0
- data/lib/oddb/drugs/sequence.rb +61 -0
- data/lib/oddb/drugs/substance.rb +31 -0
- data/lib/oddb/drugs/substance_group.rb +13 -0
- data/lib/oddb/drugs/unit.rb +12 -0
- data/lib/oddb/export.rb +4 -0
- data/lib/oddb/export/csv.rb +89 -0
- data/lib/oddb/export/l10n_sessions.rb +30 -0
- data/lib/oddb/export/rss.rb +44 -0
- data/lib/oddb/export/server.rb +58 -0
- data/lib/oddb/export/xls.rb +119 -0
- data/lib/oddb/export/yaml.rb +123 -0
- data/lib/oddb/html/state/drugs/admin/package.rb +189 -0
- data/lib/oddb/html/state/drugs/admin/product.rb +56 -0
- data/lib/oddb/html/state/drugs/admin/sequence.rb +259 -0
- data/lib/oddb/html/state/drugs/ajax/explain_ddd_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/explain_price.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/global.rb +18 -0
- data/lib/oddb/html/state/drugs/ajax/package_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/ajax/remote_infos.rb +19 -0
- data/lib/oddb/html/state/drugs/atc_browser.rb +39 -0
- data/lib/oddb/html/state/drugs/atc_guidelines.rb +21 -0
- data/lib/oddb/html/state/drugs/compare.rb +52 -0
- data/lib/oddb/html/state/drugs/download_export.rb +18 -0
- data/lib/oddb/html/state/drugs/fachinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/feedback.rb +94 -0
- data/lib/oddb/html/state/drugs/global.rb +266 -0
- data/lib/oddb/html/state/drugs/init.rb +18 -0
- data/lib/oddb/html/state/drugs/login.rb +17 -0
- data/lib/oddb/html/state/drugs/package.rb +32 -0
- data/lib/oddb/html/state/drugs/patinfo.rb +21 -0
- data/lib/oddb/html/state/drugs/products.rb +51 -0
- data/lib/oddb/html/state/drugs/result.rb +125 -0
- data/lib/oddb/html/state/global.rb +165 -0
- data/lib/oddb/html/state/global_predefine.rb +17 -0
- data/lib/oddb/html/state/limit.rb +17 -0
- data/lib/oddb/html/state/login.rb +56 -0
- data/lib/oddb/html/state/paypal/checkout.rb +130 -0
- data/lib/oddb/html/state/paypal/collect.rb +46 -0
- data/lib/oddb/html/state/paypal/redirect.rb +18 -0
- data/lib/oddb/html/state/register_export.rb +38 -0
- data/lib/oddb/html/state/register_poweruser.rb +17 -0
- data/lib/oddb/html/state/viral/admin.rb +76 -0
- data/lib/oddb/html/state/viral/poweruser.rb +16 -0
- data/lib/oddb/html/util/annotated_list.rb +39 -0
- data/lib/oddb/html/util/know_it_all.rb +28 -0
- data/lib/oddb/html/util/known_user.rb +55 -0
- data/lib/oddb/html/util/lookandfeel.rb +554 -0
- data/lib/oddb/html/util/need_all_input.rb +29 -0
- data/lib/oddb/html/util/session.rb +88 -0
- data/lib/oddb/html/util/sort.rb +72 -0
- data/lib/oddb/html/util/unsaved_helper.rb +20 -0
- data/lib/oddb/html/util/validator.rb +54 -0
- data/lib/oddb/html/view/ajax/json.rb +22 -0
- data/lib/oddb/html/view/alpha_header.rb +28 -0
- data/lib/oddb/html/view/document.rb +126 -0
- data/lib/oddb/html/view/drugs/admin/package.rb +237 -0
- data/lib/oddb/html/view/drugs/admin/product.rb +104 -0
- data/lib/oddb/html/view/drugs/admin/sequence.rb +312 -0
- data/lib/oddb/html/view/drugs/ajax/explain_ddd_price.rb +87 -0
- data/lib/oddb/html/view/drugs/ajax/explain_price.rb +61 -0
- data/lib/oddb/html/view/drugs/ajax/package_infos.rb +105 -0
- data/lib/oddb/html/view/drugs/ajax/remote_infos.rb +44 -0
- data/lib/oddb/html/view/drugs/atc_browser.rb +68 -0
- data/lib/oddb/html/view/drugs/atc_guidelines.rb +94 -0
- data/lib/oddb/html/view/drugs/compare.rb +95 -0
- data/lib/oddb/html/view/drugs/download_export.rb +28 -0
- data/lib/oddb/html/view/drugs/fachinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/feedback.rb +231 -0
- data/lib/oddb/html/view/drugs/init.rb +51 -0
- data/lib/oddb/html/view/drugs/legend.rb +24 -0
- data/lib/oddb/html/view/drugs/package.rb +398 -0
- data/lib/oddb/html/view/drugs/patinfo.rb +46 -0
- data/lib/oddb/html/view/drugs/products.rb +97 -0
- data/lib/oddb/html/view/drugs/result.rb +296 -0
- data/lib/oddb/html/view/drugs/search.rb +33 -0
- data/lib/oddb/html/view/drugs/template.rb +15 -0
- data/lib/oddb/html/view/foot.rb +52 -0
- data/lib/oddb/html/view/google.rb +23 -0
- data/lib/oddb/html/view/google_ads.rb +40 -0
- data/lib/oddb/html/view/head.rb +78 -0
- data/lib/oddb/html/view/limit.rb +109 -0
- data/lib/oddb/html/view/list.rb +59 -0
- data/lib/oddb/html/view/login.rb +38 -0
- data/lib/oddb/html/view/navigation.rb +67 -0
- data/lib/oddb/html/view/offset_header.rb +35 -0
- data/lib/oddb/html/view/paypal/collect.rb +84 -0
- data/lib/oddb/html/view/paypal/redirect.rb +51 -0
- data/lib/oddb/html/view/paypal/register_form.rb +106 -0
- data/lib/oddb/html/view/register_export.rb +29 -0
- data/lib/oddb/html/view/register_poweruser.rb +29 -0
- data/lib/oddb/html/view/rss/feedback.rb +64 -0
- data/lib/oddb/html/view/rss_preview.rb +54 -0
- data/lib/oddb/html/view/search.rb +104 -0
- data/lib/oddb/html/view/snapback.rb +24 -0
- data/lib/oddb/html/view/template.rb +56 -0
- data/lib/oddb/import/excel.rb +45 -0
- data/lib/oddb/import/import.rb +39 -0
- data/lib/oddb/import/rtf.rb +410 -0
- data/lib/oddb/import/whocc.rb +173 -0
- data/lib/oddb/import/xml.rb +15 -0
- data/lib/oddb/model.rb +179 -0
- data/lib/oddb/persistence/odba.rb +33 -0
- data/lib/oddb/persistence/odba/business/company.rb +13 -0
- data/lib/oddb/persistence/odba/business/invoice.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/atc.rb +15 -0
- data/lib/oddb/persistence/odba/drugs/galenic_form.rb +18 -0
- data/lib/oddb/persistence/odba/drugs/galenic_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/package.rb +25 -0
- data/lib/oddb/persistence/odba/drugs/product.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/sequence.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance.rb +21 -0
- data/lib/oddb/persistence/odba/drugs/substance_group.rb +13 -0
- data/lib/oddb/persistence/odba/drugs/unit.rb +13 -0
- data/lib/oddb/persistence/odba/export.rb +26 -0
- data/lib/oddb/persistence/odba/model.rb +68 -0
- data/lib/oddb/persistence/odba/regulatory/authority.rb +13 -0
- data/lib/oddb/persistence/odba/regulatory/registration.rb +13 -0
- data/lib/oddb/persistence/odba/text/document.rb +11 -0
- data/lib/oddb/persistence/odba/util/code.rb +11 -0
- data/lib/oddb/persistence/odba/util/m10l_document.rb +13 -0
- data/lib/oddb/persistence/og.rb +16 -0
- data/lib/oddb/persistence/og/drugs/composition.rb +14 -0
- data/lib/oddb/persistence/og/drugs/product.rb +14 -0
- data/lib/oddb/persistence/og/drugs/sequence.rb +15 -0
- data/lib/oddb/persistence/og/model.rb +25 -0
- data/lib/oddb/persistence/og/util/multilingual.rb +13 -0
- data/lib/oddb/redist/rtf_tools/reader.rb +139 -0
- data/lib/oddb/regulatory/authority.rb +14 -0
- data/lib/oddb/regulatory/registration.rb +15 -0
- data/lib/oddb/remote/business/company.rb +23 -0
- data/lib/oddb/remote/drugs/active_agent.rb +27 -0
- data/lib/oddb/remote/drugs/atc.rb +32 -0
- data/lib/oddb/remote/drugs/dose.rb +8 -0
- data/lib/oddb/remote/drugs/galenic_form.rb +25 -0
- data/lib/oddb/remote/drugs/package.rb +126 -0
- data/lib/oddb/remote/drugs/part.rb +30 -0
- data/lib/oddb/remote/drugs/product.rb +19 -0
- data/lib/oddb/remote/drugs/sequence.rb +46 -0
- data/lib/oddb/remote/drugs/substance.rb +20 -0
- data/lib/oddb/remote/drugs/unit.rb +19 -0
- data/lib/oddb/remote/object.rb +36 -0
- data/lib/oddb/remote/text/document.rb +20 -0
- data/lib/oddb/remote/util/m10l_document.rb +22 -0
- data/lib/oddb/text/chapter.rb +27 -0
- data/lib/oddb/text/document.rb +43 -0
- data/lib/oddb/text/format.rb +37 -0
- data/lib/oddb/text/paragraph.rb +58 -0
- data/lib/oddb/text/picture.rb +93 -0
- data/lib/oddb/text/table.rb +68 -0
- data/lib/oddb/util.rb +8 -0
- data/lib/oddb/util/annotated_list.rb +37 -0
- data/lib/oddb/util/code.rb +69 -0
- data/lib/oddb/util/comparison.rb +36 -0
- data/lib/oddb/util/exporter.rb +8 -0
- data/lib/oddb/util/feedback.rb +23 -0
- data/lib/oddb/util/ipn.rb +48 -0
- data/lib/oddb/util/m10l_document.rb +38 -0
- data/lib/oddb/util/mail.rb +73 -0
- data/lib/oddb/util/money.rb +60 -0
- data/lib/oddb/util/multilingual.rb +70 -0
- data/lib/oddb/util/quanty.rb +4 -0
- data/lib/oddb/util/quanty/fact.rb +229 -0
- data/lib/oddb/util/quanty/main.rb +160 -0
- data/lib/oddb/util/quanty/parse.rb +853 -0
- data/lib/oddb/util/quanty/units.dump +0 -0
- data/lib/oddb/util/server.rb +117 -0
- data/lib/oddb/util/updater.rb +41 -0
- data/lib/oddb/util/ydim.rb +110 -0
- data/lib/oddb/util/yus.rb +46 -0
- data/test/business/test_company.rb +29 -0
- data/test/business/test_price.rb +46 -0
- data/test/drugs/test_active_agent.rb +53 -0
- data/test/drugs/test_atc.rb +54 -0
- data/test/drugs/test_composition.rb +88 -0
- data/test/drugs/test_ddd.rb +22 -0
- data/test/drugs/test_dose.rb +190 -0
- data/test/drugs/test_galenic_form.rb +41 -0
- data/test/drugs/test_package.rb +173 -0
- data/test/drugs/test_part.rb +32 -0
- data/test/drugs/test_product.rb +31 -0
- data/test/drugs/test_sequence.rb +140 -0
- data/test/drugs/test_substance.rb +51 -0
- data/test/drugs/test_substance_group.rb +27 -0
- data/test/export/test_rss.rb +94 -0
- data/test/export/test_server.rb +117 -0
- data/test/export/test_xls.rb +152 -0
- data/test/export/test_yaml.rb +120 -0
- data/test/import/data/html/whocc/A.html +56 -0
- data/test/import/data/html/whocc/A03.html +48 -0
- data/test/import/data/html/whocc/A03AB.html +48 -0
- data/test/import/data/html/whocc/A06AA.html +47 -0
- data/test/import/data/html/whocc/C03.html +47 -0
- data/test/import/data/html/whocc/login.html +77 -0
- data/test/import/data/xml/ATC_2006.xml +47 -0
- data/test/import/data/xml/ATC_2006_ddd.xml +35 -0
- data/test/import/test_excel.rb +34 -0
- data/test/import/test_rtf.rb +40 -0
- data/test/import/test_whocc.rb +315 -0
- data/test/remote/drugs/test_active_agent.rb +36 -0
- data/test/selenium/selenium-server.jar +0 -0
- data/test/selenium/test_atc_browser.rb +122 -0
- data/test/selenium/test_atc_guidelines.rb +96 -0
- data/test/selenium/test_collect.rb +138 -0
- data/test/selenium/test_compare.rb +206 -0
- data/test/selenium/test_fachinfo.rb +130 -0
- data/test/selenium/test_feedback.rb +196 -0
- data/test/selenium/test_init.rb +52 -0
- data/test/selenium/test_limit.rb +305 -0
- data/test/selenium/test_login.rb +67 -0
- data/test/selenium/test_package.rb +512 -0
- data/test/selenium/test_patinfo.rb +131 -0
- data/test/selenium/test_product.rb +80 -0
- data/test/selenium/test_products.rb +142 -0
- data/test/selenium/test_search.rb +715 -0
- data/test/selenium/test_sequence.rb +543 -0
- data/test/selenium/unit.rb +185 -0
- data/test/stub/http_server.rb +169 -0
- data/test/stub/model.rb +173 -0
- data/test/suite.rb +15 -0
- data/test/test_model.rb +83 -0
- data/test/util/test_code.rb +74 -0
- data/test/util/test_ipn.rb +117 -0
- data/test/util/test_mail.rb +86 -0
- data/test/util/test_multilingual.rb +97 -0
- data/test/util/test_server.rb +48 -0
- data/test/util/test_updater.rb +353 -0
- data/test/util/test_ydim.rb +115 -0
- data/test/util/test_yus.rb +79 -0
- metadata +418 -0
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Ajax::ExplainDddPrice -- de.oddb.org -- 07.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/view/drugs/ajax/explain_ddd_price'
|
5
|
+
require 'oddb/html/state/drugs/ajax/global'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
module Ajax
|
12
|
+
class ExplainDddPrice < Global
|
13
|
+
VIEW = View::Drugs::Ajax::ExplainDddPrice
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Ajax::ExplainPrice -- de.oddb.org -- 07.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/view/drugs/ajax/explain_price'
|
5
|
+
require 'oddb/html/state/drugs/ajax/global'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
module Ajax
|
12
|
+
class ExplainPrice < Global
|
13
|
+
VIEW = View::Drugs::Ajax::ExplainPrice
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Ajax::Global -- de.oddb.org -- 07.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/state/drugs/global'
|
5
|
+
|
6
|
+
module ODDB
|
7
|
+
module Html
|
8
|
+
module State
|
9
|
+
module Drugs
|
10
|
+
module Ajax
|
11
|
+
class Global < Drugs::Global
|
12
|
+
VOLATILE = true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Ajax::PackageInfos -- de.oddb.org -- 05.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/view/drugs/ajax/package_infos'
|
5
|
+
require 'oddb/html/state/drugs/ajax/global'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
module Ajax
|
12
|
+
class PackageInfos < Global
|
13
|
+
VIEW = View::Drugs::Ajax::PackageInfos
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Drugs::Ajax::RemoteInfos -- de.oddb.org -- 06.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/view/drugs/ajax/remote_infos'
|
5
|
+
require 'oddb/html/state/drugs/ajax/global'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
module Ajax
|
12
|
+
class RemoteInfos < Global
|
13
|
+
VIEW = View::Drugs::Ajax::RemoteInfos
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::AtcBrowser -- de.oddb.org -- 13.12.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/state/global_predefine'
|
5
|
+
require 'oddb/html/view/drugs/atc_browser'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
class AtcBrowser < Drugs::Global
|
12
|
+
DIRECT_EVENT = :atc_browser
|
13
|
+
LIMIT = true
|
14
|
+
VIEW = View::Drugs::AtcBrowser
|
15
|
+
def init
|
16
|
+
@model = ODDB::Drugs::Atc.search_by_level_and_code(1, '')
|
17
|
+
if(code = @session.user_input(:code))
|
18
|
+
parent = ODDB::Drugs::Atc.find_by_code(code)
|
19
|
+
level = parent.level.next
|
20
|
+
children = ODDB::Drugs::Atc.search_by_level_and_code(level, parent.code)
|
21
|
+
while(level < 5 && children.size == 1)
|
22
|
+
child = children.first
|
23
|
+
level = level.next
|
24
|
+
children = ODDB::Drugs::Atc.search_by_level_and_code(level, child.code)
|
25
|
+
@model.concat children
|
26
|
+
end
|
27
|
+
parent.level.next.downto(2) { |level|
|
28
|
+
@model.concat ODDB::Drugs::Atc.search_by_level_and_code(level,
|
29
|
+
parent.code)
|
30
|
+
parent = parent.parent
|
31
|
+
}
|
32
|
+
end
|
33
|
+
@model.sort!
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::AtcGuidelines -- de.oddb.org -- 09.03.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/state/drugs/global'
|
5
|
+
require 'oddb/html/view/drugs/atc_guidelines'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
class AtcGuidelines < Global
|
12
|
+
LIMIT = true
|
13
|
+
VIEW = View::Drugs::AtcGuidelines
|
14
|
+
def direct_event
|
15
|
+
[:ddd, :code, @model.code]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Comparison -- de.oddb.org -- 14.02.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/util/comparison'
|
5
|
+
require 'oddb/html/state/global_predefine'
|
6
|
+
require 'oddb/html/util/sort'
|
7
|
+
require 'oddb/html/view/drugs/compare'
|
8
|
+
|
9
|
+
module ODDB
|
10
|
+
module Html
|
11
|
+
module State
|
12
|
+
module Drugs
|
13
|
+
class Compare < Global
|
14
|
+
include Util::PackageSort
|
15
|
+
LIMIT = true
|
16
|
+
VIEW = View::Drugs::Compare
|
17
|
+
def init
|
18
|
+
original = @model.origin
|
19
|
+
@model.collect! { |package|
|
20
|
+
ODDB::Util::Comparison.new(package, original) }
|
21
|
+
sort_by(:product)
|
22
|
+
sort_by(:difference)
|
23
|
+
sort
|
24
|
+
end
|
25
|
+
def _compare(code)
|
26
|
+
if(code == @model.query)
|
27
|
+
sort
|
28
|
+
else
|
29
|
+
super
|
30
|
+
end
|
31
|
+
end
|
32
|
+
def direct_event
|
33
|
+
direct_event = [:compare]
|
34
|
+
if(code = @model.query)
|
35
|
+
direct_event.push(:query, code)
|
36
|
+
end
|
37
|
+
direct_event
|
38
|
+
end
|
39
|
+
end
|
40
|
+
class CompareRemote < Compare
|
41
|
+
def direct_event
|
42
|
+
direct_event = [:compare_remote]
|
43
|
+
if((origin = @model.origin) && (uid = origin.uid))
|
44
|
+
direct_event.push(:uid, uid)
|
45
|
+
end
|
46
|
+
direct_event
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::DownloadExport -- de.oddb.org -- 28.07.2008 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/state/global_predefine'
|
5
|
+
require 'oddb/html/view/drugs/download_export'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
class DownloadExport < Global
|
12
|
+
VIEW = View::Drugs::DownloadExport
|
13
|
+
VOLATILE = true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Fachinfo -- de.oddb.org -- 30.10.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/html/state/global_predefine'
|
5
|
+
require 'oddb/html/view/drugs/fachinfo'
|
6
|
+
|
7
|
+
module ODDB
|
8
|
+
module Html
|
9
|
+
module State
|
10
|
+
module Drugs
|
11
|
+
class Fachinfo < Global
|
12
|
+
LIMIT = true
|
13
|
+
VIEW = View::Drugs::Fachinfo
|
14
|
+
def direct_event
|
15
|
+
[:fachinfo, [:uid, @model.uid]]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Feedback -- de.oddb.org -- 06.12.2007 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'delegate'
|
5
|
+
require 'oddb/html/state/global_predefine'
|
6
|
+
require 'oddb/html/util/need_all_input'
|
7
|
+
require 'oddb/html/view/drugs/feedback'
|
8
|
+
require 'oddb/util/feedback'
|
9
|
+
|
10
|
+
module ODDB
|
11
|
+
module Html
|
12
|
+
module State
|
13
|
+
module Drugs
|
14
|
+
class Feedback < Global
|
15
|
+
include Util::NeedAllInput
|
16
|
+
class Feedbackable < SimpleDelegator
|
17
|
+
INDEX_STEP = 10
|
18
|
+
attr_accessor :index
|
19
|
+
attr_reader :current, :item
|
20
|
+
def initialize(item)
|
21
|
+
@item = item
|
22
|
+
@index = 0
|
23
|
+
@current = ODDB::Util::Feedback.new
|
24
|
+
super
|
25
|
+
end
|
26
|
+
def created?
|
27
|
+
@item.feedbacks.include? @current
|
28
|
+
end
|
29
|
+
end
|
30
|
+
LIMIT = true
|
31
|
+
VIEW = View::Drugs::Feedback
|
32
|
+
attr_reader :passed_turing_test
|
33
|
+
def init
|
34
|
+
## disable captcha
|
35
|
+
@passed_turing_test = true
|
36
|
+
##
|
37
|
+
@model = Feedbackable.new(@model)
|
38
|
+
super
|
39
|
+
end
|
40
|
+
def direct_event
|
41
|
+
direct_event = [:feedback]
|
42
|
+
if(code = @model.code(:cid, ODDB.config.country))
|
43
|
+
direct_event.push([:cid, code.value])
|
44
|
+
end
|
45
|
+
direct_event
|
46
|
+
end
|
47
|
+
def _feedback(code)
|
48
|
+
if(@model.code(:cid, ODDB.config.country) == code)
|
49
|
+
self
|
50
|
+
else
|
51
|
+
super
|
52
|
+
end
|
53
|
+
end
|
54
|
+
def update
|
55
|
+
mandatory = [:name, :email, :email_public, :item_good_experience,
|
56
|
+
:item_recommended, :item_good_impression, :item_helps]
|
57
|
+
unless @passed_turing_test
|
58
|
+
mandatory.push :captcha
|
59
|
+
end
|
60
|
+
keys = mandatory + [:message]
|
61
|
+
hash = user_input(keys, mandatory)
|
62
|
+
if(@passed_turing_test)
|
63
|
+
# do nothing
|
64
|
+
elsif((candidates = hash[:captcha]) && candidates.any? { |key, word|
|
65
|
+
@session.lookandfeel.captcha.valid_answer? key, word })
|
66
|
+
@passed_turing_test = true
|
67
|
+
else
|
68
|
+
@errors.store(:captcha, create_error('e_failed_turing_test',
|
69
|
+
:captcha, nil))
|
70
|
+
end
|
71
|
+
unless(error?)
|
72
|
+
feedback = @model.current
|
73
|
+
info_key = (@model.created?) ? :feedback_changed : :feedback_saved
|
74
|
+
|
75
|
+
hash.each { |key, value|
|
76
|
+
writer = "#{key}="
|
77
|
+
if(feedback.respond_to? writer)
|
78
|
+
feedback.send writer, value
|
79
|
+
end
|
80
|
+
}
|
81
|
+
feedback.time = Time.now
|
82
|
+
feedback.item = @model.item
|
83
|
+
feedback.save
|
84
|
+
|
85
|
+
@session.update_feedback_rss_feed
|
86
|
+
@infos = [info_key]
|
87
|
+
end
|
88
|
+
self
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,266 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# Html::State::Drugs::Global -- de.oddb.org -- 27.10.2006 -- hwyss@ywesee.com
|
3
|
+
|
4
|
+
require 'oddb/business/company'
|
5
|
+
require 'oddb/drugs/package'
|
6
|
+
require 'oddb/remote/drugs/package'
|
7
|
+
require 'oddb/html/state/global'
|
8
|
+
require 'oddb/html/state/drugs/ajax/explain_price'
|
9
|
+
require 'oddb/html/state/drugs/ajax/explain_ddd_price'
|
10
|
+
require 'oddb/html/state/drugs/ajax/package_infos'
|
11
|
+
require 'oddb/html/state/drugs/ajax/remote_infos'
|
12
|
+
require 'oddb/html/state/drugs/atc_guidelines'
|
13
|
+
require 'oddb/html/state/drugs/compare'
|
14
|
+
require 'oddb/html/state/drugs/init'
|
15
|
+
require 'oddb/html/state/drugs/login'
|
16
|
+
require 'oddb/html/state/drugs/fachinfo'
|
17
|
+
require 'oddb/html/state/drugs/feedback'
|
18
|
+
require 'oddb/html/state/drugs/package'
|
19
|
+
require 'oddb/html/state/drugs/patinfo'
|
20
|
+
require 'oddb/html/state/drugs/products'
|
21
|
+
require 'oddb/html/state/drugs/result'
|
22
|
+
require 'oddb/html/util/know_it_all'
|
23
|
+
require 'oddb/util/annotated_list'
|
24
|
+
require 'ostruct'
|
25
|
+
|
26
|
+
module ODDB
|
27
|
+
module Html
|
28
|
+
module State
|
29
|
+
module Drugs
|
30
|
+
module Events
|
31
|
+
def compare_remote
|
32
|
+
if((uid = @session.user_input(:uid)) \
|
33
|
+
&& (package = _remote_package(uid)))
|
34
|
+
result = ODDB::Util::AnnotatedList.new(package.comparables)
|
35
|
+
result.origin = package
|
36
|
+
result.query = uid
|
37
|
+
CompareRemote.new(@session, result)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
def _compare(code)
|
41
|
+
if(package = _package_by_code(code))
|
42
|
+
result = ODDB::Util::AnnotatedList.new(package.comparables)
|
43
|
+
if(@session.lookandfeel.enabled?(:remote_databases, false))
|
44
|
+
result.concat(_remote_comparables(package))
|
45
|
+
end
|
46
|
+
result.origin = package
|
47
|
+
result.query = code
|
48
|
+
Compare.new(@session, result)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
def _complete(result)
|
52
|
+
atcs = {}
|
53
|
+
result.dup.each { |package|
|
54
|
+
if((atc = package.atc) && !atcs[atc])
|
55
|
+
atcs.store(atc, true)
|
56
|
+
result.concat(atc.packages)
|
57
|
+
end
|
58
|
+
}
|
59
|
+
result.uniq!
|
60
|
+
end
|
61
|
+
def ddd
|
62
|
+
if((code = @session.user_input(:code)) \
|
63
|
+
&& (atc = ODDB::Drugs::Atc.find_by_code(code)))
|
64
|
+
AtcGuidelines.new(@session, atc)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
def _explain_ddd_price(code, idx)
|
68
|
+
if((package = _package_by_code(code)) \
|
69
|
+
&& (ddd = package.ddds.at(idx)))
|
70
|
+
Ajax::ExplainDddPrice.new(@session,
|
71
|
+
:ddd => ddd, :package => package)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
def _explain_price(code)
|
75
|
+
if(package = _package_by_code(code))
|
76
|
+
Ajax::ExplainPrice.new(@session, package.price(:public))
|
77
|
+
end
|
78
|
+
end
|
79
|
+
def _fachinfo(uid)
|
80
|
+
if(sequence = ODDB::Drugs::Sequence.find_by_uid(uid))
|
81
|
+
Fachinfo.new(@session, sequence)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
def _feedback(code)
|
85
|
+
if(package = _package_by_code(code))
|
86
|
+
Feedback.new(@session, package)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
def limited?(*args)
|
90
|
+
super && !@session.allowed?('view', ODDB.config.auth_domain)
|
91
|
+
end
|
92
|
+
def navigation
|
93
|
+
[:products, :atc_browser].concat(super)
|
94
|
+
end
|
95
|
+
def _package(code)
|
96
|
+
if(package = _package_by_code(code))
|
97
|
+
Package.new(@session, package)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
def _package_by_code(code)
|
101
|
+
ODDB::Drugs::Package.find_by_code(:type => 'cid',
|
102
|
+
:value => code,
|
103
|
+
:country => ODDB.config.country)
|
104
|
+
end
|
105
|
+
def _package_infos(code)
|
106
|
+
if(package = _package_by_code(code))
|
107
|
+
Ajax::PackageInfos.new(@session, package)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
def _patinfo(uid)
|
111
|
+
if(sequence = ODDB::Drugs::Sequence.find_by_uid(uid))
|
112
|
+
Patinfo.new(@session, sequence)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
def _products(query)
|
116
|
+
result = ODDB::Util::AnnotatedList.new
|
117
|
+
result.query = query
|
118
|
+
if(query)
|
119
|
+
if(query == '0-9')
|
120
|
+
alpha, others = partitioned_keys(ODDB::Drugs::Product.name_keys(1))
|
121
|
+
others.each { |key|
|
122
|
+
result.concat(ODDB::Drugs::Product.search_by_name(key))
|
123
|
+
}
|
124
|
+
else
|
125
|
+
result.concat(ODDB::Drugs::Product.search_by_name(query.downcase))
|
126
|
+
end
|
127
|
+
end
|
128
|
+
Products.new(@session, result)
|
129
|
+
end
|
130
|
+
def _remote(uri, &block)
|
131
|
+
block.call DRbObject.new(nil, uri)
|
132
|
+
rescue StandardError => e
|
133
|
+
warn e.message
|
134
|
+
end
|
135
|
+
def _remote_comparables(package)
|
136
|
+
if(atc = package.atc)
|
137
|
+
_remote_packages { |remote|
|
138
|
+
remote.remote_comparables(ODBA::DRbWrapper.new(package))
|
139
|
+
}
|
140
|
+
end
|
141
|
+
end
|
142
|
+
def _remote_infos(uid)
|
143
|
+
if(pac = _remote_package(uid))
|
144
|
+
Ajax::RemoteInfos.new(@session, pac)
|
145
|
+
end
|
146
|
+
end
|
147
|
+
def _remote_package(id)
|
148
|
+
source, ref = id.split('.', 2)
|
149
|
+
uri = ODDB.config.remote_databases.at(source.to_i)
|
150
|
+
if(pac = DRbObject._load(Marshal.dump([uri, ref])))
|
151
|
+
rate = _remote(uri) { |remote|
|
152
|
+
remote.get_currency_rate("EUR") }
|
153
|
+
Remote::Drugs::Package.new(source, pac, rate, _tax_factor)
|
154
|
+
end
|
155
|
+
end
|
156
|
+
def _remote_packages(&block)
|
157
|
+
result = []
|
158
|
+
ODDB.config.remote_databases.each_with_index { |uri, source|
|
159
|
+
_remote(uri) { |remote|
|
160
|
+
rate = remote.get_currency_rate("EUR")
|
161
|
+
block.call(remote).each { |pac|
|
162
|
+
result.push Remote::Drugs::Package.new(source, pac, rate,
|
163
|
+
_tax_factor)
|
164
|
+
}
|
165
|
+
}
|
166
|
+
}
|
167
|
+
result
|
168
|
+
end
|
169
|
+
def _tax_factor
|
170
|
+
@session.lookandfeel.tax_factor
|
171
|
+
end
|
172
|
+
def search
|
173
|
+
_search(@session.persistent_user_input(:query),
|
174
|
+
@session.persistent_user_input(:dstype) || ODDB.config.default_dstype)
|
175
|
+
end
|
176
|
+
def _search(query, dstype)
|
177
|
+
result = _search_local(query, dstype)
|
178
|
+
if(@session.lookandfeel.enabled?(:remote_databases, false))
|
179
|
+
result.concat(_search_remote(query))
|
180
|
+
end
|
181
|
+
Result.new(@session, result)
|
182
|
+
end
|
183
|
+
def _search_append_products(query, result)
|
184
|
+
table = {}
|
185
|
+
result.each do |package|
|
186
|
+
table.store package.product.uid, true
|
187
|
+
end
|
188
|
+
products = ODDB::Drugs::Product.search_by_name(query)
|
189
|
+
products.reject! do |prod| table[prod.uid] end
|
190
|
+
products.collect! do |prod|
|
191
|
+
Util::KnowItAll.new prod, :active_agents => [], :parts => [], :ddds => []
|
192
|
+
end
|
193
|
+
result.concat products
|
194
|
+
end
|
195
|
+
def _search_append_sequences(query, result)
|
196
|
+
table = {}
|
197
|
+
result.each do |package|
|
198
|
+
table.store package.sequence.uid, true
|
199
|
+
end
|
200
|
+
sequences = ODDB::Drugs::Sequence.search_by_product(query)
|
201
|
+
sequences.reject! do |seq| table[seq.uid] end
|
202
|
+
sequences.collect! do |seq|
|
203
|
+
parts = seq.compositions.collect do |comp|
|
204
|
+
Util::KnowItAll.new nil, :unit => comp.galenic_form
|
205
|
+
end
|
206
|
+
Util::KnowItAll.new seq, :active_agents => [], :parts => parts,
|
207
|
+
:ddds => [], :sequence => seq
|
208
|
+
end
|
209
|
+
result.concat sequences
|
210
|
+
end
|
211
|
+
def _search_by(key, query, result)
|
212
|
+
result.concat ODDB::Drugs::Package.send("search_by_#{key}", query)
|
213
|
+
end
|
214
|
+
def _search_local(query, dstype)
|
215
|
+
result = ODDB::Util::AnnotatedList.new
|
216
|
+
result.query = query
|
217
|
+
result.dstype = dstype || ODDB.config.default_dstype
|
218
|
+
if(query.length < 3)
|
219
|
+
result.error = :e_query_short
|
220
|
+
else
|
221
|
+
case dstype
|
222
|
+
when 'company'
|
223
|
+
_search_by(:company, query, result)
|
224
|
+
when 'substance'
|
225
|
+
_search_by(:substance, query, result)
|
226
|
+
when 'compare'
|
227
|
+
_search_by(:atc, query, result)
|
228
|
+
_search_by(:company, query, result) if result.empty?
|
229
|
+
_search_by(:substance, query, result) if result.empty?
|
230
|
+
_complete(_search_by(:name, query, result)) if result.empty?
|
231
|
+
_complete(_search_by(:product, query, result)) if result.empty?
|
232
|
+
when 'indication'
|
233
|
+
seqs = ODDB::Drugs::Sequence.search_by_fachinfo_indications_de(query)
|
234
|
+
seqs.each { |seq| result.concat seq.packages }
|
235
|
+
else
|
236
|
+
_search_by(:name, query, result)
|
237
|
+
_search_by(:product, query, result) if result.empty?
|
238
|
+
_search_append_sequences(query, result)
|
239
|
+
_search_append_products(query, result)
|
240
|
+
end
|
241
|
+
end
|
242
|
+
result
|
243
|
+
end
|
244
|
+
def _search_remote(query)
|
245
|
+
_remote_packages { |remote| remote.remote_packages(query) }
|
246
|
+
end
|
247
|
+
end
|
248
|
+
class Global < State::Global
|
249
|
+
class << self
|
250
|
+
def transparent_login(*events)
|
251
|
+
events.each { |event|
|
252
|
+
define_method(event) {
|
253
|
+
state = trigger(:login)
|
254
|
+
state.desired_input = @session.valid_input.dup
|
255
|
+
state
|
256
|
+
}
|
257
|
+
}
|
258
|
+
end
|
259
|
+
end
|
260
|
+
include Events
|
261
|
+
transparent_login :_product, :_sequence
|
262
|
+
end
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
end
|