ruboss_on_ruby 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. data/History.txt +3 -0
  2. data/Manifest.txt +101 -0
  3. data/README.txt +37 -0
  4. data/Rakefile +4 -0
  5. data/config/hoe.rb +72 -0
  6. data/config/requirements.rb +15 -0
  7. data/gpl-3.0.txt +674 -0
  8. data/lib/ruboss_on_ruby.rb +64 -0
  9. data/lib/ruboss_on_ruby/active_foo.rb +127 -0
  10. data/lib/ruboss_on_ruby/active_record_tasks.rb +75 -0
  11. data/lib/ruboss_on_ruby/configuration.rb +38 -0
  12. data/lib/ruboss_on_ruby/tasks.rb +74 -0
  13. data/lib/ruboss_on_ruby/version.rb +11 -0
  14. data/merb_generators/ruboss_config/USAGE +18 -0
  15. data/merb_generators/ruboss_config/ruboss_config_generator.rb +135 -0
  16. data/merb_generators/ruboss_config/templates/actionscript.properties +16 -0
  17. data/merb_generators/ruboss_config/templates/actionscriptair.properties +16 -0
  18. data/merb_generators/ruboss_config/templates/expressInstall.swf +0 -0
  19. data/merb_generators/ruboss_config/templates/flex.properties +2 -0
  20. data/merb_generators/ruboss_config/templates/html-template/AC_OETags.js +276 -0
  21. data/merb_generators/ruboss_config/templates/html-template/history/history.css +6 -0
  22. data/merb_generators/ruboss_config/templates/html-template/history/history.js +645 -0
  23. data/merb_generators/ruboss_config/templates/html-template/history/historyFrame.html +29 -0
  24. data/merb_generators/ruboss_config/templates/html-template/index.template.html +121 -0
  25. data/merb_generators/ruboss_config/templates/html-template/playerProductInstall.swf +0 -0
  26. data/merb_generators/ruboss_config/templates/index.html.erb +19 -0
  27. data/merb_generators/ruboss_config/templates/mainair-app.xml +134 -0
  28. data/merb_generators/ruboss_config/templates/mainapp.mxml +34 -0
  29. data/merb_generators/ruboss_config/templates/project.properties +18 -0
  30. data/merb_generators/ruboss_config/templates/projectair.properties +24 -0
  31. data/merb_generators/ruboss_config/templates/swfobject.js +5 -0
  32. data/merb_generators/ruboss_controller/USAGE +11 -0
  33. data/merb_generators/ruboss_controller/ruboss_controller_generator.rb +32 -0
  34. data/merb_generators/ruboss_controller/templates/controller.as.erb +35 -0
  35. data/merb_generators/ruboss_resource_controller/USAGE +5 -0
  36. data/merb_generators/ruboss_resource_controller/ruboss_resource_controller_generator.rb +70 -0
  37. data/merb_generators/ruboss_resource_controller/templates/app/controllers/%controller_file_name%.rb +55 -0
  38. data/merb_generators/ruboss_resource_controller/templates/app/helpers/%controller_file_name%_helper.rb +16 -0
  39. data/merb_generators/ruboss_scaffold/USAGE +5 -0
  40. data/merb_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +190 -0
  41. data/merb_generators/ruboss_scaffold/templates/component.mxml.erb +148 -0
  42. data/merb_generators/ruboss_scaffold/templates/fixtures.yml.erb +35 -0
  43. data/merb_generators/ruboss_scaffold/templates/migration.rb.erb +19 -0
  44. data/merb_generators/ruboss_scaffold/templates/model.as.erb +42 -0
  45. data/merb_generators/ruboss_scaffold/templates/model.rb.erb +11 -0
  46. data/merb_generators/ruboss_yaml_scaffold/USAGE +5 -0
  47. data/merb_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +53 -0
  48. data/rails_generators/ruboss_config/USAGE +18 -0
  49. data/rails_generators/ruboss_config/ruboss_config_generator.rb +126 -0
  50. data/rails_generators/ruboss_config/templates/actionscript.properties +16 -0
  51. data/rails_generators/ruboss_config/templates/actionscriptair.properties +16 -0
  52. data/rails_generators/ruboss_config/templates/expressInstall.swf +0 -0
  53. data/rails_generators/ruboss_config/templates/flex.properties +2 -0
  54. data/rails_generators/ruboss_config/templates/html-template/AC_OETags.js +276 -0
  55. data/rails_generators/ruboss_config/templates/html-template/history/history.css +6 -0
  56. data/rails_generators/ruboss_config/templates/html-template/history/history.js +645 -0
  57. data/rails_generators/ruboss_config/templates/html-template/history/historyFrame.html +29 -0
  58. data/rails_generators/ruboss_config/templates/html-template/index.template.html +121 -0
  59. data/rails_generators/ruboss_config/templates/html-template/playerProductInstall.swf +0 -0
  60. data/rails_generators/ruboss_config/templates/index.html.erb +19 -0
  61. data/rails_generators/ruboss_config/templates/mainair-app.xml +134 -0
  62. data/rails_generators/ruboss_config/templates/mainapp.mxml +34 -0
  63. data/rails_generators/ruboss_config/templates/project.properties +18 -0
  64. data/rails_generators/ruboss_config/templates/projectair.properties +24 -0
  65. data/rails_generators/ruboss_config/templates/ruboss_tasks.rake +15 -0
  66. data/rails_generators/ruboss_config/templates/swfobject.js +5 -0
  67. data/rails_generators/ruboss_controller/USAGE +11 -0
  68. data/rails_generators/ruboss_controller/ruboss_controller_generator.rb +46 -0
  69. data/rails_generators/ruboss_controller/templates/controller.as.erb +35 -0
  70. data/rails_generators/ruboss_scaffold/USAGE +35 -0
  71. data/rails_generators/ruboss_scaffold/ruboss_scaffold_generator.rb +193 -0
  72. data/rails_generators/ruboss_scaffold/templates/component.mxml.erb +148 -0
  73. data/rails_generators/ruboss_scaffold/templates/controller.rb.erb +97 -0
  74. data/rails_generators/ruboss_scaffold/templates/fixtures.yml.erb +35 -0
  75. data/rails_generators/ruboss_scaffold/templates/migration.rb.erb +19 -0
  76. data/rails_generators/ruboss_scaffold/templates/model.as.erb +42 -0
  77. data/rails_generators/ruboss_scaffold/templates/model.rb.erb +11 -0
  78. data/rails_generators/ruboss_yaml_scaffold/USAGE +14 -0
  79. data/rails_generators/ruboss_yaml_scaffold/ruboss_yaml_scaffold_generator.rb +45 -0
  80. data/rcl-1.0.txt +0 -0
  81. data/script/console +10 -0
  82. data/script/destroy +14 -0
  83. data/script/generate +14 -0
  84. data/script/txt2html +82 -0
  85. data/setup.rb +1585 -0
  86. data/tasks/deployment.rake +34 -0
  87. data/tasks/environment.rake +7 -0
  88. data/tasks/website.rake +17 -0
  89. data/test/active_foo_test.rb +16 -0
  90. data/test/test_generator_helper.rb +29 -0
  91. data/test/test_helper.rb +2 -0
  92. data/test/test_ruboss_config_generator.rb +45 -0
  93. data/test/test_ruboss_controller_generator.rb +45 -0
  94. data/test/test_ruboss_on_ruby.rb +11 -0
  95. data/test/test_ruboss_scaffold_generator.rb +45 -0
  96. data/test/test_ruboss_yaml_scaffold_generator.rb +46 -0
  97. data/website/index.html +86 -0
  98. data/website/index.txt +83 -0
  99. data/website/javascripts/rounded_corners_lite.inc.js +285 -0
  100. data/website/stylesheets/screen.css +138 -0
  101. data/website/template.html.erb +48 -0
  102. metadata +166 -0
@@ -0,0 +1,35 @@
1
+ # Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
2
+
3
+ <% unless attributes.empty? && belongs_tos.empty? -%>
4
+ <%= class_name.underscore -%>_one:
5
+ <% for attribute in attributes -%>
6
+ <%= attribute.name %>: <%= attribute.default("#{class_name}1") %>
7
+ <% end -%>
8
+ <% for model in belongs_tos -%>
9
+ <%= model %>: <%= model %>_one
10
+ <% end -%>
11
+
12
+ <%= class_name.underscore -%>_two:
13
+ <% for attribute in attributes -%>
14
+ <%= attribute.name %>: <%= attribute.default("#{class_name}2") %>
15
+ <% end -%>
16
+ <% for model in belongs_tos -%>
17
+ <%= model %>: <%= model %>_two
18
+ <% end -%>
19
+
20
+ <%= class_name.underscore -%>_three:
21
+ <% for attribute in attributes -%>
22
+ <%= attribute.name %>: <%= attribute.default("#{class_name}3") %>
23
+ <% end -%>
24
+ <% for model in belongs_tos -%>
25
+ <%= model %>: <%= model %>_three
26
+ <% end -%>
27
+
28
+ <%= class_name.underscore -%>_four:
29
+ <% for attribute in attributes -%>
30
+ <%= attribute.name %>: <%= attribute.default("#{class_name}4") %>
31
+ <% end -%>
32
+ <% for model in belongs_tos -%>
33
+ <%= model %>: <%= model %>_four
34
+ <% end -%>
35
+ <% end -%>
@@ -0,0 +1,19 @@
1
+ class <%= migration_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :<%= table_name %> do |t|
4
+ <% for attribute in attributes -%>
5
+ t.<%= attribute.type %> :<%= attribute.name %>
6
+ <% end -%>
7
+ <% for model in belongs_tos -%>
8
+ t.references :<%= model %>
9
+ <% end -%>
10
+ <% unless options[:skip_timestamps] %>
11
+ t.timestamps
12
+ <% end -%>
13
+ end
14
+ end
15
+
16
+ def self.down
17
+ drop_table :<%= table_name %>
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ package <%= base_package %>.models {
2
+ <% if has_manies.length > 0 -%>
3
+ import org.ruboss.models.ModelsCollection;
4
+ <% end -%>
5
+ import org.ruboss.models.RubossModel;
6
+
7
+ [Resource(name="<%= resource_controller_name %>")]
8
+ [Bindable]
9
+ public class <%= class_name %> extends RubossModel {
10
+ <% if attributes && !attributes.empty? && attributes[0].flex_type != "Boolean" -%>
11
+ public static const LABEL:String = "<%= attributes[0].flex_name %>";
12
+ <% else -%>
13
+ public static const LABEL:String = "id";
14
+ <% end -%>
15
+
16
+ <% for attribute in attributes -%>
17
+ <% if attribute.type == :datetime || attribute.type == :time -%>
18
+ [DateTime]
19
+ <% end -%>
20
+ public var <%= attribute.flex_name %>:<%= attribute.flex_type %>;
21
+
22
+ <% end -%>
23
+ <% for model in belongs_tos -%>
24
+ [BelongsTo]
25
+ public var <%= model.camelcase(:lower) %>:<%= model.camelcase %>;
26
+
27
+ <% end -%>
28
+ <% for model in has_ones -%>
29
+ [HasOne]
30
+ public var <%= model.camelcase(:lower) %>:<%= model.camelcase %>;
31
+
32
+ <% end -%>
33
+ <% for model in has_manies -%>
34
+ [HasMany]
35
+ public var <%= model.camelcase(:lower) %>:ModelsCollection;
36
+
37
+ <% end -%>
38
+ public function <%= class_name %>() {
39
+ super(LABEL);
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,11 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+ <% for model in belongs_tos -%>
3
+ belongs_to :<%= model %>
4
+ <% end -%>
5
+ <% for model in has_ones -%>
6
+ has_one :<%= model %>
7
+ <% end -%>
8
+ <% for model in has_manies -%>
9
+ has_many :<%= model %>
10
+ <% end -%>
11
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,53 @@
1
+ require 'yaml'
2
+ require 'ruboss_on_ruby/configuration'
3
+
4
+ class RubossYamlScaffoldGenerator < Merb::GeneratorBase
5
+ include RubossOnRuby::Configuration
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ runtime_args.push ""
9
+ super
10
+ end
11
+
12
+ def extract_attrs(line, attrs)
13
+ attrs.each do |key,value|
14
+ if value.class == Array
15
+ line << " #{key}:#{value.join(',')}"
16
+ else
17
+ line << " #{key}:#{value}"
18
+ end
19
+ end
20
+ line
21
+ end
22
+
23
+ def manifest
24
+ record do |m|
25
+ models = YAML.load(File.open(File.join(APP_ROOT, 'schema/model.yml'), 'r'))
26
+ models.each do |model|
27
+ line = ""
28
+ attrs = model[1]
29
+ if attrs.class == Array
30
+ attrs.each do |elm|
31
+ line = extract_attrs(line, elm)
32
+ end
33
+ else
34
+ line = extract_attrs(line, attrs)
35
+ end
36
+ line = model[0].camelcase + " " + line
37
+ line = '--flex-only ' + line if ARGV.include?('flexonly')
38
+ puts 'running: ruboss_scaffold ' + line
39
+ Merb::ComponentGenerator.run "ruboss_scaffold", line.split(" "), "ruboss_scaffold", "generate"
40
+ puts 'done ...'
41
+ sleep 1
42
+ end
43
+ config_args = ['--main-only']
44
+ config_args << '--skip-framework' if ARGV.include?('skipframework')
45
+ Merb::ComponentGenerator.run "ruboss_config", config_args, "ruboss_config", "generate"
46
+ end
47
+ end
48
+
49
+ protected
50
+ def banner
51
+ "Usage: #{$0} #{spec.name}"
52
+ end
53
+ end
@@ -0,0 +1,18 @@
1
+ Description:
2
+ Generates the primary Ruboss directory structure, sets up Flex Builder
3
+ specific descriptor files and options fetches the latest published
4
+ Ruboss Framework SWC file.
5
+
6
+ You can generate Flex Builder configuration for either *pure* Flex
7
+ project or an AIR project. To generate AIR configuration pass the -a
8
+ (--air) option to the generator.
9
+
10
+ Examples:
11
+ `./script/generate ruboss_config` # generates project structure and a
12
+ # default Flex app configuration. Fetches
13
+ # latest ruboss framework SWC to "lib"
14
+ # folder
15
+ `./script/generate ruboss_config -a` # as above but generates an AIR app
16
+ # and configuration
17
+ `./script/generate ruboss_config -s` # generates Flex app but does not fetch
18
+ # the ruboss framework SWC.
@@ -0,0 +1,126 @@
1
+ ################################################################################
2
+ # Copyright 2008, Ruboss Technology Corporation.
3
+ #
4
+ # This software is dual-licensed under both the terms of the Ruboss Commercial
5
+ # License v1 (RCL v1) as published by Ruboss Technology Corporation and under
6
+ # the terms of the GNU General Public License v3 (GPL v3) as published by the
7
+ # Free Software Foundation.
8
+ #
9
+ # Both the RCL v1 (rcl-1.0.txt) and the GPL v3 (gpl-3.0.txt) are included in
10
+ # the source code. If you have purchased a commercial license then only the
11
+ # RCL v1 applies; otherwise, only the GPL v3 applies. To learn more or to buy a
12
+ # commercial license, please go to http://ruboss.com.
13
+ ################################################################################
14
+ require 'open-uri'
15
+ require 'ruboss_on_ruby/version'
16
+ require 'ruboss_on_ruby/configuration'
17
+
18
+ class RubossConfigGenerator < Rails::Generator::Base
19
+ include RubossOnRuby::Configuration
20
+
21
+ attr_reader :project_name,
22
+ :flex_project_name,
23
+ :base_package,
24
+ :base_folder,
25
+ :command_controller_name,
26
+ :component_names,
27
+ :application_tag,
28
+ :use_air
29
+
30
+ def initialize(runtime_args, runtime_options = {})
31
+ super
32
+ @project_name, @flex_project_name, @command_controller_name, @base_package, @base_folder = extract_names
33
+
34
+ # if we are updating main file only we probably want to maintain the type of project it is
35
+ if options[:main_only]
36
+ project_file_name = APP_ROOT + '/.project'
37
+ if File.exist?(project_file_name)
38
+ puts "Cannot combine -m (--main-app) and -a (--air) flags at the same time for an existing application.\n" <<
39
+ 'If you want to convert to AIR, remove -m flag.' if options[:air_config]
40
+ @use_air = true if File.read(project_file_name) =~/com.adobe.flexbuilder.apollo.apollobuilder/m
41
+ else
42
+ puts "Flex Builder project file doesn't exist. You should run 'ruboss_config' with -a (--air) option " <<
43
+ "or no arguments first to generate primary project structure."
44
+ exit 0;
45
+ end
46
+ else
47
+ @use_air = options[:air_config]
48
+ end
49
+
50
+ if @use_air
51
+ @application_tag = 'WindowedApplication'
52
+ else
53
+ @application_tag = 'Application'
54
+ end
55
+
56
+ @component_names = []
57
+ if File.exists?("app/flex/#{base_folder}/components/generated")
58
+ @component_names = list_mxml_files("app/flex/#{base_folder}/components/generated")
59
+ end
60
+ end
61
+
62
+ def manifest
63
+ record do |m|
64
+ if !options[:main_only]
65
+ m.file 'ruboss_tasks.rake', 'lib/tasks/ruboss_tasks.rake'
66
+ m.file 'flex.properties', '.flexProperties'
67
+ if @use_air
68
+ m.template 'actionscriptair.properties', '.actionScriptProperties'
69
+ m.template 'projectair.properties', '.project'
70
+ else
71
+ m.template 'actionscript.properties', '.actionScriptProperties'
72
+ m.template 'project.properties', '.project'
73
+ end
74
+
75
+ m.directory 'html-template/history'
76
+ %w(index.template.html AC_OETags.js playerProductInstall.swf).each do |file|
77
+ m.file "html-template/#{file}", "html-template/#{file}"
78
+ end
79
+
80
+ %w(history.css history.js historyFrame.html).each do |file|
81
+ m.file "html-template/history/#{file}", "html-template/history/#{file}"
82
+ end
83
+
84
+ %w(components controllers commands models events).each do |dir|
85
+ m.directory "app/flex/#{base_folder}/#{dir}"
86
+ end
87
+
88
+ m.directory "app/flex/#{base_folder}/components/generated"
89
+
90
+ framework_release = RubossOnRuby::RUBOSS_FRAMEWORK_VERSION
91
+ framework_distribution_url = "http://ruboss.com/releases/ruboss-#{framework_release}.swc"
92
+ framework_destination_file = "lib/ruboss-#{framework_release}.swc"
93
+
94
+ if !options[:skip_framework] && !File.exist?(framework_destination_file)
95
+ puts "fetching #{framework_release} framework binary from: #{framework_distribution_url} ..."
96
+ open(framework_destination_file, "wb").write(open(framework_distribution_url).read)
97
+ puts "done. saved to #{framework_destination_file}"
98
+ end
99
+
100
+ m.file 'swfobject.js', 'public/javascripts/swfobject.js'
101
+ m.file 'expressInstall.swf', 'public/expressInstall.swf'
102
+ m.template 'index.html.erb', 'public/index.html'
103
+
104
+ m.dependency 'ruboss_controller', @args
105
+ end
106
+ m.template 'mainapp.mxml', File.join('app/flex', "#{project_name}.mxml")
107
+ m.template 'mainair-app.xml', File.join('app/flex', "#{project_name}-app.xml") if @use_air
108
+ end
109
+ end
110
+
111
+ protected
112
+ def add_options!(opt)
113
+ opt.separator ''
114
+ opt.separator 'Options:'
115
+ opt.on("-m", "--main-only", "Only generate the main Flex/AIR application file.",
116
+ "Default: false") { |v| options[:main_only] = v }
117
+ opt.on("-a", "--air", "Configure AIR project instead of Flex. Flex is default.",
118
+ "Default: false") { |v| options[:air_config] = v }
119
+ opt.on("-s", "--skip-framework", "Don't fetch the latest framework binary. You'll have to link/build the framework yourself.",
120
+ "Default: false") { |v| options[:skip_framework] = v }
121
+ end
122
+
123
+ def banner
124
+ "Usage: #{$0} #{spec.name}"
125
+ end
126
+ end
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <actionScriptProperties mainApplicationPath="<%= project_name %>.mxml" version="3">
3
+ <compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="public/bin" rootURL="http://localhost:3000/bin" sourceFolderPath="app/flex" strict="true" useApolloConfig="false" verifyDigests="true" warn="true">
4
+ <compilerSourcePath/>
5
+ <libraryPath defaultLinkType="1">
6
+ <libraryPathEntry kind="4" path=""/>
7
+ <libraryPathEntry kind="1" linkType="1" path="lib"/>
8
+ </libraryPath>
9
+ <sourceAttachmentPath/>
10
+ </compiler>
11
+ <applications>
12
+ <application path="<%= project_name %>.mxml"/>
13
+ </applications>
14
+ <modules/>
15
+ <buildCSSFiles/>
16
+ </actionScriptProperties>
@@ -0,0 +1,16 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <actionScriptProperties mainApplicationPath="<%= project_name %>.mxml" version="3">
3
+ <compiler additionalCompilerArguments="-locale en_US -keep-as3-metadata+=Resource,HasOne,HasMany,BelongsTo,DateTime,Lazy,Ignored" copyDependentFiles="true" enableModuleDebug="true" generateAccessible="false" htmlExpressInstall="true" htmlGenerate="false" htmlHistoryManagement="false" htmlPlayerVersion="9.0.28" htmlPlayerVersionCheck="true" outputFolderPath="bin-debug" sourceFolderPath="app/flex" strict="true" useApolloConfig="true" verifyDigests="true" warn="true">
4
+ <compilerSourcePath/>
5
+ <libraryPath defaultLinkType="1">
6
+ <libraryPathEntry kind="4" path=""/>
7
+ <libraryPathEntry kind="1" linkType="1" path="lib"/>
8
+ </libraryPath>
9
+ <sourceAttachmentPath/>
10
+ </compiler>
11
+ <applications>
12
+ <application path="<%= project_name %>.mxml"/>
13
+ </applications>
14
+ <modules/>
15
+ <buildCSSFiles/>
16
+ </actionScriptProperties>
@@ -0,0 +1,2 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <flexProperties flexServerType="0" toolCompile="true" useServerFlexSDK="false" version="1"/>
@@ -0,0 +1,276 @@
1
+ // Flash Player Version Detection - Rev 1.6
2
+ // Detect Client Browser type
3
+ // Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
4
+ var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
5
+ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
6
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
7
+
8
+ function ControlVersion()
9
+ {
10
+ var version;
11
+ var axo;
12
+ var e;
13
+
14
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
15
+
16
+ try {
17
+ // version will be set for 7.X or greater players
18
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
19
+ version = axo.GetVariable("$version");
20
+ } catch (e) {
21
+ }
22
+
23
+ if (!version)
24
+ {
25
+ try {
26
+ // version will be set for 6.X players only
27
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
28
+
29
+ // installed player is some revision of 6.0
30
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
31
+ // so we have to be careful.
32
+
33
+ // default to the first public version
34
+ version = "WIN 6,0,21,0";
35
+
36
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
37
+ axo.AllowScriptAccess = "always";
38
+
39
+ // safe to call for 6.0r47 or greater
40
+ version = axo.GetVariable("$version");
41
+
42
+ } catch (e) {
43
+ }
44
+ }
45
+
46
+ if (!version)
47
+ {
48
+ try {
49
+ // version will be set for 4.X or 5.X player
50
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
51
+ version = axo.GetVariable("$version");
52
+ } catch (e) {
53
+ }
54
+ }
55
+
56
+ if (!version)
57
+ {
58
+ try {
59
+ // version will be set for 3.X player
60
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
61
+ version = "WIN 3,0,18,0";
62
+ } catch (e) {
63
+ }
64
+ }
65
+
66
+ if (!version)
67
+ {
68
+ try {
69
+ // version will be set for 2.X player
70
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
71
+ version = "WIN 2,0,0,11";
72
+ } catch (e) {
73
+ version = -1;
74
+ }
75
+ }
76
+
77
+ return version;
78
+ }
79
+
80
+ // JavaScript helper required to detect Flash Player PlugIn version information
81
+ function GetSwfVer(){
82
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
83
+ var flashVer = -1;
84
+
85
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
86
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
87
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
88
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
89
+ var descArray = flashDescription.split(" ");
90
+ var tempArrayMajor = descArray[2].split(".");
91
+ var versionMajor = tempArrayMajor[0];
92
+ var versionMinor = tempArrayMajor[1];
93
+ var versionRevision = descArray[3];
94
+ if (versionRevision == "") {
95
+ versionRevision = descArray[4];
96
+ }
97
+ if (versionRevision[0] == "d") {
98
+ versionRevision = versionRevision.substring(1);
99
+ } else if (versionRevision[0] == "r") {
100
+ versionRevision = versionRevision.substring(1);
101
+ if (versionRevision.indexOf("d") > 0) {
102
+ versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
103
+ }
104
+ }
105
+ var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
106
+ }
107
+ }
108
+ // MSN/WebTV 2.6 supports Flash 4
109
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
110
+ // WebTV 2.5 supports Flash 3
111
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
112
+ // older WebTV supports Flash 2
113
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
114
+ else if ( isIE && isWin && !isOpera ) {
115
+ flashVer = ControlVersion();
116
+ }
117
+ return flashVer;
118
+ }
119
+
120
+ // When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
121
+ function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
122
+ {
123
+ versionStr = GetSwfVer();
124
+ if (versionStr == -1 ) {
125
+ return false;
126
+ } else if (versionStr != 0) {
127
+ if(isIE && isWin && !isOpera) {
128
+ // Given "WIN 2,0,0,11"
129
+ tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"]
130
+ tempString = tempArray[1]; // "2,0,0,11"
131
+ versionArray = tempString.split(","); // ['2', '0', '0', '11']
132
+ } else {
133
+ versionArray = versionStr.split(".");
134
+ }
135
+ var versionMajor = versionArray[0];
136
+ var versionMinor = versionArray[1];
137
+ var versionRevision = versionArray[2];
138
+
139
+ // is the major.revision >= requested major.revision AND the minor version >= requested minor
140
+ if (versionMajor > parseFloat(reqMajorVer)) {
141
+ return true;
142
+ } else if (versionMajor == parseFloat(reqMajorVer)) {
143
+ if (versionMinor > parseFloat(reqMinorVer))
144
+ return true;
145
+ else if (versionMinor == parseFloat(reqMinorVer)) {
146
+ if (versionRevision >= parseFloat(reqRevision))
147
+ return true;
148
+ }
149
+ }
150
+ return false;
151
+ }
152
+ }
153
+
154
+ function AC_AddExtension(src, ext)
155
+ {
156
+ if (src.indexOf('?') != -1)
157
+ return src.replace(/\?/, ext+'?');
158
+ else
159
+ return src + ext;
160
+ }
161
+
162
+ function AC_Generateobj(objAttrs, params, embedAttrs)
163
+ {
164
+ var str = '';
165
+ if (isIE && isWin && !isOpera)
166
+ {
167
+ str += '<object ';
168
+ for (var i in objAttrs)
169
+ str += i + '="' + objAttrs[i] + '" ';
170
+ str += '>';
171
+ for (var i in params)
172
+ str += '<param name="' + i + '" value="' + params[i] + '" /> ';
173
+ str += '</object>';
174
+ } else {
175
+ str += '<embed ';
176
+ for (var i in embedAttrs)
177
+ str += i + '="' + embedAttrs[i] + '" ';
178
+ str += '> </embed>';
179
+ }
180
+
181
+ document.write(str);
182
+ }
183
+
184
+ function AC_FL_RunContent(){
185
+ var ret =
186
+ AC_GetArgs
187
+ ( arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
188
+ , "application/x-shockwave-flash"
189
+ );
190
+ AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
191
+ }
192
+
193
+ function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
194
+ var ret = new Object();
195
+ ret.embedAttrs = new Object();
196
+ ret.params = new Object();
197
+ ret.objAttrs = new Object();
198
+ for (var i=0; i < args.length; i=i+2){
199
+ var currArg = args[i].toLowerCase();
200
+
201
+ switch (currArg){
202
+ case "classid":
203
+ break;
204
+ case "pluginspage":
205
+ ret.embedAttrs[args[i]] = args[i+1];
206
+ break;
207
+ case "src":
208
+ case "movie":
209
+ args[i+1] = AC_AddExtension(args[i+1], ext);
210
+ ret.embedAttrs["src"] = args[i+1];
211
+ ret.params[srcParamName] = args[i+1];
212
+ break;
213
+ case "onafterupdate":
214
+ case "onbeforeupdate":
215
+ case "onblur":
216
+ case "oncellchange":
217
+ case "onclick":
218
+ case "ondblClick":
219
+ case "ondrag":
220
+ case "ondragend":
221
+ case "ondragenter":
222
+ case "ondragleave":
223
+ case "ondragover":
224
+ case "ondrop":
225
+ case "onfinish":
226
+ case "onfocus":
227
+ case "onhelp":
228
+ case "onmousedown":
229
+ case "onmouseup":
230
+ case "onmouseover":
231
+ case "onmousemove":
232
+ case "onmouseout":
233
+ case "onkeypress":
234
+ case "onkeydown":
235
+ case "onkeyup":
236
+ case "onload":
237
+ case "onlosecapture":
238
+ case "onpropertychange":
239
+ case "onreadystatechange":
240
+ case "onrowsdelete":
241
+ case "onrowenter":
242
+ case "onrowexit":
243
+ case "onrowsinserted":
244
+ case "onstart":
245
+ case "onscroll":
246
+ case "onbeforeeditfocus":
247
+ case "onactivate":
248
+ case "onbeforedeactivate":
249
+ case "ondeactivate":
250
+ case "type":
251
+ case "codebase":
252
+ ret.objAttrs[args[i]] = args[i+1];
253
+ break;
254
+ case "id":
255
+ case "width":
256
+ case "height":
257
+ case "align":
258
+ case "vspace":
259
+ case "hspace":
260
+ case "class":
261
+ case "title":
262
+ case "accesskey":
263
+ case "name":
264
+ case "tabindex":
265
+ ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
266
+ break;
267
+ default:
268
+ ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
269
+ }
270
+ }
271
+ ret.objAttrs["classid"] = classid;
272
+ if (mimeType) ret.embedAttrs["type"] = mimeType;
273
+ return ret;
274
+ }
275
+
276
+