Class: ODDB::View::Drugs::CenteredSearchComposite

Inherits:
CenteredSearchComposite show all
Includes:
Facebook
Defined in:
src/view/drugs/centeredsearchform.rb

Constant Summary

COMPONENTS =
{
  [0,0]   => :screencast,
  [0,1]   => :language_chooser,
  [0,2]   => View::Drugs::CenteredSearchForm,
  [0,3]   => :search_explain, 
  [0,4]   => View::CenteredNavigation,
}
CSS_MAP =
{
  [0,0,1,5]   => 'list center',
}

Constants inherited from CenteredSearchComposite

COMPONENTS, COMPONENT_CSS_MAP, CSS_CLASS, CSS_MAP, HTML_ATTRIBUTES, SYMBOL_MAP

Instance Method Summary (collapse)

Methods included from Facebook

#facebook_fan, #facebook_share

Methods inherited from CenteredSearchComposite

#atc_chooser, #atc_ddd_size, #beta, #database_last_updated, #database_size, #divider, #download_ebook, #download_export, #download_generics, #export_divider, #fachinfo_size, #fipi_offer, #interactions, #limitation_size, #mailinglist, #narcotics_size, #new_feature, #patinfo_size, #paypal, #plugin, #recent_registrations, #vaccines_size

Methods included from UserSettings

#language_chooser, #language_chooser_short

Methods included from ExternalLinks

#contact_link, #data_declaration, #external_link, #faq_link, #generic_definition, #help_link, #legal_note, #meddrugs_update, #wiki_link

Methods inherited from HtmlGrid::Composite

event_link, #hash_insert_col, #hash_insert_row

Instance Method Details



145
146
147
148
149
150
151
152
153
154
# File 'src/view/drugs/centeredsearchform.rb', line 145

def create_link(text_key, href, event=nil)
  link = HtmlGrid::Link.new(text_key, @model, @session, self)
  if(event && @lookandfeel.enabled?(event))
    link.href = @lookandfeel._event_url(event)
  else
    link.href = href
  end
  link.set_attribute('class', 'list')
  link
end

- (Object) ddd_count_text(model, session)



127
128
129
# File 'src/view/drugs/centeredsearchform.rb', line 127

def ddd_count_text(model, session)
  create_link(:ddd_count_text, 'http://www.whocc.no/atcddd/')
end

- (Object) fi_count_text(model, session)



135
136
137
138
139
# File 'src/view/drugs/centeredsearchform.rb', line 135

def fi_count_text(model, session)
  create_link(:fi_count_text, 
    'http://wiki.oddb.org/wiki.php?pagename=ODDB.Fi-Upload',
    :fachinfos)
end

- (Object) init



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'src/view/drugs/centeredsearchform.rb', line 49

def init
  if(@lookandfeel.enabled?(:just_medical_structure, false))
    @components = {
      [0,0]   =>  :language_chooser,
      [0,1]   =>  View::Drugs::CenteredSearchForm,
      [0,2]   =>  'search_explain', 
      [0,3,0] =>  'database_last_updated_txt',
      [0,3,1] =>  :database_last_updated,
    }
  elsif(@lookandfeel.enabled?(:oekk_structure, false))
    @components = {
      [0,0]   =>  View::Drugs::CenteredSearchForm,
      [0,1]   =>  'search_explain',
      [0,2]   =>  :recent_registrations,
      [0,3]   => :generic_definition,
      [0,4]   =>  :legal_note,
    }
  elsif(@lookandfeel.enabled?(:atupri_web, false))
    @components = {
      [0,0]   =>  View::Drugs::CenteredSearchForm,
      [0,1]   =>  'search_explain', 
      [0,2,0] =>  'database_last_updated_txt',
      [0,2,1] =>  :database_last_updated,
      [0,3]   => :generic_definition,
    }
  elsif(@lookandfeel.enabled?(:data_counts))
    components.update({
      [0,4]   => :recent_registrations,
      [0,5,0] =>  :database_size,
      [0,5,1] =>  :sequences,
      [0,5,2] =>  'comma_separator',
      [0,5,3] =>  :narcotics_size,
      [0,5,4] =>  :narcotics,
      [0,5,5] =>  'comma_separator',
      [0,5,6] =>  :vaccines_size,
      [0,5,7] =>  :vaccines,
      [0,6,0] =>  :fachinfo_size,
      [0,6,1] =>  :fi_count_text,
      [0,6,2] =>  'comma_separator',
      [0,6,3] =>  :patinfo_size,
      [0,6,4] =>  :pi_count_text,
      [0,7,0] =>  :atc_ddd_size,
      [0,7,1] =>  :ddd_count_text,
      [0,7,2] =>  'comma_separator',
      [0,7,3] =>  :limitation_size,
      [0,7,4] =>  :sl_count_text,
      [0,8]   => :atc_chooser,
      [0,9,0] =>  :new_feature,
      [0,9,1] =>  :download_ebook,
      [0,10]  => :generic_definition,
      [0,11]  => :legal_note,
      [0,12]  => :paypal,
    })
    if @lookandfeel.enabled?(:facebook_fan, false)
      components.update [0,12] => :facebook_fan, [0,13] => :paypal
      css_map.store([0,4,1,10], 'list center')
    else
      css_map.store([0,4,1,9], 'list center')
    end
    component_css_map.store([0,11], 'legal-note')
  else
    components.update({
      [0,5,0] =>  'database_last_updated_txt',
      [0,5,1] =>  :database_last_updated,
    })
    css_map.store([0,5], 'list center')
    unless(@lookandfeel.disabled?(:generic_definition))
      components.store([0,6], :generic_definition)
      css_map.store([0,6], 'list center')
    end
    unless(@lookandfeel.disabled?(:legal_note))
      components.store([0,7], :legal_note)
      css_map.store([0,7], 'list center')
      component_css_map.store([0,7], 'legal-note')
    end
  end
  super
end

- (Object) narcotics(model, session)



165
166
167
168
169
170
# File 'src/view/drugs/centeredsearchform.rb', line 165

def narcotics(model, session)
  link = HtmlGrid::Link.new(:narcotics, model, session, self)
  link.href = @lookandfeel._event_url(:narcotics)
  link.set_attribute('class', 'list')
  link
end

- (Object) pi_count_text(model, session)



140
141
142
143
144
# File 'src/view/drugs/centeredsearchform.rb', line 140

def pi_count_text(model, session)
  create_link(:pi_count_text, 
    'http://wiki.oddb.org/wiki.php?pagename=ODDB.Pi-Upload', 
    :patinfos)
end

- (Object) screencast(model, session = @session)



155
156
157
158
159
160
161
# File 'src/view/drugs/centeredsearchform.rb', line 155

def screencast(model, session=@session)
  if(@lookandfeel.enabled?(:screencast))
    link = HtmlGrid::Link.new(:screencast, model, @session, self)
    link.href = @lookandfeel.lookup(:screencast_url)
    link
  end
end

- (Object) sl_count_text(model, session)



130
131
132
133
134
# File 'src/view/drugs/centeredsearchform.rb', line 130

def sl_count_text(model, session)
  create_link(:sl_count_text, 
    'http://bag.e-mediat.net/SL2007.WEb.external/slindex.htm',
    :limitation_texts)
end

- (Object) substance_count(model, session)



162
163
164
# File 'src/view/drugs/centeredsearchform.rb', line 162

def substance_count(model, session)
  @session.app.substance_count
end

- (Object) vaccines(model, session)



171
172
173
174
175
176
# File 'src/view/drugs/centeredsearchform.rb', line 171

def vaccines(model, session)
  link = HtmlGrid::Link.new(:vaccines, model, session, self)
  link.href = @lookandfeel._event_url(:vaccines)
  link.set_attribute('class', 'list')
  link
end