Class: ODDB::State::Drugs::RootFachinfo

Inherits:
Fachinfo show all
Defined in:
src/state/drugs/fachinfo.rb,
src/state/admin/companyuser.rb

Direct Known Subclasses

CompanyFachinfo

Constant Summary

VIEW =
View::Drugs::RootFachinfo

Constants inherited from Fachinfo

VIEW

Constants inherited from Global

HOME_STATE, ZONE, ZONE_NAVIGATION

Constants inherited from Global

DIRECT_EVENT, GLOBAL_MAP, HOME_STATE, LIMITED, PRINT_STATES, READONLY_STATES, RESOLVE_STATES, REVERSE_MAP, VIEW, ZONE_NAVIGATION

Constants included from UmlautSort

FILTER_PAIRS

Instance Method Summary (collapse)

Methods inherited from Fachinfo

#allowed?, #init

Methods inherited from Global

#limit_state

Methods inherited from Global

#_search_drugs, #_search_drugs_state, #_trigger, #add_to_interaction_basket, #allowed?, #atc_chooser, #checkout, #clear_interaction_basket, #creditable?, #direct_request_path, #doctorlist, #download, #export_csv, #extend, #fachinfo, #feedbacks, #help_navigation, #home_navigation, #home_state, #hospitallist, #interaction_basket, #limit_state, #limited?, #logout, #navigation, #notify, #password_reset, #paypal_return, #powerlink, #print, #proceed_download, #proceed_poweruser, #resolve, #resolve_state, #rss, #search, #show, #snapback_event, #sort, #sponsorlink, #suggest_address, #switch, #unique_email, #user_input, #user_navigation, #ywesee_contact, #zone_navigation, #zones

Methods included from Admin::LoginMethods

#autologin, #login

Methods included from UmlautSort

#sort_model, #umlaut_filter

Instance Method Details

- (Object) update



46
47
48
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
# File 'src/state/drugs/fachinfo.rb', line 46

def  update
  mandatory = [:html_chapter, :chapter]
  keys = mandatory + [:heading]
  input = user_input(keys, mandatory)
  unless(error?)
    html = input[:html_chapter]
    writer = ChapterParse::Writer.new
    formatter = HtmlFormatter.new(writer)
    parser = ChapterParse::Parser.new(formatter)
    parser.feed(html)
    lang = @session.language
     = unique_email
    if(@fachinfo.is_a?(Persistence::CreateItem))
      registration = @fachinfo.registrations.first
      doc = @fachinfo.send(lang)
      @fachinfo = @session.app.update(@fachinfo.pointer, {lang => doc}, )
      @model = FachinfoWrapper.new(@fachinfo)
      @model.add_change_log_item(, 'created', lang)
      @session.app.update(registration.pointer,
                          {:fachinfo => @model.pointer}, )
    end
    doc = @model.descriptions.fetch(lang.to_s) {
      doc = @model.send(lang).class.new()
      doc.name = @model.name_base
      @session.app.update(@model.pointer, {lang => doc}, )
      doc
    }
    name = input[:chapter]
    unless(doc.send(name))
      doc.send("#{name}=", Text::Chapter.new)
    end
    doc_pointer = @model.pointer + [lang]
    pointer = doc_pointer + [name]
    args = {
      :heading  => input[:heading],
      :sections =>  writer.chapter.sections,
    }
    @model.add_change_log_item(, name, lang)
    @session.app.update(pointer, args, )
    @session.app.update(doc_pointer, {}, )
    @session.app.update(@model.pointer, {}, )
  end
  self
end