Class: ODDB::View::SponsorLogo

Inherits:
HtmlGrid::Component show all
Defined in:
src/view/sponsorlogo.rb

Instance Method Summary (collapse)

Methods inherited from HtmlGrid::Component

#additional_javascripts, #dynamic_html

Instance Method Details

- (Object) init



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'src/view/sponsorlogo.rb', line 20

def init
  if((name = @model.logo_filename(@lookandfeel.language)) \
    || (name = @model.logo_filename(:default)))
    @attributes['src'] = @lookandfeel.resource_global(:sponsor, name)
    @attributes['alt'] = @model.name
  end
  @span = HtmlGrid::Span.new(@model, @session, self)
  if(time = @model.)
    @span.value = @lookandfeel.lookup(:sponsor_until, 
      @lookandfeel.format_date(time))
  end
  @span.css_class = 'sponsor  right'
end

- (Object) logo(context)



33
34
35
36
37
38
39
40
41
# File 'src/view/sponsorlogo.rb', line 33

def (context)
  src = @attributes['src']
  case src[/\.[^.]+$/]
  when '.swf'
    "<object codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\">\n<param name=\"movie\" value=\"\#{src}\"/>\n<param name=\"play\" value=\"true\"/>\n<param name=\"quality\" value=\"best\"/>\n<embed src=\"\#{src}\" play=\"true\" quality=\"best\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"/>\n</object>\n"
  else
    context.img(@attributes)
  end
end

- (Object) to_html(context)



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

def to_html(context)
  url = @lookandfeel._event_url(:sponsorlink)
  context.a({'href' => url}) { 
    (context) << @span.to_html(context)
  }
end