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.
- data/Manifest.txt +240 -432
- data/README.txt +104 -97
- data/Rakefile +3 -2
- data/bin/ziyafy +33 -10
- data/examples/charts/basic_chart.rb +47 -0
- data/{charts → examples/charts/public/charts}/AC_RunActiveContent.js +0 -0
- data/{charts → examples/charts/public/charts}/charts.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/ar3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/arno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/ars3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/arst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brfl.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/brst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/buno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cl3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clfl.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clim.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clp3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cls3.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/clst.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/cnno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/dono.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/lnno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/mxno.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pi3d.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/piim.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pino.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/pono.swf +0 -0
- data/{charts → examples/charts/public/charts}/charts_library/scno.swf +0 -0
- data/{charts → examples/charts/public/charts}/full_screen.swf +0 -0
- data/{charts → examples/charts/public/charts}/scripts/output_jpg.php +0 -0
- data/{charts → examples/charts/public/charts}/sliders/black.swf +0 -0
- data/{charts → examples/charts/public/charts}/sliders/preview_handle_1.swf +0 -0
- data/{charts → examples/charts/public/charts}/sliders/preview_handle_2.swf +0 -0
- data/examples/charts/public/charts/themes/cool_theme/column_chart.yml +150 -0
- data/{charts → examples/charts/public/charts}/themes/readme.txt +0 -0
- data/examples/charts/views/index.erb +12 -0
- data/examples/maps/basic_map.rb +72 -0
- data/examples/maps/helpers/map_helper.rb +15 -0
- data/examples/maps/models/confidential_herpes_report.rb +78 -0
- data/examples/maps/public/javascripts/jquery-1.3.2.js +4376 -0
- data/examples/maps/public/map.xml +336 -0
- data/examples/maps/public/maps/js/Exception.js +45 -0
- data/examples/maps/public/maps/js/FlashProxy.js +72 -0
- data/examples/maps/public/maps/js/FlashSerializer.js +165 -0
- data/examples/maps/public/maps/js/FlashTag.js +111 -0
- data/examples/maps/public/maps/js/JavaScriptFlashGateway.js +455 -0
- data/examples/maps/public/maps/js/JavaScriptFlashGateway.swf +0 -0
- data/examples/maps/public/maps/map_library/australia.swf +0 -0
- data/examples/maps/public/maps/map_library/belgium.swf +0 -0
- data/examples/maps/public/maps/map_library/brazil.swf +0 -0
- data/examples/maps/public/maps/map_library/canada.swf +0 -0
- data/examples/maps/public/maps/map_library/europe.swf +0 -0
- data/examples/maps/public/maps/map_library/france.swf +0 -0
- data/examples/maps/public/maps/map_library/germany.swf +0 -0
- data/examples/maps/public/maps/map_library/italy.swf +0 -0
- data/examples/maps/public/maps/map_library/mexico.swf +0 -0
- data/examples/maps/public/maps/map_library/sweden.swf +0 -0
- data/examples/maps/public/maps/map_library/uk_ireland.swf +0 -0
- data/examples/maps/public/maps/map_library/us.swf +0 -0
- data/examples/maps/public/maps/map_library/us_canada.swf +0 -0
- data/examples/maps/public/maps/map_library/world.swf +0 -0
- data/examples/maps/public/maps/themes/default/base_map.yml +27 -0
- data/examples/maps/public/maps/themes/default/us_map.yml +20 -0
- data/examples/maps/public/maps/themes/default/us_map_2.yml +17 -0
- data/examples/maps/public/maps/themes/readme.txt +13 -0
- data/examples/maps/public/stylesheets/map.css +16 -0
- data/examples/maps/views/index.erb +26 -0
- data/examples/maps/views/layout.erb +21 -0
- data/lib/ziya/charts/base.rb +15 -14
- data/lib/ziya/{components → charts/support}/area.rb +2 -2
- data/lib/ziya/{components → charts/support}/axis_category.rb +1 -1
- data/lib/ziya/{components → charts/support}/axis_ticks.rb +1 -1
- data/lib/ziya/{components → charts/support}/axis_value.rb +1 -1
- data/lib/ziya/{components → charts/support}/base.rb +9 -21
- data/lib/ziya/{components → charts/support}/bevel.rb +1 -1
- data/lib/ziya/{components → charts/support}/blur.rb +1 -1
- data/lib/ziya/{components → charts/support}/button.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_border.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_grid_h.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_grid_v.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_guide.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_label.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_note.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_pref.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_rect.rb +1 -1
- data/lib/ziya/{components → charts/support}/chart_transition.rb +1 -1
- data/lib/ziya/{components → charts/support}/circle.rb +1 -1
- data/lib/ziya/{components → charts/support}/context_menu.rb +1 -3
- data/lib/ziya/{components → charts/support}/draw.rb +31 -8
- data/lib/ziya/{components → charts/support}/draw_base.rb +1 -1
- data/lib/ziya/{components → charts/support}/filter.rb +1 -1
- data/lib/ziya/{components → charts/support}/flash_to_javascript.rb +1 -3
- data/lib/ziya/{components → charts/support}/glow.rb +1 -1
- data/lib/ziya/{components → charts/support}/image.rb +1 -1
- data/lib/ziya/{components → charts/support}/legend.rb +1 -1
- data/lib/ziya/{components → charts/support}/line.rb +1 -1
- data/lib/ziya/{components → charts/support}/link.rb +1 -1
- data/lib/ziya/{components → charts/support}/link_data.rb +1 -1
- data/lib/ziya/{components → charts/support}/rect.rb +1 -1
- data/lib/ziya/{components → charts/support}/scroll.rb +1 -3
- data/lib/ziya/{components → charts/support}/series.rb +1 -3
- data/lib/ziya/{components → charts/support}/series_color.rb +1 -1
- data/lib/ziya/{components → charts/support}/series_explode.rb +1 -1
- data/lib/ziya/{components → charts/support}/shadow.rb +1 -1
- data/lib/ziya/{components → charts/support}/text.rb +9 -1
- data/lib/ziya/{components → charts/support}/tooltip.rb +1 -1
- data/lib/ziya/{components → charts/support}/update.rb +1 -1
- data/lib/ziya/core_ext/string.rb +31 -0
- data/lib/ziya/gauges/base.rb +17 -12
- data/lib/ziya/gauges/support/base.rb +4 -12
- data/lib/ziya/gauges/support/radial_numbers.rb +1 -1
- data/lib/ziya/html_helpers/base.rb +91 -0
- data/lib/ziya/html_helpers/charts.rb +200 -0
- data/lib/ziya/html_helpers/gauges.rb +90 -0
- data/lib/ziya/html_helpers/maps.rb +74 -0
- data/lib/ziya/html_helpers.rb +1 -0
- data/lib/ziya/maps/australia.rb +9 -0
- data/lib/ziya/maps/base.rb +409 -0
- data/lib/ziya/maps/belgium.rb +7 -0
- data/lib/ziya/maps/brazil.rb +7 -0
- data/lib/ziya/maps/canada.rb +7 -0
- data/lib/ziya/maps/europe.rb +7 -0
- data/lib/ziya/maps/france.rb +7 -0
- data/lib/ziya/maps/geocode.rb +18 -0
- data/lib/ziya/maps/germany.rb +7 -0
- data/lib/ziya/maps/italy.rb +7 -0
- data/lib/ziya/maps/mexico.rb +7 -0
- data/lib/ziya/maps/support/arc.rb +7 -0
- data/lib/ziya/maps/support/arc_color.rb +7 -0
- data/lib/ziya/maps/support/arc_range.rb +7 -0
- data/lib/ziya/maps/support/background_color.rb +7 -0
- data/lib/ziya/maps/support/base.rb +34 -0
- data/lib/ziya/maps/support/default_color.rb +7 -0
- data/lib/ziya/maps/support/default_point.rb +7 -0
- data/lib/ziya/maps/support/first_zoom.rb +7 -0
- data/lib/ziya/maps/support/heat_range.rb +35 -0
- data/lib/ziya/maps/support/hover.rb +7 -0
- data/lib/ziya/maps/support/line.rb +7 -0
- data/lib/ziya/maps/support/line_color.rb +7 -0
- data/lib/ziya/maps/support/line_range.rb +7 -0
- data/lib/ziya/maps/support/outline_color.rb +7 -0
- data/lib/ziya/maps/support/point.rb +8 -0
- data/lib/ziya/maps/support/point_range.rb +7 -0
- data/lib/ziya/maps/support/range.rb +31 -0
- data/lib/ziya/maps/support/ranges.rb +18 -0
- data/lib/ziya/maps/support/region.rb +7 -0
- data/lib/ziya/maps/support/scale_points.rb +7 -0
- data/lib/ziya/maps/support/show_name.rb +7 -0
- data/lib/ziya/maps/support/state.rb +7 -0
- data/lib/ziya/maps/support/state_info_icon.rb +7 -0
- data/lib/ziya/maps/support/zoom_mode.rb +7 -0
- data/lib/ziya/maps/support/zoom_out_button.rb +7 -0
- data/lib/ziya/maps/support/zoom_out_scale.rb +7 -0
- data/lib/ziya/maps/sweden.rb +7 -0
- data/lib/ziya/maps/uk.rb +7 -0
- data/lib/ziya/maps/us.rb +7 -0
- data/lib/ziya/maps/world.rb +7 -0
- data/lib/ziya/version.rb +3 -3
- data/lib/ziya/yaml_helpers/base.rb +20 -0
- data/lib/ziya/yaml_helpers/charts.rb +49 -0
- data/lib/ziya/yaml_helpers/gauges.rb +33 -0
- data/lib/ziya/yaml_helpers/maps.rb +17 -0
- data/lib/ziya/yaml_helpers.rb +1 -0
- data/lib/ziya.rb +20 -11
- data/resources/charts/AC_RunActiveContent.js +292 -0
- data/resources/charts/charts.swf +0 -0
- data/resources/charts/charts_library/ar3d.swf +0 -0
- data/resources/charts/charts_library/arno.swf +0 -0
- data/resources/charts/charts_library/ars3.swf +0 -0
- data/resources/charts/charts_library/arst.swf +0 -0
- data/resources/charts/charts_library/brfl.swf +0 -0
- data/resources/charts/charts_library/brno.swf +0 -0
- data/resources/charts/charts_library/brst.swf +0 -0
- data/resources/charts/charts_library/buno.swf +0 -0
- data/resources/charts/charts_library/cl3d.swf +0 -0
- data/resources/charts/charts_library/clfl.swf +0 -0
- data/resources/charts/charts_library/clim.swf +0 -0
- data/resources/charts/charts_library/clno.swf +0 -0
- data/resources/charts/charts_library/clp3.swf +0 -0
- data/resources/charts/charts_library/cls3.swf +0 -0
- data/resources/charts/charts_library/clst.swf +0 -0
- data/resources/charts/charts_library/cnno.swf +0 -0
- data/resources/charts/charts_library/dono.swf +0 -0
- data/resources/charts/charts_library/lnno.swf +0 -0
- data/resources/charts/charts_library/mxno.swf +0 -0
- data/resources/charts/charts_library/pi3d.swf +0 -0
- data/resources/charts/charts_library/piim.swf +0 -0
- data/resources/charts/charts_library/pino.swf +0 -0
- data/resources/charts/charts_library/pono.swf +0 -0
- data/resources/charts/charts_library/scno.swf +0 -0
- data/resources/charts/full_screen.swf +0 -0
- data/resources/charts/scripts/output_jpg.php +23 -0
- data/resources/charts/sliders/black.swf +0 -0
- data/resources/charts/sliders/preview_handle_1.swf +0 -0
- data/resources/charts/sliders/preview_handle_2.swf +0 -0
- data/resources/charts/themes/readme.txt +13 -0
- data/{gauges → resources/gauges}/designs/circle.yml +0 -0
- data/{gauges → resources/gauges}/designs/signal.yml +0 -0
- data/{gauges → resources/gauges}/designs/thermo.yml +0 -0
- data/{gauges → resources/gauges}/designs/title.yml +0 -0
- data/{gauges → resources/gauges}/gauge.swf +0 -0
- data/resources/maps/js/Exception.js +45 -0
- data/resources/maps/js/FlashProxy.js +72 -0
- data/resources/maps/js/FlashSerializer.js +165 -0
- data/resources/maps/js/FlashTag.js +111 -0
- data/resources/maps/js/JavaScriptFlashGateway.js +455 -0
- data/resources/maps/js/JavaScriptFlashGateway.swf +0 -0
- data/resources/maps/map_library/australia.swf +0 -0
- data/resources/maps/map_library/belgium.swf +0 -0
- data/resources/maps/map_library/brazil.swf +0 -0
- data/resources/maps/map_library/canada.swf +0 -0
- data/resources/maps/map_library/europe.swf +0 -0
- data/resources/maps/map_library/france.swf +0 -0
- data/resources/maps/map_library/germany.swf +0 -0
- data/resources/maps/map_library/italy.swf +0 -0
- data/resources/maps/map_library/mexico.swf +0 -0
- data/resources/maps/map_library/sweden.swf +0 -0
- data/resources/maps/map_library/uk_ireland.swf +0 -0
- data/resources/maps/map_library/us.swf +0 -0
- data/resources/maps/map_library/us_canada.swf +0 -0
- data/resources/maps/map_library/world.swf +0 -0
- data/resources/maps/themes/readme.txt +13 -0
- data/spec/charts/base_spec.rb +2 -2
- data/spec/charts/chart_type_spec.rb +3 -4
- data/spec/{components → charts/support}/area_spec.rb +8 -8
- data/spec/charts/support/draw_spec.rb +41 -0
- data/spec/{components → charts/support}/filter_spec.rb +6 -6
- data/spec/{components → charts/support}/link_spec.rb +6 -6
- data/spec/{components → charts/support}/series.rb +4 -4
- data/spec/{components → charts/support}/series_color_spec.rb +4 -4
- data/spec/{components → charts/support}/series_explode.rb +4 -4
- data/spec/{components → charts/support}/series_explode_spec.rb +4 -4
- data/spec/core_ext/string_spec.rb +40 -0
- data/spec/gauges/base_spec.rb +1 -1
- data/spec/html_helpers/base_spec.rb +50 -0
- data/spec/html_helpers/charts_spec.rb +23 -0
- data/spec/html_helpers/gauges_spec.rb +16 -0
- data/spec/html_helpers/maps_spec.rb +20 -0
- data/spec/maps/base_spec.rb +82 -0
- data/spec/maps/support/default_color_spec.rb +29 -0
- data/spec/maps/support/heat_range_spec.rb +29 -0
- data/spec/maps/us_spec.rb +12 -0
- data/spec/maps/world_spec.rb +18 -0
- data/spec/spec_helper.rb +5 -4
- data/spec/themes/maps/base_map.yml +81 -0
- data/spec/themes/maps/us_map.yml +6 -0
- data/spec/themes/maps/world_map.yml +6 -0
- data/spec/themes/maps/world_ov_map.yml +6 -0
- data/spec/{helpers/base_helper_spec.rb → yaml_helpers/charts_spec.rb} +10 -13
- data/spec/yaml_helpers/gauges_spec.rb +15 -0
- data/spec/ziya_helper_spec.rb +118 -116
- data/tasks/gem.rake +1 -1
- data/tasks/setup.rb +1 -1
- data/ziya.gemspec +39 -0
- metadata +259 -438
- data/lib/ziya/helpers/base_helper.rb +0 -91
- data/lib/ziya/utils/text.rb +0 -39
- data/lib/ziya/ziya_helper.rb +0 -362
- data/spec/components/draw_spec.rb +0 -37
- data/spec/utils/text_spec.rb +0 -33
@@ -0,0 +1,111 @@
|
|
1
|
+
/**
|
2
|
+
* Generates a browser-specific Flash tag. Create a new instance, set whatever
|
3
|
+
* properties you need, then call either toString() to get the tag as a string, or
|
4
|
+
* call write() to write the tag out.
|
5
|
+
*/
|
6
|
+
|
7
|
+
/**
|
8
|
+
* Creates a new instance of the FlashTag.
|
9
|
+
* src: The path to the SWF file.
|
10
|
+
* width: The width of your Flash content.
|
11
|
+
* height: the height of your Flash content.
|
12
|
+
*/
|
13
|
+
function FlashTag(src, width, height)
|
14
|
+
{
|
15
|
+
this.src = src;
|
16
|
+
this.width = width;
|
17
|
+
this.height = height;
|
18
|
+
this.version = '7,0,14,0';
|
19
|
+
this.id = null;
|
20
|
+
this.bgcolor = 'ffffff';
|
21
|
+
this.flashVars = null;
|
22
|
+
}
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Sets the Flash version used in the Flash tag.
|
26
|
+
*/
|
27
|
+
FlashTag.prototype.setVersion = function(v)
|
28
|
+
{
|
29
|
+
this.version = v;
|
30
|
+
}
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Sets the ID used in the Flash tag.
|
34
|
+
*/
|
35
|
+
FlashTag.prototype.setId = function(id)
|
36
|
+
{
|
37
|
+
this.id = id;
|
38
|
+
}
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Sets the background color used in the Flash tag.
|
42
|
+
*/
|
43
|
+
FlashTag.prototype.setBgcolor = function(bgc)
|
44
|
+
{
|
45
|
+
this.bgcolor = bgc;
|
46
|
+
}
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Sets any variables to be passed into the Flash content.
|
50
|
+
*/
|
51
|
+
FlashTag.prototype.setFlashvars = function(fv)
|
52
|
+
{
|
53
|
+
this.flashVars = fv;
|
54
|
+
}
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Get the Flash tag as a string.
|
58
|
+
*/
|
59
|
+
FlashTag.prototype.toString = function()
|
60
|
+
{
|
61
|
+
var ie = (navigator.appName.indexOf ("Microsoft") != -1) ? 1 : 0;
|
62
|
+
var flashTag = new String();
|
63
|
+
if (ie)
|
64
|
+
{
|
65
|
+
flashTag += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
|
66
|
+
if (this.id != null)
|
67
|
+
{
|
68
|
+
flashTag += 'id="'+this.id+'" ';
|
69
|
+
}
|
70
|
+
flashTag += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+this.version+'" ';
|
71
|
+
flashTag += 'width="'+this.width+'" ';
|
72
|
+
flashTag += 'height="'+this.height+'">';
|
73
|
+
flashTag += '<param name="movie" value="'+this.src+'"/>';
|
74
|
+
flashTag += '<param name="quality" value="high"/>';
|
75
|
+
flashTag += '<param name="bgcolor" value="#'+this.bgcolor+'"/>';
|
76
|
+
if (this.flashVars != null)
|
77
|
+
{
|
78
|
+
flashTag += '<param name="flashvars" value="'+this.flashVars+'"/>';
|
79
|
+
}
|
80
|
+
flashTag += '</object>';
|
81
|
+
}
|
82
|
+
else
|
83
|
+
{
|
84
|
+
flashTag += '<embed src="'+this.src+'" ';
|
85
|
+
flashTag += 'quality="high" ';
|
86
|
+
flashTag += 'bgcolor="#'+this.bgcolor+'" ';
|
87
|
+
flashTag += 'width="'+this.width+'" ';
|
88
|
+
flashTag += 'height="'+this.height+'" ';
|
89
|
+
flashTag += 'type="application/x-shockwave-flash" ';
|
90
|
+
if (this.flashVars != null)
|
91
|
+
{
|
92
|
+
flashTag += 'flashvars="'+this.flashVars+'" ';
|
93
|
+
}
|
94
|
+
if (this.id != null)
|
95
|
+
{
|
96
|
+
flashTag += 'name="'+this.id+'" ';
|
97
|
+
}
|
98
|
+
flashTag += 'pluginspage="http://www.macromedia.com/go/getflashplayer">';
|
99
|
+
flashTag += '</embed>';
|
100
|
+
}
|
101
|
+
return flashTag;
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Write the Flash tag out. Pass in a reference to the document to write to.
|
106
|
+
*/
|
107
|
+
FlashTag.prototype.write = function(doc)
|
108
|
+
{
|
109
|
+
doc.write(this.toString());
|
110
|
+
}
|
111
|
+
|
@@ -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,'&').replace(/</g,'<');
|
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
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# This demonstrates stylesheet inheritance. Define a base style here for
|
2
|
+
# the look and feel of all maps. Then you can refine/augment the styles in derived
|
3
|
+
# classes. How cool is that ?
|
4
|
+
<%= map :base %>
|
5
|
+
|
6
|
+
# color to be used when to heat_color can be found for range or value
|
7
|
+
<%=config :default_color %>
|
8
|
+
color: 000000
|
9
|
+
|
10
|
+
# states outline color
|
11
|
+
<%=config :outline_color %>
|
12
|
+
color: 000000
|
13
|
+
|
14
|
+
# map background color
|
15
|
+
<%=config :background_color %>
|
16
|
+
color: ff0000
|
17
|
+
opacity: 20
|
18
|
+
|
19
|
+
# tooltip configuration
|
20
|
+
<%=config :hover %>
|
21
|
+
font_size: 10
|
22
|
+
font_color: 434343
|
23
|
+
background_color: fcf8b8
|
24
|
+
|
25
|
+
# disable zooming
|
26
|
+
<%=config :zoom_mode %>
|
27
|
+
data: no zoom
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Here we redefine the map outline color using a helper and
|
2
|
+
# specify the heat map ranges using the handy dandy heat_range component...
|
3
|
+
<%= map :us%>
|
4
|
+
|
5
|
+
# overrides background color and opacity to white/full
|
6
|
+
<%=config :background_color %>
|
7
|
+
color: ffffff
|
8
|
+
opacity: 100
|
9
|
+
|
10
|
+
# overrides state outline with color from helper
|
11
|
+
<%=config :outline_color %>
|
12
|
+
color: <%= outline_color %>
|
13
|
+
|
14
|
+
<%=config :heat_range %>
|
15
|
+
base_color: 'f49329'
|
16
|
+
min: 0
|
17
|
+
max: 100
|
18
|
+
step: 10
|
19
|
+
color_step: 90
|
20
|
+
color_method: darken_by
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Here we redefine the map outline color using a helper and
|
2
|
+
# specify the heat map ranges using the handy dandy heat_range component...
|
3
|
+
<%= map :us%>
|
4
|
+
# randomizes heat map base color
|
5
|
+
<% color = random_color %>
|
6
|
+
|
7
|
+
# overrides state outline with color from helper
|
8
|
+
<%=config :outline_color %>
|
9
|
+
color: <%= color %>
|
10
|
+
|
11
|
+
<%=config :heat_range %>
|
12
|
+
base_color: <%= color %>
|
13
|
+
min: 0
|
14
|
+
max: 100
|
15
|
+
step: 10
|
16
|
+
color_step: 90
|
17
|
+
color_method: darken_by
|
@@ -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/charts/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" )
|