forgeos_core 1.9.5.rc1 → 1.9.5.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +6 -0
- data/README.textile +1 -0
- data/app/helpers/application_helper.rb +6 -5
- data/app/models/administrator.rb +1 -1
- data/app/models/attachment.rb +2 -1
- data/app/models/person.rb +18 -13
- data/app/views/layouts/admin.html.haml +2 -2
- data/config/forgeos_admin_menu.yml +51 -0
- data/config/initializers/forgeos_menu_hash.rb +10 -0
- data/db/migrate/20091103220541_migrate_from_restful_authentication_to_authlogic.rb +3 -25
- data/lib/forgeos.rb +2 -62
- data/lib/forgeos/core.rb +1 -6
- data/lib/forgeos/core/engine.rb +1 -0
- data/lib/forgeos/core/version.rb +1 -1
- data/test/before_travis.sh +9 -0
- data/test/dummy/config/application.rb +8 -1
- data/test/dummy/config/database.yml +1 -21
- data/test/dummy/config/initializers/in_memory_database.rb +8 -0
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/dummy/config/initializers/wrap_parameters.rb +1 -1
- data/test/dummy/db/schema.rb +256 -0
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/RAILS_ENV=test.log +0 -0
- data/test/dummy/log/development.log +546 -0
- data/test/dummy/log/test.log +20047 -0
- data/test/dummy/test/fixtures/geo_zones.yml +1582 -0
- data/test/dummy/test/fixtures/people.yml +11 -0
- data/test/dummy/test/fixtures/settings.yml +70 -0
- data/test/dummy/vendor/plugins/attachment_fu/CHANGELOG +35 -0
- data/test/dummy/vendor/plugins/attachment_fu/LICENSE +20 -0
- data/test/dummy/vendor/plugins/attachment_fu/README +193 -0
- data/test/dummy/vendor/plugins/attachment_fu/Rakefile +22 -0
- data/test/dummy/vendor/plugins/attachment_fu/amazon_s3.yml.tpl +17 -0
- data/test/dummy/vendor/plugins/attachment_fu/init.rb +17 -0
- data/test/dummy/vendor/plugins/attachment_fu/install.rb +7 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/geometry.rb +93 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb +538 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/cloud_file_backend.rb +211 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/db_file_backend.rb +39 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/file_system_backend.rb +126 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/ftp_backend.rb +255 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/backends/s3_backend.rb +394 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/core_image_processor.rb +59 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/gd2_processor.rb +54 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/image_science_processor.rb +61 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/mini_magick_processor.rb +132 -0
- data/test/dummy/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu/processors/rmagick_processor.rb +57 -0
- data/test/dummy/vendor/plugins/attachment_fu/rackspace_cloudfiles.yml.tpl +14 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/color.rb +27 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/effects.rb +31 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/perspective.rb +25 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/quality.rb +25 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/scale.rb +47 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/watermark.rb +32 -0
- data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/processor.rb +123 -0
- data/test/dummy/vendor/plugins/open_flash_chart/MIT-LICENSE +20 -0
- data/test/dummy/vendor/plugins/open_flash_chart/README +54 -0
- data/test/dummy/vendor/plugins/open_flash_chart/Rakefile +22 -0
- data/test/dummy/vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js +5 -0
- data/test/dummy/vendor/plugins/open_flash_chart/assets/open-flash-chart-bar-clicking.swf +0 -0
- data/test/dummy/vendor/plugins/open_flash_chart/assets/open-flash-chart.swf +0 -0
- data/test/dummy/vendor/plugins/open_flash_chart/init.rb +9 -0
- data/test/dummy/vendor/plugins/open_flash_chart/install.rb +17 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart.rb +54 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb +18 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb +13 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/background.rb +45 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb +18 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb +17 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb +7 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb +18 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb +67 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb +13 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb +29 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb +123 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb +22 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb +13 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb +55 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb +26 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb +7 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb +23 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb +17 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb +17 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb +12 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb +39 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb +26 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb +116 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb +53 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb +75 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb +22 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb +20 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb +20 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb +27 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb +62 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb +25 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb +1 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb +18 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb +21 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb +9 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb +3 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb +7 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb +12 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb +7 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb +4 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb +10 -0
- data/test/dummy/vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb +6 -0
- data/test/dummy/vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake +4 -0
- data/test/dummy/vendor/plugins/open_flash_chart/uninstall.rb +1 -0
- data/test/files/admin_menu.yml +1 -0
- data/test/files/database.yml.mysql +5 -0
- data/test/files/database.yml.postgres +4 -0
- data/test/files/database.yml.sqlite +5 -0
- data/test/fixtures/geo_zones.yml +1582 -0
- data/test/fixtures/people.yml +43 -0
- data/test/fixtures/settings.yml +70 -0
- data/test/forgeos_core_test.rb +30 -2
- data/test/test_helper.rb +8 -0
- data/test/unit/administrator_test.rb +30 -0
- data/test/unit/person_test.rb +103 -0
- data/test/unit/user_test.rb +16 -0
- metadata +251 -37
- data/db/migrate/20110310144114_add_perishable_token_to_people.rb +0 -10
data/test/dummy/vendor/plugins/attachment_fu/vendor/red_artisan/core_image/filters/watermark.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
module RedArtisan
|
2
|
+
module CoreImage
|
3
|
+
module Filters
|
4
|
+
module Watermark
|
5
|
+
|
6
|
+
def watermark(watermark_image, tile = false, strength = 0.1)
|
7
|
+
create_core_image_context(@original.extent.size.width, @original.extent.size.height)
|
8
|
+
|
9
|
+
if watermark_image.respond_to? :to_str
|
10
|
+
watermark_image = OSX::CIImage.from(watermark_image.to_str)
|
11
|
+
end
|
12
|
+
|
13
|
+
if tile
|
14
|
+
tile_transform = OSX::NSAffineTransform.transform
|
15
|
+
tile_transform.scaleXBy_yBy 1.0, 1.0
|
16
|
+
|
17
|
+
watermark_image.affine_tile :inputTransform => tile_transform do |tiled|
|
18
|
+
tiled.crop :inputRectangle => vector(0, 0, @original.extent.size.width, @original.extent.size.height) do |tiled_watermark|
|
19
|
+
watermark_image = tiled_watermark
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
@original.dissolve_transition :inputTargetImage => watermark_image, :inputTime => strength do |watermarked|
|
25
|
+
@target = watermarked
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'osx/cocoa'
|
3
|
+
require 'active_support'
|
4
|
+
|
5
|
+
require 'red_artisan/core_image/filters/scale'
|
6
|
+
require 'red_artisan/core_image/filters/color'
|
7
|
+
require 'red_artisan/core_image/filters/watermark'
|
8
|
+
require 'red_artisan/core_image/filters/quality'
|
9
|
+
require 'red_artisan/core_image/filters/perspective'
|
10
|
+
require 'red_artisan/core_image/filters/effects'
|
11
|
+
|
12
|
+
# Generic image processor for scaling images based on CoreImage via RubyCocoa.
|
13
|
+
#
|
14
|
+
# Example usage:
|
15
|
+
#
|
16
|
+
# p = Processor.new OSX::CIImage.from(path_to_image)
|
17
|
+
# p.resize(640, 480)
|
18
|
+
# p.render do |result|
|
19
|
+
# result.save('resized.jpg', OSX::NSJPEGFileType)
|
20
|
+
# end
|
21
|
+
#
|
22
|
+
# This will resize the image to the given dimensions exactly, if you'd like to ensure that aspect ratio is preserved:
|
23
|
+
#
|
24
|
+
# p = Processor.new OSX::CIImage.from(path_to_image)
|
25
|
+
# p.fit(640)
|
26
|
+
# p.render do |result|
|
27
|
+
# result.save('resized.jpg', OSX::NSJPEGFileType)
|
28
|
+
# end
|
29
|
+
#
|
30
|
+
# fit(size) will attempt its best to resize the image so that the longest width/height (depending on image orientation) will match
|
31
|
+
# the given size. The second axis will be calculated automatically based on the aspect ratio.
|
32
|
+
#
|
33
|
+
# Scaling is performed by first clamping the image so that its external bounds become infinite, this helps when scaling so that any
|
34
|
+
# rounding discrepencies in dimensions don't affect the resultant image. We then perform a Lanczos transform on the image which scales
|
35
|
+
# it to the target size. We then crop the image to the traget dimensions.
|
36
|
+
#
|
37
|
+
# If you are generating smaller images such as thumbnails where high quality rendering isn't as important, an additional method is
|
38
|
+
# available:
|
39
|
+
#
|
40
|
+
# p = Processor.new OSX::CIImage.from(path_to_image)
|
41
|
+
# p.thumbnail(100, 100)
|
42
|
+
# p.render do |result|
|
43
|
+
# result.save('resized.jpg', OSX::NSJPEGFileType)
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# This will perform a straight affine transform and scale the X and Y boundaries to the requested size. Generally, this will be faster
|
47
|
+
# than a lanczos scale transform, but with a scaling quality trade.
|
48
|
+
#
|
49
|
+
# More than welcome to intregrate any patches, improvements - feel free to mail me with ideas.
|
50
|
+
#
|
51
|
+
# Thanks to
|
52
|
+
# * Satoshi Nakagawa for working out that OCObjWrapper needs inclusion when aliasing method_missing on existing OSX::* classes.
|
53
|
+
# * Vasantha Crabb for general help and inspiration with Cocoa
|
54
|
+
# * Ben Schwarz for example image data and collaboration during performance testing
|
55
|
+
#
|
56
|
+
# Copyright (c) Marcus Crafter <crafterm@redartisan.com> released under the MIT license
|
57
|
+
#
|
58
|
+
module RedArtisan
|
59
|
+
module CoreImage
|
60
|
+
class Processor
|
61
|
+
|
62
|
+
def initialize(original)
|
63
|
+
if original.respond_to? :to_str
|
64
|
+
@original = OSX::CIImage.from(original.to_str)
|
65
|
+
else
|
66
|
+
@original = original
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def render(&block)
|
71
|
+
raise "unprocessed image: #{@original}" unless @target
|
72
|
+
block.call @target
|
73
|
+
end
|
74
|
+
|
75
|
+
include Filters::Scale, Filters::Color, Filters::Watermark, Filters::Quality, Filters::Perspective, Filters::Effects
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def create_core_image_context(width, height)
|
80
|
+
output = OSX::NSBitmapImageRep.alloc.initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel(nil, width, height, 8, 4, true, false, OSX::NSDeviceRGBColorSpace, 0, 0)
|
81
|
+
context = OSX::NSGraphicsContext.graphicsContextWithBitmapImageRep(output)
|
82
|
+
OSX::NSGraphicsContext.setCurrentContext(context)
|
83
|
+
@ci_context = context.CIContext
|
84
|
+
end
|
85
|
+
|
86
|
+
def vector(x, y, w, h)
|
87
|
+
OSX::CIVector.vectorWithX_Y_Z_W(x, y, w, h)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
module OSX
|
94
|
+
class CIImage
|
95
|
+
include OCObjWrapper
|
96
|
+
|
97
|
+
def method_missing_with_filter_processing(sym, *args, &block)
|
98
|
+
f = OSX::CIFilter.filterWithName("CI#{sym.to_s.camelize}")
|
99
|
+
return method_missing_without_filter_processing(sym, *args, &block) unless f
|
100
|
+
|
101
|
+
f.setDefaults if f.respond_to? :setDefaults
|
102
|
+
f.setValue_forKey(self, 'inputImage')
|
103
|
+
options = args.last.is_a?(Hash) ? args.last : {}
|
104
|
+
options.each { |k, v| f.setValue_forKey(v, k.to_s) }
|
105
|
+
|
106
|
+
block.call f.valueForKey('outputImage')
|
107
|
+
end
|
108
|
+
|
109
|
+
alias_method_chain :method_missing, :filter_processing
|
110
|
+
|
111
|
+
def save(target, format = OSX::NSJPEGFileType, properties = nil)
|
112
|
+
bitmapRep = OSX::NSBitmapImageRep.alloc.initWithCIImage(self)
|
113
|
+
blob = bitmapRep.representationUsingType_properties(format, properties)
|
114
|
+
blob.writeToFile_atomically(target, false)
|
115
|
+
end
|
116
|
+
|
117
|
+
def self.from(filepath)
|
118
|
+
raise Errno::ENOENT, "No such file or directory - #{filepath}" unless File.exists?(filepath)
|
119
|
+
OSX::CIImage.imageWithContentsOfURL(OSX::NSURL.fileURLWithPath(filepath))
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
OpenFlashChart Version 2.0.0 11/14/2008
|
2
|
+
==============
|
3
|
+
|
4
|
+
1) rails ofc2_test_app
|
5
|
+
2) cd ofc2_test_app
|
6
|
+
3) script/plugin install git://github.com/pullmonkey/open_flash_chart.git
|
7
|
+
3.1) If the install didn't copy the contents of the assets directory to your RAILS_ROOT/public directory, make sure to do so.
|
8
|
+
4) script/generate controller test_it
|
9
|
+
|
10
|
+
5) Add the following to the test_it_controller.rb in RAILS_ROOT/app/controllers:
|
11
|
+
class TestItController < ApplicationController
|
12
|
+
|
13
|
+
def index
|
14
|
+
respond_to do |wants|
|
15
|
+
wants.html {
|
16
|
+
@graph = open_flash_chart_object( 600, 300, url_for( :action => 'index', :format => :json ) )
|
17
|
+
}
|
18
|
+
wants.json {
|
19
|
+
chart = OpenFlashChart.new( "MY TITLE" ) do |c|
|
20
|
+
c << BarGlass.new( :values => (1..10).sort_by{rand} )
|
21
|
+
end
|
22
|
+
render :text => chart, :layout => false
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
6) Add the following to index.html.erb in RAILS_ROOT/app/views/test_it/:
|
30
|
+
<html>
|
31
|
+
<head>
|
32
|
+
<script type="text/javascript" src="/javascripts/swfobject.js"></script>
|
33
|
+
</head>
|
34
|
+
<body>
|
35
|
+
<%= @graph %>
|
36
|
+
</body>
|
37
|
+
</html>
|
38
|
+
|
39
|
+
7) script/server
|
40
|
+
8) Let me know how it goes, thanks.
|
41
|
+
|
42
|
+
|
43
|
+
Example
|
44
|
+
=======
|
45
|
+
|
46
|
+
Example above and more to follow here - http://www.pullmonkey.com/projects/open_flash_chart
|
47
|
+
|
48
|
+
Notes
|
49
|
+
======
|
50
|
+
The plugin breaks if the json gem is included, because of the way that the gem generates json vs the rails native json generator.
|
51
|
+
|
52
|
+
Not tested, but klochner claims to have implemented a fix for it here - http://github.com/klochner/open_flash_chart/commit/00cf531387880af8c49ed5118737f0492b437f75
|
53
|
+
|
54
|
+
Copyright (c) 2008 PullMonkey, released under the MIT license
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/testtask'
|
3
|
+
require 'rake/rdoctask'
|
4
|
+
|
5
|
+
desc 'Default: run unit tests.'
|
6
|
+
task :default => :test
|
7
|
+
|
8
|
+
desc 'Test the open_flash_chart plugin.'
|
9
|
+
Rake::TestTask.new(:test) do |t|
|
10
|
+
t.libs << 'lib'
|
11
|
+
t.pattern = 'test/**/*_test.rb'
|
12
|
+
t.verbose = true
|
13
|
+
end
|
14
|
+
|
15
|
+
desc 'Generate documentation for the open_flash_chart plugin.'
|
16
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
17
|
+
rdoc.rdoc_dir = 'rdoc'
|
18
|
+
rdoc.title = 'OpenFlashChart'
|
19
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
20
|
+
rdoc.rdoc_files.include('README')
|
21
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
22
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
/* SWFObject v2.1 <http://code.google.com/p/swfobject/>
|
2
|
+
Copyright (c) 2007-2008 Geoff Stearns, Michael Williams, and Bobby van der Sluis
|
3
|
+
This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
|
4
|
+
*/
|
5
|
+
var swfobject=function(){var b="undefined",Q="object",n="Shockwave Flash",p="ShockwaveFlash.ShockwaveFlash",P="application/x-shockwave-flash",m="SWFObjectExprInst",j=window,K=document,T=navigator,o=[],N=[],i=[],d=[],J,Z=null,M=null,l=null,e=false,A=false;var h=function(){var v=typeof K.getElementById!=b&&typeof K.getElementsByTagName!=b&&typeof K.createElement!=b,AC=[0,0,0],x=null;if(typeof T.plugins!=b&&typeof T.plugins[n]==Q){x=T.plugins[n].description;if(x&&!(typeof T.mimeTypes!=b&&T.mimeTypes[P]&&!T.mimeTypes[P].enabledPlugin)){x=x.replace(/^.*\s+(\S+\s+\S+$)/,"$1");AC[0]=parseInt(x.replace(/^(.*)\..*$/,"$1"),10);AC[1]=parseInt(x.replace(/^.*\.(.*)\s.*$/,"$1"),10);AC[2]=/r/.test(x)?parseInt(x.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof j.ActiveXObject!=b){var y=null,AB=false;try{y=new ActiveXObject(p+".7")}catch(t){try{y=new ActiveXObject(p+".6");AC=[6,0,21];y.AllowScriptAccess="always"}catch(t){if(AC[0]==6){AB=true}}if(!AB){try{y=new ActiveXObject(p)}catch(t){}}}if(!AB&&y){try{x=y.GetVariable("$version");if(x){x=x.split(" ")[1].split(",");AC=[parseInt(x[0],10),parseInt(x[1],10),parseInt(x[2],10)]}}catch(t){}}}}var AD=T.userAgent.toLowerCase(),r=T.platform.toLowerCase(),AA=/webkit/.test(AD)?parseFloat(AD.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,q=false,z=r?/win/.test(r):/win/.test(AD),w=r?/mac/.test(r):/mac/.test(AD);/*@cc_on q=true;@if(@_win32)z=true;@elif(@_mac)w=true;@end@*/return{w3cdom:v,pv:AC,webkit:AA,ie:q,win:z,mac:w}}();var L=function(){if(!h.w3cdom){return }f(H);if(h.ie&&h.win){try{K.write("<script id=__ie_ondomload defer=true src=//:><\/script>");J=C("__ie_ondomload");if(J){I(J,"onreadystatechange",S)}}catch(q){}}if(h.webkit&&typeof K.readyState!=b){Z=setInterval(function(){if(/loaded|complete/.test(K.readyState)){E()}},10)}if(typeof K.addEventListener!=b){K.addEventListener("DOMContentLoaded",E,null)}R(E)}();function S(){if(J.readyState=="complete"){J.parentNode.removeChild(J);E()}}function E(){if(e){return }if(h.ie&&h.win){var v=a("span");try{var u=K.getElementsByTagName("body")[0].appendChild(v);u.parentNode.removeChild(u)}catch(w){return }}e=true;if(Z){clearInterval(Z);Z=null}var q=o.length;for(var r=0;r<q;r++){o[r]()}}function f(q){if(e){q()}else{o[o.length]=q}}function R(r){if(typeof j.addEventListener!=b){j.addEventListener("load",r,false)}else{if(typeof K.addEventListener!=b){K.addEventListener("load",r,false)}else{if(typeof j.attachEvent!=b){I(j,"onload",r)}else{if(typeof j.onload=="function"){var q=j.onload;j.onload=function(){q();r()}}else{j.onload=r}}}}}function H(){var t=N.length;for(var q=0;q<t;q++){var u=N[q].id;if(h.pv[0]>0){var r=C(u);if(r){N[q].width=r.getAttribute("width")?r.getAttribute("width"):"0";N[q].height=r.getAttribute("height")?r.getAttribute("height"):"0";if(c(N[q].swfVersion)){if(h.webkit&&h.webkit<312){Y(r)}W(u,true)}else{if(N[q].expressInstall&&!A&&c("6.0.65")&&(h.win||h.mac)){k(N[q])}else{O(r)}}}}else{W(u,true)}}}function Y(t){var q=t.getElementsByTagName(Q)[0];if(q){var w=a("embed"),y=q.attributes;if(y){var v=y.length;for(var u=0;u<v;u++){if(y[u].nodeName=="DATA"){w.setAttribute("src",y[u].nodeValue)}else{w.setAttribute(y[u].nodeName,y[u].nodeValue)}}}var x=q.childNodes;if(x){var z=x.length;for(var r=0;r<z;r++){if(x[r].nodeType==1&&x[r].nodeName=="PARAM"){w.setAttribute(x[r].getAttribute("name"),x[r].getAttribute("value"))}}}t.parentNode.replaceChild(w,t)}}function k(w){A=true;var u=C(w.id);if(u){if(w.altContentId){var y=C(w.altContentId);if(y){M=y;l=w.altContentId}}else{M=G(u)}if(!(/%$/.test(w.width))&&parseInt(w.width,10)<310){w.width="310"}if(!(/%$/.test(w.height))&&parseInt(w.height,10)<137){w.height="137"}K.title=K.title.slice(0,47)+" - Flash Player Installation";var z=h.ie&&h.win?"ActiveX":"PlugIn",q=K.title,r="MMredirectURL="+j.location+"&MMplayerType="+z+"&MMdoctitle="+q,x=w.id;if(h.ie&&h.win&&u.readyState!=4){var t=a("div");x+="SWFObjectNew";t.setAttribute("id",x);u.parentNode.insertBefore(t,u);u.style.display="none";var v=function(){u.parentNode.removeChild(u)};I(j,"onload",v)}U({data:w.expressInstall,id:m,width:w.width,height:w.height},{flashvars:r},x)}}function O(t){if(h.ie&&h.win&&t.readyState!=4){var r=a("div");t.parentNode.insertBefore(r,t);r.parentNode.replaceChild(G(t),r);t.style.display="none";var q=function(){t.parentNode.removeChild(t)};I(j,"onload",q)}else{t.parentNode.replaceChild(G(t),t)}}function G(v){var u=a("div");if(h.win&&h.ie){u.innerHTML=v.innerHTML}else{var r=v.getElementsByTagName(Q)[0];if(r){var w=r.childNodes;if(w){var q=w.length;for(var t=0;t<q;t++){if(!(w[t].nodeType==1&&w[t].nodeName=="PARAM")&&!(w[t].nodeType==8)){u.appendChild(w[t].cloneNode(true))}}}}}return u}function U(AG,AE,t){var q,v=C(t);if(v){if(typeof AG.id==b){AG.id=t}if(h.ie&&h.win){var AF="";for(var AB in AG){if(AG[AB]!=Object.prototype[AB]){if(AB.toLowerCase()=="data"){AE.movie=AG[AB]}else{if(AB.toLowerCase()=="styleclass"){AF+=' class="'+AG[AB]+'"'}else{if(AB.toLowerCase()!="classid"){AF+=" "+AB+'="'+AG[AB]+'"'}}}}}var AD="";for(var AA in AE){if(AE[AA]!=Object.prototype[AA]){AD+='<param name="'+AA+'" value="'+AE[AA]+'" />'}}v.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AF+">"+AD+"</object>";i[i.length]=AG.id;q=C(AG.id)}else{if(h.webkit&&h.webkit<312){var AC=a("embed");AC.setAttribute("type",P);for(var z in AG){if(AG[z]!=Object.prototype[z]){if(z.toLowerCase()=="data"){AC.setAttribute("src",AG[z])}else{if(z.toLowerCase()=="styleclass"){AC.setAttribute("class",AG[z])}else{if(z.toLowerCase()!="classid"){AC.setAttribute(z,AG[z])}}}}}for(var y in AE){if(AE[y]!=Object.prototype[y]){if(y.toLowerCase()!="movie"){AC.setAttribute(y,AE[y])}}}v.parentNode.replaceChild(AC,v);q=AC}else{var u=a(Q);u.setAttribute("type",P);for(var x in AG){if(AG[x]!=Object.prototype[x]){if(x.toLowerCase()=="styleclass"){u.setAttribute("class",AG[x])}else{if(x.toLowerCase()!="classid"){u.setAttribute(x,AG[x])}}}}for(var w in AE){if(AE[w]!=Object.prototype[w]&&w.toLowerCase()!="movie"){F(u,w,AE[w])}}v.parentNode.replaceChild(u,v);q=u}}}return q}function F(t,q,r){var u=a("param");u.setAttribute("name",q);u.setAttribute("value",r);t.appendChild(u)}function X(r){var q=C(r);if(q&&(q.nodeName=="OBJECT"||q.nodeName=="EMBED")){if(h.ie&&h.win){if(q.readyState==4){B(r)}else{j.attachEvent("onload",function(){B(r)})}}else{q.parentNode.removeChild(q)}}}function B(t){var r=C(t);if(r){for(var q in r){if(typeof r[q]=="function"){r[q]=null}}r.parentNode.removeChild(r)}}function C(t){var q=null;try{q=K.getElementById(t)}catch(r){}return q}function a(q){return K.createElement(q)}function I(t,q,r){t.attachEvent(q,r);d[d.length]=[t,q,r]}function c(t){var r=h.pv,q=t.split(".");q[0]=parseInt(q[0],10);q[1]=parseInt(q[1],10)||0;q[2]=parseInt(q[2],10)||0;return(r[0]>q[0]||(r[0]==q[0]&&r[1]>q[1])||(r[0]==q[0]&&r[1]==q[1]&&r[2]>=q[2]))?true:false}function V(v,r){if(h.ie&&h.mac){return }var u=K.getElementsByTagName("head")[0],t=a("style");t.setAttribute("type","text/css");t.setAttribute("media","screen");if(!(h.ie&&h.win)&&typeof K.createTextNode!=b){t.appendChild(K.createTextNode(v+" {"+r+"}"))}u.appendChild(t);if(h.ie&&h.win&&typeof K.styleSheets!=b&&K.styleSheets.length>0){var q=K.styleSheets[K.styleSheets.length-1];if(typeof q.addRule==Q){q.addRule(v,r)}}}function W(t,q){var r=q?"visible":"hidden";if(e&&C(t)){C(t).style.visibility=r}else{V("#"+t,"visibility:"+r)}}function g(s){var r=/[\\\"<>\.;]/;var q=r.exec(s)!=null;return q?encodeURIComponent(s):s}var D=function(){if(h.ie&&h.win){window.attachEvent("onunload",function(){var w=d.length;for(var v=0;v<w;v++){d[v][0].detachEvent(d[v][1],d[v][2])}var t=i.length;for(var u=0;u<t;u++){X(i[u])}for(var r in h){h[r]=null}h=null;for(var q in swfobject){swfobject[q]=null}swfobject=null})}}();return{registerObject:function(u,q,t){if(!h.w3cdom||!u||!q){return }var r={};r.id=u;r.swfVersion=q;r.expressInstall=t?t:false;N[N.length]=r;W(u,false)},getObjectById:function(v){var q=null;if(h.w3cdom){var t=C(v);if(t){var u=t.getElementsByTagName(Q)[0];if(!u||(u&&typeof t.SetVariable!=b)){q=t}else{if(typeof u.SetVariable!=b){q=u}}}}return q},embedSWF:function(x,AE,AB,AD,q,w,r,z,AC){if(!h.w3cdom||!x||!AE||!AB||!AD||!q){return }AB+="";AD+="";if(c(q)){W(AE,false);var AA={};if(AC&&typeof AC===Q){for(var v in AC){if(AC[v]!=Object.prototype[v]){AA[v]=AC[v]}}}AA.data=x;AA.width=AB;AA.height=AD;var y={};if(z&&typeof z===Q){for(var u in z){if(z[u]!=Object.prototype[u]){y[u]=z[u]}}}if(r&&typeof r===Q){for(var t in r){if(r[t]!=Object.prototype[t]){if(typeof y.flashvars!=b){y.flashvars+="&"+t+"="+r[t]}else{y.flashvars=t+"="+r[t]}}}}f(function(){U(AA,y,AE);if(AA.id==AE){W(AE,true)}})}else{if(w&&!A&&c("6.0.65")&&(h.win||h.mac)){A=true;W(AE,false);f(function(){var AF={};AF.id=AF.altContentId=AE;AF.width=AB;AF.height=AD;AF.expressInstall=w;k(AF)})}}},getFlashPlayerVersion:function(){return{major:h.pv[0],minor:h.pv[1],release:h.pv[2]}},hasFlashPlayerVersion:c,createSWF:function(t,r,q){if(h.w3cdom){return U(t,r,q)}else{return undefined}},removeSWF:function(q){if(h.w3cdom){X(q)}},createCSS:function(r,q){if(h.w3cdom){V(r,q)}},addDomLoadEvent:f,addLoadEvent:R,getQueryParamValue:function(v){var u=K.location.search||K.location.hash;if(v==null){return g(u)}if(u){var t=u.substring(1).split("&");for(var r=0;r<t.length;r++){if(t[r].substring(0,t[r].indexOf("="))==v){return g(t[r].substring((t[r].indexOf("=")+1)))}}}return""},expressInstallCallback:function(){if(A&&M){var q=C(m);if(q){q.parentNode.replaceChild(M,q);if(l){W(l,true);if(h.ie&&h.win){M.style.display="block"}}M=null;l=null;A=false}}}}}();
|
Binary file
|
@@ -0,0 +1,9 @@
|
|
1
|
+
require 'open_flash_chart'
|
2
|
+
|
3
|
+
ActionView::Base.send :include, OpenFlashChart::View
|
4
|
+
OpenFlashChart::Base.send :include, OpenFlashChart::View
|
5
|
+
ActionController::Base.send :include, OpenFlashChart::Controller
|
6
|
+
ActionController::Base.send :include, OpenFlashChart
|
7
|
+
ActiveRecord::Base.send :include, OpenFlashChart::View
|
8
|
+
ActiveRecord::Base.send :include, OpenFlashChart::Controller
|
9
|
+
ActiveRecord::Base.send :include, OpenFlashChart
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Workaround a problem with script/plugin and http-based repos.
|
2
|
+
# See http://dev.rubyonrails.org/ticket/8189
|
3
|
+
Dir.chdir(Dir.getwd.sub(/vendor.*/, '')) do
|
4
|
+
|
5
|
+
##
|
6
|
+
## Copy over asset files (javascript/css/images) from the plugin directory to public/
|
7
|
+
##
|
8
|
+
|
9
|
+
def copy_files(source_path, destination_path, directory)
|
10
|
+
source, destination = File.join(directory, source_path), File.join(RAILS_ROOT, destination_path)
|
11
|
+
# FileUtils.mkdir(destination) unless File.exist?(destination)
|
12
|
+
FileUtils.cp_r(Dir.glob(source+'/*.*'), destination)
|
13
|
+
end
|
14
|
+
|
15
|
+
directory = File.dirname(__FILE__)
|
16
|
+
copy_files("/assets", "/public", directory)
|
17
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'open_flash_chart/base'
|
2
|
+
require 'open_flash_chart/bar_base'
|
3
|
+
require 'open_flash_chart/bar'
|
4
|
+
require 'open_flash_chart/bar_3d'
|
5
|
+
require 'open_flash_chart/bar_glass'
|
6
|
+
require 'open_flash_chart/bar_sketch'
|
7
|
+
require 'open_flash_chart/bar_filled'
|
8
|
+
require 'open_flash_chart/bar_stack'
|
9
|
+
require 'open_flash_chart/candle'
|
10
|
+
require 'open_flash_chart/chart'
|
11
|
+
require 'open_flash_chart/h_bar'
|
12
|
+
require 'open_flash_chart/dot_base'
|
13
|
+
require 'open_flash_chart/line_base'
|
14
|
+
require 'open_flash_chart/line'
|
15
|
+
require 'open_flash_chart/line_dot'
|
16
|
+
require 'open_flash_chart/line_hollow'
|
17
|
+
require 'open_flash_chart/line_style'
|
18
|
+
require 'open_flash_chart/pie'
|
19
|
+
require 'open_flash_chart/scatter'
|
20
|
+
require 'open_flash_chart/scatter_line'
|
21
|
+
require 'open_flash_chart/radar_axis_labels'
|
22
|
+
require 'open_flash_chart/radar_axis'
|
23
|
+
require 'open_flash_chart/radar_spoke_labels'
|
24
|
+
require 'open_flash_chart/title'
|
25
|
+
require 'open_flash_chart/x_axis_label'
|
26
|
+
require 'open_flash_chart/x_axis_labels'
|
27
|
+
require 'open_flash_chart/x_axis'
|
28
|
+
require 'open_flash_chart/x_legend'
|
29
|
+
require 'open_flash_chart/y_axis_base'
|
30
|
+
require 'open_flash_chart/y_axis'
|
31
|
+
require 'open_flash_chart/y_axis_labels'
|
32
|
+
require 'open_flash_chart/y_axis_label'
|
33
|
+
require 'open_flash_chart/y_axis_right'
|
34
|
+
require 'open_flash_chart/y_legend'
|
35
|
+
require 'open_flash_chart/y_legend_right'
|
36
|
+
require 'open_flash_chart/legend'
|
37
|
+
require 'open_flash_chart/tooltip'
|
38
|
+
require 'open_flash_chart/area_base'
|
39
|
+
require 'open_flash_chart/area_hollow'
|
40
|
+
require 'open_flash_chart/area_line'
|
41
|
+
require 'open_flash_chart/shape'
|
42
|
+
require 'open_flash_chart/upload_image'
|
43
|
+
require 'open_flash_chart/radar_axis_labels'
|
44
|
+
require 'open_flash_chart/radar_axis'
|
45
|
+
require 'open_flash_chart/radar_spoke_labels'
|
46
|
+
require 'open_flash_chart/linear_regression'
|
47
|
+
require 'open_flash_chart/arrow'
|
48
|
+
require 'open_flash_chart/menu'
|
49
|
+
require 'open_flash_chart/sugar'
|
50
|
+
require 'open_flash_chart/tags'
|
51
|
+
require 'open_flash_chart/background'
|
52
|
+
|
53
|
+
require 'open_flash_chart/ofc_ajax'
|
54
|
+
require 'open_flash_chart/open_flash_chart_object'
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module OpenFlashChart
|
2
|
+
class AreaBase < Base
|
3
|
+
def initialize args={}
|
4
|
+
super
|
5
|
+
@type = "area"
|
6
|
+
@fill_alpha = 0.35
|
7
|
+
@values = []
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_fill_colour(color)
|
11
|
+
@fill = color
|
12
|
+
end
|
13
|
+
|
14
|
+
def set_loop
|
15
|
+
@loop = true
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module OpenFlashChart
|
2
|
+
|
3
|
+
class Inner_bg_grad
|
4
|
+
def initialize()
|
5
|
+
@fillType = 'linear'
|
6
|
+
@colour1 = '#f8f8d8'
|
7
|
+
@colour2 = '#FFFFFF'
|
8
|
+
@alpha = [1,1]
|
9
|
+
@ratio = [0,255]
|
10
|
+
@angle = '90'
|
11
|
+
end
|
12
|
+
|
13
|
+
def set_fillType(type)
|
14
|
+
@fillType = type
|
15
|
+
end
|
16
|
+
|
17
|
+
def set_colour1(color)
|
18
|
+
@colour1 = color
|
19
|
+
end
|
20
|
+
|
21
|
+
def set_colour2(color)
|
22
|
+
@colour2 = color
|
23
|
+
end
|
24
|
+
|
25
|
+
def set_alpha(array)
|
26
|
+
@alpha = array.to_a
|
27
|
+
end
|
28
|
+
|
29
|
+
def set_ratio(array)
|
30
|
+
@ratio = array.to_a
|
31
|
+
end
|
32
|
+
|
33
|
+
def set_angle(angle)
|
34
|
+
@angle = angle.to_s
|
35
|
+
end
|
36
|
+
|
37
|
+
alias_method :fillType=, :set_fillType
|
38
|
+
alias_method :colour1=, :set_colour1
|
39
|
+
alias_method :colour2=, :set_colour2
|
40
|
+
alias_method :alpha=, :set_alpha
|
41
|
+
alias_method :ratio=, :set_ratio
|
42
|
+
alias_method :angle=, :set_angle
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|