view · edit · sidebar · attach · print · history

20111026-change-admin-link-format-oddb_org

<< | Index | >>


  1. Replace Narcotics List Link
  2. Replace Admin/Address link suspend
  3. Replace Admin/Galenik link
  4. Replace Admin/CommercialForm link
  5. Replace Admin/Indication link
  6. Replace FeedBack link in drug search view

Goal/Estimate/Evaluation
  • Replace pointer link in Admin / 70% / 80%
Commit

Replace Narcotics List Link

Replace link

Note

  • Package 1--->* Narcotic
  • Narcotic 1--->* Substance
  • Substance 1--->1 Narcotic

Access

Commit

Replace Admin/Address link

Link

Note

  • There are warnings
/home/masa/ywesee/oddb.org/src/view/address.rb:67: warning: Object#type is deprecated; use Object#class
/home/masa/ywesee/oddb.org/src/view/address.rb:122: warning: Object#type is deprecated; use Object#class
  • 'suggest_address' event is already defined

Access

Note

  • Pointer instance is used to resolve the parent instance as follows
 module ODDB
   module State
    module Admin
 class AddressSuggestion < Global
   def init
    if(pointer = @model.address_pointer)
      addr = pointer.resolve(@session)
      if(addr.nil?)
        addr = Address2.new
        addr.pointer = pointer
      end
      @active_address = AddressWrapper.new(addr)
      parent = pointer.parent.resolve(@session)
      select_zone(parent)
      @active_address.email_suggestion = parent.email
    end
    super
   end
  • This parent problem should be resolved otherwise it is impossible to replace all the link format wihtout Pointer class
  • Sometimes it can be replaced by using XXXObserver module method, but in this case there is no Observer module included in ODDB::Address2 class

suspend

Replace Admin/Galenik link

Link

Note (IMPORTANT)

  • oid and odba_id are usually same but not totally same, sometimes different
  • It does not make sense to use two similar types of INDEX number in a system
ch.oddb> galenic_group('890150').oid
-> 890150
ch.oddb> galenic_group('890150').odba_id
-> 890150
ch.oddb> galenic_group('5').oid
-> 5
ch.oddb> galenic_group('5').odba_id
-> 3790

Update

  • src/state/global.rb
      def galenic_group
        if oid = @session.user_input(:oid) and model = @session.app.galenic_group(oid)
          if @session.allowed?('edit', 'org.oddb.model.!galenic_group.*')
            ODDB::State::Admin::GalenicGroup.new(@session, model)
          else
            ODDB::State::Admin::TransparentLogin.new(@session, model)
          end
        end
      end
  • src/view/admin/galenicgroups.rb
  def oid(model, session)
    link = View::PointerLink.new(:oid, model, session)
    link.href = @lookandfeel._event_url(:galenic_group, {:oid => model.oid})
    link
  end
  def description(model, session)
    link = View::PointerLink.new(:description, model, session)
    link.href = @lookandfeel._event_url(:galenic_group, {:oid => model.oid})
    link
  end

Access

Galenic Form link

Update

  • src/state/global.rb
      def galenic_group
        if oid = @session.user_input(:oid) and model = @session.app.galenic_group(oid)
          if @session.allowed?('edit', 'org.oddb.model.!galenic_group.*')
            ODDB::State::Admin::GalenicGroup.new(@session, model)
          else
            ODDB::State::Admin::TransparentLogin.new(@session, model)
          end
        end
      end
      def galenic_form
        if group_oid = @session.user_input(:goid) and group = @session.app.galenic_group(group_oid) and model = group.galenic_form(@session.user_input(:foid))
          if @session.allowed?('edit', 'org.oddb.model.!galenic_group.*')
            ODDB::State::Admin::GalenicForm.new(@session, model)
          else
            ODDB::State::Admin::TransparentLogin.new(@session, model)
          end
        end
      end
  • src/util/validator.rb
    EVENTS = [
      :galenic_form,
      :galenic_group,

    STRINGS = [
      :foid,
      :goid,

  • src/view/admin/galenicgroup.rb
  def oid(model, session)
    link = View::PointerLink.new(:oid, model, session)
    link.href = @lookandfeel._event_url(:galenic_form, [:goid, model.galenic_group.oid, :foid, model.oid])
    link
  end
  def description(model, session)
    link = View::PointerLink.new(:description, model, session)
    link.href = @lookandfeel._event_url(:galenic_form, [:goid, model.galenic_group.oid, :foid, model.oid])
    link
  end
  • src/view/admin/galenicgroups.rb
  def oid(model, session)
    link = View::PointerLink.new(:oid, model, session)
    link.href = @lookandfeel._event_url(:galenic_group, {:oid => model.oid})
    link
  end
  def description(model, session)
    link = View::PointerLink.new(:description, model, session)
    link.href = @lookandfeel._event_url(:galenic_group, {:oid => model.oid})
    link
  end

Access

Commit

Replace Admin/CommercialForm link

Link

Update

  • src/state/global.rb
      def commercial_form
        if oid = @session.user_input(:oid) and model = @session.app.commercial_form(oid)
          ODDB::State::Admin::TransparentLogin.new(@session, model)
        end
      end
  • src/state/admin/root.rb
  def commercial_form
    if oid = @session.user_input(:oid) and model = @session.app.commercial_form(oid)
      ODDB::State::Admin::CommercialForm.new(@session, model)
    end
  end

Access

Commit

Replace Admin/Indication link

Link

Update

  • src/state/global.rb
      def indication
        if oid = @session.user_input(:oid) and model = @session.app.indication(oid)
          ODDB::State::Admin::TransparentLogin.new(@session, model)
        end
      end
  • src/util/validator.rb
    EVENTS = [
                       :indication,
  • src/state/admin/root.rb
  def indication
    if oid = @session.user_input(:oid) and model = @session.app.indication(oid)
      State::Admin::Indication.new(@session, model)
    end
  end
  • src/view/admin/indications.rb
  def description(model, session)
    link = View::PointerLink.new(:description, model, session)
    link.href = @lookandfeel._event_url(:indication, {:oid => model.oid})
    link
  end

Access

Commit

Replace FeedBack link in drug search view

Link

Commit

view · edit · sidebar · attach · print · history
Page last modified on October 26, 2011, at 04:12 PM