view · edit · sidebar · attach · print · history

20111025-change-link-format-oddb_org

<< | Index | >>


  1. Check oddb.org on Ruby 1.9.3 after migrate_to_utf8
  2. Debug company view to edit
  3. Replace Limitation link
  4. Replace Minifi link
  5. Replace PI Drucken link
  6. Replace Patenteintrag bearbeiten link in registration view suspend
  7. Setup FB FeedBack function suspend
  8. Replace PP and TK in compare view
  9. migrate_to_utf8 on Ruby 1.9.3

Goal/Estimate/Evaluation
  • Replace pointer link in drug search result / 80% / 100%
Commit

Check oddb.org on Ruby 1.9.3 after migrate_to_utf8

Refer to http://dev.ywesee.com/wiki.php/Choddb/Ruby193RC1

Debug company view to edit

Task

Update

  • src/state/global.rb
        GLOBAL_MAP = {
          #:company                => State::Companies::Company,

      def company
        if oid = @session.user_input(:oid) and model = @session.app.company(oid)
          if @session.allowed?('edit', model)
            State::Companies::RootCompany.new(@session, model)
          else
            State::Companies::Company.new(@session, model)
          end
        else
          Http404.new(@session, nil)
        end
      end

Commit

Bug

  • 'new company' button does not work

Error

NoMethodError
undefined method `business_area' for nil:NilClass

Note

  • This is not important for the moment
  • Keep it in mind

Replace Limitation link

Task

Updates

  • src/state/global.rb

Access

Result

  • Success

Bug

  • The drug search in 'Limitation Texts' does not work

Update

  • src/view/drugs/limitationtexts.rb
 def name(model)
 ...
    args = {
      #'search_query' =>  model.name_base,
      'search_query'  =>  model.name_base.split.first,
    }
    link.href = @lookandfeel._event_url(:search, args)

Access

Result

  • Success

Note

  • In some parts, Pointer#parent method id used to resolve a parent object
  • For example, src/view/drugs/limitationtext.rb#limitation_text_title used the parent method

Commit

Replace Minifi link

Task

Commit

Access

Bug

  • The string is NOT utf-8 encoded but iso-8859-1 though the encoding of the html is set as utf-8

Replace PI Drucken link

Updates

  • src/state/global.rb
      def print
        if pointer = @session.user_input(:pointer)
          if((model = pointer.resolve(@session.app))             && (klass = resolve_state(pointer, :print)))
            klass.new(@session, model)
          end
        elsif iksnr = @session.user_input(:reg) and reg = @session.app.registration(iksnr) and seq = reg.sequence(@session.user_input(:seq)) and pi = seq.patinfo
          State::Drugs::PatinfoPrint.new(@session, pi)
        elsif iksnr = @session.user_input(:fachinfo) and reg = @session.app.registration(iksnr) and fi = reg.fachinfo
          State::Drugs::FachinfoPrint.new(@session, fi)
        end
      end
  • src/view/drugs/patinfo.rb
  def print(model, session=@session, key=:print)
    link = HtmlGrid::Link.new(key, model, session, self)
    link.set_attribute('title', @lookandfeel.lookup(:print_title))
    args = [
      :reg => model.sequences.first.registration.iksnr,
      :seq => model.sequences.first.seqnr,
      :patinfo => nil
    ]
    link.href = @lookandfeel._event_url(:print, args)
    link
  end

Access

Commit

Replace Patenteintrag bearbeiten link in registration view

Note

  • It is directly and deeply related to Pointer class

suspend

Setup FB FeedBack function

Problem

  • At the moment, the following error happens when 'FB' link is clicked
error in SBSM::Session#to_html: /de/gcc/feedbacks/pointer/%3A%21registration%2C31706%21sequence%2C01%21package%2C017.
ArgumentError
Failed to load dictionary: No such file or directory - /home/masa/ywesee/oddb.org/data/captcha/de
/usr/lib64/ruby/gems/1.8/gems/turing-0.0.11/lib/turing/challenge.rb:75:in `__orig_initialize__'
/usr/lib64/ruby/site_ruby/1.8/sbsm/turing.rb:22:in `initialize'
/home/masa/ywesee/oddb.org/src/custom/lookandfeelbase.rb:4144:in `new'
/home/masa/ywesee/oddb.org/src/custom/lookandfeelbase.rb:4144:in `captcha'
/home/masa/ywesee/oddb.org/src/custom/lookandfeelbase.rb:4206:in `generate_challenge'
/home/masa/ywesee/oddb.org/src/view/captcha.rb:5:in `challenge'
/home/masa/ywesee/oddb.org/src/view/captcha.rb:8:in `captcha'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/form.rb:82:in `init'
/home/masa/ywesee/oddb.org/src/view/feedbacks.rb:42:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/home/masa/ywesee/oddb.org/src/view/drugs/feedbacks.rb:84:in `new'
/home/masa/ywesee/oddb.org/src/view/drugs/feedbacks.rb:84:in `current_feedback'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `new'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `content'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:50:in `init'
/home/masa/ywesee/oddb.org/src/view/resulttemplate.rb:28:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `new'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `view'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:197:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:529:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:177:in `drb_process'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `synchronize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block'
/usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform'
/usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service'

Note

  • We have known this is related to GD library

Copy data/captcha directory from the server

Access

Result

  • Segmentation fault
/usr/lib64/ruby/gems/1.8/gems/gd2-1.1.1/lib/gd2/font.rb:242: [BUG] Segmentation fault
ruby 1.8.6 (2009-06-08) [x86_64-linux]
Abgebrochen

emerge gd

$ sudo emerge media-libs/gd
$ sudo emerge @preserved-rebuild

Note

  • The server gd library version is 2.0.35
  media-libs/gd
      Latest version available: 2.0.35-r1
      Latest version installed: 2.0.35

Run

  • bin/oddb
/usr/lib64/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.so: libMagickCore.so.3: cannot open shared object file: No such file or directory - /usr/lib64/ruby/gems/1.8/gems/rmagick-2.13.1/lib/RMagick2.so (LoadError)

Donwgrade gd lib

$ sudo emerge /usr/portage/media-libs/gd/gd-2.0.35-r1.ebuild

Donwgrade rmagick gem

$ sudo gem install rmagick --version='2.9.0'

Result

  • bin/oddbd runs but FB does not work (with segmentation fault)

Patch

suspend

Replace PP and TK in compare view

Task

  • Replace PP (Publikumspreis) and TT (Tageskosten) link in compare view to the one without pointer

Access (for example)

PP

TK

Update

  • src/view/dataformat.rb (for PP)
      def formatted_price(key, model)
      ...
            pointer = if model.is_a?(ODDB::Package) || model.is_a?(ODDB::State::Drugs::Compare::Comparison::PackageFacade)
                        [:reg, model.registration.iksnr, :seq, model.sequence.seqnr, :pack, model.ikscd]
                      else
                        [:pointer, model.pointer]
                      end
  • src/view/additional_information.rb (for TK)
       def ddd_price(model, session=@session)
       ...
         pointer = if model.is_a?(ODDB::Package) || model.is_a?(ODDB::State::Drugs::Compare::Comparison::PackageFacade)
                      [:reg, model.registration.iksnr, :seq, model.sequence.seqnr, :pack, model.ikscd]
                    else
                      [:pointer, model.pointer]
                    end

Commit

migrate_to_utf8 on Ruby 1.9.3

Patch

Setup

  • restore database
 $ sudo -u postgres dropdb oddb.org; sudo -u postgres createdb -E UTF8 -T template0 oddb.org
 $ zcat data/sql/oddb.org.20111024.sql.gz |psql -U postgres oddb.org

Run

 ruby193 -I ../oddb/lib bin/oddbd > log.dat 2>&1
  • bin/admin
 ch.oddb> migrate_to_utf8

Result

  • Let's see tomorrow
view · edit · sidebar · attach · print · history
Page last modified on October 25, 2011, at 04:43 PM