Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add models (Graph, etc.), add open_flash_chart plugin

  • Loading branch information...
commit d1a522facdba8de50ddbf6a3bc4dd59014761545 1 parent 42574e8
Mikhail Mikhaliov authored

Showing 86 changed files with 1,523 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  Gemfile
  2. 7  Gemfile.lock
  3. 2  app/controllers/application_controller.rb
  4. 4  app/models/action.rb
  5. 4  app/models/condition.rb
  6. 4  app/models/graph.rb
  7. 8  app/models/graph_item.rb
  8. 6  app/models/history.rb
  9. 4  app/models/history_log.rb
  10. 5  app/models/item.rb
  11. 4  app/models/screen.rb
  12. 5  app/models/screen_item.rb
  13. 5  app/models/trend.rb
  14. 5  app/models/trend_uint.rb
  15. 2  app/views/layouts/application.html.erb
  16. 7  config/routes.rb
  17. 5  public/javascripts/swfobject.js
  18. BIN  public/open-flash-chart-bar-clicking.swf
  19. BIN  public/open-flash-chart.swf
  20. 25  test/fixtures/actions.yml
  21. 13  test/fixtures/conditions.yml
  22. 11  test/fixtures/history_logs.yml
  23. 8  test/unit/action_test.rb
  24. 8  test/unit/condition_test.rb
  25. 8  test/unit/history_log_test.rb
  26. 20  vendor/plugins/open_flash_chart/MIT-LICENSE
  27. 54  vendor/plugins/open_flash_chart/README
  28. 22  vendor/plugins/open_flash_chart/Rakefile
  29. 5  vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js
  30. BIN  vendor/plugins/open_flash_chart/assets/open-flash-chart-bar-clicking.swf
  31. BIN  vendor/plugins/open_flash_chart/assets/open-flash-chart.swf
  32. 9  vendor/plugins/open_flash_chart/init.rb
  33. 17  vendor/plugins/open_flash_chart/install.rb
  34. 53  vendor/plugins/open_flash_chart/lib/open_flash_chart.rb
  35. 18  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb
  36. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb
  37. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb
  38. 13  vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb
  39. 18  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb
  40. 17  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb
  41. 7  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb
  42. 18  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb
  43. 67  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb
  44. 13  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb
  45. 29  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb
  46. 123  vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb
  47. 22  vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb
  48. 13  vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb
  49. 55  vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb
  50. 26  vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb
  51. 7  vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb
  52. 23  vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb
  53. 17  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb
  54. 17  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb
  55. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb
  56. 12  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb
  57. 39  vendor/plugins/open_flash_chart/lib/open_flash_chart/linear_regression.rb
  58. 26  vendor/plugins/open_flash_chart/lib/open_flash_chart/menu.rb
  59. 116  vendor/plugins/open_flash_chart/lib/open_flash_chart/ofc_ajax.rb
  60. 53  vendor/plugins/open_flash_chart/lib/open_flash_chart/open_flash_chart_object.rb
  61. 75  vendor/plugins/open_flash_chart/lib/open_flash_chart/pie.rb
  62. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis.rb
  63. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_axis_labels.rb
  64. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/radar_spoke_labels.rb
  65. 22  vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter.rb
  66. 20  vendor/plugins/open_flash_chart/lib/open_flash_chart/scatter_line.rb
  67. 20  vendor/plugins/open_flash_chart/lib/open_flash_chart/shape.rb
  68. 27  vendor/plugins/open_flash_chart/lib/open_flash_chart/sugar.rb
  69. 62  vendor/plugins/open_flash_chart/lib/open_flash_chart/tags.rb
  70. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/title.rb
  71. 25  vendor/plugins/open_flash_chart/lib/open_flash_chart/tooltip.rb
  72. 1  vendor/plugins/open_flash_chart/lib/open_flash_chart/upload_image.rb
  73. 18  vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis.rb
  74. 21  vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_label.rb
  75. 9  vendor/plugins/open_flash_chart/lib/open_flash_chart/x_axis_labels.rb
  76. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/x_legend.rb
  77. 3  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis.rb
  78. 7  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_base.rb
  79. 12  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_label.rb
  80. 7  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_labels.rb
  81. 4  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_axis_right.rb
  82. 10  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend.rb
  83. 6  vendor/plugins/open_flash_chart/lib/open_flash_chart/y_legend_right.rb
  84. 4  vendor/plugins/open_flash_chart/tasks/open_flash_chart_tasks.rake
  85. 8  vendor/plugins/open_flash_chart/test/open_flash_chart_test.rb
  86. 1  vendor/plugins/open_flash_chart/uninstall.rb
4  Gemfile
@@ -4,6 +4,10 @@ gem 'rails', '3.0.7'
4 4
 gem 'mysql2', '= 0.2.6'
5 5
 gem 'devise'
6 6
 gem 'haml'
  7
+#gem 'rchart', '= 2.0.2'
  8
+gem 'gd2-ffij'
  9
+gem 'ffi'
  10
+gem 'gruff'
7 11
 
8 12
 # Use unicorn as the web server
9 13
 # gem 'unicorn'
7  Gemfile.lock
@@ -37,6 +37,10 @@ GEM
37 37
       warden (~> 1.0.3)
38 38
     erubis (2.6.6)
39 39
       abstract (>= 1.0.0)
  40
+    ffi (1.0.7)
  41
+      rake (>= 0.8.7)
  42
+    gd2-ffij (0.0.3)
  43
+    gruff (0.3.6)
40 44
     haml (3.1.1)
41 45
     i18n (0.5.0)
42 46
     mail (2.2.19)
@@ -79,6 +83,9 @@ PLATFORMS
79 83
 
80 84
 DEPENDENCIES
81 85
   devise
  86
+  ffi
  87
+  gd2-ffij
  88
+  gruff
82 89
   haml
83 90
   mysql2 (= 0.2.6)
84 91
   rails (= 3.0.7)
2  app/controllers/application_controller.rb
... ...
@@ -1,6 +1,6 @@
1 1
 class ApplicationController < ActionController::Base
2 2
   protect_from_forgery
3 3
 
4  
-  before_filter :authenticate_user!
  4
+  #before_filter :authenticate_user!
5 5
  
6 6
 end
4  app/models/action.rb
... ...
@@ -0,0 +1,4 @@
  1
+class Action < ActiveRecord::Base
  2
+  set_primary_key "actionid"
  3
+  has_many :conditions, :foreign_key => "actionid"
  4
+end
4  app/models/condition.rb
... ...
@@ -0,0 +1,4 @@
  1
+class Condition < ActiveRecord::Base
  2
+  set_primary_key "conditionid"
  3
+  belongs_to :action, :foreign_key => "actionid"
  4
+end
4  app/models/graph.rb
... ...
@@ -0,0 +1,4 @@
  1
+class Graph < ActiveRecord::Base
  2
+  set_primary_key "graphid"
  3
+  has_many :items, :class_name => "GraphItem", :foreign_key => "graphid"
  4
+end
8  app/models/graph_item.rb
... ...
@@ -0,0 +1,8 @@
  1
+class GraphItem < ActiveRecord::Base
  2
+  set_table_name "graphs_items"
  3
+  set_primary_key "gitemid"
  4
+  set_inheritance_column :ruby_type
  5
+
  6
+  belongs_to :graph, :foreign_key => "graphid"
  7
+  belongs_to :item, :foreign_key => "itemid"
  8
+end
6  app/models/history.rb
... ...
@@ -0,0 +1,6 @@
  1
+class History < ActiveRecord::Base
  2
+  set_table_name "history"
  3
+  set_primary_key "itemid"
  4
+  belongs_to :item, :foreign_key => "itemid"
  5
+
  6
+end
4  app/models/history_log.rb
... ...
@@ -0,0 +1,4 @@
  1
+class HistoryLog < ActiveRecord::Base
  2
+  set_table_name "history_log"
  3
+  belongs_to :item, :foreign_key => "itemid"
  4
+end
5  app/models/item.rb
@@ -5,4 +5,9 @@ class Item < ActiveRecord::Base
5 5
   belongs_to :host, :foreign_key => "hostid"
6 6
   has_many :items_applications, :foreign_key => "itemid"
7 7
   has_many :applications, :through => :items_applications
  8
+
  9
+  has_many :history, :class_name => "History", :foreign_key => "itemid"
  10
+  has_many :trends, :class_name => "Trend", :foreign_key => "itemid"
  11
+  has_many :trends_uint, :class_name => "TrendUint", :foreign_key => "itemid"
  12
+  has_many :history_logs, :foreign_key => "itemid"
8 13
 end
4  app/models/screen.rb
... ...
@@ -0,0 +1,4 @@
  1
+class Screen < ActiveRecord::Base
  2
+  set_primary_key "screenid"
  3
+  has_many :items, :class_name => "ScreenItem", :foreign_key => "screenid"
  4
+end
5  app/models/screen_item.rb
... ...
@@ -0,0 +1,5 @@
  1
+class ScreenItem < ActiveRecord::Base
  2
+  set_table_name "screens_items"
  3
+  set_primary_key "screenitemid"
  4
+  belongs_to :screen, :foreign_key => "screenid"
  5
+end
5  app/models/trend.rb
... ...
@@ -0,0 +1,5 @@
  1
+class Trend < ActiveRecord::Base
  2
+  set_table_name "trends"
  3
+  set_primary_key "itemid"
  4
+  belongs_to :item, :foreign_key => "itemid"
  5
+end
5  app/models/trend_uint.rb
... ...
@@ -0,0 +1,5 @@
  1
+class TrendUint < ActiveRecord::Base
  2
+  set_table_name "trends_uint"
  3
+  set_primary_key "itemid"
  4
+  belongs_to :item, :foreign_key => "itemid"
  5
+end
2  app/views/layouts/application.html.erb
@@ -3,7 +3,7 @@
3 3
 <head>
4 4
   <title>Zabbix</title>
5 5
   <%= stylesheet_link_tag :all %>
6  
-  <%= javascript_include_tag :defaults %>
  6
+  <%= javascript_include_tag :defaults, "swfobject" %>
7 7
   <%= csrf_meta_tag %>
8 8
 </head>
9 9
 <body>
7  config/routes.rb
@@ -4,6 +4,13 @@
4 4
   resources :applications
5 5
   resources :hosts
6 6
 
  7
+  resources :screens
  8
+  resources :graphs do 
  9
+    member do
  10
+      get "data"
  11
+    end
  12
+  end
  13
+
7 14
   devise_for :users
8 15
 
9 16
   # The priority is based upon order of creation:
5  public/javascripts/swfobject.js
... ...
@@ -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}}}}}();
BIN  public/open-flash-chart-bar-clicking.swf
Binary file not shown
BIN  public/open-flash-chart.swf
Binary file not shown
25  test/fixtures/actions.yml
... ...
@@ -0,0 +1,25 @@
  1
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
  2
+
  3
+one:
  4
+  name: MyString
  5
+  eventsource: 1
  6
+  evaltype: 1
  7
+  status: 1
  8
+  esc_period: 1
  9
+  def_shortdata: MyString
  10
+  def_longdata: MyText
  11
+  recovery_msg: 1
  12
+  r_shortdata: MyString
  13
+  r_logndata: MyText
  14
+
  15
+two:
  16
+  name: MyString
  17
+  eventsource: 1
  18
+  evaltype: 1
  19
+  status: 1
  20
+  esc_period: 1
  21
+  def_shortdata: MyString
  22
+  def_longdata: MyText
  23
+  recovery_msg: 1
  24
+  r_shortdata: MyString
  25
+  r_logndata: MyText
13  test/fixtures/conditions.yml
... ...
@@ -0,0 +1,13 @@
  1
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
  2
+
  3
+one:
  4
+  action_id: 1
  5
+  conditiontype: 1
  6
+  operator: 1
  7
+  value: MyString
  8
+
  9
+two:
  10
+  action_id: 1
  11
+  conditiontype: 1
  12
+  operator: 1
  13
+  value: MyString
11  test/fixtures/history_logs.yml
... ...
@@ -0,0 +1,11 @@
  1
+# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
  2
+
  3
+# This model initially had no columns defined.  If you add columns to the
  4
+# model remove the '{}' from the fixture names and add the columns immediately
  5
+# below each fixture, per the syntax in the comments below
  6
+#
  7
+one: {}
  8
+# column: value
  9
+#
  10
+two: {}
  11
+#  column: value
8  test/unit/action_test.rb
... ...
@@ -0,0 +1,8 @@
  1
+require 'test_helper'
  2
+
  3
+class ActionTest < ActiveSupport::TestCase
  4
+  # Replace this with your real tests.
  5
+  test "the truth" do
  6
+    assert true
  7
+  end
  8
+end
8  test/unit/condition_test.rb
... ...
@@ -0,0 +1,8 @@
  1
+require 'test_helper'
  2
+
  3
+class ConditionTest < ActiveSupport::TestCase
  4
+  # Replace this with your real tests.
  5
+  test "the truth" do
  6
+    assert true
  7
+  end
  8
+end
8  test/unit/history_log_test.rb
... ...
@@ -0,0 +1,8 @@
  1
+require 'test_helper'
  2
+
  3
+class HistoryLogTest < ActiveSupport::TestCase
  4
+  # Replace this with your real tests.
  5
+  test "the truth" do
  6
+    assert true
  7
+  end
  8
+end
20  vendor/plugins/open_flash_chart/MIT-LICENSE
... ...
@@ -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.
54  vendor/plugins/open_flash_chart/README
... ...
@@ -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
22  vendor/plugins/open_flash_chart/Rakefile
... ...
@@ -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
5  vendor/plugins/open_flash_chart/assets/javascripts/swfobject.js
... ...
@@ -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}}}}}();
BIN  vendor/plugins/open_flash_chart/assets/open-flash-chart-bar-clicking.swf
Binary file not shown
BIN  vendor/plugins/open_flash_chart/assets/open-flash-chart.swf
Binary file not shown
9  vendor/plugins/open_flash_chart/init.rb
... ...
@@ -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
17  vendor/plugins/open_flash_chart/install.rb
... ...
@@ -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
53  vendor/plugins/open_flash_chart/lib/open_flash_chart.rb
... ...
@@ -0,0 +1,53 @@
  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
+
  52
+require 'open_flash_chart/ofc_ajax'
  53
+require 'open_flash_chart/open_flash_chart_object'
18  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_base.rb
... ...
@@ -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
10  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_hollow.rb
... ...
@@ -0,0 +1,10 @@
  1
+module OpenFlashChart
  2
+
  3
+  class AreaHollow < AreaBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "area_hollow"      
  7
+    end
  8
+  end
  9
+
  10
+end
10  vendor/plugins/open_flash_chart/lib/open_flash_chart/area_line.rb
... ...
@@ -0,0 +1,10 @@
  1
+module OpenFlashChart
  2
+
  3
+  class AreaLine < AreaBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "area_line"      
  7
+    end
  8
+  end
  9
+
  10
+end
13  vendor/plugins/open_flash_chart/lib/open_flash_chart/arrow.rb
... ...
@@ -0,0 +1,13 @@
  1
+module OpenFlashChart
  2
+
  3
+  class AreaLine
  4
+    def initialize(x, y, a, b, colour, barb_length=10)
  5
+      @type   = "arrow"
  6
+      @start  = {:x => x, :y => y}
  7
+      @end    = {:x => a, :y => b}
  8
+      @colour = colour
  9
+      @barb_length = barb_length
  10
+    end
  11
+  end
  12
+
  13
+end
18  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar.rb
... ...
@@ -0,0 +1,18 @@
  1
+module OpenFlashChart
  2
+
  3
+  class Bar < BarBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "bar"      
  7
+    end
  8
+  end
  9
+
  10
+  class BarValue < Base
  11
+    def initialize( top, bottom=nil, args={} )
  12
+      @top = top
  13
+      @bottom = bottom
  14
+      super args
  15
+    end
  16
+  end
  17
+
  18
+end
17  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_3d.rb
... ...
@@ -0,0 +1,17 @@
  1
+module OpenFlashChart
  2
+
  3
+  class Bar3d < BarBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "bar_3d"      
  7
+    end
  8
+  end
  9
+
  10
+  class Bar3dValue < Base
  11
+    def initialize(top, args={})
  12
+      @top = top
  13
+      super args
  14
+    end
  15
+  end 
  16
+
  17
+end
7  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_base.rb
... ...
@@ -0,0 +1,7 @@
  1
+module OpenFlashChart
  2
+  class BarBase < Base
  3
+    def attach_to_right_y_axis
  4
+      @axis = 'right'
  5
+    end    
  6
+  end
  7
+end
18  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_filled.rb
... ...
@@ -0,0 +1,18 @@
  1
+module OpenFlashChart
  2
+
  3
+  class BarFilled < BarBase
  4
+    def initialize(colour=nil, outline_colour=nil, args={})
  5
+      super args
  6
+      @type           = "bar_filled"
  7
+      @colour         = colour
  8
+      @outline_colour = outline_colour      
  9
+    end
  10
+  end
  11
+
  12
+  class BarFilledValue < BarValue
  13
+    def initialize(top, bottom=nil, args={})
  14
+      super
  15
+    end
  16
+  end
  17
+
  18
+end
67  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_glass.rb
... ...
@@ -0,0 +1,67 @@
  1
+module OpenFlashChart
  2
+
  3
+  class BarOnShow < Base
  4
+    def initialize(type, cascade, delay)
  5
+      @type    = type
  6
+      @cascade = cascade.to_f
  7
+      @delay   = delay.to_f
  8
+    end
  9
+  end
  10
+
  11
+  class BarGlass < BarBase
  12
+    def initialize args={}
  13
+      super
  14
+      @type = "bar_glass"      
  15
+    end
  16
+  end
  17
+
  18
+  class BarCylinder < BarBase
  19
+    def initialize args={}
  20
+      super
  21
+      @type = "bar_cylinder"      
  22
+    end
  23
+  end
  24
+
  25
+  class BarCylinderOutline < BarBase
  26
+    def initialize args={}
  27
+      super
  28
+      @type = "bar_cylinder_outline"      
  29
+    end
  30
+  end
  31
+
  32
+  class BarRoundedGlass < BarBase
  33
+    def initialize args={}
  34
+      super
  35
+      @type = "bar_rounded_glass"      
  36
+    end
  37
+  end
  38
+
  39
+  class BarRound < BarBase
  40
+    def initialize args={}
  41
+      super
  42
+      @type = "bar_round"      
  43
+    end
  44
+  end
  45
+
  46
+  class BarDome < BarBase
  47
+    def initialize args={}
  48
+      super
  49
+      @type = "bar_dome"      
  50
+    end
  51
+  end
  52
+
  53
+  class BarRound3d < BarBase
  54
+    def initialize args={}
  55
+      super
  56
+      @type = "bar_round3d"      
  57
+    end
  58
+  end
  59
+
  60
+  class BarGlassValue < Base
  61
+    def initialize(top, args={})
  62
+      @top = top
  63
+      super args
  64
+    end
  65
+  end
  66
+
  67
+end
13  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_sketch.rb
... ...
@@ -0,0 +1,13 @@
  1
+module OpenFlashChart
  2
+
  3
+  class BarSketch < BarBase
  4
+    def initialize(colour, outline_colour, fun_factor, args = {} )
  5
+      super args
  6
+      @type           = "bar_sketch"
  7
+      @colour         = colour
  8
+      @outline_colour = outline_colour
  9
+      @offset         = fun_factor      
  10
+    end
  11
+  end
  12
+
  13
+end
29  vendor/plugins/open_flash_chart/lib/open_flash_chart/bar_stack.rb
... ...
@@ -0,0 +1,29 @@
  1
+module OpenFlashChart
  2
+
  3
+  class BarStack < BarBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "bar_stack"      
  7
+    end
  8
+
  9
+    alias_method :append_stack, :append_value
  10
+  end
  11
+
  12
+  class BarStackValue < Base
  13
+    def initialize(val,colour, args={})
  14
+      @val    = val
  15
+      @colour = colour
  16
+      super(args)
  17
+    end
  18
+  end
  19
+
  20
+  class BarStackKey < Base
  21
+    def initialize(colour, text, font_size, args={})
  22
+      @colour    = colour
  23
+      @text      = text
  24
+      @font_size = font_size
  25
+      super(args)
  26
+    end
  27
+  end
  28
+
  29
+end
123  vendor/plugins/open_flash_chart/lib/open_flash_chart/base.rb
... ...
@@ -0,0 +1,123 @@
  1
+module OpenFlashChart
  2
+  class Base
  3
+
  4
+    def initialize(args={})
  5
+      # set all the instance variables we want
  6
+      # assuming something like this OpenFlashChart.new(:x_axis => 5, :y_axis => 10, :elements => ["one", "two"], ...)
  7
+      args.each do |k,v|
  8
+        self.instance_variable_set("@#{k}", v)
  9
+      end
  10
+      yield self if block_given?  # magic pen pattern
  11
+    end
  12
+
  13
+    # same as to_s but won't stack overflow ... use this instead of to_s
  14
+    def render
  15
+      # need to return the following like this
  16
+      # 1) font_size as font-size 
  17
+      # 2) dot_size as dot-size
  18
+      # 3) outline_colour as outline-colour
  19
+      # 4) halo_size as halo-size
  20
+      # 5) start_angle as start-angle
  21
+      # 6) tick_height as tick-height
  22
+      # 7) grid_colour as grid-colour
  23
+      # 8) threed as 3d
  24
+      # 9) tick_length as tick-length
  25
+      # 10) visible_steps as visible-steps
  26
+      # 11) key_on_click as key-on-click
  27
+      # 12) barb_length as barb-length
  28
+      # 13) on_show as on-show
  29
+      # 14) negative_colour as negative-colour
  30
+      # 15) line_style as line-style
  31
+      # 16) on_click as on-click
  32
+      # 17) javascript_function_name as javascript-function-name
  33
+      # 18) pad_x to pad-x
  34
+      # 19) pad_y to pad-y
  35
+      # 20) align_x to align-x
  36
+      # 21) align_y to align-y
  37
+      # 22) dot_style to dot-style
  38
+      # 23) hollow_dot to hollow-dot
  39
+      # 24) default_dot_style to dot-style
  40
+      self.to_json2.tap do |output|
  41
+        output.gsub!("threed","3d")
  42
+        output.gsub!("default_dot_style","dot-style")
  43
+        %w(font_size dot_size outline_colour halo_size start_angle tick_height grid_colour tick_length no_labels label_colour gradient_fill fill_alpha on_click spoke_labels visible_steps key_on_click barb_length on_show negative_colour line_style javascript_function_name pad_x pad_y align_x align_y dot_style hollow_dot).each do |replace|
  44
+          output.gsub!(replace, replace.gsub("_", "-"))
  45
+        end
  46
+      end
  47
+    end
  48
+
  49
+    def to_json2
  50
+      self.instance_values.to_json
  51
+    end    
  52
+
  53
+    alias_method :to_s, :render
  54
+
  55
+    def add_element(element)
  56
+      @elements ||= []
  57
+      @elements << element
  58
+    end
  59
+
  60
+    def <<(e)
  61
+      add_element e
  62
+    end
  63
+
  64
+    def set_key(text, size)
  65
+      @text      = text
  66
+      @font_size = size
  67
+    end
  68
+
  69
+    def append_value(v)
  70
+      @values ||= []
  71
+      @values << v
  72
+    end
  73
+
  74
+    def set_range(min,max,steps=1)
  75
+      @min   = min
  76
+      @max   = max
  77
+      @steps = steps
  78
+    end
  79
+
  80
+    def set_offset(v)
  81
+      @offset = v ? true : false
  82
+    end
  83
+
  84
+    def set_colours(colours, grid_colour)
  85
+      @colours     = colours
  86
+      @grid_colour = grid_colour
  87
+    end
  88
+
  89
+    def set_tooltip(tip)
  90
+      if tip.is_a?(Tooltip)
  91
+        #we have a style for our chart's tooltips
  92
+        @tooltip = tip
  93
+      else
  94
+        # the user could just use set_tip(tip) or tip=(tip) to just set the text of the tooltip
  95
+        @tip = tip
  96
+      end
  97
+    end
  98
+    alias_method "tooltip=", :set_tooltip
  99
+
  100
+    def attach_to_right_y_axis
  101
+      @axis = 'right'
  102
+    end 
  103
+    
  104
+
  105
+
  106
+
  107
+    def method_missing(method_name, *args, &blk)
  108
+      case method_name.to_s
  109
+      when /(.*)=/   # i.e., if it is something x_legend=
  110
+        # if the user wants to set an instance variable then let them
  111
+        # the other args (args[0]) are ignored since it is a set method
  112
+        self.instance_variable_set("@#{$1}", args[0])
  113
+      when /^set_(.*)/
  114
+        # backwards compatible ... the user can still use the same set_y_legend methods if they want
  115
+        self.instance_variable_set("@#{$1}", args[0])
  116
+      else
  117
+        # if the method/attribute is missing and it is not a set method then hmmmm better let the user know
  118
+        super
  119
+      end
  120
+    end
  121
+
  122
+  end
  123
+end
22  vendor/plugins/open_flash_chart/lib/open_flash_chart/candle.rb
... ...
@@ -0,0 +1,22 @@
  1
+module OpenFlashChart
  2
+
  3
+  class Candle < Base
  4
+    def initialize(colour, negative_colour, args={})
  5
+      @colour = colour
  6
+      @negative_colour = negative_colour
  7
+      super args
  8
+      @type = "candle"   
  9
+    end
  10
+  end
  11
+  
  12
+  class CandleValue < Base
  13
+    def initialize( high, open, close, low, args={} )
  14
+      @top = open
  15
+      @bottom = close
  16
+      @low = low
  17
+      @high = high
  18
+      super args
  19
+    end
  20
+  end
  21
+
  22
+end
13  vendor/plugins/open_flash_chart/lib/open_flash_chart/chart.rb
... ...
@@ -0,0 +1,13 @@
  1
+module OpenFlashChart
  2
+
  3
+  class Chart < Base
  4
+    def initialize( title=nil, args={})
  5
+      super args
  6
+      @title = Title.new( title ) if title      
  7
+    end    
  8
+  end
  9
+
  10
+  class OpenFlashChart < Chart
  11
+  end
  12
+
  13
+end
55  vendor/plugins/open_flash_chart/lib/open_flash_chart/dot_base.rb
... ...
@@ -0,0 +1,55 @@
  1
+module OpenFlashChart
  2
+
  3
+  class DotBase < Base
  4
+    def initialize type, value=nil, args={}
  5
+      super args
  6
+      @type  = type
  7
+      @value = value if value
  8
+    end
  9
+
  10
+    def position=(x, y)
  11
+      @x = x
  12
+      @y = y
  13
+    end
  14
+
  15
+    def size=(size)
  16
+      @dot_size = size        
  17
+    end
  18
+  end
  19
+
  20
+  class HollowDot < DotBase
  21
+    def initialize(value=nil, args={})
  22
+      super 'hollow_dot', value, args
  23
+    end
  24
+  end
  25
+  
  26
+  class Star < DotBase
  27
+    def initialize(value=nil, args={})
  28
+      super 'star', value, args
  29
+    end
  30
+  end
  31
+  
  32
+  class Bow < DotBase
  33
+    def initialize(value=nil, args={})
  34
+      super 'bow', value, args
  35
+    end
  36
+  end
  37
+  
  38
+  class Anchor < DotBase
  39
+    def initialize(value=nil, args={})
  40
+      super 'anchor', value, args
  41
+    end
  42
+  end
  43
+  
  44
+  class Dot < DotBase
  45
+    def initialize(value=nil, args={})
  46
+      super 'dot', value, args
  47
+    end
  48
+  end
  49
+  
  50
+  class SolidDot < DotBase
  51
+    def initialize(value=nil, args={})
  52
+      super 'solid-dot', value, args
  53
+    end
  54
+  end
  55
+end
26  vendor/plugins/open_flash_chart/lib/open_flash_chart/h_bar.rb
... ...
@@ -0,0 +1,26 @@
  1
+module OpenFlashChart
  2
+
  3
+  class HBarValue < Base
  4
+    def initialize(left,right=nil, args={})
  5
+      super args
  6
+      @left  = left if right
  7
+      @right = right || left      
  8
+    end
  9
+  end
  10
+
  11
+  class HBar < Base
  12
+    def initialize(colour="#9933CC", args={})
  13
+      super args
  14
+      @type = "hbar"
  15
+      @colour = colour
  16
+      @values = []      
  17
+    end
  18
+
  19
+    def set_values(v)
  20
+      v.each do |val|
  21
+        append_value(HBarValue.new(val))
  22
+      end
  23
+    end
  24
+  end
  25
+
  26
+end
7  vendor/plugins/open_flash_chart/lib/open_flash_chart/legend.rb
... ...
@@ -0,0 +1,7 @@
  1
+module OpenFlashChart
  2
+
  3
+  class Legend < Base
  4
+  end
  5
+
  6
+end
  7
+
23  vendor/plugins/open_flash_chart/lib/open_flash_chart/line.rb
... ...
@@ -0,0 +1,23 @@
  1
+module OpenFlashChart
  2
+
  3
+  class LineOnShow < Base
  4
+    def initialize(type, cascade, delay)
  5
+      @type    = type
  6
+      @cascade = cascade.to_F
  7
+      @delay   = delay.to_f
  8
+    end
  9
+  end
  10
+
  11
+  class Line < LineBase
  12
+    def initialize args={}
  13
+      super
  14
+      @type = "line"      
  15
+      @values = []
  16
+    end
  17
+
  18
+    def set_default_dot_style(style)
  19
+      @dot_style = style
  20
+    end
  21
+  end
  22
+
  23
+end
17  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_base.rb
... ...
@@ -0,0 +1,17 @@
  1
+module OpenFlashChart
  2
+
  3
+  class LineBase < Base
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "line"
  7
+      @text = "Page Views"
  8
+      @font_size = 10
  9
+      @values = []
  10
+    end
  11
+
  12
+    def loop
  13
+      @loop = true
  14
+    end
  15
+  end
  16
+
  17
+end
17  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_dot.rb
... ...
@@ -0,0 +1,17 @@
  1
+module OpenFlashChart
  2
+
  3
+  class LineDot < LineBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "line_dot"
  7
+    end
  8
+  end
  9
+
  10
+  class DotValue < Base
  11
+    def initialize(value, colour, args={})
  12
+      @value = value
  13
+      @colour = colour
  14
+      super(args)
  15
+    end
  16
+  end
  17
+end
10  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_hollow.rb
... ...
@@ -0,0 +1,10 @@
  1
+module OpenFlashChart
  2
+
  3
+  class LineHollow < LineBase
  4
+    def initialize args={}
  5
+      super
  6
+      @type = "line_hollow"
  7
+    end
  8
+  end
  9
+
  10
+end
12  vendor/plugins/open_flash_chart/lib/open_flash_chart/line_style.rb