old_sql 1.9.0 → 1.10.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,6 +1,20 @@
1
- = old_sql
1
+ = Old SQL
2
+
3
+ Old SQL is a Rails Engine database reporting gem that uses plain old SQL.
4
+
5
+ = Installation
6
+
7
+ To install Old SQL type:
8
+
9
+ rails g old_sql:install
10
+
11
+ This will create the following directories:
12
+
13
+ * config/old_sql
14
+ * lib/old_sql
15
+
16
+ Configure your reports config/old_sql/report.yml.
2
17
 
3
- OldSQL is a Rails Engine database reporting gem that uses plain old SQL
4
18
 
5
19
  == Contributing to old_sql
6
20
 
@@ -16,9 +16,10 @@ module OldSql
16
16
  BASE_PROCESSOR = "base"
17
17
 
18
18
  def index
19
+ @report_view = OldSql.default_report_view
19
20
  end
20
21
 
21
- def datagrid
22
+ def jqgrid
22
23
  @start_date = params[:start_date]
23
24
  @end_date = params[:end_date]
24
25
  @generation = params[:generation]
@@ -27,12 +28,34 @@ module OldSql
27
28
 
28
29
  #todo allow these to be overridden in the report config
29
30
  @row_num = OldSql.jqgrid_row_num
30
- @width = OldSql.jqgrid_width
31
- @height = OldSql.jqgrid_height
31
+ @width = OldSql.report_width
32
+ @height = OldSql.report_height
32
33
 
33
34
  render :template => "old_sql/report/datagrid.html.erb"
34
35
  end
35
36
 
37
+ def table
38
+ @start_date = params[:start_date]
39
+ @end_date = params[:end_date]
40
+ @generation = params[:generation]
41
+ @report_name = params[:report]
42
+ @report_sql = params[:report_sql].downcase
43
+ @report_sql_orig = params[:report_sql].downcase
44
+
45
+ @width = OldSql.report_width
46
+ @height = OldSql.report_height
47
+
48
+ if !@generation.nil? && @generation.to_i >= 0
49
+ @report_sql << "_gen_#{@generation}"
50
+ end
51
+
52
+ processor = load_base_processor
53
+ @report = processor.execute_query(@report_sql,@start_date,@end_date,query_vars(@report_name),@reports[@report_name]['report_design'],
54
+ @reports[@report_name]['report_processor'])
55
+
56
+ render :template => "old_sql/report/table.html.erb"
57
+ end
58
+
36
59
  def query
37
60
  @start_date = params[:start_date]
38
61
  @end_date = params[:end_date]
@@ -1,6 +1,7 @@
1
1
  <script>
2
2
  var host = "<%=@host%>";
3
3
  var port = "<%=@port%>";
4
+ var report_view = "<%=@report_view%>";
4
5
  </script>
5
6
 
6
7
  <div class="os-block">
@@ -0,0 +1,20 @@
1
+ <%= stylesheet_link_tag "old_sql/table.css" %>
2
+ <%= javascript_include_tag "old_sql/table.js" %>
3
+
4
+ <table class="grid" border="0" width="<%=@width%>">
5
+ <thead>
6
+ <tr>
7
+ <% @reports[@report_name]['fields'].each do |field| %>
8
+ <th><%= field.capitalize %></th>
9
+ <% end %>
10
+ </tr>
11
+ </thead>
12
+
13
+ <% @report[:rows].each do |row| %>
14
+ <tr>
15
+ <% row[:cell].each do |cell| %>
16
+ <td><%=cell%></td>
17
+ <% end %>
18
+ </tr>
19
+ <% end %>
20
+ </table>
data/config/routes.rb CHANGED
@@ -4,7 +4,8 @@ Rails.application.routes.draw do
4
4
  controller "report" do
5
5
  match "/", :to => :index, :as => "report_list"
6
6
  match "/query", :to => :query, :as => "query"
7
- match "/datagrid", :to => :datagrid, :as => "datagrid"
7
+ match "/jqgrid", :to => :jqgrid, :as => "jqgrid"
8
+ match "/table", :to => :table, :as => "table"
8
9
  match "/print", :to => :print, :as => "print"
9
10
  end
10
11
  end
@@ -14,13 +14,13 @@ OldSql.setup do |config|
14
14
  # in config/old_sql/reports.yml.
15
15
  config.default_report_view = "jqgrid"
16
16
 
17
- # ==> jqGrid Report View Configuration
18
- # Height of the jqGrid component in the jqGrid report view.
19
- config.jqgrid_height = 630
17
+ # Height of the report table or jqGrid.
18
+ config.report_height = 630
20
19
 
21
- # Width of the jqGrid component in the jqGrid report view.
22
- config.jqgrid_width = 800
20
+ # Width of the report table or jqGrid.
21
+ config.report_width = 800
23
22
 
23
+ # ==> jqGrid Report View Configuration
24
24
  # Number of rows to display in the jqGrid component in the jqGrid report view.
25
25
  config.jqgrid_row_num = 25
26
26
  end
data/lib/old_sql.rb CHANGED
@@ -18,13 +18,13 @@ module OldSql
18
18
  mattr_accessor :rounding_precision
19
19
  @@rounding_precision = 2
20
20
 
21
- # Width of the jqGrid component in the jqGrid report view.
22
- mattr_accessor :jqgrid_width
23
- @@jqgrid_width = 800
21
+ # Width of the report table or jqGrid.
22
+ mattr_accessor :report_width
23
+ @@report_width = 800
24
24
 
25
- # Height of the jqGrid component in the jqGrid report view.
26
- mattr_accessor :jqgrid_height
27
- @@jqgrid_width = 630
25
+ # Height of the report table or jqGrid.
26
+ mattr_accessor :report_height
27
+ @@report_width = 630
28
28
 
29
29
  # Number of rows to display in the jqGrid component in the jqGrid report view.
30
30
  mattr_accessor :jqgrid_row_num
@@ -19,7 +19,7 @@ function report_selected()
19
19
 
20
20
  function load_report()
21
21
  {
22
- var src = "http://"+host+":"+port+"/sql/reports/datagrid/?report="+jQuery("#report").val()+
22
+ var src = "http://"+host+":"+port+"/sql/reports/"+report_view+"/?report="+jQuery("#report").val()+
23
23
  "&start_date="+jQuery("#datepicker-start").val()+"&end_date="+jQuery("#datepicker-end").val()+"&generation="+
24
24
  jQuery("#select-generation").val()+"&report_sql="+
25
25
  _report_sql;
@@ -0,0 +1,4 @@
1
+ jQuery(document).ready(function($){
2
+ $('tbody tr:even').addClass('even');
3
+ $('tbody tr:odd').addClass('odd');
4
+ });
@@ -0,0 +1,64 @@
1
+ * {
2
+ }
3
+
4
+ body{
5
+ background:#fff url(../../images/rails_admin/background.png) repeat-x;
6
+ font-family:Verdana, Geneva, sans-serif;
7
+ font-size:12px;
8
+ }
9
+
10
+ .grid {
11
+ border-collapse: collapse;
12
+ }
13
+
14
+ .even {
15
+ background-color: #FFFFFF;
16
+ }
17
+
18
+ .odd {
19
+ background-color: #F2F2F2;
20
+ }
21
+
22
+ td, th {
23
+ display: table-cell;
24
+ vertical-align: inherit;
25
+ font-family:Verdana, Geneva, sans-serif;
26
+ font-size:12px;
27
+ }
28
+
29
+ th {
30
+ margin-left: 5px;
31
+ text-align: left;
32
+ border-bottom: 2px solid #B9B9B9;
33
+ padding: 9px 0;
34
+ }
35
+
36
+ #content {
37
+ width:960px;
38
+ background:#FFF;
39
+ margin-bottom: 20px;
40
+ border-bottom: 1px solid #e6e6e6;
41
+ }
42
+
43
+ .ra-block .ui-widget-header {
44
+ padding:8px;
45
+ }
46
+
47
+ .ra-block-content {
48
+ padding:10px;
49
+ border-left:1px solid #e6e6e6;
50
+ border-right:1px solid #e6e6e6;
51
+ }
52
+
53
+ .ra-block-content .ra-block-content {
54
+ border: none;
55
+ }
56
+
57
+ .ra-block .ra-block-toolbar {
58
+ border-top:1px solid #e6e6e6;
59
+ border-bottom:1px solid #e6e6e6;
60
+ border-left: none;
61
+ border-right: none;
62
+ padding:5px;
63
+ margin-bottom: 10px;
64
+ }
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: old_sql
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.9.0
5
+ version: 1.10.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Eddie Gonzales
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-06-12 00:00:00 Z
13
+ date: 2011-06-13 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: devise
@@ -54,6 +54,7 @@ files:
54
54
  - app/views/old_sql/report/datagrid.html.erb
55
55
  - app/views/old_sql/report/index.html.erb
56
56
  - app/views/old_sql/report/print.html.erb
57
+ - app/views/old_sql/report/table.html.erb
57
58
  - config/locales/old_sql.en.yml
58
59
  - config/routes.rb
59
60
  - lib/extensions/action_controller/base.rb
@@ -119,6 +120,7 @@ files:
119
120
  - public/javascripts/old_sql/jquery-ui-1.8.13.custom.min.js
120
121
  - public/javascripts/old_sql/jquery-ui-timepicker-addon.js
121
122
  - public/javascripts/old_sql/old_sql.js
123
+ - public/javascripts/old_sql/table.js
122
124
  - public/stylesheets/old_sql/jqgrid/themes/default/images/ui-bg_diagonals-thick_90_eeeeee_40x40.png
123
125
  - public/stylesheets/old_sql/jqgrid/themes/default/images/ui-bg_flat_15_cd0a0a_40x100.png
124
126
  - public/stylesheets/old_sql/jqgrid/themes/default/images/ui-bg_glass_100_e4f1fb_1x400.png
@@ -154,6 +156,7 @@ files:
154
156
  - public/stylesheets/old_sql/jqgrid/ui.jqgrid.css
155
157
  - public/stylesheets/old_sql/jqgrid/ui.multiselect.css
156
158
  - public/stylesheets/old_sql/old_sql.css
159
+ - public/stylesheets/old_sql/table.css
157
160
  - public/stylesheets/old_sql/ui-lightness/images/ui-bg_diagonals-thick_18_b81900_40x40.png
158
161
  - public/stylesheets/old_sql/ui-lightness/images/ui-bg_diagonals-thick_20_666666_40x40.png
159
162
  - public/stylesheets/old_sql/ui-lightness/images/ui-bg_flat_10_000000_40x100.png
@@ -182,7 +185,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
185
  requirements:
183
186
  - - ">="
184
187
  - !ruby/object:Gem::Version
185
- hash: 2678801917328631953
188
+ hash: -1338027586824661245
186
189
  segments:
187
190
  - 0
188
191
  version: "0"