ifd_tools 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (137) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +28 -0
  3. data/Rakefile +40 -0
  4. data/app/admin/emergency_messages.rb +33 -0
  5. data/app/admin/notifier_updates.rb +42 -0
  6. data/app/admin/software_updates.rb +42 -0
  7. data/app/admin/users.rb +48 -0
  8. data/app/assets/javascripts/ifd_tools/base.js +4 -0
  9. data/app/assets/javascripts/ifd_tools/fusion_charts.js +361 -0
  10. data/app/assets/stylesheets/ifd_tools/active_admin/_analytics.scss +32 -0
  11. data/app/assets/stylesheets/ifd_tools/active_admin/_cleanup.scss +15 -0
  12. data/app/assets/stylesheets/ifd_tools/active_admin/_footer.scss +87 -0
  13. data/app/assets/stylesheets/ifd_tools/active_admin/_square_admin_buttons.scss +27 -0
  14. data/app/assets/stylesheets/ifd_tools/base.scss +4 -0
  15. data/app/assets/swfs/FCF_Area2D.swf +0 -0
  16. data/app/assets/swfs/usa_map.swf +0 -0
  17. data/app/controllers/ifd_tools/application_controller.rb +4 -0
  18. data/app/helpers/ifd_tools/application_helper.rb +30 -0
  19. data/app/models/ifd_tools/emergency_message.rb +27 -0
  20. data/app/models/ifd_tools/notifier_update.rb +28 -0
  21. data/app/models/ifd_tools/software_update.rb +28 -0
  22. data/app/models/ifd_tools/tracking/application_event.rb +6 -0
  23. data/app/models/ifd_tools/tracking/event.rb +51 -0
  24. data/app/models/ifd_tools/tracking.rb +7 -0
  25. data/app/uploaders/software_uploader.rb +18 -0
  26. data/app/views/admin/customers/_trend.html.haml +7 -0
  27. data/app/views/admin/customers/_trend_info_sidebar.html.haml +11 -0
  28. data/app/views/admin/customers/demographic_data.builder +11 -0
  29. data/app/views/admin/customers/events_data.builder +6 -0
  30. data/app/views/admin/customers/filter_events.js.erb +6 -0
  31. data/app/views/admin/customers/trends.html.haml +11 -0
  32. data/app/views/admin/dashboard/_line_graph.html.haml +11 -0
  33. data/app/views/admin/dashboard/_usa_map.html.haml +2 -0
  34. data/app/views/admin/emergency_messages/_form.html.haml +6 -0
  35. data/app/views/admin/notifier_updates/_form.html.haml +9 -0
  36. data/app/views/admin/shared/_footer.html.haml +6 -0
  37. data/app/views/admin/software_updates/_form.html.haml +9 -0
  38. data/app/views/admin/users/_form.html.haml +9 -0
  39. data/app/views/api/emergency_messages.builder +12 -0
  40. data/app/views/api/notifier_updates.builder +15 -0
  41. data/app/views/api/software_updates.builder +15 -0
  42. data/app/views/api/track.builder +6 -0
  43. data/app/views/layouts/ifd_tools/application.html.erb +14 -0
  44. data/config/routes.rb +2 -0
  45. data/db/migrate/20121010183004_create_ifd_tools_emergency_messages.rb +11 -0
  46. data/db/migrate/20121011150939_create_ifd_tools_notifier_updates.rb +14 -0
  47. data/db/migrate/20121011151124_create_ifd_tools_software_updates.rb +14 -0
  48. data/db/migrate/20121011205911_devise_create_users.rb +57 -0
  49. data/db/migrate/20121012123505_create_customers.rb +52 -0
  50. data/db/migrate/20121012133303_create_ifd_tools_tracking_events.rb +14 -0
  51. data/lib/generators/ifd_tools/install/USAGE +5 -0
  52. data/lib/generators/ifd_tools/install/install_generator.rb +153 -0
  53. data/lib/generators/ifd_tools/install/templates/admin/customers.rb +108 -0
  54. data/lib/generators/ifd_tools/install/templates/admin/dashboard.rb +47 -0
  55. data/lib/generators/ifd_tools/install/templates/assets/active_admin.css.scss +7 -0
  56. data/lib/generators/ifd_tools/install/templates/assets/active_admin.js +2 -0
  57. data/lib/generators/ifd_tools/install/templates/assets/application.css.scss +46 -0
  58. data/lib/generators/ifd_tools/install/templates/assets/application.js +2 -0
  59. data/lib/generators/ifd_tools/install/templates/assets/ckeditor.js.coffee +13 -0
  60. data/lib/generators/ifd_tools/install/templates/capistrano/Capfile +5 -0
  61. data/lib/generators/ifd_tools/install/templates/capistrano/deploy/production.rb +2 -0
  62. data/lib/generators/ifd_tools/install/templates/capistrano/deploy/staging.rb +2 -0
  63. data/lib/generators/ifd_tools/install/templates/capistrano/deploy.rb +50 -0
  64. data/lib/generators/ifd_tools/install/templates/config/en.yml +17 -0
  65. data/lib/generators/ifd_tools/install/templates/config/ifd_tools.rb +4 -0
  66. data/lib/generators/ifd_tools/install/templates/config/schedule.rb.erb +28 -0
  67. data/lib/generators/ifd_tools/install/templates/controllers/api_controller.rb +8 -0
  68. data/lib/generators/ifd_tools/install/templates/controllers/application_controller.rb +19 -0
  69. data/lib/generators/ifd_tools/install/templates/controllers/customer_session_controller.rb +39 -0
  70. data/lib/generators/ifd_tools/install/templates/foreman/Procfile +2 -0
  71. data/lib/generators/ifd_tools/install/templates/layouts/application.html.haml +29 -0
  72. data/lib/generators/ifd_tools/install/templates/layouts/application_logged_out.html.haml +21 -0
  73. data/lib/generators/ifd_tools/install/templates/models/ability.rb +23 -0
  74. data/lib/generators/ifd_tools/install/templates/models/customer.rb +60 -0
  75. data/lib/generators/ifd_tools/install/templates/models/settings.rb +5 -0
  76. data/lib/generators/ifd_tools/install/templates/models/user.rb +31 -0
  77. data/lib/generators/ifd_tools/install/templates/settings/application.yml +16 -0
  78. data/lib/generators/ifd_tools/install/templates/views/customers/_form.html.haml +8 -0
  79. data/lib/ifd_tools/active_admin/base.rb +18 -0
  80. data/lib/ifd_tools/api_controller/emergency_messages.rb +9 -0
  81. data/lib/ifd_tools/api_controller/notifier_updates.rb +9 -0
  82. data/lib/ifd_tools/api_controller/software_updates.rb +9 -0
  83. data/lib/ifd_tools/api_controller/tracking.rb +44 -0
  84. data/lib/ifd_tools/api_controller_extensions.rb +18 -0
  85. data/lib/ifd_tools/configure.rb +27 -0
  86. data/lib/ifd_tools/date_time_additions.rb +11 -0
  87. data/lib/ifd_tools/engine.rb +17 -0
  88. data/lib/ifd_tools/states.rb +59 -0
  89. data/lib/ifd_tools/tracking/customer_tracking.rb +143 -0
  90. data/lib/ifd_tools/tracking/trackable.rb +28 -0
  91. data/lib/ifd_tools/validations/phone.rb +17 -0
  92. data/lib/ifd_tools/version.rb +3 -0
  93. data/lib/ifd_tools.rb +26 -0
  94. data/lib/tasks/ifd_tools_tasks.rake +2 -0
  95. data/test/dummy/README.rdoc +261 -0
  96. data/test/dummy/Rakefile +7 -0
  97. data/test/dummy/app/assets/javascripts/application.js +15 -0
  98. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  99. data/test/dummy/app/controllers/application_controller.rb +3 -0
  100. data/test/dummy/app/helpers/application_helper.rb +2 -0
  101. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  102. data/test/dummy/config/application.rb +59 -0
  103. data/test/dummy/config/boot.rb +10 -0
  104. data/test/dummy/config/database.yml +25 -0
  105. data/test/dummy/config/environment.rb +5 -0
  106. data/test/dummy/config/environments/development.rb +37 -0
  107. data/test/dummy/config/environments/production.rb +67 -0
  108. data/test/dummy/config/environments/test.rb +37 -0
  109. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  110. data/test/dummy/config/initializers/inflections.rb +15 -0
  111. data/test/dummy/config/initializers/mime_types.rb +5 -0
  112. data/test/dummy/config/initializers/secret_token.rb +7 -0
  113. data/test/dummy/config/initializers/session_store.rb +8 -0
  114. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  115. data/test/dummy/config/locales/en.yml +5 -0
  116. data/test/dummy/config/routes.rb +4 -0
  117. data/test/dummy/config.ru +4 -0
  118. data/test/dummy/db/development.sqlite3 +0 -0
  119. data/test/dummy/db/schema.rb +24 -0
  120. data/test/dummy/log/development.log +15 -0
  121. data/test/dummy/public/404.html +26 -0
  122. data/test/dummy/public/422.html +26 -0
  123. data/test/dummy/public/500.html +25 -0
  124. data/test/dummy/public/favicon.ico +0 -0
  125. data/test/dummy/script/rails +6 -0
  126. data/test/fixtures/ifd_tools/emergency_messages.yml +11 -0
  127. data/test/fixtures/ifd_tools/notifier_updates.yml +17 -0
  128. data/test/fixtures/ifd_tools/software_updates.yml +17 -0
  129. data/test/fixtures/ifd_tools/tracking/events.yml +17 -0
  130. data/test/ifd_tools_test.rb +7 -0
  131. data/test/integration/navigation_test.rb +10 -0
  132. data/test/test_helper.rb +15 -0
  133. data/test/unit/ifd_tools/emergency_message_test.rb +9 -0
  134. data/test/unit/ifd_tools/notifier_update_test.rb +9 -0
  135. data/test/unit/ifd_tools/software_update_test.rb +9 -0
  136. data/test/unit/ifd_tools/tracking/event_test.rb +9 -0
  137. metadata +464 -0
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright 2012 YOURNAME
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.
data/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # IFD Tools
2
+
3
+ This gem provides common functionality for use with all IFD server applications, including:
4
+
5
+ * Base tweaks in styling and functionality for ActiveAdmin
6
+ * `User` management for access to the /admin area
7
+ * Management of `EmergencyMessage`, `NotifierUpdate` & `SoftwareUpdate` resources
8
+ * Management of `Customer`
9
+ * `IfdTools::Tracking::Event` & framework for tracking API and reporting (customer trends, etc)
10
+ * Automatic inclusion of modules for generating API XML responses for `/api/emergency_messages.xml`, `/api/notifier_updates.xml` & `/api/software_updates.xml`
11
+ * Protected API requests by Devise authentication (auth_token)
12
+
13
+ ## Usage
14
+
15
+ To install:
16
+
17
+ 1. Create a new Rails project
18
+ 2. Add `gem 'ifd_tools'` to your `Gemfile`
19
+ 3. Run `bundle`
20
+ 4. Run `rails g ifd_tools:install`
21
+ 5. Start your server, login credentials are "matt@dmgx.com" & "P@$$w0rd" for `http://localhost:5000/admin`
22
+
23
+ ## Tracking
24
+
25
+ 1. There are several configuration options for color choices in the `ifd_tools.rb` initializer.
26
+ 2. To track specific events, create subclasses of `IfdTools::Tracking::Event` in your application, in `app/models/ifd_tools/tracking` folder.
27
+ 3. Be sure to override the `assign_trackable_item_by_id` method per subclass (default implement is to raise an exception)
28
+ 4. Tracking requests can be initiated via the API at `/api/track.xml?type=product_event&id=14`. The `type` parameter is the class name without the module prefixes, underscored -> "IfdTools::Tracking::ProductEvent" should be sent as "product_event".
data/Rakefile ADDED
@@ -0,0 +1,40 @@
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
14
+
15
+ RDoc::Task.new(:rdoc) do |rdoc|
16
+ rdoc.rdoc_dir = 'rdoc'
17
+ rdoc.title = 'IfdTools'
18
+ rdoc.options << '--line-numbers'
19
+ rdoc.rdoc_files.include('README.rdoc')
20
+ rdoc.rdoc_files.include('lib/**/*.rb')
21
+ end
22
+
23
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
24
+ load 'rails/tasks/engine.rake'
25
+
26
+
27
+
28
+ Bundler::GemHelper.install_tasks
29
+
30
+ require 'rake/testtask'
31
+
32
+ Rake::TestTask.new(:test) do |t|
33
+ t.libs << 'lib'
34
+ t.libs << 'test'
35
+ t.pattern = 'test/**/*_test.rb'
36
+ t.verbose = false
37
+ end
38
+
39
+
40
+ task :default => :test
@@ -0,0 +1,33 @@
1
+ ActiveAdmin.register IfdTools::EmergencyMessage, as: "Emergency Message" do
2
+
3
+ menu parent: "Super Admin", if: proc { can? :manage, IfdTools::EmergencyMessage }
4
+
5
+ config.sort_order = "title_asc"
6
+ controller.authorize_resource class: "IfdTools::EmergencyMessage"
7
+
8
+ scope :all
9
+ scope :active, default: true
10
+ scope :inactive
11
+
12
+ index do
13
+ selectable_column
14
+ column :title
15
+ column(:created, sortbale: :created_at) { |s| s.created_at.humanize }
16
+ default_actions
17
+ end
18
+
19
+ form partial: "form"
20
+
21
+ show do
22
+ panel "Software Update" do
23
+ attributes_table_for resource do
24
+ row(:title)
25
+ row(:active) { status_tag resource.active? ? "active" : "old", resource.active? ? :green : :gray }
26
+ row(:created) { resource.created_at.humanize }
27
+ row(:description) { raw resource.body }
28
+ end
29
+ end
30
+ active_admin_comments
31
+ end
32
+
33
+ end
@@ -0,0 +1,42 @@
1
+ ActiveAdmin.register IfdTools::NotifierUpdate, as: "Notifier Update" do
2
+
3
+ menu parent: "Super Admin", if: proc { can? :manage, IfdTools::NotifierUpdate }
4
+
5
+ config.sort_order = "release_version_desc"
6
+ controller.authorize_resource class: "IfdTools::NotifierUpdate"
7
+
8
+ filter :release_date
9
+ filter :release_version
10
+ filter :release_notes
11
+
12
+ scope :all
13
+ scope :current, default: true
14
+ scope :previous
15
+
16
+ index do
17
+ selectable_column
18
+ column :release_version
19
+ column :release_date
20
+ column(:created, sortable: :created_at) { |s| s.created_at.humanize }
21
+ default_actions
22
+ end
23
+
24
+ form partial: "form"
25
+
26
+ show do
27
+ panel "Notifier Update Details" do
28
+ attributes_table_for resource do
29
+ row(:release_date)
30
+ row(:release_version)
31
+ row(:current_release) { status_tag resource.current_release? ? "YES" : "NO", resource.current_release? ? :green : :gray }
32
+ row(:created_at) { resource.created_at.humanize }
33
+ row(:updated_at) { resource.updated_at.humanize }
34
+ row(:mac) { link_to File.basename(resource.mac.current_path), resource.mac.url, target: "_blank" if resource.mac.present? }
35
+ row(:pc) { link_to File.basename(resource.pc.current_path), resource.pc.url, target: "_blank" if resource.pc.present? }
36
+ row(:release_notes) { raw resource.release_notes }
37
+ end
38
+ end
39
+ active_admin_comments
40
+ end
41
+
42
+ end
@@ -0,0 +1,42 @@
1
+ ActiveAdmin.register IfdTools::SoftwareUpdate, as: "Software Update" do
2
+
3
+ menu parent: "Super Admin", if: proc { can? :manage, IfdTools::SoftwareUpdate }
4
+
5
+ config.sort_order = "release_version_desc"
6
+ controller.authorize_resource class: "IfdTools::SoftwareUpdate"
7
+
8
+ filter :release_date
9
+ filter :release_version
10
+ filter :release_notes
11
+
12
+ scope :all
13
+ scope :current, default: true
14
+ scope :previous
15
+
16
+ index do
17
+ selectable_column
18
+ column :release_version
19
+ column :release_date
20
+ column(:created, sortable: :created_at) { |s| s.created_at.humanize }
21
+ default_actions
22
+ end
23
+
24
+ form partial: "form"
25
+
26
+ show do
27
+ panel "Software Update Details" do
28
+ attributes_table_for resource do
29
+ row(:release_date)
30
+ row(:release_version)
31
+ row(:current_release) { status_tag resource.current_release? ? "YES" : "NO", resource.current_release? ? :green : :gray }
32
+ row(:created_at) { resource.created_at.humanize }
33
+ row(:updated_at) { resource.updated_at.humanize }
34
+ row(:mac) { link_to File.basename(resource.mac.current_path), resource.mac.url, target: "_blank" if resource.mac.present? }
35
+ row(:pc) { link_to File.basename(resource.pc.current_path), resource.pc.url, target: "_blank" if resource.pc.present? }
36
+ row(:release_notes) { raw resource.release_notes }
37
+ end
38
+ end
39
+ active_admin_comments
40
+ end
41
+
42
+ end
@@ -0,0 +1,48 @@
1
+ ActiveAdmin.register User do
2
+
3
+ menu parent: "Administration", if: proc { can? :manage, User }
4
+
5
+ config.sort_order = "email_asc"
6
+ controller.authorize_resource
7
+
8
+ filter :email
9
+ filter :first_name
10
+ filter :last_name
11
+ filter :time_zone, as: :select, collection: ActiveSupport::TimeZone.all, member_label: :to_s, member_value: :name
12
+ filter :created_at
13
+ filter :reset_password_sent_at
14
+ filter :current_sign_in_at
15
+
16
+ scope :all
17
+ scope :admin, default: true
18
+ scope :super_admin
19
+
20
+ index do
21
+ selectable_column
22
+ column(:email, sortable: :email) { |user| mail_to user.email, user.email }
23
+ column(:first, sortable: :first_name) { |user| link_to user.first_name, [:admin, user] if user.first_name.present? }
24
+ column(:last, sortable: :last_name) { |user| link_to user.last_name, [:admin, user] if user.last_name.present? }
25
+ default_actions
26
+ end
27
+
28
+ form partial: "form"
29
+
30
+ show title: :full_name do
31
+ panel "Admin Details" do
32
+ attributes_table_for resource do
33
+ row(:email) { link_to resource.email, "mailto:%s" % resource.email }
34
+ row(:first_name)
35
+ row(:last_name)
36
+ row(:time_zone)
37
+ row(:role)
38
+ row(:sign_in_count)
39
+ row(:created) { resource.created_at.humanize }
40
+ end
41
+ end
42
+ end
43
+
44
+ collection_action :profile do
45
+ redirect_to edit_admin_user_path(current_user)
46
+ end
47
+
48
+ end
@@ -0,0 +1,4 @@
1
+ //= require swfobject
2
+ //= require ifd_tools/fusion_charts
3
+ //= require ckeditor-jquery
4
+ //= require cocoon
@@ -0,0 +1,361 @@
1
+ /**
2
+ * FusionCharts: Flash Player detection and Chart embedding.
3
+ * Version 1.2.3F ( 22 November 2008) - Specialized for FusionChartsFREE
4
+ * Checking Flash Version >=6 and added updateChartXML() for FREE Charts.
5
+ * Version: 1.2.3 (1st September, 2008) - Added Fix for % and & characters, scaled dimensions, fixes in to properly handling of double quotes and single quotes in setDataXML() function.
6
+ * Version: 1.2.2 (10th July, 2008) - Added Fix for % scaled dimensions, fixes in setDataXML() and setDataURL() functions
7
+ * Version: 1.2.1 (21st December, 2007) - Added setting up Transparent/opaque mode: setTransparent() function
8
+ * Version: 1.2 (1st November, 2007) - Added FORM fixes for IE
9
+ * Version: 1.1 (29th June, 2007) - Added Player detection, New conditional fixes for IE
10
+ *
11
+ * Morphed from SWFObject (http://blog.deconcept.com/swfobject/) under MIT License:
12
+ * http://www.opensource.org/licenses/mit-license.php
13
+ *
14
+ */
15
+ if(typeof infosoftglobal == "undefined") var infosoftglobal = new Object();
16
+ if(typeof infosoftglobal.FusionChartsUtil == "undefined") infosoftglobal.FusionChartsUtil = new Object();
17
+ infosoftglobal.FusionCharts = function(swf, id, w, h, debugMode, registerWithJS, c, scaleMode, lang, detectFlashVersion, autoInstallRedirect){
18
+ if (!document.getElementById) { return; }
19
+
20
+ //Flag to see whether data has been set initially
21
+ this.initialDataSet = false;
22
+
23
+ //Create container objects
24
+ this.params = new Object();
25
+ this.variables = new Object();
26
+ this.attributes = new Array();
27
+
28
+ //Set attributes for the SWF
29
+ if(swf) { this.setAttribute('swf', swf); }
30
+ if(id) { this.setAttribute('id', id); }
31
+
32
+ w=w.toString().replace(/\%$/,"%25");
33
+ if(w) { this.setAttribute('width', w); }
34
+ h=h.toString().replace(/\%$/,"%25");
35
+ if(h) { this.setAttribute('height', h); }
36
+
37
+
38
+ //Set background color
39
+ if(c) { this.addParam('bgcolor', c); }
40
+
41
+ //Set Quality
42
+ this.addParam('quality', 'high');
43
+
44
+ //Add scripting access parameter
45
+ this.addParam('allowScriptAccess', 'always');
46
+
47
+ //Pass width and height to be appended as chartWidth and chartHeight
48
+ this.addVariable('chartWidth', w);
49
+ this.addVariable('chartHeight', h);
50
+
51
+ //Whether in debug mode
52
+ debugMode = debugMode ? debugMode : 0;
53
+ this.addVariable('debugMode', debugMode);
54
+ //Pass DOM ID to Chart
55
+ this.addVariable('DOMId', id);
56
+ //Whether to registed with JavaScript
57
+ registerWithJS = registerWithJS ? registerWithJS : 0;
58
+ this.addVariable('registerWithJS', registerWithJS);
59
+
60
+ //Scale Mode of chart
61
+ scaleMode = scaleMode ? scaleMode : 'noScale';
62
+ this.addVariable('scaleMode', scaleMode);
63
+
64
+ //Application Message Language
65
+ lang = lang ? lang : 'EN';
66
+ this.addVariable('lang', lang);
67
+
68
+ //Whether to auto detect and re-direct to Flash Player installation
69
+ this.detectFlashVersion = detectFlashVersion?detectFlashVersion:1;
70
+ this.autoInstallRedirect = autoInstallRedirect?autoInstallRedirect:1;
71
+
72
+ //Ger Flash Player version
73
+ this.installedVer = infosoftglobal.FusionChartsUtil.getPlayerVersion();
74
+
75
+ if (!window.opera && document.all && this.installedVer.major > 7) {
76
+ // Only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
77
+ infosoftglobal.FusionCharts.doPrepUnload = true;
78
+ }
79
+ }
80
+
81
+ infosoftglobal.FusionCharts.prototype = {
82
+ setAttribute: function(name, value){
83
+ this.attributes[name] = value;
84
+ },
85
+ getAttribute: function(name){
86
+ return this.attributes[name];
87
+ },
88
+ addParam: function(name, value){
89
+ this.params[name] = value;
90
+ },
91
+ getParams: function(){
92
+ return this.params;
93
+ },
94
+ addVariable: function(name, value){
95
+ this.variables[name] = value;
96
+ },
97
+ getVariable: function(name){
98
+ return this.variables[name];
99
+ },
100
+ getVariables: function(){
101
+ return this.variables;
102
+ },
103
+ getVariablePairs: function(){
104
+ var variablePairs = new Array();
105
+ var key;
106
+ var variables = this.getVariables();
107
+ for(key in variables){
108
+ variablePairs.push(key +"="+ variables[key]);
109
+ }
110
+ return variablePairs;
111
+ },
112
+ getSWFHTML: function() {
113
+ var swfNode = "";
114
+ if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) {
115
+ // netscape plugin architecture
116
+ swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" ';
117
+ swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
118
+ var params = this.getParams();
119
+ for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
120
+ var pairs = this.getVariablePairs().join("&");
121
+ if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
122
+ swfNode += '/>';
123
+ } else { // PC IE
124
+ swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'">';
125
+ swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
126
+ var params = this.getParams();
127
+ for(var key in params) {
128
+ swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
129
+ }
130
+ var pairs = this.getVariablePairs().join("&");
131
+ if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
132
+ swfNode += "</object>";
133
+ }
134
+ return swfNode;
135
+ },
136
+ setDataURL: function(strDataURL){
137
+ //This method sets the data URL for the chart.
138
+ //If being set initially
139
+ if (this.initialDataSet==false){
140
+ this.addVariable('dataURL',strDataURL);
141
+ //Update flag
142
+ this.initialDataSet = true;
143
+ }else{
144
+ //Else, we update the chart data using External Interface
145
+ //Get reference to chart object
146
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
147
+
148
+ if (!chartObj.setDataURL)
149
+ {
150
+ __flash__addCallback(chartObj, "setDataURL");
151
+ }
152
+
153
+ chartObj.setDataURL(strDataURL);
154
+ }
155
+ },
156
+ //This function :
157
+ //fixes the double quoted attributes to single quotes
158
+ //Encodes all quotes inside attribute values
159
+ //Encodes % to %25 and & to %26;
160
+ encodeDataXML: function(strDataXML){
161
+
162
+ var regExpReservedCharacters=["\\$","\\+"];
163
+ var arrDQAtt=strDataXML.match(/=\s*\".*?\"/g);
164
+ if (arrDQAtt){
165
+ for(var i=0;i<arrDQAtt.length;i++){
166
+ var repStr=arrDQAtt[i].replace(/^=\s*\"|\"$/g,"");
167
+ repStr=repStr.replace(/\'/g,"%26apos;");
168
+ var strTo=strDataXML.indexOf(arrDQAtt[i]);
169
+ var repStrr="='"+repStr+"'";
170
+ var strStart=strDataXML.substring(0,strTo);
171
+ var strEnd=strDataXML.substring(strTo+arrDQAtt[i].length);
172
+ var strDataXML=strStart+repStrr+strEnd;
173
+ }
174
+ }
175
+
176
+ strDataXML=strDataXML.replace(/\"/g,"%26quot;");
177
+ strDataXML=strDataXML.replace(/%(?![\da-f]{2}|[\da-f]{4})/ig,"%25");
178
+ strDataXML=strDataXML.replace(/\&/g,"%26");
179
+
180
+ return strDataXML;
181
+
182
+ },
183
+ setDataXML: function(strDataXML){
184
+ //If being set initially
185
+ if (this.initialDataSet==false){
186
+ //This method sets the data XML for the chart INITIALLY.
187
+ this.addVariable('dataXML',this.encodeDataXML(strDataXML));
188
+ //Update flag
189
+ this.initialDataSet = true;
190
+ }else{
191
+ //Else, we update the chart data using External Interface
192
+ //Get reference to chart object
193
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(this.getAttribute('id'));
194
+ chartObj.setDataXML(strDataXML);
195
+ }
196
+ },
197
+ setTransparent: function(isTransparent){
198
+ //Sets chart to transparent mode when isTransparent is true (default)
199
+ //When no parameter is passed, we assume transparent to be true.
200
+ if(typeof isTransparent=="undefined") {
201
+ isTransparent=true;
202
+ }
203
+ //Set the property
204
+ if(isTransparent)
205
+ this.addParam('WMode', 'transparent');
206
+ else
207
+ this.addParam('WMode', 'Opaque');
208
+ },
209
+
210
+ render: function(elementId){
211
+ //First check for installed version of Flash Player - we need a minimum of 6
212
+ if((this.detectFlashVersion==1) && (this.installedVer.major < 6)){
213
+ if (this.autoInstallRedirect==1){
214
+ //If we can auto redirect to install the player?
215
+ var installationConfirm = window.confirm("You need Adobe Flash Player 6 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. Please click on Ok to install the same.");
216
+ if (installationConfirm){
217
+ window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
218
+ }else{
219
+ return false;
220
+ }
221
+ }else{
222
+ //Else, do not take an action. It means the developer has specified a message in the DIV (and probably a link).
223
+ //So, expect the developers to provide a course of way to their end users.
224
+ //window.alert("You need Adobe Flash Player 8 (or above) to view the charts. It is a free and lightweight installation from Adobe.com. ");
225
+ return false;
226
+ }
227
+ }else{
228
+ //Render the chart
229
+ var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
230
+ n.innerHTML = this.getSWFHTML();
231
+
232
+ //Added <FORM> compatibility
233
+ //Check if it's added in Mozilla embed array or if already exits
234
+ if(!document.embeds[this.getAttribute('id')] && !window[this.getAttribute('id')])
235
+ window[this.getAttribute('id')]=document.getElementById(this.getAttribute('id'));
236
+ //or else document.forms[formName/formIndex][chartId]
237
+ return true;
238
+ }
239
+ }
240
+ }
241
+
242
+ /* ---- detection functions ---- */
243
+ infosoftglobal.FusionChartsUtil.getPlayerVersion = function(){
244
+ var PlayerVersion = new infosoftglobal.PlayerVersion([0,0,0]);
245
+ if(navigator.plugins && navigator.mimeTypes.length){
246
+ var x = navigator.plugins["Shockwave Flash"];
247
+ if(x && x.description) {
248
+ PlayerVersion = new infosoftglobal.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/, "").replace(/(\s+r|\s+b[0-9]+)/, ".").split("."));
249
+ }
250
+ }else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){
251
+ //If Windows CE
252
+ var axo = 1;
253
+ var counter = 3;
254
+ while(axo) {
255
+ try {
256
+ counter++;
257
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
258
+ PlayerVersion = new infosoftglobal.PlayerVersion([counter,0,0]);
259
+ } catch (e) {
260
+ axo = null;
261
+ }
262
+ }
263
+ } else {
264
+ // Win IE (non mobile)
265
+ // Do minor version lookup in IE, but avoid Flash Player 6 crashing issues
266
+ try{
267
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
268
+ }catch(e){
269
+ try {
270
+ var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
271
+ PlayerVersion = new infosoftglobal.PlayerVersion([6,0,21]);
272
+ axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
273
+ } catch(e) {
274
+ if (PlayerVersion.major == 6) {
275
+ return PlayerVersion;
276
+ }
277
+ }
278
+ try {
279
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
280
+ } catch(e) {}
281
+ }
282
+ if (axo != null) {
283
+ PlayerVersion = new infosoftglobal.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
284
+ }
285
+ }
286
+ return PlayerVersion;
287
+ }
288
+ infosoftglobal.PlayerVersion = function(arrVersion){
289
+ this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
290
+ this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
291
+ this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
292
+ }
293
+ // ------------ Fix for Out of Memory Bug in IE in FP9 ---------------//
294
+ /* Fix for video streaming bug */
295
+ infosoftglobal.FusionChartsUtil.cleanupSWFs = function() {
296
+ var objects = document.getElementsByTagName("OBJECT");
297
+ for (var i = objects.length - 1; i >= 0; i--) {
298
+ objects[i].style.display = 'none';
299
+ for (var x in objects[i]) {
300
+ if (typeof objects[i][x] == 'function') {
301
+ objects[i][x] = function(){};
302
+ }
303
+ }
304
+ }
305
+ }
306
+ // Fixes bug in fp9
307
+ if (infosoftglobal.FusionCharts.doPrepUnload) {
308
+ if (!infosoftglobal.unloadSet) {
309
+ infosoftglobal.FusionChartsUtil.prepUnload = function() {
310
+ __flash_unloadHandler = function(){};
311
+ __flash_savedUnloadHandler = function(){};
312
+ window.attachEvent("onunload", infosoftglobal.FusionChartsUtil.cleanupSWFs);
313
+ }
314
+ window.attachEvent("onbeforeunload", infosoftglobal.FusionChartsUtil.prepUnload);
315
+ infosoftglobal.unloadSet = true;
316
+ }
317
+ }
318
+ /* Add document.getElementById if needed (mobile IE < 5) */
319
+ if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}
320
+ /* Add Array.push if needed (ie5) */
321
+ if (Array.prototype.push == null) { Array.prototype.push = function(item) { this[this.length] = item; return this.length; }}
322
+
323
+ /* Function to return Flash Object from ID */
324
+ infosoftglobal.FusionChartsUtil.getChartObject = function(id)
325
+ {
326
+ var chartRef=null;
327
+ if (navigator.appName.indexOf("Microsoft Internet")==-1) {
328
+ if (document.embeds && document.embeds[id])
329
+ chartRef = document.embeds[id];
330
+ else
331
+ chartRef = window.document[id];
332
+ }
333
+ else {
334
+ chartRef = window[id];
335
+ }
336
+ if (!chartRef)
337
+ chartRef = document.getElementById(id);
338
+
339
+ return chartRef;
340
+ }
341
+ /*
342
+ Function to update chart's data at client side (FOR FusionCharts vFREE and 2.x
343
+ */
344
+ infosoftglobal.FusionChartsUtil.updateChartXML = function(chartId, strXML){
345
+ //Get reference to chart object
346
+ var chartObj = infosoftglobal.FusionChartsUtil.getChartObject(chartId);
347
+ //Set dataURL to null
348
+ chartObj.SetVariable("_root.dataURL","");
349
+ //Set the flag
350
+ chartObj.SetVariable("_root.isNewData","1");
351
+ //Set the actual data
352
+ chartObj.SetVariable("_root.newData",strXML);
353
+ //Go to the required frame
354
+ chartObj.TGotoLabel("/", "JavaScriptHandler");
355
+ }
356
+
357
+
358
+ /* Aliases for easy usage */
359
+ var getChartFromId = infosoftglobal.FusionChartsUtil.getChartObject;
360
+ var updateChartXML = infosoftglobal.FusionChartsUtil.updateChartXML;
361
+ var FusionCharts = infosoftglobal.FusionCharts;
@@ -0,0 +1,32 @@
1
+ #usa_map {
2
+ width:550px;
3
+ margin:0px auto;
4
+ display:block;
5
+ }
6
+
7
+ #line_graph {
8
+ width: 600px;
9
+ margin:10px auto;
10
+ }
11
+
12
+ #line_graph_controls.sidebar_section {
13
+ box-shadow:none;
14
+ margin-left:45px;
15
+
16
+ form.filter_form .filter_form_field {
17
+ clear:none;
18
+ float:left;
19
+ margin-right:15px;
20
+ &#filter_platform_eq {
21
+ clear:both !important;
22
+ }
23
+ }
24
+ .buttons {
25
+ clear:both;
26
+ }
27
+ }
28
+
29
+ #top_users_panel {
30
+ margin-bottom:60px;
31
+ padding-top:56px;
32
+ }
@@ -0,0 +1,15 @@
1
+ /* Fix for IE8 */
2
+ #header {
3
+ position:inherit;
4
+ }
5
+
6
+ body.active_admin span.cke_skin_kama {
7
+ margin-top:20px;
8
+ border:1px solid #D3D3D3;
9
+ }
10
+
11
+ .nested-fields a.remove_fields {
12
+ float:right;
13
+ margin-right:15px;
14
+ @include clearfix;
15
+ }