Included Modules

Class Index

Quicksearch

Ziya::HtmlHelpers::Maps

Public Instance Methods

_ziya_map( url, swf_file, options ) click to toggle source

generates actual html tags

    # File lib/ziya/html_helpers/maps.rb, line 37
37:   def _ziya_map( url, swf_file, options )    
38:     # Setup options for opaque mode
39:     setup_wmode( options )      
40:   
41:     # setup width and height
42:     setup_movie_size( options )
43:   
44:     color_param  = tag( 'param', {:name => 'bgcolor', :value => options[:bgcolor]}, true )
45:     color_param += tag( 'param', {:name  => "wmode", :value => options[:wmode]}, true )
46: 
47:     xml_swf_path = gen_sw_path( options[:swf_path], swf_file, url )
48:     xml_swf_path << "&amp;timestamp=#{Time.now.to_i}" if options[:cache]
49:         
50:     tags = "<object codebase=\"\#{options[:codebase]}\" classid=\"\#{options[:class_id]}\" id=\"\#{options[:id]}\" height=\"\#{options[:height]}\" width=\"\#{options[:width]}\">\n<param name=\"align\"             value=\"\#{options[:align]}\"/>\n<param name=\"Flashvars\"         value=\"lcId=\#{options[:id]}\"/>\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=\"quality\"           value=\"\#{options[:quality]}\"/>\n<embed scale=\"noscale\"\nflashvars         = \"lcId=\#{options[:id]}\"\nbgcolor           = \"\#{options[:bgcolor]}\"\nsrc               = \"\#{xml_swf_path}\"\nname              = \"\#{options[:id]}\"\npluginspage       = \"\#{plugin_url}\"\nquality           = \"high\"\ntype              = \"\#{mime}\"\nwmode             = \"\#{options[:wmode]}\"\nalign             = \"\#{options[:align]}\"\nheight            = \"\#{options[:height]}\"\nwidth             = \"\#{options[:width]}\"/>\n</object>\n"
51:         
52:   end
default_map_options() click to toggle source

default options

    # File lib/ziya/html_helpers/maps.rb, line 8
 8:   def default_map_options
 9:     { 
10:       :width          => "400",
11:       :height         => "300",
12:       :map_type       => :world,
13:       :id             => "ziya_map",
14:       :code_base      => "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0",
15:       :align          => "top",
16:       :quality        => "high",
17:       :wmode          => "opaque",   
18:       :class_id       => "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",
19:       :swf_path       => "/maps/map_library",
20:       :use_cache      => false
21:     }
22:   end
gen_sw_path( path, swf_file, url ) click to toggle source

generates swf path

    # File lib/ziya/html_helpers/maps.rb, line 25
25:   def gen_sw_path( path, swf_file, url )
26:     path_directive = "#{path}/%s?data_file=%s"
27:     path_directive % [swf_file, escape_url( url )]
28:   end
maps_swf() click to toggle source

(Not documented)

   # File lib/ziya/html_helpers/maps.rb, line 5
5:   def maps_swf()         "#{maps_swf_base}?data_file=%s"; end
maps_swf_base() click to toggle source

(Not documented)

   # File lib/ziya/html_helpers/maps.rb, line 4
4:   def maps_swf_base()    "/maps"; end
ziya_map( url, map_options={} ) click to toggle source

generates necessary tags for map support

    # File lib/ziya/html_helpers/maps.rb, line 31
31:   def ziya_map( url, map_options={} )
32:     options = default_map_options.merge( map_options )    
33:     _ziya_map( url, "#{options[:map_type]}.swf", options )
34:   end

secsequence

--- SEC00195

seccomment

--- ""

method_list

--- 
- methods: 
  - visibility: public
    aref: M000044
    name: _ziya_map
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 37</span>\n\
      37:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">_ziya_map</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-identifier\">swf_file</span>, <span class=\"ruby-identifier\">options</span> )    \n\
      38:     <span class=\"ruby-comment cmt\"># Setup options for opaque mode</span>\n\
      39:     <span class=\"ruby-identifier\">setup_wmode</span>( <span class=\"ruby-identifier\">options</span> )      \n\
      40:   \n\
      41:     <span class=\"ruby-comment cmt\"># setup width and height</span>\n\
      42:     <span class=\"ruby-identifier\">setup_movie_size</span>( <span class=\"ruby-identifier\">options</span> )\n\
      43:   \n\
      44:     <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\
      45:     <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\
      46: \n\
      47:     <span class=\"ruby-identifier\">xml_swf_path</span> = <span class=\"ruby-identifier\">gen_sw_path</span>( <span class=\"ruby-identifier\">options</span>[<span class=\"ruby-identifier\">:swf_path</span>], <span class=\"ruby-identifier\">swf_file</span>, <span class=\"ruby-identifier\">url</span> )\n\
      48:     <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\">:cache</span>]\n\
      49:         \n\
      50:     <span class=\"ruby-identifier\">tags</span> = <span class=\"ruby-value str\">&quot;&lt;object codebase=\\&quot;\\#{options[: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;align\\&quot;             value=\\&quot;\\#{options[:align]}\\&quot;/&gt;\\n&lt;param name=\\&quot;Flashvars\\&quot;         value=\\&quot;lcId=\\#{options[:id]}\\&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;quality\\&quot;           value=\\&quot;\\#{options[:quality]}\\&quot;/&gt;\\n&lt;embed scale=\\&quot;noscale\\&quot;\\nflashvars         = \\&quot;lcId=\\#{options[:id]}\\&quot;\\nbgcolor           = \\&quot;\\#{options[:bgcolor]}\\&quot;\\nsrc               = \\&quot;\\#{xml_swf_path}\\&quot;\\nname              = \\&quot;\\#{options[:id]}\\&quot;\\npluginspage       = \\&quot;\\#{plugin_url}\\&quot;\\nquality           = \\&quot;high\\&quot;\\ntype              = \\&quot;\\#{mime}\\&quot;\\nwmode             = \\&quot;\\#{options[:wmode]}\\&quot;\\nalign             = \\&quot;\\#{options[:align]}\\&quot;\\nheight            = \\&quot;\\#{options[:height]}\\&quot;\\nwidth             = \\&quot;\\#{options[:width]}\\&quot;/&gt;\\n&lt;/object&gt;\\n&quot;</span>\n\
      51:         \n\
      52:   <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      generates actual html tags
      </p>
    params: ( url, swf_file, options )
  - visibility: public
    aref: M000041
    name: default_map_options
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 8</span>\n 8:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">default_map_options</span>\n 9:     { \n\
      10:       <span class=\"ruby-identifier\">:width</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;400&quot;</span>,\n\
      11:       <span class=\"ruby-identifier\">:height</span>         =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;300&quot;</span>,\n\
      12:       <span class=\"ruby-identifier\">:map_type</span>       =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-identifier\">:world</span>,\n\
      13:       <span class=\"ruby-identifier\">:id</span>             =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;ziya_map&quot;</span>,\n\
      14:       <span class=\"ruby-identifier\">:code_base</span>      =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0&quot;</span>,\n\
      15:       <span class=\"ruby-identifier\">:align</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;top&quot;</span>,\n\
      16:       <span class=\"ruby-identifier\">:quality</span>        =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;high&quot;</span>,\n\
      17:       <span class=\"ruby-identifier\">:wmode</span>          =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;opaque&quot;</span>,   \n\
      18:       <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\
      19:       <span class=\"ruby-identifier\">:swf_path</span>       =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-value str\">&quot;/maps/map_library&quot;</span>,\n\
      20:       <span class=\"ruby-identifier\">:use_cache</span>      =<span class=\"ruby-operator\">&gt;</span> <span class=\"ruby-keyword kw\">false</span>\n\
      21:     }\n\
      22:   <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      default options
      </p>
    params: ()
  - visibility: public
    aref: M000042
    name: gen_sw_path
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 25</span>\n\
      25:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">gen_sw_path</span>( <span class=\"ruby-identifier\">path</span>, <span class=\"ruby-identifier\">swf_file</span>, <span class=\"ruby-identifier\">url</span> )\n\
      26:     <span class=\"ruby-identifier\">path_directive</span> = <span class=\"ruby-node\">&quot;#{path}/%s?data_file=%s&quot;</span>\n\
      27:     <span class=\"ruby-identifier\">path_directive</span> <span class=\"ruby-operator\">%</span> [<span class=\"ruby-identifier\">swf_file</span>, <span class=\"ruby-identifier\">escape_url</span>( <span class=\"ruby-identifier\">url</span> )]\n\
      28:   <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      generates swf path
      </p>
    params: ( path, swf_file, url )
  - visibility: public
    aref: M000040
    name: maps_swf
    sourcecode: "   <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 5</span>\n\
      5:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">maps_swf</span>()         <span class=\"ruby-node\">&quot;#{maps_swf_base}?data_file=%s&quot;</span>; <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000039
    name: maps_swf_base
    sourcecode: "   <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 4</span>\n\
      4:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">maps_swf_base</span>()    <span class=\"ruby-value str\">&quot;/maps&quot;</span>; <span class=\"ruby-keyword kw\">end</span>"
    params: ()
  - visibility: public
    aref: M000043
    name: ziya_map
    sourcecode: "    <span class=\"ruby-comment cmt\"># File lib/ziya/html_helpers/maps.rb, line 31</span>\n\
      31:   <span class=\"ruby-keyword kw\">def</span> <span class=\"ruby-identifier\">ziya_map</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-identifier\">map_options</span>={} )\n\
      32:     <span class=\"ruby-identifier\">options</span> = <span class=\"ruby-identifier\">default_map_options</span>.<span class=\"ruby-identifier\">merge</span>( <span class=\"ruby-identifier\">map_options</span> )    \n\
      33:     <span class=\"ruby-identifier\">_ziya_map</span>( <span class=\"ruby-identifier\">url</span>, <span class=\"ruby-node\">&quot;#{options[:map_type]}.swf&quot;</span>, <span class=\"ruby-identifier\">options</span> )\n\
      34:   <span class=\"ruby-keyword kw\">end</span>"
    m_desc: |-
      <p>
      generates necessary tags for map support
      </p>
    params: ( url, map_options={} )
  category: Instance
  type: Public

sectitle

--- 

[Validate]

Generated with the Darkfish Rdoc Generator.