Module: Ziya::HtmlHelpers::Gauges
Overview
Generates necessary html flash tag to support ZiYa
TODO – Rewrite to use content tag block instead…
Author: Fernand Galiana
Instance Method Summary collapse
- #_ziya_gauge(url, swf_path, options) ⇒ Object
- #class_id ⇒ Object
- #codebase ⇒ Object
- #default_gauge_options ⇒ Object
- #gauge_path ⇒ Object
-
#gauges_swf ⇒ Object
Const accessors…
-
#ziya_gauge(url, gauge_options = {}) ⇒ Object
generates necessary html tags to display a gauge.
Methods included from Base
#escape_chars, #escape_once, #escape_url, #mime, #plugin_url, #setup_movie_size, #setup_wmode, #tag_options, #ziya_tag
Instance Method Details
#_ziya_gauge(url, swf_path, options) ⇒ Object
42 43 44 45 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 'lib/ziya/html_helpers/gauges.rb', line 42 def _ziya_gauge( url, swf_path, ) # Setup options for opaque mode setup_wmode( ) # setup width and height setup_movie_size( ) color_param = ziya_tag( 'param', {:name => 'bgcolor', :value => [:bgcolor]}, true ) color_param += ziya_tag( 'param', {:name => "wmode", :value => [:wmode]}, true ) xml_swf_path = swf_path % [[:swf_path], url] xml_swf_path << "&timestamp=#{Time.now.to_i}" if [:use_cache] == true xml_swf_path << "&timeout=#{[:timeout]}&retry=#{[:retry]}" if [:timeout] xml_swf_path << "&stage_width=#{[:width]}&stage_height=#{[:height]}" if [:use_stage] == true = <<-TAGS <object codebase="#{codebase}" classid="#{[:class_id]}" id="#{[:id]}" height="#{[:height]}" width="#{[:width]}"> <param name="scale" value="noscale"/> <param name="align" value="#{[:align]}"/> <param name="bgcolor" value="#{[:bgcolor]}"/> <param name="wmode" value="#{[:wmode]}"/> <param name="movie" value="#{xml_swf_path}"/> <param name="menu" value="true"/> <param name="allowFullScreen" value="true"/> <param name="allowScriptAccess" value="#{[:script_access]}"/> <param name="quality" value="high"/> <param name="play" value="true"/> <param name="devicefont" value="false"/> <embed scale="noscale" allowfullscreen="true" allowscriptaccess="#{[:script_access]}" bgcolor="#{[:bgcolor]}" devicefont="false" src="#{xml_swf_path}" menu="true" name="#{[:id]}" play="true" pluginspage="#{plugin_url}" quality="high" salign="#{[:salign]}" src="#{xml_swf_path}" type="#{mime}" wmode="#{[:wmode]}" salign="#{[:salign]}" height="#{[:height]}" width="#{[:width]}"> </object> TAGS end |
#class_id ⇒ Object
22 |
# File 'lib/ziya/html_helpers/gauges.rb', line 22 def class_id() "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" end |
#codebase ⇒ Object
23 |
# File 'lib/ziya/html_helpers/gauges.rb', line 23 def codebase() "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0"; end |
#default_gauge_options ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ziya/html_helpers/gauges.rb', line 25 def { :width => "200", :height => "200", :align => "middle", :scale => "noscale", :script_access => "sameDomain", :salign => "", :class => "", :class_id => "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", :id => "ziya_gauge", :swf_path => gauge_path, :use_cache => false, :timeout => 30, :retry => 2, :use_stage => false } end |
#gauge_path ⇒ Object
21 |
# File 'lib/ziya/html_helpers/gauges.rb', line 21 def gauge_path() "/gauges"; end |
#gauges_swf ⇒ Object
Const accessors…
20 |
# File 'lib/ziya/html_helpers/gauges.rb', line 20 def gauges_swf() "%s/gauge.swf?xml_source=%s"; end |
#ziya_gauge(url, gauge_options = {}) ⇒ Object
generates necessary html tags to display a gauge.
11 12 13 14 |
# File 'lib/ziya/html_helpers/gauges.rb', line 11 def ziya_gauge( url, ={} ) = .merge( ) _ziya_gauge( url, gauges_swf, ) end |