old_sql 1.26.0 → 1.27.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +15 -21
- data/app/controllers/old_sql/report_controller.rb +141 -120
- data/app/views/old_sql/report/_query.html.erb +49 -0
- data/app/views/old_sql/report/_reports.html.erb +40 -0
- data/app/views/old_sql/report/index.html.erb +20 -46
- data/app/views/old_sql/report/{datagrid.html.erb → jqgrid.html.erb} +11 -4
- data/config/routes.rb +1 -1
- data/lib/old_sql/report_processor/base.rb +60 -28
- data/public/javascripts/old_sql/chart.js +1 -0
- data/public/javascripts/old_sql/jquery-ui-1.8.13.custom.min.js +65 -0
- data/public/javascripts/old_sql/old_sql.js +130 -32
- data/public/stylesheets/old_sql/old_sql.css +29 -32
- data/public/stylesheets/old_sql/table.css +29 -29
- data/public/stylesheets/old_sql/ui-lightness/jquery-ui-1.8.13.custom.css +60 -0
- metadata +6 -4
@@ -4,56 +4,30 @@ var port = "<%=@port%>";
|
|
4
4
|
var default_report_view = "<%=@report_view%>";
|
5
5
|
</script>
|
6
6
|
|
7
|
-
<div
|
8
|
-
<
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
<div class="report-form-row">
|
14
|
-
<div class="report-form-label">SELECT A REPORT:</div>
|
15
|
-
<div class="report-form-input">
|
16
|
-
<select name="report" id="report"
|
17
|
-
onchange="report_selected()">
|
18
|
-
<option></option>
|
19
|
-
<% @reports.each do |report, data| %>
|
20
|
-
<option value="<%= data['name'] %>" report_sql="<%= data['report_sql'] %>"
|
21
|
-
desc="<%= data['description'] %>" name="<%=report%>"
|
22
|
-
report_view="<%=data['report_view']%>"><%= data['description'] %></option>
|
23
|
-
<% end %>
|
24
|
-
</select>
|
25
|
-
</div>
|
26
|
-
</div>
|
27
|
-
|
28
|
-
<div class="report-form-row">
|
29
|
-
<div class="report-form-label">START DATE:</div>
|
30
|
-
<div class="report-form-input">
|
31
|
-
<input type="text" id="datepicker-start" name="start_date" value="">
|
32
|
-
</div>
|
33
|
-
</div>
|
34
|
-
|
35
|
-
<div class="report-form-row">
|
36
|
-
<div class="report-form-label">END DATE:</div>
|
37
|
-
<div class="report-form-input">
|
38
|
-
<input type="text" id="datepicker-end" name="end_date" value="">
|
39
|
-
</div>
|
40
|
-
</div>
|
41
|
-
|
42
|
-
<div class="report-form-row">
|
43
|
-
<div class="report-form-label"></div>
|
44
|
-
<input type="button" value="Run" onclick="load_report();"/>
|
45
|
-
</div>
|
46
|
-
</form>
|
7
|
+
<div id="tabs">
|
8
|
+
<ul>
|
9
|
+
<li><a href="#tabs-1">Reports</a></li>
|
10
|
+
<li><a href="#tabs-2">Query</a></li>
|
11
|
+
<li><a href="#tabs-3">Schema</a></li>
|
12
|
+
</ul>
|
47
13
|
|
48
|
-
<div id="
|
49
|
-
|
50
|
-
<div><%= link_to_function("Export To Excel", "javascript:export_report_to_excel()") %></div>
|
14
|
+
<div id="tabs-1">
|
15
|
+
<%= render(:partial => 'reports') %>
|
51
16
|
</div>
|
52
|
-
|
17
|
+
|
18
|
+
<div id="tabs-2">
|
19
|
+
<%= render(:partial => 'query') %>
|
20
|
+
</div>
|
21
|
+
|
22
|
+
<div id="tabs-3">
|
23
|
+
Coming Soon...
|
24
|
+
</div>
|
25
|
+
|
53
26
|
<div id="data_grid">
|
54
27
|
<iframe id="data_grid_frame" src="" width="100%" height="530" frameborder="0" scrolling="no">
|
55
28
|
<p>Your browser does not support iframes.</p>
|
56
29
|
</iframe>
|
57
30
|
</div>
|
58
|
-
|
59
|
-
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div id="old-sql">built with <a href="https://github.com/egonz/old_sql" target="_blank">Old SQL</a></div>
|
@@ -1,3 +1,8 @@
|
|
1
|
+
<%col_names = jqgrid_col_names%>
|
2
|
+
|
3
|
+
<% if col_names.nil? || col_names=='null' %>
|
4
|
+
The query returned no data.
|
5
|
+
<% else %>
|
1
6
|
<!-- TODO move these to the head -->
|
2
7
|
<%= stylesheet_link_tag "old_sql/jqgrid/ui.jqgrid.css" %>
|
3
8
|
<%= javascript_include_tag "old_sql/jqgrid/jquery.jqGrid.min.js" %>
|
@@ -6,18 +11,20 @@
|
|
6
11
|
<script>
|
7
12
|
jQuery(document).ready(function(){
|
8
13
|
jQuery("#rowed1").jqGrid({
|
9
|
-
url:"http://<%=@host%>:<%=@port%>/sql/reports/query.json/?report=<%=@report_name%>&report_sql=<%=@report_sql%>&start_date=<%=@start_date%>&end_date=<%=@end_date%>",
|
14
|
+
url:"http://<%=@host%>:<%=@port%>/sql/reports/query.json/?report=<%=@report_name%>&report_sql=<%=@report_sql%>&start_date=<%=@start_date%>&end_date=<%=@end_date%>&query=<%=@query%>&db=<%=@db%>",
|
10
15
|
datatype: "json",
|
11
16
|
pager: false,
|
12
|
-
colNames: <%=
|
17
|
+
colNames: <%=col_names%>,
|
13
18
|
colModel: <%=jqgrid_col_model%>,
|
14
19
|
rowNum: <%=@row_num%>,
|
15
20
|
rowList: [10,20,30],
|
16
21
|
width: <%=@width%>,
|
17
22
|
height: <%=@height%>,
|
18
|
-
|
23
|
+
cellEdit: true,
|
24
|
+
caption: "<%=@caption%> Report"
|
19
25
|
});
|
20
26
|
});
|
21
27
|
</script>
|
22
28
|
|
23
|
-
<table id="rowed1"></table>
|
29
|
+
<table id="rowed1"></table>
|
30
|
+
<% end %>
|
data/config/routes.rb
CHANGED
@@ -3,8 +3,8 @@ Rails.application.routes.draw do
|
|
3
3
|
scope "reports", :as => "reports" do
|
4
4
|
controller "report" do
|
5
5
|
match "/", :to => :index, :as => "report_list"
|
6
|
-
match "/query", :to => :query, :as => "query"
|
7
6
|
match "/jqgrid", :to => :jqgrid, :as => "jqgrid"
|
7
|
+
match "/query", :to => :query, :as => "query"
|
8
8
|
match "/table", :to => :table, :as => "table"
|
9
9
|
match "/chart", :to => :chart, :as => "chart"
|
10
10
|
match "/print", :to => :print, :as => "print"
|
@@ -14,15 +14,11 @@ module OldSql
|
|
14
14
|
|
15
15
|
ROUND_PRECISION = OldSql.rounding_precision
|
16
16
|
|
17
|
-
def execute_query(report_config, start_date, end_date, query_vars = nil)
|
18
|
-
|
19
|
-
query(sql, report_config)
|
20
|
-
|
21
|
-
return nil if @resultset.nil?
|
22
|
-
|
23
|
-
init
|
17
|
+
def execute_query(report_config, start_date, end_date, query_vars = nil, sql_query = nil, db_class = nil)
|
18
|
+
execute(report_config, start_date, end_date, query_vars, sql_query, db_class)
|
24
19
|
|
25
20
|
return nil if @rec.nil?
|
21
|
+
return parse(@resultset) if report_config.nil?
|
26
22
|
|
27
23
|
@report_type = report_config['report_view']
|
28
24
|
report_design = report_config['report_design']
|
@@ -43,6 +39,15 @@ module OldSql
|
|
43
39
|
@data
|
44
40
|
end
|
45
41
|
|
42
|
+
def fields(report_config, start_date, end_date, query_vars = nil, sql_query = nil, db_class = nil)
|
43
|
+
return report_config['fields'] unless report_config.nil?
|
44
|
+
|
45
|
+
execute(report_config, start_date, end_date, query_vars, sql_query, db_class)
|
46
|
+
return humanize_fields(@rec.keys) unless @rec.nil?
|
47
|
+
|
48
|
+
nil
|
49
|
+
end
|
50
|
+
|
46
51
|
protected
|
47
52
|
|
48
53
|
def add_row(cell_data = [], id = @id+1)
|
@@ -60,6 +65,30 @@ module OldSql
|
|
60
65
|
|
61
66
|
private
|
62
67
|
|
68
|
+
def execute(report_config, start_date, end_date, query_vars = nil, sql_query = nil, db_class = nil)
|
69
|
+
if !sql_query.nil? && sql_query.length > 0
|
70
|
+
sql = sql_query.gsub("\n"," ")
|
71
|
+
else
|
72
|
+
sql = load_sql(report_config['report_sql'], start_date, end_date, query_vars)
|
73
|
+
end
|
74
|
+
|
75
|
+
query(sql, report_config, db_class)
|
76
|
+
|
77
|
+
return nil if @resultset.nil?
|
78
|
+
|
79
|
+
init
|
80
|
+
end
|
81
|
+
|
82
|
+
def humanize_fields(fields)
|
83
|
+
humanized_fields = []
|
84
|
+
fields.each do |field|
|
85
|
+
humanized_field = ""
|
86
|
+
field.split("_").each {|f| humanized_field << "#{f.capitalize} "}
|
87
|
+
humanized_fields << humanized_field.rstrip
|
88
|
+
end
|
89
|
+
humanized_fields
|
90
|
+
end
|
91
|
+
|
63
92
|
def load_sql(report_sql, start_date, end_date, query_vars)
|
64
93
|
vars = {:start_date => start_date, :end_date => end_date}
|
65
94
|
|
@@ -71,15 +100,13 @@ module OldSql
|
|
71
100
|
sql = Erubis::Eruby.new(template).result(vars)
|
72
101
|
end
|
73
102
|
|
74
|
-
def query sql, report_config
|
103
|
+
def query sql, report_config, db_class
|
75
104
|
begin
|
76
105
|
#todo change to a reporting db
|
77
|
-
db = db_connection(report_config
|
78
|
-
|
79
|
-
raise Exception("Unable to Establish a Database Connection") unless db.active?
|
106
|
+
db = db_connection(report_config, db_class)
|
80
107
|
|
81
108
|
@resultset = []
|
82
|
-
rec = db.select_all(sql)
|
109
|
+
rec = db.connection.select_all(sql)
|
83
110
|
rec.each do |row|
|
84
111
|
@resultset << row
|
85
112
|
end
|
@@ -90,28 +117,33 @@ module OldSql
|
|
90
117
|
@resultset
|
91
118
|
end
|
92
119
|
|
93
|
-
def db_connection
|
94
|
-
|
95
|
-
|
96
|
-
|
120
|
+
def db_connection report_config, db_class
|
121
|
+
if !report_config.nil? && report_db = report_config['report_db']
|
122
|
+
db = load_db_connection(report_db)
|
123
|
+
elsif !db_class.nil? && db_class.length > 0
|
124
|
+
db = load_db_connection(db_class)
|
97
125
|
else
|
98
|
-
|
99
|
-
|
100
|
-
db_class_name = ""
|
101
|
-
first = true
|
102
|
-
|
103
|
-
report_db.split("/").each do |path|
|
104
|
-
db_class_name << "::" unless first
|
105
|
-
path.split("_").each {|c| db_class_name << c.capitalize }
|
106
|
-
first = false
|
107
|
-
end
|
108
|
-
|
109
|
-
db=eval(db_class_name).connection
|
126
|
+
db = ActiveRecord::Base;
|
110
127
|
end
|
111
128
|
|
112
129
|
db
|
113
130
|
end
|
114
131
|
|
132
|
+
def load_db_connection db_class_path
|
133
|
+
require db_class_path
|
134
|
+
|
135
|
+
db_class_name = ""
|
136
|
+
first = true
|
137
|
+
|
138
|
+
db_class_path.split("/").each do |path|
|
139
|
+
db_class_name << "::" unless first
|
140
|
+
path.split("_").each {|c| db_class_name << c.capitalize }
|
141
|
+
first = false
|
142
|
+
end
|
143
|
+
|
144
|
+
db=eval(db_class_name)
|
145
|
+
end
|
146
|
+
|
115
147
|
def load_sub_processor sub_processor
|
116
148
|
return if sub_processor.nil?
|
117
149
|
|
@@ -269,6 +269,36 @@ f,this._uiHash())});for(e=this.containers.length-1;e>=0;e--)if(d.ui.contains(thi
|
|
269
269
|
this.containers[e]));if(this.containers[e].containerCache.over){c.push(function(f){return function(g){f._trigger("out",g,this._uiHash(this))}}.call(this,this.containers[e]));this.containers[e].containerCache.over=0}}this._storedCursor&&d("body").css("cursor",this._storedCursor);this._storedOpacity&&this.helper.css("opacity",this._storedOpacity);if(this._storedZIndex)this.helper.css("zIndex",this._storedZIndex=="auto"?"":this._storedZIndex);this.dragging=false;if(this.cancelHelperRemoval){if(!b){this._trigger("beforeStop",
|
270
270
|
a,this._uiHash());for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}return false}b||this._trigger("beforeStop",a,this._uiHash());this.placeholder[0].parentNode.removeChild(this.placeholder[0]);this.helper[0]!=this.currentItem[0]&&this.helper.remove();this.helper=null;if(!b){for(e=0;e<c.length;e++)c[e].call(this,a);this._trigger("stop",a,this._uiHash())}this.fromOutside=false;return true},_trigger:function(){d.Widget.prototype._trigger.apply(this,arguments)===false&&this.cancel()},
|
271
271
|
_uiHash:function(a){var b=a||this;return{helper:b.helper,placeholder:b.placeholder||d([]),position:b.position,originalPosition:b.originalPosition,offset:b.positionAbs,item:b.currentItem,sender:a?a.element:null}}});d.extend(d.ui.sortable,{version:"1.8.13"})})(jQuery);
|
272
|
+
;/*
|
273
|
+
* jQuery UI Accordion 1.8.13
|
274
|
+
*
|
275
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
276
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
277
|
+
* http://jquery.org/license
|
278
|
+
*
|
279
|
+
* http://docs.jquery.com/UI/Accordion
|
280
|
+
*
|
281
|
+
* Depends:
|
282
|
+
* jquery.ui.core.js
|
283
|
+
* jquery.ui.widget.js
|
284
|
+
*/
|
285
|
+
(function(c){c.widget("ui.accordion",{options:{active:0,animated:"slide",autoHeight:true,clearStyle:false,collapsible:false,event:"click",fillSpace:false,header:"> li > :first-child,> :not(li):even",icons:{header:"ui-icon-triangle-1-e",headerSelected:"ui-icon-triangle-1-s"},navigation:false,navigationFilter:function(){return this.href.toLowerCase()===location.href.toLowerCase()}},_create:function(){var a=this,b=a.options;a.running=0;a.element.addClass("ui-accordion ui-widget ui-helper-reset").children("li").addClass("ui-accordion-li-fix");
|
286
|
+
a.headers=a.element.find(b.header).addClass("ui-accordion-header ui-helper-reset ui-state-default ui-corner-all").bind("mouseenter.accordion",function(){b.disabled||c(this).addClass("ui-state-hover")}).bind("mouseleave.accordion",function(){b.disabled||c(this).removeClass("ui-state-hover")}).bind("focus.accordion",function(){b.disabled||c(this).addClass("ui-state-focus")}).bind("blur.accordion",function(){b.disabled||c(this).removeClass("ui-state-focus")});a.headers.next().addClass("ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom");
|
287
|
+
if(b.navigation){var d=a.element.find("a").filter(b.navigationFilter).eq(0);if(d.length){var h=d.closest(".ui-accordion-header");a.active=h.length?h:d.closest(".ui-accordion-content").prev()}}a.active=a._findActive(a.active||b.active).addClass("ui-state-default ui-state-active").toggleClass("ui-corner-all").toggleClass("ui-corner-top");a.active.next().addClass("ui-accordion-content-active");a._createIcons();a.resize();a.element.attr("role","tablist");a.headers.attr("role","tab").bind("keydown.accordion",
|
288
|
+
function(f){return a._keydown(f)}).next().attr("role","tabpanel");a.headers.not(a.active||"").attr({"aria-expanded":"false","aria-selected":"false",tabIndex:-1}).next().hide();a.active.length?a.active.attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}):a.headers.eq(0).attr("tabIndex",0);c.browser.safari||a.headers.find("a").attr("tabIndex",-1);b.event&&a.headers.bind(b.event.split(" ").join(".accordion ")+".accordion",function(f){a._clickHandler.call(a,f,this);f.preventDefault()})},_createIcons:function(){var a=
|
289
|
+
this.options;if(a.icons){c("<span></span>").addClass("ui-icon "+a.icons.header).prependTo(this.headers);this.active.children(".ui-icon").toggleClass(a.icons.header).toggleClass(a.icons.headerSelected);this.element.addClass("ui-accordion-icons")}},_destroyIcons:function(){this.headers.children(".ui-icon").remove();this.element.removeClass("ui-accordion-icons")},destroy:function(){var a=this.options;this.element.removeClass("ui-accordion ui-widget ui-helper-reset").removeAttr("role");this.headers.unbind(".accordion").removeClass("ui-accordion-header ui-accordion-disabled ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top").removeAttr("role").removeAttr("aria-expanded").removeAttr("aria-selected").removeAttr("tabIndex");
|
290
|
+
this.headers.find("a").removeAttr("tabIndex");this._destroyIcons();var b=this.headers.next().css("display","").removeAttr("role").removeClass("ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-accordion-disabled ui-state-disabled");if(a.autoHeight||a.fillHeight)b.css("height","");return c.Widget.prototype.destroy.call(this)},_setOption:function(a,b){c.Widget.prototype._setOption.apply(this,arguments);a=="active"&&this.activate(b);if(a=="icons"){this._destroyIcons();
|
291
|
+
b&&this._createIcons()}if(a=="disabled")this.headers.add(this.headers.next())[b?"addClass":"removeClass"]("ui-accordion-disabled ui-state-disabled")},_keydown:function(a){if(!(this.options.disabled||a.altKey||a.ctrlKey)){var b=c.ui.keyCode,d=this.headers.length,h=this.headers.index(a.target),f=false;switch(a.keyCode){case b.RIGHT:case b.DOWN:f=this.headers[(h+1)%d];break;case b.LEFT:case b.UP:f=this.headers[(h-1+d)%d];break;case b.SPACE:case b.ENTER:this._clickHandler({target:a.target},a.target);
|
292
|
+
a.preventDefault()}if(f){c(a.target).attr("tabIndex",-1);c(f).attr("tabIndex",0);f.focus();return false}return true}},resize:function(){var a=this.options,b;if(a.fillSpace){if(c.browser.msie){var d=this.element.parent().css("overflow");this.element.parent().css("overflow","hidden")}b=this.element.parent().height();c.browser.msie&&this.element.parent().css("overflow",d);this.headers.each(function(){b-=c(this).outerHeight(true)});this.headers.next().each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+
|
293
|
+
c(this).height()))}).css("overflow","auto")}else if(a.autoHeight){b=0;this.headers.next().each(function(){b=Math.max(b,c(this).height("").height())}).height(b)}return this},activate:function(a){this.options.active=a;a=this._findActive(a)[0];this._clickHandler({target:a},a);return this},_findActive:function(a){return a?typeof a==="number"?this.headers.filter(":eq("+a+")"):this.headers.not(this.headers.not(a)):a===false?c([]):this.headers.filter(":eq(0)")},_clickHandler:function(a,b){var d=this.options;
|
294
|
+
if(!d.disabled)if(a.target){a=c(a.currentTarget||b);b=a[0]===this.active[0];d.active=d.collapsible&&b?false:this.headers.index(a);if(!(this.running||!d.collapsible&&b)){var h=this.active;j=a.next();g=this.active.next();e={options:d,newHeader:b&&d.collapsible?c([]):a,oldHeader:this.active,newContent:b&&d.collapsible?c([]):j,oldContent:g};var f=this.headers.index(this.active[0])>this.headers.index(a[0]);this.active=b?c([]):a;this._toggle(j,g,e,b,f);h.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);
|
295
|
+
if(!b){a.removeClass("ui-state-default ui-corner-all").addClass("ui-state-active ui-corner-top").children(".ui-icon").removeClass(d.icons.header).addClass(d.icons.headerSelected);a.next().addClass("ui-accordion-content-active")}}}else if(d.collapsible){this.active.removeClass("ui-state-active ui-corner-top").addClass("ui-state-default ui-corner-all").children(".ui-icon").removeClass(d.icons.headerSelected).addClass(d.icons.header);this.active.next().addClass("ui-accordion-content-active");var g=this.active.next(),
|
296
|
+
e={options:d,newHeader:c([]),oldHeader:d.active,newContent:c([]),oldContent:g},j=this.active=c([]);this._toggle(j,g,e)}},_toggle:function(a,b,d,h,f){var g=this,e=g.options;g.toShow=a;g.toHide=b;g.data=d;var j=function(){if(g)return g._completed.apply(g,arguments)};g._trigger("changestart",null,g.data);g.running=b.size()===0?a.size():b.size();if(e.animated){d={};d=e.collapsible&&h?{toShow:c([]),toHide:b,complete:j,down:f,autoHeight:e.autoHeight||e.fillSpace}:{toShow:a,toHide:b,complete:j,down:f,autoHeight:e.autoHeight||
|
297
|
+
e.fillSpace};if(!e.proxied)e.proxied=e.animated;if(!e.proxiedDuration)e.proxiedDuration=e.duration;e.animated=c.isFunction(e.proxied)?e.proxied(d):e.proxied;e.duration=c.isFunction(e.proxiedDuration)?e.proxiedDuration(d):e.proxiedDuration;h=c.ui.accordion.animations;var i=e.duration,k=e.animated;if(k&&!h[k]&&!c.easing[k])k="slide";h[k]||(h[k]=function(l){this.slide(l,{easing:k,duration:i||700})});h[k](d)}else{if(e.collapsible&&h)a.toggle();else{b.hide();a.show()}j(true)}b.prev().attr({"aria-expanded":"false",
|
298
|
+
"aria-selected":"false",tabIndex:-1}).blur();a.prev().attr({"aria-expanded":"true","aria-selected":"true",tabIndex:0}).focus()},_completed:function(a){this.running=a?0:--this.running;if(!this.running){this.options.clearStyle&&this.toShow.add(this.toHide).css({height:"",overflow:""});this.toHide.removeClass("ui-accordion-content-active");if(this.toHide.length)this.toHide.parent()[0].className=this.toHide.parent()[0].className;this._trigger("change",null,this.data)}}});c.extend(c.ui.accordion,{version:"1.8.13",
|
299
|
+
animations:{slide:function(a,b){a=c.extend({easing:"swing",duration:300},a,b);if(a.toHide.size())if(a.toShow.size()){var d=a.toShow.css("overflow"),h=0,f={},g={},e;b=a.toShow;e=b[0].style.width;b.width(parseInt(b.parent().width(),10)-parseInt(b.css("paddingLeft"),10)-parseInt(b.css("paddingRight"),10)-(parseInt(b.css("borderLeftWidth"),10)||0)-(parseInt(b.css("borderRightWidth"),10)||0));c.each(["height","paddingTop","paddingBottom"],function(j,i){g[i]="hide";j=(""+c.css(a.toShow[0],i)).match(/^([\d+-.]+)(.*)$/);
|
300
|
+
f[i]={value:j[1],unit:j[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(g,{step:function(j,i){if(i.prop=="height")h=i.end-i.start===0?0:(i.now-i.start)/(i.end-i.start);a.toShow[0].style[i.prop]=h*f[i.prop].value+f[i.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css({width:e,overflow:d});a.complete()}})}else a.toHide.animate({height:"hide",
|
301
|
+
paddingTop:"hide",paddingBottom:"hide"},a);else a.toShow.animate({height:"show",paddingTop:"show",paddingBottom:"show"},a)},bounceslide:function(a){this.slide(a,{easing:a.down?"easeOutBounce":"swing",duration:a.down?1E3:200})}}})})(jQuery);
|
272
302
|
;/*
|
273
303
|
* jQuery UI Autocomplete 1.8.13
|
274
304
|
*
|
@@ -399,6 +429,41 @@ return a=this._trimAlignValue(a)}else{a=this.options.values.slice();for(c=0;c<a.
|
|
399
429
|
_refreshValue:function(){var b=this.options.range,a=this.options,c=this,f=!this._animateOff?a.animate:false,e,j={},g,k,l,i;if(this.options.values&&this.options.values.length)this.handles.each(function(h){e=(c.values(h)-c._valueMin())/(c._valueMax()-c._valueMin())*100;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";d(this).stop(1,1)[f?"animate":"css"](j,a.animate);if(c.options.range===true)if(c.orientation==="horizontal"){if(h===0)c.range.stop(1,1)[f?"animate":"css"]({left:e+"%"},a.animate);
|
400
430
|
if(h===1)c.range[f?"animate":"css"]({width:e-g+"%"},{queue:false,duration:a.animate})}else{if(h===0)c.range.stop(1,1)[f?"animate":"css"]({bottom:e+"%"},a.animate);if(h===1)c.range[f?"animate":"css"]({height:e-g+"%"},{queue:false,duration:a.animate})}g=e});else{k=this.value();l=this._valueMin();i=this._valueMax();e=i!==l?(k-l)/(i-l)*100:0;j[c.orientation==="horizontal"?"left":"bottom"]=e+"%";this.handle.stop(1,1)[f?"animate":"css"](j,a.animate);if(b==="min"&&this.orientation==="horizontal")this.range.stop(1,
|
401
431
|
1)[f?"animate":"css"]({width:e+"%"},a.animate);if(b==="max"&&this.orientation==="horizontal")this.range[f?"animate":"css"]({width:100-e+"%"},{queue:false,duration:a.animate});if(b==="min"&&this.orientation==="vertical")this.range.stop(1,1)[f?"animate":"css"]({height:e+"%"},a.animate);if(b==="max"&&this.orientation==="vertical")this.range[f?"animate":"css"]({height:100-e+"%"},{queue:false,duration:a.animate})}}});d.extend(d.ui.slider,{version:"1.8.13"})})(jQuery);
|
432
|
+
;/*
|
433
|
+
* jQuery UI Tabs 1.8.13
|
434
|
+
*
|
435
|
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
436
|
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
437
|
+
* http://jquery.org/license
|
438
|
+
*
|
439
|
+
* http://docs.jquery.com/UI/Tabs
|
440
|
+
*
|
441
|
+
* Depends:
|
442
|
+
* jquery.ui.core.js
|
443
|
+
* jquery.ui.widget.js
|
444
|
+
*/
|
445
|
+
(function(d,p){function u(){return++v}function w(){return++x}var v=0,x=0;d.widget("ui.tabs",{options:{add:null,ajaxOptions:null,cache:false,cookie:null,collapsible:false,disable:null,disabled:[],enable:null,event:"click",fx:null,idPrefix:"ui-tabs-",load:null,panelTemplate:"<div></div>",remove:null,select:null,show:null,spinner:"<em>Loading…</em>",tabTemplate:"<li><a href='#{href}'><span>#{label}</span></a></li>"},_create:function(){this._tabify(true)},_setOption:function(b,e){if(b=="selected")this.options.collapsible&&
|
446
|
+
e==this.options.selected||this.select(e);else{this.options[b]=e;this._tabify()}},_tabId:function(b){return b.title&&b.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uFFFF-]/g,"")||this.options.idPrefix+u()},_sanitizeSelector:function(b){return b.replace(/:/g,"\\:")},_cookie:function(){var b=this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+w());return d.cookie.apply(null,[b].concat(d.makeArray(arguments)))},_ui:function(b,e){return{tab:b,panel:e,index:this.anchors.index(b)}},_cleanup:function(){this.lis.filter(".ui-state-processing").removeClass("ui-state-processing").find("span:data(label.tabs)").each(function(){var b=
|
447
|
+
d(this);b.html(b.data("label.tabs")).removeData("label.tabs")})},_tabify:function(b){function e(g,f){g.css("display","");!d.support.opacity&&f.opacity&&g[0].style.removeAttribute("filter")}var a=this,c=this.options,h=/^#.+/;this.list=this.element.find("ol,ul").eq(0);this.lis=d(" > li:has(a[href])",this.list);this.anchors=this.lis.map(function(){return d("a",this)[0]});this.panels=d([]);this.anchors.each(function(g,f){var i=d(f).attr("href"),l=i.split("#")[0],q;if(l&&(l===location.toString().split("#")[0]||
|
448
|
+
(q=d("base")[0])&&l===q.href)){i=f.hash;f.href=i}if(h.test(i))a.panels=a.panels.add(a.element.find(a._sanitizeSelector(i)));else if(i&&i!=="#"){d.data(f,"href.tabs",i);d.data(f,"load.tabs",i.replace(/#.*$/,""));i=a._tabId(f);f.href="#"+i;f=a.element.find("#"+i);if(!f.length){f=d(c.panelTemplate).attr("id",i).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").insertAfter(a.panels[g-1]||a.list);f.data("destroy.tabs",true)}a.panels=a.panels.add(f)}else c.disabled.push(g)});if(b){this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all");
|
449
|
+
this.list.addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.lis.addClass("ui-state-default ui-corner-top");this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom");if(c.selected===p){location.hash&&this.anchors.each(function(g,f){if(f.hash==location.hash){c.selected=g;return false}});if(typeof c.selected!=="number"&&c.cookie)c.selected=parseInt(a._cookie(),10);if(typeof c.selected!=="number"&&this.lis.filter(".ui-tabs-selected").length)c.selected=
|
450
|
+
this.lis.index(this.lis.filter(".ui-tabs-selected"));c.selected=c.selected||(this.lis.length?0:-1)}else if(c.selected===null)c.selected=-1;c.selected=c.selected>=0&&this.anchors[c.selected]||c.selected<0?c.selected:0;c.disabled=d.unique(c.disabled.concat(d.map(this.lis.filter(".ui-state-disabled"),function(g){return a.lis.index(g)}))).sort();d.inArray(c.selected,c.disabled)!=-1&&c.disabled.splice(d.inArray(c.selected,c.disabled),1);this.panels.addClass("ui-tabs-hide");this.lis.removeClass("ui-tabs-selected ui-state-active");
|
451
|
+
if(c.selected>=0&&this.anchors.length){a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash)).removeClass("ui-tabs-hide");this.lis.eq(c.selected).addClass("ui-tabs-selected ui-state-active");a.element.queue("tabs",function(){a._trigger("show",null,a._ui(a.anchors[c.selected],a.element.find(a._sanitizeSelector(a.anchors[c.selected].hash))[0]))});this.load(c.selected)}d(window).bind("unload",function(){a.lis.add(a.anchors).unbind(".tabs");a.lis=a.anchors=a.panels=null})}else c.selected=this.lis.index(this.lis.filter(".ui-tabs-selected"));
|
452
|
+
this.element[c.collapsible?"addClass":"removeClass"]("ui-tabs-collapsible");c.cookie&&this._cookie(c.selected,c.cookie);b=0;for(var j;j=this.lis[b];b++)d(j)[d.inArray(b,c.disabled)!=-1&&!d(j).hasClass("ui-tabs-selected")?"addClass":"removeClass"]("ui-state-disabled");c.cache===false&&this.anchors.removeData("cache.tabs");this.lis.add(this.anchors).unbind(".tabs");if(c.event!=="mouseover"){var k=function(g,f){f.is(":not(.ui-state-disabled)")&&f.addClass("ui-state-"+g)},n=function(g,f){f.removeClass("ui-state-"+
|
453
|
+
g)};this.lis.bind("mouseover.tabs",function(){k("hover",d(this))});this.lis.bind("mouseout.tabs",function(){n("hover",d(this))});this.anchors.bind("focus.tabs",function(){k("focus",d(this).closest("li"))});this.anchors.bind("blur.tabs",function(){n("focus",d(this).closest("li"))})}var m,o;if(c.fx)if(d.isArray(c.fx)){m=c.fx[0];o=c.fx[1]}else m=o=c.fx;var r=o?function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.hide().removeClass("ui-tabs-hide").animate(o,o.duration||"normal",
|
454
|
+
function(){e(f,o);a._trigger("show",null,a._ui(g,f[0]))})}:function(g,f){d(g).closest("li").addClass("ui-tabs-selected ui-state-active");f.removeClass("ui-tabs-hide");a._trigger("show",null,a._ui(g,f[0]))},s=m?function(g,f){f.animate(m,m.duration||"normal",function(){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");e(f,m);a.element.dequeue("tabs")})}:function(g,f){a.lis.removeClass("ui-tabs-selected ui-state-active");f.addClass("ui-tabs-hide");a.element.dequeue("tabs")};
|
455
|
+
this.anchors.bind(c.event+".tabs",function(){var g=this,f=d(g).closest("li"),i=a.panels.filter(":not(.ui-tabs-hide)"),l=a.element.find(a._sanitizeSelector(g.hash));if(f.hasClass("ui-tabs-selected")&&!c.collapsible||f.hasClass("ui-state-disabled")||f.hasClass("ui-state-processing")||a.panels.filter(":animated").length||a._trigger("select",null,a._ui(this,l[0]))===false){this.blur();return false}c.selected=a.anchors.index(this);a.abort();if(c.collapsible)if(f.hasClass("ui-tabs-selected")){c.selected=
|
456
|
+
-1;c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){s(g,i)}).dequeue("tabs");this.blur();return false}else if(!i.length){c.cookie&&a._cookie(c.selected,c.cookie);a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this));this.blur();return false}c.cookie&&a._cookie(c.selected,c.cookie);if(l.length){i.length&&a.element.queue("tabs",function(){s(g,i)});a.element.queue("tabs",function(){r(g,l)});a.load(a.anchors.index(this))}else throw"jQuery UI Tabs: Mismatching fragment identifier.";
|
457
|
+
d.browser.msie&&this.blur()});this.anchors.bind("click.tabs",function(){return false})},_getIndex:function(b){if(typeof b=="string")b=this.anchors.index(this.anchors.filter("[href$="+b+"]"));return b},destroy:function(){var b=this.options;this.abort();this.element.unbind(".tabs").removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible").removeData("tabs");this.list.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all");this.anchors.each(function(){var e=
|
458
|
+
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b,
|
459
|
+
e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=c.element.find("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]);
|
460
|
+
j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
|
461
|
+
if(a.hasClass("ui-tabs-selected")&&this.anchors.length>1)this.select(b+(b+1<this.anchors.length?1:-1));e.disabled=d.map(d.grep(e.disabled,function(h){return h!=b}),function(h){return h>=b?--h:h});this._tabify();this._trigger("remove",null,this._ui(a.find("a")[0],c[0]));return this},enable:function(b){b=this._getIndex(b);var e=this.options;if(d.inArray(b,e.disabled)!=-1){this.lis.eq(b).removeClass("ui-state-disabled");e.disabled=d.grep(e.disabled,function(a){return a!=b});this._trigger("enable",null,
|
462
|
+
this._ui(this.anchors[b],this.panels[b]));return this}},disable:function(b){b=this._getIndex(b);var e=this.options;if(b!=e.selected){this.lis.eq(b).addClass("ui-state-disabled");e.disabled.push(b);e.disabled.sort();this._trigger("disable",null,this._ui(this.anchors[b],this.panels[b]))}return this},select:function(b){b=this._getIndex(b);if(b==-1)if(this.options.collapsible&&this.options.selected!=-1)b=this.options.selected;else return this;this.anchors.eq(b).trigger(this.options.event+".tabs");return this},
|
463
|
+
load:function(b){b=this._getIndex(b);var e=this,a=this.options,c=this.anchors.eq(b)[0],h=d.data(c,"load.tabs");this.abort();if(!h||this.element.queue("tabs").length!==0&&d.data(c,"cache.tabs"))this.element.dequeue("tabs");else{this.lis.eq(b).addClass("ui-state-processing");if(a.spinner){var j=d("span",c);j.data("label.tabs",j.html()).html(a.spinner)}this.xhr=d.ajax(d.extend({},a.ajaxOptions,{url:h,success:function(k,n){e.element.find(e._sanitizeSelector(c.hash)).html(k);e._cleanup();a.cache&&d.data(c,
|
464
|
+
"cache.tabs",true);e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.success(k,n)}catch(m){}},error:function(k,n){e._cleanup();e._trigger("load",null,e._ui(e.anchors[b],e.panels[b]));try{a.ajaxOptions.error(k,n,b,c)}catch(m){}}}));e.element.dequeue("tabs");return this}},abort:function(){this.element.queue([]);this.panels.stop(false,true);this.element.queue("tabs",this.element.queue("tabs").splice(-2,2));if(this.xhr){this.xhr.abort();delete this.xhr}this._cleanup();return this},
|
465
|
+
url:function(b,e){this.anchors.eq(b).removeData("cache.tabs").data("load.tabs",e);return this},length:function(){return this.anchors.length}});d.extend(d.ui.tabs,{version:"1.8.13"});d.extend(d.ui.tabs.prototype,{rotation:null,rotate:function(b,e){var a=this,c=this.options,h=a._rotate||(a._rotate=function(j){clearTimeout(a.rotation);a.rotation=setTimeout(function(){var k=c.selected;a.select(++k<a.anchors.length?k:0)},b);j&&j.stopPropagation()});e=a._unrotate||(a._unrotate=!e?function(j){j.clientX&&
|
466
|
+
a.rotate(null)}:function(){t=c.selected;h()});if(b){this.element.bind("tabsshow",h);this.anchors.bind(c.event+".tabs",e);h()}else{clearTimeout(a.rotation);this.element.unbind("tabsshow",h);this.anchors.unbind(c.event+".tabs",e);delete this._rotate;delete this._unrotate}return this}})})(jQuery);
|
402
467
|
;/*
|
403
468
|
* jQuery UI Datepicker 1.8.13
|
404
469
|
*
|
@@ -1,67 +1,137 @@
|
|
1
1
|
function load_report()
|
2
2
|
{
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
report_name = jQuery("#report option:selected").attr('name');
|
4
|
+
report_sql = jQuery("#report option:selected").attr('report_sql');
|
5
|
+
report_view = get_report_view();
|
6
|
+
|
7
|
+
if (!reported_selected(report_name)) return;
|
6
8
|
|
7
|
-
if (!reported_selected(report_name)) return;
|
8
|
-
|
9
9
|
var src = "http://"+host+":"+port+"/sql/reports/"+report_view+"/?report="+report_name+
|
10
10
|
"&start_date="+jQuery("#datepicker-start").val()+"&end_date="+jQuery("#datepicker-end").val()+"&report_sql="+
|
11
|
-
report_sql;
|
11
|
+
report_sql+"&caption="+report_name;
|
12
|
+
|
13
|
+
jQuery('iframe').attr('src', src);
|
14
|
+
|
15
|
+
_report_loaded = true;
|
16
|
+
}
|
17
|
+
|
18
|
+
function query()
|
19
|
+
{
|
20
|
+
sql = jQuery("#query-text").val();
|
21
|
+
db = jQuery("#query-db option:selected").attr('class_name');
|
12
22
|
|
23
|
+
if (!sql) {
|
24
|
+
alert('Invalid Query.');
|
25
|
+
}
|
26
|
+
|
27
|
+
var src = "http://"+host+":"+port+"/sql/reports/jqgrid/?&query="+sql+"&db="+db+"&caption=Ad Hoc Query&w="+$(document).width();
|
28
|
+
|
13
29
|
jQuery('iframe').attr('src', src);
|
14
30
|
|
15
|
-
|
31
|
+
save_query(sql);
|
32
|
+
load_saved_queries();
|
33
|
+
}
|
34
|
+
|
35
|
+
function save_query(sql)
|
36
|
+
{
|
37
|
+
if (typeof(localStorage) == 'undefined' ) {
|
38
|
+
alert('Your browser does not support HTML5 localStorage. Try upgrading.');
|
39
|
+
} else {
|
40
|
+
try {
|
41
|
+
localStorage.setItem(sql, sql); //saves to the database, “key”, “value”
|
42
|
+
} catch (e) {
|
43
|
+
if (e == QUOTA_EXCEEDED_ERR) {
|
44
|
+
alert('Quota exceeded!'); //data wasn’t successfully saved due to quota exceed so throw an error
|
45
|
+
}
|
46
|
+
}
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
function load_saved_queries()
|
51
|
+
{
|
52
|
+
if (typeof(localStorage) == 'undefined' ) {
|
53
|
+
alert('Your browser does not support HTML5 localStorage. Try upgrading.');
|
54
|
+
} else {
|
55
|
+
clear_saved_queries();
|
56
|
+
|
57
|
+
for (var i = 0; i < localStorage.length; i++) {
|
58
|
+
$('#saved-queries-list').
|
59
|
+
append($("<option></option>").
|
60
|
+
text(localStorage.getItem(localStorage.key(i))));
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
|
65
|
+
function clear_saved_queries()
|
66
|
+
{
|
67
|
+
$('#saved-queries-list')
|
68
|
+
.find('option')
|
69
|
+
.remove()
|
70
|
+
.end();
|
71
|
+
}
|
72
|
+
|
73
|
+
function deleted_saved_queries()
|
74
|
+
{
|
75
|
+
if (typeof(localStorage) == 'undefined' ) {
|
76
|
+
alert('Your browser does not support HTML5 localStorage. Try upgrading.');
|
77
|
+
} else {
|
78
|
+
localStorage.clear();
|
79
|
+
clear_saved_queries();
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
function reset_report()
|
84
|
+
{
|
85
|
+
jQuery('iframe').attr('src', "");
|
16
86
|
}
|
17
87
|
|
18
88
|
function print_report()
|
19
89
|
{
|
20
90
|
report_name = jQuery("#report option:selected").attr('name');
|
21
|
-
|
91
|
+
report_sql = jQuery("#report option:selected").attr('report_sql');
|
22
92
|
report_view = get_report_view();
|
23
|
-
|
93
|
+
|
24
94
|
if (!reported_selected(report_name)) return;
|
25
|
-
|
95
|
+
|
26
96
|
var src = "http://"+host+":"+port+"/sql/reports/print/?report="+report_name+
|
27
|
-
|
28
|
-
|
97
|
+
"&start_date="+jQuery("#datepicker-start").val()+"&end_date="+jQuery("#datepicker-end").val()+
|
98
|
+
"&report_sql="+report_sql+"&desc="+jQuery("#report option:selected").attr('desc');
|
29
99
|
window.open(src,'Old SQL Report')
|
30
100
|
}
|
31
101
|
|
32
102
|
function export_report_to_excel()
|
33
103
|
{
|
34
104
|
report_name = jQuery("#report option:selected").attr('name');
|
35
|
-
|
36
|
-
|
37
|
-
|
105
|
+
report_sql = jQuery("#report option:selected").attr('report_sql');
|
106
|
+
report_view = get_report_view();
|
107
|
+
|
38
108
|
if (!reported_selected(report_name)) return;
|
39
|
-
|
109
|
+
|
40
110
|
var src = "http://"+host+":"+port+"/sql/reports/query.csv/?report="+report_name+
|
41
|
-
|
42
|
-
|
111
|
+
"&start_date="+jQuery("#datepicker-start").val()+"&end_date="+jQuery("#datepicker-end").val()+
|
112
|
+
"&report_sql="+ report_sql+"&desc="+jQuery("#report option:selected").attr('desc');
|
43
113
|
window.open(src,'DB Report')
|
44
114
|
}
|
45
115
|
|
46
116
|
function reported_selected(report_name)
|
47
117
|
{
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
118
|
+
if (!report_name) {
|
119
|
+
alert("You must select a report, and run it before continuing.");
|
120
|
+
return false;
|
121
|
+
} else {
|
122
|
+
return true;
|
123
|
+
}
|
54
124
|
}
|
55
125
|
|
56
126
|
function get_report_view()
|
57
127
|
{
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
128
|
+
report_view = jQuery("#report option:selected").attr('report_view');
|
129
|
+
|
130
|
+
if (report_view) {
|
131
|
+
return report_view;
|
132
|
+
} else {
|
133
|
+
return default_report_view;
|
134
|
+
}
|
65
135
|
}
|
66
136
|
|
67
137
|
jQuery(document).ready(function($){
|
@@ -69,7 +139,7 @@ jQuery(document).ready(function($){
|
|
69
139
|
jQuery("#datepicker-start").datetimepicker( "option", "dateFormat", "yy/mm/dd" );
|
70
140
|
jQuery("#datepicker-end").datetimepicker();
|
71
141
|
jQuery("#datepicker-end").datetimepicker( "option", "dateFormat", "yy/mm/dd" );
|
72
|
-
|
142
|
+
|
73
143
|
var now = new Date();
|
74
144
|
var tomorrow = new Date();
|
75
145
|
var two_weeks_ago = new Date();
|
@@ -77,4 +147,32 @@ jQuery(document).ready(function($){
|
|
77
147
|
tomorrow.setDate(now.getDate() + 1);
|
78
148
|
jQuery("#datepicker-start").attr('value', two_weeks_ago.format("yyyy/mm/dd HH:MM:ss"));
|
79
149
|
jQuery("#datepicker-end").attr('value', tomorrow.format("yyyy/mm/dd HH:MM:ss"));
|
150
|
+
|
151
|
+
//Setup key listeners for the ad hoc query textarea
|
152
|
+
$('#query-text').keydown(function (e) {
|
153
|
+
if (e.ctrlKey && e.keyCode == 13) {
|
154
|
+
e.preventDefault();
|
155
|
+
query();
|
156
|
+
} else if (e.keyCode == 13) {
|
157
|
+
e.preventDefault();
|
158
|
+
$('#query-text').val($('#query-text').val()+' \n');
|
159
|
+
}
|
160
|
+
});
|
161
|
+
|
162
|
+
$('#tabs').bind('tabsselect', function(event, ui) {
|
163
|
+
// Objects available in the function context:
|
164
|
+
//ui.tab // anchor element of the selected (clicked) tab
|
165
|
+
//ui.panel // element, that contains the selected/clicked tab contents
|
166
|
+
//ui.index // zero-based index of the selected (clicked) tab
|
167
|
+
|
168
|
+
reset_report();
|
169
|
+
|
170
|
+
if (ui.index == 1) {
|
171
|
+
load_saved_queries();
|
172
|
+
}
|
173
|
+
});
|
174
|
+
});
|
175
|
+
|
176
|
+
$(function() {
|
177
|
+
$( "#tabs" ).tabs();
|
80
178
|
});
|