Module: Ziya::HtmlHelpers::Maps
Instance Method Summary collapse
-
#_ziya_map(url, swf_file, options) ⇒ Object
generates actual html tags.
-
#default_map_options ⇒ Object
default options.
-
#gen_sw_path(path, swf_file, url) ⇒ Object
generates swf path.
- #maps_swf ⇒ Object
- #maps_swf_base ⇒ Object
-
#ziya_map(url, map_options = {}) ⇒ Object
generates necessary tags for map support.
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_map(url, swf_file, options) ⇒ Object
generates actual html tags
37 38 39 40 41 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 |
# File 'lib/ziya/html_helpers/maps.rb', line 37 def _ziya_map( url, swf_file, ) # 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 = gen_sw_path( [:swf_path], swf_file, url ) xml_swf_path << "&timestamp=#{Time.now.to_i}" if [:cache] = <<-TAGS <object codebase="#{[:codebase]}" classid="#{[:class_id]}" id="#{[:id]}" height="#{[:height]}" width="#{[:width]}"> <param name="align" value="#{[:align]}"/> <param name="Flashvars" value="lcId=#{[:id]}"/> <param name="bgcolor" value="#{[:bgcolor]}"/> <param name="wmode" value="#{[:wmode]}"/> <param name="movie" value="#{xml_swf_path}"/> <param name="quality" value="#{[:quality]}"/> <embed scale="noscale" flashvars = "lcId=#{[:id]}" bgcolor = "#{[:bgcolor]}" src = "#{xml_swf_path}" name = "#{[:id]}" pluginspage = "#{plugin_url}" quality = "high" type = "#{mime}" wmode = "#{[:wmode]}" align = "#{[:align]}" height = "#{[:height]}" width = "#{[:width]}"/> </object> TAGS end |
#default_map_options ⇒ Object
default options
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ziya/html_helpers/maps.rb', line 8 def { :width => "400", :height => "300", :map_type => :world, :id => "ziya_map", :code_base => "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0", :align => "top", :quality => "high", :wmode => "opaque", :class_id => "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000", :swf_path => "/maps/map_library", :use_cache => false } end |
#gen_sw_path(path, swf_file, url) ⇒ Object
generates swf path
25 26 27 28 |
# File 'lib/ziya/html_helpers/maps.rb', line 25 def gen_sw_path( path, swf_file, url ) path_directive = "#{path}/%s?data_file=%s" path_directive % [swf_file, escape_url( url )] end |
#maps_swf ⇒ Object
5 |
# File 'lib/ziya/html_helpers/maps.rb', line 5 def maps_swf() "#{maps_swf_base}?data_file=%s"; end |
#maps_swf_base ⇒ Object
4 |
# File 'lib/ziya/html_helpers/maps.rb', line 4 def maps_swf_base() "/maps"; end |
#ziya_map(url, map_options = {}) ⇒ Object
generates necessary tags for map support
31 32 33 34 |
# File 'lib/ziya/html_helpers/maps.rb', line 31 def ziya_map( url, ={} ) = .merge( ) _ziya_map( url, "#{[:map_type]}.swf", ) end |