derailed-ziya 2.0.8 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (263) hide show
  1. data/Manifest.txt +240 -432
  2. data/README.txt +104 -97
  3. data/Rakefile +3 -2
  4. data/bin/ziyafy +33 -10
  5. data/examples/charts/basic_chart.rb +47 -0
  6. data/{charts → examples/charts/public/charts}/AC_RunActiveContent.js +0 -0
  7. data/{charts → examples/charts/public/charts}/charts.swf +0 -0
  8. data/{charts → examples/charts/public/charts}/charts_library/ar3d.swf +0 -0
  9. data/{charts → examples/charts/public/charts}/charts_library/arno.swf +0 -0
  10. data/{charts → examples/charts/public/charts}/charts_library/ars3.swf +0 -0
  11. data/{charts → examples/charts/public/charts}/charts_library/arst.swf +0 -0
  12. data/{charts → examples/charts/public/charts}/charts_library/brfl.swf +0 -0
  13. data/{charts → examples/charts/public/charts}/charts_library/brno.swf +0 -0
  14. data/{charts → examples/charts/public/charts}/charts_library/brst.swf +0 -0
  15. data/{charts → examples/charts/public/charts}/charts_library/buno.swf +0 -0
  16. data/{charts → examples/charts/public/charts}/charts_library/cl3d.swf +0 -0
  17. data/{charts → examples/charts/public/charts}/charts_library/clfl.swf +0 -0
  18. data/{charts → examples/charts/public/charts}/charts_library/clim.swf +0 -0
  19. data/{charts → examples/charts/public/charts}/charts_library/clno.swf +0 -0
  20. data/{charts → examples/charts/public/charts}/charts_library/clp3.swf +0 -0
  21. data/{charts → examples/charts/public/charts}/charts_library/cls3.swf +0 -0
  22. data/{charts → examples/charts/public/charts}/charts_library/clst.swf +0 -0
  23. data/{charts → examples/charts/public/charts}/charts_library/cnno.swf +0 -0
  24. data/{charts → examples/charts/public/charts}/charts_library/dono.swf +0 -0
  25. data/{charts → examples/charts/public/charts}/charts_library/lnno.swf +0 -0
  26. data/{charts → examples/charts/public/charts}/charts_library/mxno.swf +0 -0
  27. data/{charts → examples/charts/public/charts}/charts_library/pi3d.swf +0 -0
  28. data/{charts → examples/charts/public/charts}/charts_library/piim.swf +0 -0
  29. data/{charts → examples/charts/public/charts}/charts_library/pino.swf +0 -0
  30. data/{charts → examples/charts/public/charts}/charts_library/pono.swf +0 -0
  31. data/{charts → examples/charts/public/charts}/charts_library/scno.swf +0 -0
  32. data/{charts → examples/charts/public/charts}/full_screen.swf +0 -0
  33. data/{charts → examples/charts/public/charts}/scripts/output_jpg.php +0 -0
  34. data/{charts → examples/charts/public/charts}/sliders/black.swf +0 -0
  35. data/{charts → examples/charts/public/charts}/sliders/preview_handle_1.swf +0 -0
  36. data/{charts → examples/charts/public/charts}/sliders/preview_handle_2.swf +0 -0
  37. data/examples/charts/public/charts/themes/cool_theme/column_chart.yml +150 -0
  38. data/{charts → examples/charts/public/charts}/themes/readme.txt +0 -0
  39. data/examples/charts/views/index.erb +12 -0
  40. data/examples/maps/basic_map.rb +72 -0
  41. data/examples/maps/helpers/map_helper.rb +15 -0
  42. data/examples/maps/models/confidential_herpes_report.rb +78 -0
  43. data/examples/maps/public/javascripts/jquery-1.3.2.js +4376 -0
  44. data/examples/maps/public/map.xml +336 -0
  45. data/examples/maps/public/maps/js/Exception.js +45 -0
  46. data/examples/maps/public/maps/js/FlashProxy.js +72 -0
  47. data/examples/maps/public/maps/js/FlashSerializer.js +165 -0
  48. data/examples/maps/public/maps/js/FlashTag.js +111 -0
  49. data/examples/maps/public/maps/js/JavaScriptFlashGateway.js +455 -0
  50. data/examples/maps/public/maps/js/JavaScriptFlashGateway.swf +0 -0
  51. data/examples/maps/public/maps/map_library/australia.swf +0 -0
  52. data/examples/maps/public/maps/map_library/belgium.swf +0 -0
  53. data/examples/maps/public/maps/map_library/brazil.swf +0 -0
  54. data/examples/maps/public/maps/map_library/canada.swf +0 -0
  55. data/examples/maps/public/maps/map_library/europe.swf +0 -0
  56. data/examples/maps/public/maps/map_library/france.swf +0 -0
  57. data/examples/maps/public/maps/map_library/germany.swf +0 -0
  58. data/examples/maps/public/maps/map_library/italy.swf +0 -0
  59. data/examples/maps/public/maps/map_library/mexico.swf +0 -0
  60. data/examples/maps/public/maps/map_library/sweden.swf +0 -0
  61. data/examples/maps/public/maps/map_library/uk_ireland.swf +0 -0
  62. data/examples/maps/public/maps/map_library/us.swf +0 -0
  63. data/examples/maps/public/maps/map_library/us_canada.swf +0 -0
  64. data/examples/maps/public/maps/map_library/world.swf +0 -0
  65. data/examples/maps/public/maps/themes/default/base_map.yml +27 -0
  66. data/examples/maps/public/maps/themes/default/us_map.yml +20 -0
  67. data/examples/maps/public/maps/themes/default/us_map_2.yml +17 -0
  68. data/examples/maps/public/maps/themes/readme.txt +13 -0
  69. data/examples/maps/public/stylesheets/map.css +16 -0
  70. data/examples/maps/views/index.erb +26 -0
  71. data/examples/maps/views/layout.erb +21 -0
  72. data/lib/ziya/charts/base.rb +15 -14
  73. data/lib/ziya/{components → charts/support}/area.rb +2 -2
  74. data/lib/ziya/{components → charts/support}/axis_category.rb +1 -1
  75. data/lib/ziya/{components → charts/support}/axis_ticks.rb +1 -1
  76. data/lib/ziya/{components → charts/support}/axis_value.rb +1 -1
  77. data/lib/ziya/{components → charts/support}/base.rb +9 -21
  78. data/lib/ziya/{components → charts/support}/bevel.rb +1 -1
  79. data/lib/ziya/{components → charts/support}/blur.rb +1 -1
  80. data/lib/ziya/{components → charts/support}/button.rb +1 -1
  81. data/lib/ziya/{components → charts/support}/chart_border.rb +1 -1
  82. data/lib/ziya/{components → charts/support}/chart_grid_h.rb +1 -1
  83. data/lib/ziya/{components → charts/support}/chart_grid_v.rb +1 -1
  84. data/lib/ziya/{components → charts/support}/chart_guide.rb +1 -1
  85. data/lib/ziya/{components → charts/support}/chart_label.rb +1 -1
  86. data/lib/ziya/{components → charts/support}/chart_note.rb +1 -1
  87. data/lib/ziya/{components → charts/support}/chart_pref.rb +1 -1
  88. data/lib/ziya/{components → charts/support}/chart_rect.rb +1 -1
  89. data/lib/ziya/{components → charts/support}/chart_transition.rb +1 -1
  90. data/lib/ziya/{components → charts/support}/circle.rb +1 -1
  91. data/lib/ziya/{components → charts/support}/context_menu.rb +1 -3
  92. data/lib/ziya/{components → charts/support}/draw.rb +31 -8
  93. data/lib/ziya/{components → charts/support}/draw_base.rb +1 -1
  94. data/lib/ziya/{components → charts/support}/filter.rb +1 -1
  95. data/lib/ziya/{components → charts/support}/flash_to_javascript.rb +1 -3
  96. data/lib/ziya/{components → charts/support}/glow.rb +1 -1
  97. data/lib/ziya/{components → charts/support}/image.rb +1 -1
  98. data/lib/ziya/{components → charts/support}/legend.rb +1 -1
  99. data/lib/ziya/{components → charts/support}/line.rb +1 -1
  100. data/lib/ziya/{components → charts/support}/link.rb +1 -1
  101. data/lib/ziya/{components → charts/support}/link_data.rb +1 -1
  102. data/lib/ziya/{components → charts/support}/rect.rb +1 -1
  103. data/lib/ziya/{components → charts/support}/scroll.rb +1 -3
  104. data/lib/ziya/{components → charts/support}/series.rb +1 -3
  105. data/lib/ziya/{components → charts/support}/series_color.rb +1 -1
  106. data/lib/ziya/{components → charts/support}/series_explode.rb +1 -1
  107. data/lib/ziya/{components → charts/support}/shadow.rb +1 -1
  108. data/lib/ziya/{components → charts/support}/text.rb +9 -1
  109. data/lib/ziya/{components → charts/support}/tooltip.rb +1 -1
  110. data/lib/ziya/{components → charts/support}/update.rb +1 -1
  111. data/lib/ziya/core_ext/string.rb +31 -0
  112. data/lib/ziya/gauges/base.rb +17 -12
  113. data/lib/ziya/gauges/support/base.rb +4 -12
  114. data/lib/ziya/gauges/support/radial_numbers.rb +1 -1
  115. data/lib/ziya/html_helpers/base.rb +91 -0
  116. data/lib/ziya/html_helpers/charts.rb +200 -0
  117. data/lib/ziya/html_helpers/gauges.rb +90 -0
  118. data/lib/ziya/html_helpers/maps.rb +74 -0
  119. data/lib/ziya/html_helpers.rb +1 -0
  120. data/lib/ziya/maps/australia.rb +9 -0
  121. data/lib/ziya/maps/base.rb +409 -0
  122. data/lib/ziya/maps/belgium.rb +7 -0
  123. data/lib/ziya/maps/brazil.rb +7 -0
  124. data/lib/ziya/maps/canada.rb +7 -0
  125. data/lib/ziya/maps/europe.rb +7 -0
  126. data/lib/ziya/maps/france.rb +7 -0
  127. data/lib/ziya/maps/geocode.rb +18 -0
  128. data/lib/ziya/maps/germany.rb +7 -0
  129. data/lib/ziya/maps/italy.rb +7 -0
  130. data/lib/ziya/maps/mexico.rb +7 -0
  131. data/lib/ziya/maps/support/arc.rb +7 -0
  132. data/lib/ziya/maps/support/arc_color.rb +7 -0
  133. data/lib/ziya/maps/support/arc_range.rb +7 -0
  134. data/lib/ziya/maps/support/background_color.rb +7 -0
  135. data/lib/ziya/maps/support/base.rb +34 -0
  136. data/lib/ziya/maps/support/default_color.rb +7 -0
  137. data/lib/ziya/maps/support/default_point.rb +7 -0
  138. data/lib/ziya/maps/support/first_zoom.rb +7 -0
  139. data/lib/ziya/maps/support/heat_range.rb +35 -0
  140. data/lib/ziya/maps/support/hover.rb +7 -0
  141. data/lib/ziya/maps/support/line.rb +7 -0
  142. data/lib/ziya/maps/support/line_color.rb +7 -0
  143. data/lib/ziya/maps/support/line_range.rb +7 -0
  144. data/lib/ziya/maps/support/outline_color.rb +7 -0
  145. data/lib/ziya/maps/support/point.rb +8 -0
  146. data/lib/ziya/maps/support/point_range.rb +7 -0
  147. data/lib/ziya/maps/support/range.rb +31 -0
  148. data/lib/ziya/maps/support/ranges.rb +18 -0
  149. data/lib/ziya/maps/support/region.rb +7 -0
  150. data/lib/ziya/maps/support/scale_points.rb +7 -0
  151. data/lib/ziya/maps/support/show_name.rb +7 -0
  152. data/lib/ziya/maps/support/state.rb +7 -0
  153. data/lib/ziya/maps/support/state_info_icon.rb +7 -0
  154. data/lib/ziya/maps/support/zoom_mode.rb +7 -0
  155. data/lib/ziya/maps/support/zoom_out_button.rb +7 -0
  156. data/lib/ziya/maps/support/zoom_out_scale.rb +7 -0
  157. data/lib/ziya/maps/sweden.rb +7 -0
  158. data/lib/ziya/maps/uk.rb +7 -0
  159. data/lib/ziya/maps/us.rb +7 -0
  160. data/lib/ziya/maps/world.rb +7 -0
  161. data/lib/ziya/version.rb +3 -3
  162. data/lib/ziya/yaml_helpers/base.rb +20 -0
  163. data/lib/ziya/yaml_helpers/charts.rb +49 -0
  164. data/lib/ziya/yaml_helpers/gauges.rb +33 -0
  165. data/lib/ziya/yaml_helpers/maps.rb +17 -0
  166. data/lib/ziya/yaml_helpers.rb +1 -0
  167. data/lib/ziya.rb +20 -11
  168. data/resources/charts/AC_RunActiveContent.js +292 -0
  169. data/resources/charts/charts.swf +0 -0
  170. data/resources/charts/charts_library/ar3d.swf +0 -0
  171. data/resources/charts/charts_library/arno.swf +0 -0
  172. data/resources/charts/charts_library/ars3.swf +0 -0
  173. data/resources/charts/charts_library/arst.swf +0 -0
  174. data/resources/charts/charts_library/brfl.swf +0 -0
  175. data/resources/charts/charts_library/brno.swf +0 -0
  176. data/resources/charts/charts_library/brst.swf +0 -0
  177. data/resources/charts/charts_library/buno.swf +0 -0
  178. data/resources/charts/charts_library/cl3d.swf +0 -0
  179. data/resources/charts/charts_library/clfl.swf +0 -0
  180. data/resources/charts/charts_library/clim.swf +0 -0
  181. data/resources/charts/charts_library/clno.swf +0 -0
  182. data/resources/charts/charts_library/clp3.swf +0 -0
  183. data/resources/charts/charts_library/cls3.swf +0 -0
  184. data/resources/charts/charts_library/clst.swf +0 -0
  185. data/resources/charts/charts_library/cnno.swf +0 -0
  186. data/resources/charts/charts_library/dono.swf +0 -0
  187. data/resources/charts/charts_library/lnno.swf +0 -0
  188. data/resources/charts/charts_library/mxno.swf +0 -0
  189. data/resources/charts/charts_library/pi3d.swf +0 -0
  190. data/resources/charts/charts_library/piim.swf +0 -0
  191. data/resources/charts/charts_library/pino.swf +0 -0
  192. data/resources/charts/charts_library/pono.swf +0 -0
  193. data/resources/charts/charts_library/scno.swf +0 -0
  194. data/resources/charts/full_screen.swf +0 -0
  195. data/resources/charts/scripts/output_jpg.php +23 -0
  196. data/resources/charts/sliders/black.swf +0 -0
  197. data/resources/charts/sliders/preview_handle_1.swf +0 -0
  198. data/resources/charts/sliders/preview_handle_2.swf +0 -0
  199. data/resources/charts/themes/readme.txt +13 -0
  200. data/{gauges → resources/gauges}/designs/circle.yml +0 -0
  201. data/{gauges → resources/gauges}/designs/signal.yml +0 -0
  202. data/{gauges → resources/gauges}/designs/thermo.yml +0 -0
  203. data/{gauges → resources/gauges}/designs/title.yml +0 -0
  204. data/{gauges → resources/gauges}/gauge.swf +0 -0
  205. data/resources/maps/js/Exception.js +45 -0
  206. data/resources/maps/js/FlashProxy.js +72 -0
  207. data/resources/maps/js/FlashSerializer.js +165 -0
  208. data/resources/maps/js/FlashTag.js +111 -0
  209. data/resources/maps/js/JavaScriptFlashGateway.js +455 -0
  210. data/resources/maps/js/JavaScriptFlashGateway.swf +0 -0
  211. data/resources/maps/map_library/australia.swf +0 -0
  212. data/resources/maps/map_library/belgium.swf +0 -0
  213. data/resources/maps/map_library/brazil.swf +0 -0
  214. data/resources/maps/map_library/canada.swf +0 -0
  215. data/resources/maps/map_library/europe.swf +0 -0
  216. data/resources/maps/map_library/france.swf +0 -0
  217. data/resources/maps/map_library/germany.swf +0 -0
  218. data/resources/maps/map_library/italy.swf +0 -0
  219. data/resources/maps/map_library/mexico.swf +0 -0
  220. data/resources/maps/map_library/sweden.swf +0 -0
  221. data/resources/maps/map_library/uk_ireland.swf +0 -0
  222. data/resources/maps/map_library/us.swf +0 -0
  223. data/resources/maps/map_library/us_canada.swf +0 -0
  224. data/resources/maps/map_library/world.swf +0 -0
  225. data/resources/maps/themes/readme.txt +13 -0
  226. data/spec/charts/base_spec.rb +2 -2
  227. data/spec/charts/chart_type_spec.rb +3 -4
  228. data/spec/{components → charts/support}/area_spec.rb +8 -8
  229. data/spec/charts/support/draw_spec.rb +41 -0
  230. data/spec/{components → charts/support}/filter_spec.rb +6 -6
  231. data/spec/{components → charts/support}/link_spec.rb +6 -6
  232. data/spec/{components → charts/support}/series.rb +4 -4
  233. data/spec/{components → charts/support}/series_color_spec.rb +4 -4
  234. data/spec/{components → charts/support}/series_explode.rb +4 -4
  235. data/spec/{components → charts/support}/series_explode_spec.rb +4 -4
  236. data/spec/core_ext/string_spec.rb +40 -0
  237. data/spec/gauges/base_spec.rb +1 -1
  238. data/spec/html_helpers/base_spec.rb +50 -0
  239. data/spec/html_helpers/charts_spec.rb +23 -0
  240. data/spec/html_helpers/gauges_spec.rb +16 -0
  241. data/spec/html_helpers/maps_spec.rb +20 -0
  242. data/spec/maps/base_spec.rb +82 -0
  243. data/spec/maps/support/default_color_spec.rb +29 -0
  244. data/spec/maps/support/heat_range_spec.rb +29 -0
  245. data/spec/maps/us_spec.rb +12 -0
  246. data/spec/maps/world_spec.rb +18 -0
  247. data/spec/spec_helper.rb +5 -4
  248. data/spec/themes/maps/base_map.yml +81 -0
  249. data/spec/themes/maps/us_map.yml +6 -0
  250. data/spec/themes/maps/world_map.yml +6 -0
  251. data/spec/themes/maps/world_ov_map.yml +6 -0
  252. data/spec/{helpers/base_helper_spec.rb → yaml_helpers/charts_spec.rb} +10 -13
  253. data/spec/yaml_helpers/gauges_spec.rb +15 -0
  254. data/spec/ziya_helper_spec.rb +118 -116
  255. data/tasks/gem.rake +1 -1
  256. data/tasks/setup.rb +1 -1
  257. data/ziya.gemspec +39 -0
  258. metadata +259 -438
  259. data/lib/ziya/helpers/base_helper.rb +0 -91
  260. data/lib/ziya/utils/text.rb +0 -39
  261. data/lib/ziya/ziya_helper.rb +0 -362
  262. data/spec/components/draw_spec.rb +0 -37
  263. data/spec/utils/text_spec.rb +0 -33
@@ -0,0 +1,455 @@
1
+ /*
2
+ Macromedia(r) Flash(r) JavaScript Integration Kit License
3
+
4
+
5
+ Copyright (c) 2005 Macromedia, inc. All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without modification,
8
+ are permitted provided that the following conditions are met:
9
+
10
+ 1. Redistributions of source code must retain the above copyright notice, this
11
+ list of conditions and the following disclaimer.
12
+
13
+ 2. Redistributions in binary form must reproduce the above copyright notice,
14
+ this list of conditions and the following disclaimer in the documentation and/or
15
+ other materials provided with the distribution.
16
+
17
+ 3. The end-user documentation included with the redistribution, if any, must
18
+ include the following acknowledgment:
19
+
20
+ "This product includes software developed by Macromedia, Inc.
21
+ (http://www.macromedia.com)."
22
+
23
+ Alternately, this acknowledgment may appear in the software itself, if and
24
+ wherever such third-party acknowledgments normally appear.
25
+
26
+ 4. The name Macromedia must not be used to endorse or promote products derived
27
+ from this software without prior written permission. For written permission,
28
+ please contact devrelations@macromedia.com.
29
+
30
+ 5. Products derived from this software may not be called "Macromedia" or
31
+ "Macromedia Flash", nor may "Macromedia" or "Macromedia Flash" appear in their
32
+ name.
33
+
34
+ THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES,
35
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
36
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MACROMEDIA OR
37
+ ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
38
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
39
+ OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
40
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
41
+ STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
42
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
43
+ DAMAGE.
44
+
45
+ --
46
+
47
+ This code is part of the Flash / JavaScript Integration Kit:
48
+ http://www.macromedia.com/go/flashjavascript/
49
+
50
+ Created by:
51
+
52
+ Christian Cantrell
53
+ http://weblogs.macromedia.com/cantrell/
54
+ mailto:cantrell@macromedia.com
55
+
56
+ Mike Chambers
57
+ http://weblogs.macromedia.com/mesh/
58
+ mailto:mesh@macromedia.com
59
+
60
+ Macromedia
61
+ */
62
+
63
+ /**
64
+ * Create a new Exception object.
65
+ * name: The name of the exception.
66
+ * message: The exception message.
67
+ */
68
+ function Exception(name, message)
69
+ {
70
+ if (name)
71
+ this.name = name;
72
+ if (message)
73
+ this.message = message;
74
+ }
75
+
76
+ /**
77
+ * Set the name of the exception.
78
+ */
79
+ Exception.prototype.setName = function(name)
80
+ {
81
+ this.name = name;
82
+ }
83
+
84
+ /**
85
+ * Get the exception's name.
86
+ */
87
+ Exception.prototype.getName = function()
88
+ {
89
+ return this.name;
90
+ }
91
+
92
+ /**
93
+ * Set a message on the exception.
94
+ */
95
+ Exception.prototype.setMessage = function(msg)
96
+ {
97
+ this.message = msg;
98
+ }
99
+
100
+ /**
101
+ * Get the exception message.
102
+ */
103
+ Exception.prototype.getMessage = function()
104
+ {
105
+ return this.message;
106
+ }
107
+
108
+ /**
109
+ * Generates a browser-specific Flash tag. Create a new instance, set whatever
110
+ * properties you need, then call either toString() to get the tag as a string, or
111
+ * call write() to write the tag out.
112
+ */
113
+
114
+ /**
115
+ * Creates a new instance of the FlashTag.
116
+ * src: The path to the SWF file.
117
+ * width: The width of your Flash content.
118
+ * height: the height of your Flash content.
119
+ */
120
+ function FlashTag(src, width, height)
121
+ {
122
+ this.src = src;
123
+ this.width = width;
124
+ this.height = height;
125
+ this.version = '7,0,14,0';
126
+ this.id = null;
127
+ this.bgcolor = 'ffffff';
128
+ this.flashVars = null;
129
+ }
130
+
131
+ /**
132
+ * Sets the Flash version used in the Flash tag.
133
+ */
134
+ FlashTag.prototype.setVersion = function(v)
135
+ {
136
+ this.version = v;
137
+ }
138
+
139
+ /**
140
+ * Sets the ID used in the Flash tag.
141
+ */
142
+ FlashTag.prototype.setId = function(id)
143
+ {
144
+ this.id = id;
145
+ }
146
+
147
+ /**
148
+ * Sets the background color used in the Flash tag.
149
+ */
150
+ FlashTag.prototype.setBgcolor = function(bgc)
151
+ {
152
+ this.bgcolor = bgc;
153
+ }
154
+
155
+ /**
156
+ * Sets any variables to be passed into the Flash content.
157
+ */
158
+ FlashTag.prototype.setFlashvars = function(fv)
159
+ {
160
+ this.flashVars = fv;
161
+ }
162
+
163
+ /**
164
+ * Get the Flash tag as a string.
165
+ */
166
+ FlashTag.prototype.toString = function()
167
+ {
168
+ var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
169
+ var flashTag = new String();
170
+ if (ie)
171
+ {
172
+ flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
173
+ if (this.id != null)
174
+ {
175
+ flashTag += 'id="'+this.id+'" ';
176
+ }
177
+ flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
178
+ flashTag += 'width="'+this.width+'" ';
179
+ flashTag += 'height="'+this.height+'">';
180
+ flashTag += '<param name="movie" value="'+this.src+'"/>';
181
+ flashTag += '<param name="quality" value="high"/>';
182
+ flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
183
+ if (this.flashVars != null)
184
+ {
185
+ flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
186
+ }
187
+ flashTag += '</object>';
188
+ }
189
+ else
190
+ {
191
+ flashTag += '<embed src="'+this.src+'" ';
192
+ flashTag += 'quality="high" ';
193
+ flashTag += 'bgcolor="#'+this.bgcolor+'" ';
194
+ flashTag += 'width="'+this.width+'" ';
195
+ flashTag += 'height="'+this.height+'" ';
196
+ flashTag += 'type="application/x-shockwave-flash" ';
197
+ if (this.flashVars != null)
198
+ {
199
+ flashTag += 'flashvars="'+this.flashVars+'" ';
200
+ }
201
+ if (this.id != null)
202
+ {
203
+ flashTag += 'name="'+this.id+'" ';
204
+ }
205
+ flashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
206
+ flashTag += '</embed>';
207
+ }
208
+ return flashTag;
209
+ }
210
+
211
+ /**
212
+ * Write the Flash tag out. Pass in a reference to the document to write to.
213
+ */
214
+ FlashTag.prototype.write = function(doc)
215
+ {
216
+ doc.write(this.toString());
217
+ }
218
+
219
+ /**
220
+ * The FlashSerializer serializes JavaScript variables of types object, array, string,
221
+ * number, date, boolean, null or undefined into XML.
222
+ */
223
+
224
+ /**
225
+ * Create a new instance of the FlashSerializer.
226
+ * useCdata: Whether strings should be treated as character data. If false, strings are simply XML encoded.
227
+ */
228
+ function FlashSerializer(useCdata)
229
+ {
230
+ this.useCdata = useCdata;
231
+ }
232
+
233
+ /**
234
+ * Serialize an array into a format that can be deserialized in Flash. Supported data types are object,
235
+ * array, string, number, date, boolean, null, and undefined. Returns a string of serialized data.
236
+ */
237
+ FlashSerializer.prototype.serialize = function(args)
238
+ {
239
+ var qs = new String();
240
+
241
+ for (var i = 0; i < args.length; ++i)
242
+ {
243
+ switch(typeof(args[i]))
244
+ {
245
+ case 'undefined':
246
+ qs += 't'+(i)+'=undf';
247
+ break;
248
+ case 'string':
249
+ qs += 't'+(i)+'=str&d'+(i)+'='+escape(args[i]);
250
+ break;
251
+ case 'number':
252
+ qs += 't'+(i)+'=num&d'+(i)+'='+escape(args[i]);
253
+ break;
254
+ case 'boolean':
255
+ qs += 't'+(i)+'=bool&d'+(i)+'='+escape(args[i]);
256
+ break;
257
+ case 'object':
258
+ if (args[i] == null)
259
+ {
260
+ qs += 't'+(i)+'=null';
261
+ }
262
+ else if (args[i] instanceof Date)
263
+ {
264
+ qs += 't'+(i)+'=date&d'+(i)+'='+escape(args[i].getTime());
265
+ }
266
+ else // array or object
267
+ {
268
+ try
269
+ {
270
+ qs += 't'+(i)+'=xser&d'+(i)+'='+escape(this._serializeXML(args[i]));
271
+ }
272
+ catch (exception)
273
+ {
274
+ throw new Exception("FlashSerializationException",
275
+ "The following error occurred during complex object serialization: " + exception.getMessage());
276
+ }
277
+ }
278
+ break;
279
+ default:
280
+ throw new Exception("FlashSerializationException",
281
+ "You can only serialize strings, numbers, booleans, dates, objects, arrays, nulls, and undefined.");
282
+ }
283
+
284
+ if (i != (args.length - 1))
285
+ {
286
+ qs += '&';
287
+ }
288
+ }
289
+
290
+ return qs;
291
+ }
292
+
293
+ /**
294
+ * Private
295
+ */
296
+ FlashSerializer.prototype._serializeXML = function(obj)
297
+ {
298
+ var doc = new Object();
299
+ doc.xml = '<fp>';
300
+ this._serializeNode(obj, doc, null);
301
+ doc.xml += '</fp>';
302
+ return doc.xml;
303
+ }
304
+
305
+ /**
306
+ * Private
307
+ */
308
+ FlashSerializer.prototype._serializeNode = function(obj, doc, name)
309
+ {
310
+ switch(typeof(obj))
311
+ {
312
+ case 'undefined':
313
+ doc.xml += '<undf'+this._addName(name)+'/>';
314
+ break;
315
+ case 'string':
316
+ doc.xml += '<str'+this._addName(name)+'>'+this._escapeXml(obj)+'</str>';
317
+ break;
318
+ case 'number':
319
+ doc.xml += '<num'+this._addName(name)+'>'+obj+'</num>';
320
+ break;
321
+ case 'boolean':
322
+ doc.xml += '<bool'+this._addName(name)+' val="'+obj+'"/>';
323
+ break;
324
+ case 'object':
325
+ if (obj == null)
326
+ {
327
+ doc.xml += '<null'+this._addName(name)+'/>';
328
+ }
329
+ else if (obj instanceof Date)
330
+ {
331
+ doc.xml += '<date'+this._addName(name)+'>'+obj.getTime()+'</date>';
332
+ }
333
+ else if (obj instanceof Array)
334
+ {
335
+ doc.xml += '<array'+this._addName(name)+'>';
336
+ for (var i = 0; i < obj.length; ++i)
337
+ {
338
+ this._serializeNode(obj[i], doc, null);
339
+ }
340
+ doc.xml += '</array>';
341
+ }
342
+ else
343
+ {
344
+ doc.xml += '<obj'+this._addName(name)+'>';
345
+ for (var n in obj)
346
+ {
347
+ if (typeof(obj[n]) == 'function')
348
+ continue;
349
+ this._serializeNode(obj[n], doc, n);
350
+ }
351
+ doc.xml += '</obj>';
352
+ }
353
+ break;
354
+ default:
355
+ throw new Exception("FlashSerializationException",
356
+ "You can only serialize strings, numbers, booleans, objects, dates, arrays, nulls and undefined");
357
+ break;
358
+ }
359
+ }
360
+
361
+ /**
362
+ * Private
363
+ */
364
+ FlashSerializer.prototype._addName= function(name)
365
+ {
366
+ if (name != null)
367
+ {
368
+ return ' name="'+name+'"';
369
+ }
370
+ return '';
371
+ }
372
+
373
+ /**
374
+ * Private
375
+ */
376
+ FlashSerializer.prototype._escapeXml = function(str)
377
+ {
378
+ if (this.useCdata)
379
+ return '<![CDATA['+str+']]>';
380
+ else
381
+ return str.replace(/&/g,'&amp;').replace(/</g,'&lt;');
382
+ }
383
+
384
+ /**
385
+ * The FlashProxy object is what proxies function calls between JavaScript and Flash.
386
+ * It handles all argument serialization issues.
387
+ */
388
+
389
+ /**
390
+ * Instantiates a new FlashProxy object. Pass in a uniqueID and the name (including the path)
391
+ * of the Flash proxy SWF. The ID is the same ID that needs to be passed into your Flash content as lcId.
392
+ */
393
+ function FlashProxy(uid, proxySwfName)
394
+ {
395
+ this.uid = uid;
396
+ this.proxySwfName = proxySwfName;
397
+ this.flashSerializer = new FlashSerializer(false);
398
+ }
399
+
400
+ /**
401
+ * Call a function in your Flash content. Arguments should be:
402
+ * 1. ActionScript function name to call,
403
+ * 2. any number of additional arguments of type object,
404
+ * array, string, number, boolean, date, null, or undefined.
405
+ */
406
+ FlashProxy.prototype.call = function()
407
+ {
408
+
409
+ if (arguments.length == 0)
410
+ {
411
+ throw new Exception("Flash Proxy Exception",
412
+ "The first argument should be the function name followed by any number of additional arguments.");
413
+ }
414
+
415
+ var qs = 'lcId=' + escape(this.uid) + '&functionName=' + escape(arguments[0]);
416
+
417
+ if (arguments.length > 1)
418
+ {
419
+ var justArgs = new Array();
420
+ for (var i = 1; i < arguments.length; ++i)
421
+ {
422
+ justArgs.push(arguments[i]);
423
+ }
424
+ qs += ('&' + this.flashSerializer.serialize(justArgs));
425
+ }
426
+
427
+ var divName = '_flash_proxy_' + this.uid;
428
+ if(!document.getElementById(divName))
429
+ {
430
+ var newTarget = document.createElement("div");
431
+ newTarget.id = divName;
432
+ document.body.appendChild(newTarget);
433
+ }
434
+ var target = document.getElementById(divName);
435
+ var ft = new FlashTag(this.proxySwfName, 1, 1);
436
+ ft.setVersion('6,0,65,0');
437
+ ft.setFlashvars(qs);
438
+ target.innerHTML = ft.toString();
439
+ }
440
+
441
+ /**
442
+ * This is the function that proxies function calls from Flash to JavaScript.
443
+ * It is called implicitly.
444
+ */
445
+ FlashProxy.callJS = function()
446
+ {
447
+ var functionToCall = eval(arguments[0]);
448
+ var argArray = new Array();
449
+ for (var i = 1; i < arguments.length; ++i)
450
+ {
451
+ argArray.push(arguments[i]);
452
+ }
453
+ functionToCall.apply(functionToCall, argArray);
454
+ }
455
+
Binary file
@@ -0,0 +1,13 @@
1
+ This directory indicates the location where you can specify the maps looks and feel.
2
+ You will need to create a new theme directory which contains the map YAML stylesheets for
3
+ your various maps.
4
+
5
+ For example
6
+
7
+ public/maps/themes/cool_maps
8
+ - us_map.yml
9
+ - world_map.yml
10
+
11
+ Then in your controller, indicate you want to choose the 'cool_maps' theme by using the following:
12
+
13
+ map.add( :theme, "cool_maps" )
@@ -40,8 +40,8 @@ describe Ziya::Charts::Base do
40
40
  end
41
41
 
42
42
  it "should support setting a composite chart urls" do
43
- @chart.add( :composites, { :fred => "url1", :blee => "url2" } )
44
- @chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><draw><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=url1&amp;chart_id=fred\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=url2&amp;chart_id=blee\"/></draw></chart>"
43
+ @chart.add( :composites, { :fred => { :url => "url1" }, :blee => { :url => "url2" } } )
44
+ @chart.to_xml.should == "<?xml version=\"1.0\" encoding=\"UTF-8\"?><chart><draw><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=url2&amp;chart_id=blee\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=url1&amp;chart_id=fred\"/></draw></chart>"
45
45
  end
46
46
  it "should error if the composite url arg is not an array" do
47
47
  lambda { @chart.add( :composites, "") }.should raise_error( ArgumentError, /hash of id => url/ )
@@ -1,8 +1,7 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
2
+ require 'ziya/core_ext/string'
2
3
 
3
- describe Ziya::Charts::Base do
4
- include Ziya::Utils::Text
5
-
4
+ describe Ziya::Charts::Base do
6
5
  before( :all ) do
7
6
  @types = %w[
8
7
  Area
@@ -38,7 +37,7 @@ describe Ziya::Charts::Base do
38
37
  describe "#initialize" do
39
38
  it "should create a set of charts correctly" do
40
39
  @types.each do |type|
41
- chart = Ziya::Charts.const_get( classify(type) ).new
40
+ chart = Ziya::Charts.const_get( type.classify ).new
42
41
  if type.index( /Threed/ )
43
42
  match = type.match( /(.*)Threed(.*)/ )
44
43
  if match[2] and !match[2].empty?
@@ -1,8 +1,8 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
1
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper]))
2
2
 
3
- describe Ziya::Components::Area do
3
+ describe Ziya::Charts::Support::Area do
4
4
  before( :each ) do
5
- @comp = Ziya::Components::Area.new
5
+ @comp = Ziya::Charts::Support::Area.new
6
6
  @comp.x = 1
7
7
  @comp.y = 2
8
8
  @comp.width = 100
@@ -14,7 +14,7 @@ describe Ziya::Components::Area do
14
14
  end
15
15
 
16
16
  it "should construct an area correctly" do
17
- area = Ziya::Components::Area.new( :height => 200, :width => 100, :x => 0, :y => 1 )
17
+ area = Ziya::Charts::Support::Area.new( :height => 200, :width => 100, :x => 0, :y => 1 )
18
18
  area.height.should == 200
19
19
  area.width.should == 100
20
20
  area.x.should == 0
@@ -26,7 +26,7 @@ describe Ziya::Components::Area do
26
26
  end
27
27
 
28
28
  it "should define the correct attribute methods" do
29
- lambda{ Ziya::Components::Area.attributes[@comp.class.name].each {
29
+ lambda{ Ziya::Charts::Support::Area.attributes[@comp.class.name].each {
30
30
  |m| @comp.send( m ) } }.should_not raise_error
31
31
  end
32
32
 
@@ -35,12 +35,12 @@ describe Ziya::Components::Area do
35
35
  end
36
36
 
37
37
  it "should check that no properties are set correctly" do
38
- @comp = Ziya::Components::Area.new
38
+ @comp = Ziya::Charts::Support::Area.new
39
39
  @comp.should_not be_configured
40
40
  end
41
41
 
42
42
  it "should merge attributes correctly" do
43
- parent = Ziya::Components::Area.new
43
+ parent = Ziya::Charts::Support::Area.new
44
44
  parent.x = 20
45
45
  parent.y = 50
46
46
  @comp.merge( parent, false )
@@ -58,7 +58,7 @@ describe Ziya::Components::Area do
58
58
 
59
59
  it "should flatten simple component correctly" do
60
60
  xml = Builder::XmlMarkup.new
61
- comp = Ziya::Components::Area.new
61
+ comp = Ziya::Charts::Support::Area.new
62
62
  comp.x = 10
63
63
  comp.flatten( xml ).should == "<area x=\"10\"/>"
64
64
  end
@@ -0,0 +1,41 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper]))
2
+
3
+ describe Ziya::Charts::Support::Draw do
4
+ before( :each ) do
5
+ @comp = Ziya::Charts::Support::Draw.new
6
+ circle = Ziya::Charts::Support::Circle.new
7
+ circle.radius = 10
8
+ image = Ziya::Charts::Support::Image.new
9
+ image.x = 10
10
+ text = Ziya::Charts::Support::Text.new
11
+ text.x = 20
12
+ # text.y = 10
13
+ text.text = "Hello World"
14
+ @comp.components = [circle, image, text]
15
+ end
16
+
17
+ it "should define the correct attribute methods" do
18
+ lambda{ Ziya::Charts::Support::Draw.attributes[@comp.class.name].each {
19
+ |m| @comp.send( m ) } }.should_not raise_error
20
+ end
21
+
22
+ describe "#flatten" do
23
+ before( :each ) do
24
+ @xml = Builder::XmlMarkup.new
25
+ end
26
+
27
+ it "should flatten component correctly" do
28
+ @comp.flatten( @xml ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><text x=\"20\">Hello World</text></draw>"
29
+ end
30
+
31
+ it "should support composite charts" do
32
+ urls = { :fred => { :url => "/fred" }, :blee => { :url => "/blee" } }
33
+ @comp.flatten( @xml, urls ).should == "<draw><circle radius=\"10\"/><image x=\"10\"/><text x=\"20\">Hello World</text><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=%2Fblee&amp;chart_id=blee\"/><image url=\"/charts/charts.swf?library_path=/charts/charts_library&amp;xml_source=%2Ffred&amp;chart_id=fred\"/></draw>"
34
+ end
35
+
36
+ it "should support composite chart with options" do
37
+ urls = { :fred => { :url => "/fred", :transition => "slide_left", :duration => 1 } }
38
+ @comp.flatten( @xml, urls ).index( "transition=\"slide_left\"" ).should_not be_nil
39
+ end
40
+ end
41
+ end
@@ -1,17 +1,17 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
1
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper]))
2
2
 
3
- describe Ziya::Components::Filter do
3
+ describe Ziya::Charts::Support::Filter do
4
4
  before( :each ) do
5
- @comp = Ziya::Components::Filter.new
6
- blur = Ziya::Components::Blur.new
5
+ @comp = Ziya::Charts::Support::Filter.new
6
+ blur = Ziya::Charts::Support::Blur.new
7
7
  blur.blurX = 10
8
- glow = Ziya::Components::Glow.new
8
+ glow = Ziya::Charts::Support::Glow.new
9
9
  glow.alpha = 50
10
10
  @comp.filters = [blur, glow]
11
11
  end
12
12
 
13
13
  it "should define the correct attribute methods" do
14
- lambda{ Ziya::Components::Filter.attributes[@comp.class.name].each {
14
+ lambda{ Ziya::Charts::Support::Filter.attributes[@comp.class.name].each {
15
15
  |m| @comp.send( m ) } }.should_not raise_error
16
16
  end
17
17
 
@@ -1,17 +1,17 @@
1
- require File.expand_path(File.join(File.dirname(__FILE__), %w[.. spec_helper]))
1
+ require File.expand_path(File.join(File.dirname(__FILE__), %w[.. .. spec_helper]))
2
2
 
3
- describe Ziya::Components::Link do
3
+ describe Ziya::Charts::Support::Link do
4
4
  before( :each ) do
5
- @comp = Ziya::Components::Link.new
6
- area1 = Ziya::Components::Area.new
5
+ @comp = Ziya::Charts::Support::Link.new
6
+ area1 = Ziya::Charts::Support::Area.new
7
7
  area1.x = 10
8
- area2 = Ziya::Components::Area.new
8
+ area2 = Ziya::Charts::Support::Area.new
9
9
  area2.x = 20
10
10
  @comp.areas = [area1, area2]
11
11
  end
12
12
 
13
13
  it "should define the correct attribute methods" do
14
- lambda{ Ziya::Components::Link.attributes[@comp.class.name].each {
14
+ lambda{ Ziya::Charts::Support::Link.attributes[@comp.class.name].each {
15
15
  |m| @comp.send( m ) } }.should_not raise_error
16
16
  end
17
17