Class: ODDB::View::PublicTemplate

Inherits:
HtmlGrid::Template
  • Object
show all
Includes:
HtmlGrid::DojoToolkit::DojoTemplate, Custom::HeadMethods
Defined in:
src/view/publictemplate.rb

Direct Known Subclasses

Admin::Login, Admin::PasswordLost, Admin::PasswordReset, Admin::Search, Admin::Sponsor, Analysis::Search, Companies::EmptyResult, Companies::RootEmptyResult, Companies::Search, Confirm, Doctors::EmptyResult, Doctors::Search, Drugs::CompareSearch, Drugs::Search, Exception, Hospitals::EmptyResult, Hospitals::Hospitals, Hospitals::Search, Http404, Interactions::EmptyResult, Migel::Search, ODDB::View::PayPal::Return, PopupTemplate, PrivateTemplate, ResultTemplate, Search, User::AuthInfo, User::Checkout, User::InvalidUser, User::MailingList, User::PayPalThanks, User::Plugin, User::RegisterDownload, User::Search, User::YweseeContact

Constant Summary

DOJO_DEBUG =
false
DOJO_ENCODING =
'UTF-8'
DOJO_REQUIRE =
[ 'ywesee.widget.Tooltip', 'dojo.io.script',
'dojox.data.JsonRestStore', 'dijit.form.ComboBox' ]
DOJO_PARSE_WIDGETS =
false
DOJO_PREFIX =
{
  'ywesee'  =>  '/resources/javascript',
}
CONTENT =
nil
CSS_CLASS =
"composite"
COMPONENTS =
{
  [0,0]   => :head,
  [0,1]   => :content,
  [0,2]   => :foot,
}
HEAD =
View::LogoHead
HTTP_HEADERS =
{
  "Content-Type"  => "text/html; charset=UTF-8",
  "Cache-Control" =>  "private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0",
  "Pragma"        =>  "no-cache",
  "Expires"       => Time.now.rfc1123,
  "P3P"           => "CP='OTI NID CUR OUR STP ONL UNI PRE'",
}
FOOT =
View::NavigationFoot
META_TAGS =
[
  {
    "name"       => "robots",
    "content"      => "follow, index, noarchive",
  },
]

Instance Method Summary (collapse)

Methods included from Custom::HeadMethods

#just_medical, #oekk_head

Instance Method Details

- (Object) content(model, session)



52
53
54
# File 'src/view/publictemplate.rb', line 52

def content(model, session)
  self::class::CONTENT.new(model, session, self)
end


55
56
57
58
59
60
61
# File 'src/view/publictemplate.rb', line 55

def css_link(context, path=nil)
  if(@lookandfeel.enabled?(:external_css, false))
    super(context, @lookandfeel.resource_external(:external_css))
  else
    super
  end
end

- (Object) dynamic_html_headers(context)



62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'src/view/publictemplate.rb', line 62

def dynamic_html_headers(context)
  if(@lookandfeel.enabled?(:ajax))
    headers = super
    if @lookandfeel.enabled?(:google_analytics)
      headers << context.script('type' => 'text/javascript') do
        "dojo.addOnLoad(function(){\nsetTimeout(function(){\ndojo.require(\"dojox.analytics.Urchin\")\ndojo.addOnLoad(function(){\nvar tracker = new dojox.analytics.Urchin({\nacct: \"UA-115196-1\"\n})\n})\n}, 100)\n})\n"
      end
    end
    headers
  else
    ''
  end
end

- (Object) foot(model, session)



87
88
89
# File 'src/view/publictemplate.rb', line 87

def foot(model, session)
  self::class::FOOT.new(model, session, self) unless self::class::FOOT.nil?
end

- (Object) head(model, session)



90
91
92
# File 'src/view/publictemplate.rb', line 90

def head(model, session)
  self::class::HEAD.new(model, session, self) unless self::class::HEAD.nil?
end

- (Object) init



48
49
50
51
# File 'src/view/publictemplate.rb', line 48

def init
  @additional_javascripts = []
  super
end

- (Object) javascripts(context)



93
94
95
96
97
98
99
100
101
102
103
# File 'src/view/publictemplate.rb', line 93

def javascripts(context)
  scripts = super
  @additional_javascripts.each do |script|
    args = {
      'type'     => 'text/javascript',
      'language' => 'JavaScript',
    }
    scripts << context.script(args) do script end
  end
  scripts
end

- (Object) title(context)



104
105
106
107
108
109
110
111
112
# File 'src/view/publictemplate.rb', line 104

def title(context)
  context.title { 
    [
      @lookandfeel.lookup(:html_title),
      @lookandfeel.lookup(@session.state.zone),
      title_part_three(),
    ].compact.join(@lookandfeel.lookup(:title_divider))
  }
end

- (Object) title_part_three



113
114
115
116
117
118
119
120
121
122
123
124
# File 'src/view/publictemplate.rb', line 113

def title_part_three
  event = @session.state.direct_event || @session.event
  if([nil, :resolve, :login, :update, :delete].include?(event))
    if(@model.respond_to?(:pointer_descr))
      @model.pointer_descr
    elsif(@model.respond_to?(:name))
      @model.name
    end
  else
    @lookandfeel.lookup(event)
  end
end

- (Object) topfoot(model, session)



125
126
127
128
129
130
131
132
133
# File 'src/view/publictemplate.rb', line 125

def topfoot(model, session)
  if(@lookandfeel.enabled?(:just_medical_structure, false))
    just_medical(model, session)
  elsif(@lookandfeel.enabled?(:oekk_structure, false))
    oekk_head(model)
  else
    TopFoot.new(model, session, self)
  end
end