Included Modules

Class Index

Quicksearch

Ziya::HtmlHelpers::Gauges

Generates necessary html flash tag to support ZiYa

TODO — Rewrite to use content tag block instead...

Author: Fernand Galiana

Public Instance Methods

_ziya_gauge( url, swf_path, options ) click to toggle source

(Not documented)

    # File lib/ziya/html_helpers/gauges.rb, line 42
42:   def _ziya_gauge( url, swf_path, options )
43:     # Setup options for opaque mode
44:     setup_wmode( options )      
45:     
46:     # setup width and height
47:     setup_movie_size( options )
48:     
49:     color_param  = tag( 'param', {:name => 'bgcolor', :value => options[:bgcolor]}, true )
50:     color_param += tag( 'param', {:name  => "wmode", :value => options[:wmode]}, true )
51:   
52:     xml_swf_path = swf_path % [options[:swf_path], url]
53:     xml_swf_path << "&amp;timestamp=#{Time.now.to_i}" if options[:use_cache] == true
54:     xml_swf_path << "&amp;timeout=#{options[:timeout]}&amp;retry=#{options[:retry]}" if options[:timeout] == true
55:     xml_swf_path << "&amp;stage_width=#{options[:width]}&amp;stage_height=#{options[:height]}" if options[:use_stage] == true
56:     tags = "<object codebase=\"\#{codebase}\" classid=\"\#{options[:class_id]}\" id=\"\#{options[:id]}\" height=\"\#{options[:height]}\" width=\"\#{options[:width]}\">\n<param name=\"scale\" value=\"noscale\"/>\n<param name=\"align\" value=\"\#{options[:align]}\"/>\n<param name=\"bgcolor\" value=\"\#{options[:bgcolor]}\"/>\n<param name=\"wmode\" value=\"\#{options[:wmode]}\"/>\n<param name=\"movie\" value=\"\#{xml_swf_path}\"/>\n<param name=\"menu\" value=\"true\"/>\n<param name=\"allowFullScreen\" value=\"true\"/>\n<param name=\"allowScriptAccess\" value=\"\#{options[:script_access]}\"/>\n<param name=\"quality\" value=\"high\"/>\n<param name=\"play\" value=\"true\"/>\n<param name=\"devicefont\" value=\"false\"/>\n<embed scale=\"noscale\"\nallowfullscreen=\"true\"\nallowscriptaccess=\"\#{options[:script_access]}\"\nbgcolor=\"\#{options[:bgcolor]}\"\ndevicefont=\"false\"\nsrc=\"\#{xml_swf_path}\"\nmenu=\"true\"\nname=\"\#{options[:id]}\"\nplay=\"true\"\npluginspage=\"\#{plugin_url}\"\nquality=\"high\"\nsalign=\"\#{options[:salign]}\"\nsrc=\"\#{xml_swf_path}\"\ntype=\"\#{mime}\"\nwmode=\"\#{options[:wmode]}\"\nsalign=\"\#{options[:salign]}\"\nheight=\"\#{options[:height]}\"\nwidth=\"\#{options[:width]}\">\n</object>\n"
57:   end
class_id() click to toggle source

(Not documented)

    # File lib/ziya/html_helpers/gauges.rb, line 22
22:   def class_id()           "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" end
codebase() click to toggle source

(Not documented)

    # File lib/ziya/html_helpers/gauges.rb, line 23
23:   def codebase()           "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0"; end
default_gauge_options() click to toggle source

(Not documented)

    # File lib/ziya/html_helpers/gauges.rb, line 25
25:   def default_gauge_options
26:     { :width          => "200",
27:       :height         => "200",
28:       :align          => "middle",
29:       :scale          => "noscale",
30:       :script_access  => "sameDomain",
31:       :salign         => "",
32:       :class          => "",   
33:       :class_id       => "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",    
34:       :id             => "ziya_gauge",
35:       :swf_path       => gauge_path,
36:       :use_cache      => false,
37:       :timeout        => false,
38:       :retry          => 2,
39:       :use_stage      => false }    
40:   end
gauge_path() click to toggle source

(Not documented)

    # File lib/ziya/html_helpers/gauges.rb, line 21
21:   def gauge_path()         "/gauges"; end
gauges_swf() click to toggle source

Const accessors...

    # File lib/ziya/html_helpers/gauges.rb, line 20
20:   def gauges_swf()         "%s/gauge.swf?xml_source=%s"; end
ziya_gauge( url, gauge_options={} ) click to toggle source

generates necessary html tags to display a gauge.

    # File lib/ziya/html_helpers/gauges.rb, line 11
11:   def ziya_gauge( url, gauge_options={} )
12:     options = default_gauge_options.merge( gauge_options )                    
13:     _ziya_gauge( url, gauges_swf, options )
14:   end

secsequence

--- SEC00193

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000051
    name: _ziya_gauge
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 42</span>\n\
      42:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">_ziya_gauge</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-identifier\">swf_path</span>, <span class=\"ruby-identifier\">options</span> )\n\
      43:     <span class=\"ruby-comment cmt\"># Setup options for opaque mode</span>\n\
      44:     <span class=\"ruby-identifier\">setup_wmode</span>( <span class=\"ruby-identifier\">options</span> )      \n\
      45:     \n\
      46:     <span class=\"ruby-comment cmt\"># setup width and height</span>\n\
      47:     <span class=\"ruby-identifier\">setup_movie_size</span>( <span class=\"ruby-identifier\">options</span> )\n\
      48:     \n\
      49:     <span class=\"ruby-identifier\">color_param</span>  = <span class=\"ruby-identifier\">tag</span>( <span class=\"ruby-value str\">'param'</span>, {<span class=\"ruby-identifier\">:name</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">'bgcolor'</span>, <span class=\"ruby-identifier\">:value</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:bgcolor</span>]}, <span class=\"ruby-keyword kw\">true</span> )\n\
      50:     <span class=\"ruby-identifier\">color_param</span> <span class=\"ruby-operator\">+=</span> <span class=\"ruby-identifier\">tag</span>( <span class=\"ruby-value str\">'param'</span>, {<span class=\"ruby-identifier\">:name</span>  =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;wmode&quot;</span>, <span class=\"ruby-identifier\">:value</span> =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:wmode</span>]}, <span class=\"ruby-keyword kw\">true</span> )\n\
      51:   \n\
      52:     <span class=\"ruby-identifier\">xml_swf_path</span> = <span class=\"ruby-identifier\">swf_path</span> <span class=\"ruby-operator\">%</span> [<span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:swf_path</span>], <span class=\"ruby-identifier\">url</span>]\n\
      53:     <span class=\"ruby-identifier\">xml_swf_path</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-node\">&quot;&amp;amp;timestamp=#{Time.now.to_i}&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:use_cache</span>] <span class=\"ruby-operator\">==</span> <span class=\"ruby-keyword kw\">true</span>\n\
      54:     <span class=\"ruby-identifier\">xml_swf_path</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-node\">&quot;&amp;amp;timeout=#{options[:timeout]}&amp;amp;retry=#{options[:retry]}&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:timeout</span>] <span class=\"ruby-operator\">==</span> <span class=\"ruby-keyword kw\">true</span>\n\
      55:     <span class=\"ruby-identifier\">xml_swf_path</span> <span class=\"ruby-operator\">&lt;&lt;</span> <span class=\"ruby-node\">&quot;&amp;amp;stage_width=#{options[:width]}&amp;amp;stage_height=#{options[:height]}&quot;</span> <span class=\"ruby-keyword kw\">if</span> <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:use_stage</span>] <span class=\"ruby-operator\">==</span> <span class=\"ruby-keyword kw\">true</span>\n\
      56:     <span class=\"ruby-identifier\">tags</span> = <span class=\"ruby-value str\">&quot;&lt;object codebase=\\&quot;\\#{codebase}\\&quot; classid=\\&quot;\\#{options[:class_id]}\\&quot; id=\\&quot;\\#{options[:id]}\\&quot; height=\\&quot;\\#{options[:height]}\\&quot; width=\\&quot;\\#{options[:width]}\\&quot;&gt;\\n&lt;param name=\\&quot;scale\\&quot; value=\\&quot;noscale\\&quot;/&gt;\\n&lt;param name=\\&quot;align\\&quot; value=\\&quot;\\#{options[:align]}\\&quot;/&gt;\\n&lt;param name=\\&quot;bgcolor\\&quot; value=\\&quot;\\#{options[:bgcolor]}\\&quot;/&gt;\\n&lt;param name=\\&quot;wmode\\&quot; value=\\&quot;\\#{options[:wmode]}\\&quot;/&gt;\\n&lt;param name=\\&quot;movie\\&quot; value=\\&quot;\\#{xml_swf_path}\\&quot;/&gt;\\n&lt;param name=\\&quot;menu\\&quot; value=\\&quot;true\\&quot;/&gt;\\n&lt;param name=\\&quot;allowFullScreen\\&quot; value=\\&quot;true\\&quot;/&gt;\\n&lt;param name=\\&quot;allowScriptAccess\\&quot; value=\\&quot;\\#{options[:script_access]}\\&quot;/&gt;\\n&lt;param name=\\&quot;quality\\&quot; value=\\&quot;high\\&quot;/&gt;\\n&lt;param name=\\&quot;play\\&quot; value=\\&quot;true\\&quot;/&gt;\\n&lt;param name=\\&quot;devicefont\\&quot; value=\\&quot;false\\&quot;/&gt;\\n&lt;embed scale=\\&quot;noscale\\&quot;\\nallowfullscreen=\\&quot;true\\&quot;\\nallowscriptaccess=\\&quot;\\#{options[:script_access]}\\&quot;\\nbgcolor=\\&quot;\\#{options[:bgcolor]}\\&quot;\\ndevicefont=\\&quot;false\\&quot;\\nsrc=\\&quot;\\#{xml_swf_path}\\&quot;\\nmenu=\\&quot;true\\&quot;\\nname=\\&quot;\\#{options[:id]}\\&quot;\\nplay=\\&quot;true\\&quot;\\npluginspage=\\&quot;\\#{plugin_url}\\&quot;\\nquality=\\&quot;high\\&quot;\\nsalign=\\&quot;\\#{options[:salign]}\\&quot;\\nsrc=\\&quot;\\#{xml_swf_path}\\&quot;\\ntype=\\&quot;\\#{mime}\\&quot;\\nwmode=\\&quot;\\#{options[:wmode]}\\&quot;\\nsalign=\\&quot;\\#{options[:salign]}\\&quot;\\nheight=\\&quot;\\#{options[:height]}\\&quot;\\nwidth=\\&quot;\\#{options[:width]}\\&quot;&gt;\\n&lt;/object&gt;\\n&quot;</span>\n\
      57:   <span class=\"ruby-keyword kw\">end</span>"
    params: ( url, swf_path, options )
  - visibility: public
    aref: M000048
    name: class_id
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 22</span>\n\
      22:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">class_id</span>()           <span class=\"ruby-value str\">&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;</span> <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000049
    name: codebase
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 23</span>\n\
      23:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">codebase</span>()           <span class=\"ruby-value str\">&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,45,0&quot;</span>; <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000050
    name: default_gauge_options
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 25</span>\n\
      25:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">default_gauge_options</span>\n\
      26:     { <span class=\"ruby-identifier\">:width</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;200&quot;</span>,\n\
      27:       <span class=\"ruby-identifier\">:height</span>         =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;200&quot;</span>,\n\
      28:       <span class=\"ruby-identifier\">:align</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;middle&quot;</span>,\n\
      29:       <span class=\"ruby-identifier\">:scale</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;noscale&quot;</span>,\n\
      30:       <span class=\"ruby-identifier\">:script_access</span>  =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;sameDomain&quot;</span>,\n\
      31:       <span class=\"ruby-identifier\">:salign</span>         =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;&quot;</span>,\n\
      32:       <span class=\"ruby-identifier\">:class</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;&quot;</span>,   \n\
      33:       <span class=\"ruby-identifier\">:class_id</span>       =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;</span>,    \n\
      34:       <span class=\"ruby-identifier\">:id</span>             =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;ziya_gauge&quot;</span>,\n\
      35:       <span class=\"ruby-identifier\">:swf_path</span>       =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-identifier\">gauge_path</span>,\n\
      36:       <span class=\"ruby-identifier\">:use_cache</span>      =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-keyword kw\">false</span>,\n\
      37:       <span class=\"ruby-identifier\">:timeout</span>        =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-keyword kw\">false</span>,\n\
      38:       <span class=\"ruby-identifier\">:retry</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value\">2</span>,\n\
      39:       <span class=\"ruby-identifier\">:use_stage</span>      =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-keyword kw\">false</span> }    \n\
      40:   <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000047
    name: gauge_path
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 21</span>\n\
      21:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">gauge_path</span>()         <span class=\"ruby-value str\">&quot;/gauges&quot;</span>; <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000046
    name: gauges_swf
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 20</span>\n\
      20:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">gauges_swf</span>()         <span class=\"ruby-value str\">&quot;%s/gauge.swf?xml_source=%s&quot;</span>; <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      Const accessors...
      </p>
    params: ()
  - visibility: public
    aref: M000045
    name: ziya_gauge
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/gauges.rb, line 11</span>\n\
      11:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">ziya_gauge</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-identifier\">gauge_options</span>={} )\n\
      12:     <span class=\"ruby-identifier\">options</span> = <span class=\"ruby-identifier\">default_gauge_options</span>.<span class=\"ruby-identifier\">merge</span>( <span class=\"ruby-identifier\">gauge_options</span> )                    \n\
      13:     <span class=\"ruby-identifier\">_ziya_gauge</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-identifier\">gauges_swf</span>, <span class=\"ruby-identifier\">options</span> )\n\
      14:   <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      generates necessary html tags to display a gauge.
      </p>
    params: ( url, gauge_options={} )
  category: Instance
  type: Public

sectitle

--- 

[Validate]

Generated with the Darkfish Rdoc Generator.