Module: ODDB::View::AdditionalInformation

Includes:
Drugs::AtcDddLink, PartSize
Included in:
ODDB::View::Admin::AssignDeprivedSequenceForm, ODDB::View::Admin::AssignFachinfoForm, ODDB::View::Admin::CompanyHeader, ODDB::View::Admin::OrphanedFachinfoRegistrations, ODDB::View::Admin::RegistrationForm, ODDB::View::Admin::RegistrationInnerComposite, ODDB::View::Admin::RegistrationSequenceList, ODDB::View::Admin::ResellerRegistrationForm, ODDB::View::Admin::ResellerSequenceForm, ODDB::View::Admin::SequenceForm, ODDB::View::Ajax::DDDPriceTable, ODDB::View::Analysis::AdditionalInfoComposite, ODDB::View::Analysis::List, ODDB::View::Analysis::PositionInnerComposite, ODDB::View::Analysis::PositionList, Companies::FiPiCsv, Companies::FiPiOverviewList, Drugs::AtcHeader, Drugs::CompareList, Drugs::DDDPriceTable, Drugs::FachinfoList, Drugs::FiChapterChooser, Drugs::LimitationTextList, Drugs::MiniFiChapter, Drugs::NarcoticInnerComposite, Drugs::PackageComposite, Drugs::PackageInnerComposite, Drugs::PatinfoList, Drugs::ResultLimitList, Drugs::ResultList, Drugs::SequenceList, ExplainResult, Interactions::FiList, Migel::List, Migel::ProductInnerComposite
Defined in:
src/view/additional_information.rb

Instance Method Summary (collapse)

Methods included from PartSize

#comparable_size, #part_size

Instance Method Details

- (Object) _fachinfo(model, css = 'square infos')



165
166
167
168
169
170
171
172
173
174
175
# File 'src/view/additional_information.rb', line 165

def _fachinfo(model, css='square infos')
  if(model.fachinfo_active?)
    link = HtmlGrid::Link.new(:square_fachinfo, 
        model, @session, self)
    link.href = @lookandfeel._event_url(:fachinfo,
      {:swissmedicnr => model.iksnr})
    link.css_class = css
    link.set_attribute('title', @lookandfeel.lookup(:fachinfo))
    link
  end
end


49
50
51
52
53
54
55
56
# File 'src/view/additional_information.rb', line 49

def atc_ddd_link(atc, session=@session)
  unless(@lookandfeel.disabled?(:atc_ddd))
    while(atc && !atc.has_ddd? && (code = atc.parent_code))
      atc = session.app.atc_class(code)
    end
    super(atc, session)
  end
end

- (Object) atc_description(atc, session = @session)



57
58
59
60
61
62
63
# File 'src/view/additional_information.rb', line 57

def atc_description(atc, session=@session)
  if(descr = atc.description(@lookandfeel.language))
    descr.dup.to_s << ' (' << atc.code << ')' 
  else
    atc.code
  end
end

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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'src/view/additional_information.rb', line 64

def comarketing(model, session=@session)
  if(model.parallel_import)
    square(:parallel_import)
  elsif(model.patent_protected?)
    link = HtmlGrid::Link.new(:square_patent, model, @session, self)
    link.href = @lookandfeel.lookup(:swissreg_url, 
                  model.patent.certificate_number)
    square(:patent, link)
  elsif(comarketing = model.comarketing_with)
    link = HtmlGrid::Link.new(:square_comarketing, model, @session, self)
    link.href = CoMarketingPlugin::SOURCE_URI
    link.set_attribute('title', 
       @lookandfeel.lookup(:comarketing, comarketing.name_base))
    square(:comarketing, link)
  end
end

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



80
81
82
83
84
# File 'src/view/additional_information.rb', line 80

def complementary_type(model, session=@session)
  if(ctype = model.complementary_type)
    square(ctype)
  end
end

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



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'src/view/additional_information.rb', line 85

def compositions(model, session=@session)
  link = HtmlGrid::Link.new(:show, model, session, self)
  link.href = @lookandfeel._event_url(:show, {:pointer => model.pointer})
  lang = @session.language
  parts = model.compositions.collect { |comp|
    part = ''
    if galform = comp.galenic_form
      part << galform.send(lang) << ': '
    end
    if comp.active_agents.size > 1
      part << @lookandfeel.lookup(:active_agents, model.active_agents.size)
    else
      part << comp.active_agents.first.to_s
    end
  }
  link.value = parts.join('<br/>')
  link
end

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



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'src/view/additional_information.rb', line 103

def ddd_price(model, session=@session)
  chart = @lookandfeel.enabled? :ddd_chart
  node = chart ?
           HtmlGrid::Link.new(:ddd_price_link, model, @session, self) :
           HtmlGrid::Span.new(model, @session, self)
  if(ddd_price = model.ddd_price)
    ddd_price = convert_price(ddd_price, @session.currency)
    @ddd_price_count ||= 0
    @ddd_price_count += 1
    node.value = ddd_price
    node.css_id = "ddd_price_#{@ddd_price_count}"
    query = @session.persistent_user_input(:search_query)
    query = model.name_base if query.is_a?(SBSM::InvalidDataError)
    query ||= model.name_base
    stype = @session.persistent_user_input(:search_type)
    args = [
      :pointer, model.pointer,
      :search_query, query.gsub('/', '%2F'),
      :search_type, stype || 'st_sequence'
    ]
    if chart
      node.set_attribute('title', @lookandfeel.lookup(:ddd_price_title))
      node.href = @lookandfeel._event_url(:ddd_price, args)
    else
      node.dojo_tooltip = @lookandfeel._event_url(:ajax_ddd_price, args)
    end
  end
  node.label = true
  node
end

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



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# File 'src/view/additional_information.rb', line 133

def deductible(model, session=@session)
  @deductible_count ||= 0
  @deductible_count += 1
  span = HtmlGrid::Span.new(model, @session, self)
  tooltip = HtmlGrid::Div.new(model, @session, self)
  deductible = model.deductible
  if(deductible)
    tooltip.value = @lookandfeel.lookup(:deductible_title, 
                                        @lookandfeel.lookup(deductible))
  else
    tooltip.value = @lookandfeel.lookup(:deductible_unknown_title)
  end
  span.css_id = "deductible_#{@deductible_count}"
  span.css_class = deductible.to_s
  span.dojo_tooltip = tooltip
  span.value = @lookandfeel.lookup(deductible || :deductible_unknown)
  span.label = true
  span
end

- (Object) fachinfo(model, session = @session, css = 'square infos')



152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'src/view/additional_information.rb', line 152

def fachinfo(model, session=@session, css='square infos')
  if(link = _fachinfo(model, css))
    link
  elsif(!model.has_fachinfo? && @session.allowed?('edit', model))
    link = HtmlGrid::Link.new(:fachinfo_create, model, @session, self)
    ptr = model.is_a?(Registration) ? 
      model.pointer : model.registration.pointer
    args = {:pointer => ptr, :chapter => 'composition'}
    link.href = @lookandfeel._event_url(:new_fachinfo, args)
    link.css_class = 'square create-infos'
    link
  end
end

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



176
177
178
179
180
181
182
183
184
# File 'src/view/additional_information.rb', line 176

def (model, session=@session)
  link = HtmlGrid::Link.new(:square_feedback, model, session, self)
  link.href = @lookandfeel._event_url(:feedbacks, 
                                      {'pointer'=>model.pointer})
  link.css_class = "square feedback"
  link.set_attribute('title', @lookandfeel.lookup(:feedback_alt, 
    model.localized_name(@session.language)))
  link
end

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



185
186
187
188
189
190
191
192
# File 'src/view/additional_information.rb', line 185

def google_search(model, session=@session)
  text = model.localized_name(@session.language)
  link = HtmlGrid::Link.new(:square_google_search, @model, @session, self)
  link.href =  "http://www.google.com/search?q=#{text}"
  link.css_class= 'square google_search'
  link.set_attribute('title', "#{@lookandfeel.lookup(:google_alt)}#{text}")
  link
end

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



193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'src/view/additional_information.rb', line 193

def ikscat(model, session=@session)
  @ikscat_count ||= 0
  @ikscat_count += 1
  txt = HtmlGrid::Span.new(model, session, self)
  text_elements = []
  if(cat = model.ikscat)
    text_elements.push(cat)
  end
  if(sl = model.sl_entry)
    text_elements.push(@lookandfeel.lookup(:sl))
  end
  if(model.lppv)
    catstr = @lookandfeel.lookup(:lppv)
    text_elements.push(catstr)
  end
  if(gt = model.sl_generic_type)
    text_elements.push(@lookandfeel.lookup("sl_#{gt}_short"))
  end
  txt.value = text_elements.join('&nbsp;/&nbsp;')
  url = @lookandfeel._event_url(:ajax_swissmedic_cat,
    {:pointer => model.pointer})
  txt.css_id = "ikscat_#{@ikscat_count}"
  txt.dojo_tooltip = url
  txt
end


223
224
225
226
227
228
229
230
231
232
233
# File 'src/view/additional_information.rb', line 223

def limitation_link(sltxt)
  link = HtmlGrid::Link.new(:square_limitation, 
    nil, @session, self)
  link.href = @lookandfeel._event_url(:resolve, 
    {'pointer'=>CGI.escape(sltxt.pointer.to_s)})
  link.set_attribute('title', 
    @lookandfeel.lookup(:limitation_text))
  pos = components.index(:limitation_text)
  link.css_class = "square infos"
  link
end

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



218
219
220
221
222
# File 'src/view/additional_information.rb', line 218

def limitation_text(model, session=@session)
  if(sltxt = model.limitation_text)
    limitation_link(sltxt)
  end
end

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



234
235
236
237
238
239
240
241
242
243
# File 'src/view/additional_information.rb', line 234

def minifi(model, session=@session)
  if(mfi = model.minifi)
    link = HtmlGrid::Link.new(:square_minifi, mfi, @session, self)
    link.href = @lookandfeel._event_url(:resolve,
      {'pointer' => mfi.pointer})
    link.css_class = 'square infos'
    link.set_attribute('title', @lookandfeel.lookup(:minifi))
    link
  end
end

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



244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
# File 'src/view/additional_information.rb', line 244

def narcotic(model, session=@session)
  if(model.narcotic?)
    link = HtmlGrid::Link.new(:square_narc, 
        model, @session, self)
    link.href = @lookandfeel._event_url(:resolve,
      {'pointer' => model.pointer + :narcotics})
    link.css_class = 'square infos'
    link.set_attribute('title', @lookandfeel.lookup(:narcotic))
    link
  elsif(model.vaccine)
    square(:vaccine)
  #elsif(model.export_flag)
  # square(:export_flag)
  end
end

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



259
260
261
262
263
264
265
266
267
268
269
270
# File 'src/view/additional_information.rb', line 259

def notify(model, session=@session)
  link = HtmlGrid::Link.new(:notify, model, @session, self)
  args = {
    :pointer => model.pointer.to_s,
  }
  link.href = @lookandfeel._event_url(:notify, args)
  img = HtmlGrid::Image.new(:notify, model, @session, self)
  img.set_attribute('src', @lookandfeel.resource_global(:notify))
  link.value = img
  link.set_attribute('title', @lookandfeel.lookup(:notify_alt))
  link
end

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



271
272
273
274
275
276
277
278
# File 'src/view/additional_information.rb', line 271

def patent(model, session=@session)
  if(model.patent_protected?)
    link = HtmlGrid::Link.new(:square_patent, model, @session, self)
    link.href = @lookandfeel.lookup(:swissreg_url,
                  model.patent.certificate_number)
    square(:patent, link)
  end
end

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



279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'src/view/additional_information.rb', line 279

def patinfo(model, session=@session)
  if(model.has_patinfo?)
    href = nil
    klass = nil
    if(pdf_patinfo = model.pdf_patinfo)
      klass = HtmlGrid::PopupLink
      href = @lookandfeel.resource_global(:pdf_patinfo, pdf_patinfo)
    elsif(patinfo = model.patinfo)
      klass = HtmlGrid::Link
      href = @lookandfeel._event_url(:resolve, {'pointer' => patinfo.pointer})
    end
    link = klass.new(:square_patinfo, model, @session, self)
    link.href = href
    link.set_attribute('title', @lookandfeel.lookup(:patinfo))
    link.css_class = 'square infos'
    link
  end
end

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



297
298
299
300
301
302
303
304
305
# File 'src/view/additional_information.rb', line 297

def qty_unit(model, session=@session)
  if(model.qty || model.unit)
    unit = nil
    if(u = model.unit)
      unit = u.send(@session.language)
    end
    [ '&nbsp;(', model.qty, unit, ')' ].compact.join(' ')
  end
end

- (Object) square(key, square = nil)



306
307
308
309
310
311
312
# File 'src/view/additional_information.rb', line 306

def square(key, square=nil)
  square ||= HtmlGrid::Span.new(nil, @session, self)
  square.value = @lookandfeel.lookup("square_#{key}")
  square.attributes['title'] ||= @lookandfeel.lookup(key)
  square.css_class = "square #{key}"
  square
end

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



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'src/view/additional_information.rb', line 313

def (model, session=@session)
  link = HtmlGrid::Link.new(:twitter_share_short, model, @session, self)
  link.value = HtmlGrid::Image.new(:icon_twitter, model, @session, self)
  base = model.name_base
  size = comparable_size(model)
  status = u sprintf("%s, %s", base, size)
  url = @lookandfeel._event_url(:show, {:pointer => model.pointer})
  tweet = "http://twitter.com/home?status=#{status} - "
  if ind = model.indication
    tweet << ind.send(@session.language) << " - "
  end
  link.href = '#' #tweet + url
  link.onclick = "bitly_for_twitter('#{url}', '#{tweet}');"
  link.set_attribute("title", @lookandfeel.lookup(:twitter_share))
  link.css_class = "twitter"
  link
end