rails_db_admin 3.0.0 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_16x16.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_24x24.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_32x32.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_64x64.png +0 -0
- data/{public → app/assets}/images/icons/rails_db_admin/rails_db_admin_light_16x16.png +0 -0
- data/app/assets/images/splash/db_admin_splash.png +0 -0
- data/{public → app/assets}/images/splash/images/console-icon.png +0 -0
- data/{public → app/assets}/images/splash/images/data-model-icon.png +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/app.js +20 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/database_combo.js +1 -1
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/module.js +227 -135
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/queries_tree_menu.js +6 -6
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +383 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/readonly_table_data_grid.js +0 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/ParamWindow.js +426 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/ParamsManager.js +177 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/RolesPanel.js +95 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/SetDefaultWindow.js +244 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/Settings.js +155 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/reports/TreePanel.js +391 -0
- data/app/assets/javascripts/erp_app/desktop/applications/rails_db_admin/splash_screen.js +163 -0
- data/{public → app/assets}/javascripts/erp_app/desktop/applications/rails_db_admin/tables_tree_menu.js +5 -3
- data/app/assets/javascripts/erp_app/shared/MultiOption.js +151 -0
- data/app/assets/javascripts/erp_app/shared/ReportsParams.js +289 -0
- data/app/assets/javascripts/erp_app/shared/rails_db_admin_shared.js +13 -0
- data/{public/stylesheets/erp_app/desktop/applications/rails_db_admin/rails_db_admin.css → app/assets/stylesheets/erp_app/shared/rails_db_admin_shared.css} +5 -10
- data/app/controllers/rails_db_admin/erp_app/desktop/base_controller.rb +7 -6
- data/app/controllers/rails_db_admin/erp_app/desktop/queries_controller.rb +88 -74
- data/app/controllers/rails_db_admin/erp_app/desktop/reports_controller.rb +361 -30
- data/app/controllers/rails_db_admin/reports/base_controller.rb +105 -22
- data/app/mailers/report_mailer.rb +15 -0
- data/app/models/report.rb +227 -14
- data/app/views/rails_db_admin/reports/base/error_report.erb +27 -0
- data/app/views/report_mailer/email_report.html.erb +255 -0
- data/config/routes.rb +2 -1
- data/db/data_migrations/20110816005525_rails_db_admin_application.rb +6 -14
- data/db/data_migrations/20151015093724_add_report_role_type.rb +15 -0
- data/db/migrate/20121210160131_add_reports.rb +2 -0
- data/db/migrate/20150926061259_add_meta_data_to_reports.rb +9 -0
- data/lib/rails_db_admin.rb +4 -2
- data/lib/rails_db_admin/engine.rb +12 -4
- data/lib/rails_db_admin/erp_string_parser.rb +26 -0
- data/lib/rails_db_admin/extensions/railties/action_view/helpers/report_helper.rb +167 -10
- data/lib/rails_db_admin/extjs/json_data_builder.rb +36 -20
- data/lib/rails_db_admin/query_params.rb +14 -0
- data/lib/rails_db_admin/query_support.rb +56 -46
- data/lib/rails_db_admin/services/report_helper.rb +241 -0
- data/lib/rails_db_admin/version.rb +1 -1
- metadata +41 -30
- data/app/assets/javascripts/rails_db_admin/application.js +0 -9
- data/app/assets/stylesheets/rails_db_admin/application.css +0 -7
- data/app/views/rails_db_admin/reports/base/show_report.erb +0 -11
- data/db/migrate/20131112013053_add_rails_db_admin_missing_indexes.rb +0 -17
- data/lib/rails_db_admin/report_support.rb +0 -52
- data/public/images/splash/splash.png +0 -0
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/query_panel.js +0 -223
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/report_panel.js +0 -78
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/reports_tree_panel.js +0 -237
- data/public/javascripts/erp_app/desktop/applications/rails_db_admin/splash_screen.js +0 -136
@@ -0,0 +1,163 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.SplashScreen", {
|
2
|
+
title: 'Startup',
|
3
|
+
extend: "Ext.panel.Panel",
|
4
|
+
alias: 'widget.railsdbadmin_splash_screen',
|
5
|
+
bodyStyle: 'background-color: #f2f6fa;',
|
6
|
+
autoScroll: true,
|
7
|
+
items: [
|
8
|
+
{
|
9
|
+
html: "<div style='background-color: #f2f6fa; padding: 15px 50px 5px 50px;'><h2 style='margin: 3px 0px 0px 0px; color: #2fb3d4; text-align: center'>CompassAE Database Navigator</h2></div>"
|
10
|
+
},
|
11
|
+
{
|
12
|
+
xtype: 'image',
|
13
|
+
style: 'background-color: #f2f6fa; padding-left: 50%; margin-top: 20px; margin-left: -150px;',
|
14
|
+
src: '/assets/splash/db_admin_splash.png'
|
15
|
+
},
|
16
|
+
{
|
17
|
+
html: "<div style='background-color: #f2f6fa; padding: 15px 50px 5px 35px;'><p style='margin: 0px 0px 10px 5px; color: #222; text-align: center; font-size: 16px; font-weight: 300;'>Click on the shortcuts below to get started.</p></div>"
|
18
|
+
},
|
19
|
+
{
|
20
|
+
xtype: 'panel',
|
21
|
+
layout: 'column',
|
22
|
+
style: 'background-color: #f2f6fa; width: 450px; margin-top: 0px; margin-left: auto; margin-right: auto;',
|
23
|
+
items: [
|
24
|
+
|
25
|
+
{
|
26
|
+
xtype: 'panel',
|
27
|
+
height: 140,
|
28
|
+
width: 150,
|
29
|
+
style:{
|
30
|
+
margin: '',
|
31
|
+
cursor: 'pointer'
|
32
|
+
},
|
33
|
+
bodyStyle: 'background-color: #f2f6fa;',
|
34
|
+
border: false,
|
35
|
+
bodyBorder: false,
|
36
|
+
overCls: 'shortcut-hover',
|
37
|
+
items: [
|
38
|
+
{
|
39
|
+
xtype: 'image',
|
40
|
+
src: '/assets/splash/icons/console_icon.png',
|
41
|
+
height: 115,
|
42
|
+
width: 115,
|
43
|
+
style: 'background-color: #f2f6fa; margin-left: 15px;',
|
44
|
+
listeners: {
|
45
|
+
render: function (component) {
|
46
|
+
component.getEl().on('click', function (e) {
|
47
|
+
|
48
|
+
var module = compassDesktop.getModule('rails_db_admin-win');
|
49
|
+
module.addConsolePanel();
|
50
|
+
|
51
|
+
}, component);
|
52
|
+
|
53
|
+
component.getEl().on('mouseover', function () {
|
54
|
+
component.setSrc('/assets/splash/icons/console_icon_active.png');
|
55
|
+
}
|
56
|
+
);
|
57
|
+
component.getEl().on('mouseout', function () {
|
58
|
+
component.setSrc('/assets/splash/icons/console_icon.png');
|
59
|
+
}
|
60
|
+
);
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
{
|
65
|
+
html: "<p style='background-color: #f2f6fa; margin: 0px; text-align: center'>Open a console</p>"
|
66
|
+
}
|
67
|
+
]
|
68
|
+
},
|
69
|
+
|
70
|
+
{
|
71
|
+
xtype: 'panel',
|
72
|
+
height: 140,
|
73
|
+
width: 150,
|
74
|
+
style:{
|
75
|
+
margin: '',
|
76
|
+
cursor: 'pointer'
|
77
|
+
},
|
78
|
+
bodyStyle: 'background-color: #f2f6fa;',
|
79
|
+
border: false,
|
80
|
+
bodyBorder: false,
|
81
|
+
overCls: 'shortcut-hover',
|
82
|
+
items: [
|
83
|
+
{
|
84
|
+
xtype: 'image',
|
85
|
+
src: '/assets/splash/icons/db_icon.png',
|
86
|
+
height: 115,
|
87
|
+
width: 115,
|
88
|
+
style: 'background-color: #f2f6fa; margin-left: 15px;',
|
89
|
+
listeners: {
|
90
|
+
render: function (component) {
|
91
|
+
component.getEl().on('click', function (e) {
|
92
|
+
|
93
|
+
var module = compassDesktop.getModule('rails_db_admin-win');
|
94
|
+
module.openIframeInTab('CompassAE Documentation - Data Models', 'https://docs.mycompassagile.com');
|
95
|
+
|
96
|
+
}, component);
|
97
|
+
|
98
|
+
component.getEl().on('mouseover', function () {
|
99
|
+
component.setSrc('/assets/splash/icons/db_icon_active.png');
|
100
|
+
}
|
101
|
+
);
|
102
|
+
component.getEl().on('mouseout', function () {
|
103
|
+
component.setSrc('/assets/splash/icons/db_icon.png');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
html: "<p style='background-color: #f2f6fa; margin: 0px; text-align: center'>Browse the DB</p>"
|
111
|
+
}
|
112
|
+
]
|
113
|
+
},
|
114
|
+
{
|
115
|
+
xtype: 'panel',
|
116
|
+
height: 140,
|
117
|
+
width: 150,
|
118
|
+
style:{
|
119
|
+
margin: '',
|
120
|
+
cursor: 'pointer'
|
121
|
+
},
|
122
|
+
bodyStyle: 'background-color: #f2f6fa;',
|
123
|
+
border: false,
|
124
|
+
bodyBorder: false,
|
125
|
+
overCls: 'shortcut-hover',
|
126
|
+
items: [
|
127
|
+
{
|
128
|
+
xtype: 'image',
|
129
|
+
src: '/assets/splash/icons/help_icon.png',
|
130
|
+
height: 115,
|
131
|
+
width: 115,
|
132
|
+
style: 'background-color: #f2f6fa; margin-left: 15px;',
|
133
|
+
listeners: {
|
134
|
+
render: function (component) {
|
135
|
+
component.getEl().on('click', function (e) {
|
136
|
+
|
137
|
+
var module = compassDesktop.getModule('rails_db_admin-win');
|
138
|
+
module.openIframeInTab('CompassAE Documentation - Data Models', 'https://docs.mycompassagile.com');
|
139
|
+
|
140
|
+
}, component);
|
141
|
+
|
142
|
+
component.getEl().on('mouseover', function () {
|
143
|
+
component.setSrc('/assets/splash/icons/help_icon_active.png');
|
144
|
+
}
|
145
|
+
);
|
146
|
+
component.getEl().on('mouseout', function () {
|
147
|
+
component.setSrc('/assets/splash/icons/help_icon.png');
|
148
|
+
}
|
149
|
+
);
|
150
|
+
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
{
|
155
|
+
html: "<p style='background-color: #f2f6fa; margin: 0px; text-align: center'>Learn more</p>"
|
156
|
+
}
|
157
|
+
]
|
158
|
+
}
|
159
|
+
]
|
160
|
+
}
|
161
|
+
]
|
162
|
+
|
163
|
+
});
|
@@ -20,12 +20,14 @@ Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.TablesMenuTreePanel
|
|
20
20
|
change: function (comp, newValue, oldValue) {
|
21
21
|
var store = comp.up('treepanel').getStore();
|
22
22
|
|
23
|
-
setTimeout(function(){
|
24
|
-
if(!store.loading){
|
25
|
-
store.
|
23
|
+
setTimeout(function () {
|
24
|
+
if (!store.loading) {
|
25
|
+
store.load({params: {name: newValue}});
|
26
26
|
}
|
27
27
|
}, 500);
|
28
28
|
|
29
|
+
comp.up('treepanel').getRootNode().collapseChildren();
|
30
|
+
|
29
31
|
}
|
30
32
|
}
|
31
33
|
}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.ApplicationManagement.MultiOptions", {
|
2
|
+
alias: 'widget.applicationmanagementmultioptions',
|
3
|
+
extend: 'Ext.grid.Panel',
|
4
|
+
|
5
|
+
mixins: {
|
6
|
+
field: 'Ext.form.field.Field'
|
7
|
+
},
|
8
|
+
|
9
|
+
fieldLabel: false,
|
10
|
+
|
11
|
+
name: 'options',
|
12
|
+
|
13
|
+
multiSelect: false,
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @cfg {Object} field
|
17
|
+
* Field Object
|
18
|
+
*/
|
19
|
+
field: null,
|
20
|
+
|
21
|
+
fieldSelectOptions: null,
|
22
|
+
|
23
|
+
title: 'Options',
|
24
|
+
|
25
|
+
columns: [{
|
26
|
+
header: 'Name',
|
27
|
+
dataIndex: 'name',
|
28
|
+
flex: 1,
|
29
|
+
sortable: false,
|
30
|
+
menuDisabled: true,
|
31
|
+
editor: {
|
32
|
+
xtype: 'textfield',
|
33
|
+
allowBlank: false
|
34
|
+
}
|
35
|
+
}, {
|
36
|
+
xtype: 'actioncolumn',
|
37
|
+
width: 30,
|
38
|
+
sortable: false,
|
39
|
+
menuDisabled: true,
|
40
|
+
items: [{
|
41
|
+
icon: '/assets/icons/delete/delete_16x16.png',
|
42
|
+
tooltip: 'Remove Option',
|
43
|
+
scope: this,
|
44
|
+
handler: function(grid, rowIndex) {
|
45
|
+
grid.getStore().removeAt(rowIndex);
|
46
|
+
}
|
47
|
+
}]
|
48
|
+
}],
|
49
|
+
|
50
|
+
dockedItems: [{
|
51
|
+
xtype: 'toolbar',
|
52
|
+
items: [{
|
53
|
+
text: 'Add',
|
54
|
+
iconCls: 'icon-add',
|
55
|
+
handler: function(btn) {
|
56
|
+
var grid = btn.up('grid');
|
57
|
+
grid.getStore().insert(0, {
|
58
|
+
name: ''
|
59
|
+
});
|
60
|
+
grid.getPlugin().startEditByPosition({
|
61
|
+
row: 0,
|
62
|
+
column: 0
|
63
|
+
});
|
64
|
+
}
|
65
|
+
}]
|
66
|
+
}],
|
67
|
+
|
68
|
+
plugins: {
|
69
|
+
ptype: 'cellediting',
|
70
|
+
clicksToEdit: 1,
|
71
|
+
listeners: {
|
72
|
+
edit: function(editor, context) {
|
73
|
+
context.record.commit();
|
74
|
+
}
|
75
|
+
}
|
76
|
+
},
|
77
|
+
|
78
|
+
viewConfig: {
|
79
|
+
plugins: {
|
80
|
+
ptype: 'gridviewdragdrop',
|
81
|
+
dragGroup: 'optionsGrid',
|
82
|
+
dropGroup: 'optionsGrid'
|
83
|
+
}
|
84
|
+
},
|
85
|
+
|
86
|
+
initComponent: function() {
|
87
|
+
var me = this;
|
88
|
+
|
89
|
+
me.store = Ext.create('Ext.data.ArrayStore', {
|
90
|
+
fields: ['name'],
|
91
|
+
data: {
|
92
|
+
options: me.getOptions()
|
93
|
+
},
|
94
|
+
proxy: {
|
95
|
+
type: 'memory',
|
96
|
+
reader: {
|
97
|
+
type: 'json',
|
98
|
+
root: 'options'
|
99
|
+
}
|
100
|
+
}
|
101
|
+
});
|
102
|
+
|
103
|
+
me.callParent(arguments);
|
104
|
+
},
|
105
|
+
|
106
|
+
getOptions: function() {
|
107
|
+
var me = this;
|
108
|
+
var options = [];
|
109
|
+
|
110
|
+
switch (me.field.internalIdentifier) {
|
111
|
+
case 'radio':
|
112
|
+
case 'check':
|
113
|
+
Ext.each(me.field.items.items, function(item, index) {
|
114
|
+
options.push({
|
115
|
+
name: item.boxLabel
|
116
|
+
});
|
117
|
+
});
|
118
|
+
break;
|
119
|
+
case 'select':
|
120
|
+
Ext.each(me.field.store.data.items, function(item, index) {
|
121
|
+
options.push({
|
122
|
+
name: item.data.display
|
123
|
+
});
|
124
|
+
});
|
125
|
+
break;
|
126
|
+
case 'question':
|
127
|
+
Ext.each(me.field.answers, function(answer, index) {
|
128
|
+
options.push({
|
129
|
+
name: answer
|
130
|
+
});
|
131
|
+
});
|
132
|
+
break;
|
133
|
+
}
|
134
|
+
|
135
|
+
return options;
|
136
|
+
},
|
137
|
+
|
138
|
+
getValue: function() {
|
139
|
+
return Ext.encode(this.getStore().collect('name'));
|
140
|
+
},
|
141
|
+
|
142
|
+
getSubmitData: function() {
|
143
|
+
var me = this,
|
144
|
+
data = null;
|
145
|
+
if (!me.disabled && me.submitValue) {
|
146
|
+
data = {};
|
147
|
+
data[me.getName()] = me.getValue();
|
148
|
+
}
|
149
|
+
return data;
|
150
|
+
}
|
151
|
+
});
|
@@ -0,0 +1,289 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Shared.ReportsParams", {
|
2
|
+
extend: "Ext.form.Panel",
|
3
|
+
alias: 'widget.reportparamspanel',
|
4
|
+
params: [],
|
5
|
+
bodyPadding: '0 0 0 10',
|
6
|
+
layout: {
|
7
|
+
type: 'vbox'
|
8
|
+
},
|
9
|
+
items: [],
|
10
|
+
slice: 3,
|
11
|
+
|
12
|
+
initComponent: function() {
|
13
|
+
var me = this;
|
14
|
+
me.items = [];
|
15
|
+
|
16
|
+
me.params.eachSlice(me.slice, function(slice) {
|
17
|
+
var container = {
|
18
|
+
xtype: 'container',
|
19
|
+
layout: 'hbox',
|
20
|
+
style: {
|
21
|
+
marginBottom: '5px'
|
22
|
+
},
|
23
|
+
defaults: {
|
24
|
+
labelWidth: 80,
|
25
|
+
style: {
|
26
|
+
marginRight: '20px'
|
27
|
+
}
|
28
|
+
},
|
29
|
+
items: []
|
30
|
+
};
|
31
|
+
|
32
|
+
Ext.each(slice, function(param) {
|
33
|
+
var defaultValue = param.default_value;
|
34
|
+
|
35
|
+
switch (param.type) {
|
36
|
+
case 'text':
|
37
|
+
container.items.push({
|
38
|
+
xtype: 'textfield',
|
39
|
+
fieldLabel: param.display_name,
|
40
|
+
allowBlank: (param.required !== true),
|
41
|
+
style: {
|
42
|
+
marginRight: '20px'
|
43
|
+
},
|
44
|
+
name: param.name,
|
45
|
+
value: param.default_value
|
46
|
+
});
|
47
|
+
break;
|
48
|
+
case 'date':
|
49
|
+
var today = new Date();
|
50
|
+
var defaultDate = null;
|
51
|
+
|
52
|
+
if (param.options && param.options.onlyWeeks == 'on') {
|
53
|
+
defaultDate = new Date(today.getFullYear(), today.getMonth(), (today.getDate() - today.getDay() + 1));
|
54
|
+
|
55
|
+
if (defaultValue == 'previous') {
|
56
|
+
defaultDate = Ext.Date.subtract(defaultDate, Ext.Date.DAY, 7);
|
57
|
+
} else if (defaultValue == 'next') {
|
58
|
+
defaultDate = Ext.Date.add(defaultDate, Ext.Date.DAY, 7);
|
59
|
+
}
|
60
|
+
|
61
|
+
container.items.push({
|
62
|
+
xtype: 'datefield',
|
63
|
+
allowBlank: (param.required !== true),
|
64
|
+
labelWidth: 80,
|
65
|
+
style: {
|
66
|
+
marginRight: '20px'
|
67
|
+
},
|
68
|
+
format: 'm/d/Y',
|
69
|
+
fieldLabel: param.display_name,
|
70
|
+
name: param.name,
|
71
|
+
disabledDays: [0, 2, 3, 4, 5, 6],
|
72
|
+
value: defaultDate
|
73
|
+
});
|
74
|
+
|
75
|
+
} else if (param.options && param.options.onlyMonths == 'on') {
|
76
|
+
defaultDate = new Date(today.getFullYear(), today.getMonth(), 1);
|
77
|
+
|
78
|
+
if (defaultValue == 'previous') {
|
79
|
+
defaultDate = Ext.Date.subtract(defaultDate, Ext.Date.MONTH, 1);
|
80
|
+
} else if (defaultValue == 'next') {
|
81
|
+
defaultDate = Ext.Date.add(defaultDate, Ext.Date.MONTH, 1);
|
82
|
+
}
|
83
|
+
|
84
|
+
container.items.push({
|
85
|
+
xtype: 'monthfield',
|
86
|
+
allowBlank: (param.required !== true),
|
87
|
+
labelWidth: 80,
|
88
|
+
style: {
|
89
|
+
marginRight: '20px'
|
90
|
+
},
|
91
|
+
format: 'm/d/Y',
|
92
|
+
fieldLabel: param.display_name,
|
93
|
+
name: param.name,
|
94
|
+
value: defaultDate
|
95
|
+
});
|
96
|
+
|
97
|
+
} else {
|
98
|
+
defaultDate = null;
|
99
|
+
|
100
|
+
if (defaultValue == 'previous') {
|
101
|
+
defaultDate = Ext.Date.subtract(new Date(), Ext.Date.DAY, 1);
|
102
|
+
} else if (defaultValue == 'next') {
|
103
|
+
defaultDate = Ext.Date.add(new Date(), Ext.Date.DAY, 1);
|
104
|
+
} else if (defaultValue == 'current') {
|
105
|
+
defaultDate = new Date();
|
106
|
+
}
|
107
|
+
|
108
|
+
container.items.push({
|
109
|
+
xtype: 'datefield',
|
110
|
+
allowBlank: (param.required !== true),
|
111
|
+
labelWidth: 80,
|
112
|
+
style: {
|
113
|
+
marginRight: '20px'
|
114
|
+
},
|
115
|
+
format: 'm/d/Y',
|
116
|
+
fieldLabel: param.display_name,
|
117
|
+
name: param.name,
|
118
|
+
value: defaultDate
|
119
|
+
});
|
120
|
+
}
|
121
|
+
|
122
|
+
break;
|
123
|
+
case 'time':
|
124
|
+
container.items.push({
|
125
|
+
xtype: 'timefield',
|
126
|
+
fieldLabel: param.display_name,
|
127
|
+
allowBlank: (param.required !== true),
|
128
|
+
style: {
|
129
|
+
marginRight: '20px'
|
130
|
+
},
|
131
|
+
name: param.name,
|
132
|
+
value: param.default_value
|
133
|
+
});
|
134
|
+
break;
|
135
|
+
case 'select':
|
136
|
+
var values = (!param.options.values) ? [] : eval(param.options.values);
|
137
|
+
var storeData = [];
|
138
|
+
for (var i = 0; i < values.length; i++) {
|
139
|
+
storeData.push([values[i]]);
|
140
|
+
}
|
141
|
+
|
142
|
+
var arrayStore = Ext.create('Ext.data.ArrayStore', {
|
143
|
+
fields: ['name'],
|
144
|
+
data: storeData
|
145
|
+
});
|
146
|
+
|
147
|
+
container.items.push({
|
148
|
+
xtype: 'combo',
|
149
|
+
allowBlank: (param.required !== true),
|
150
|
+
queryMode: 'local',
|
151
|
+
multiSelect: (param.options.multiSelect == 'on'),
|
152
|
+
displayField: 'name',
|
153
|
+
valueField: 'name',
|
154
|
+
fieldLabel: param.display_name,
|
155
|
+
name: param.name,
|
156
|
+
store: arrayStore,
|
157
|
+
value: defaultValue,
|
158
|
+
listeners: {
|
159
|
+
select: function(combo, records) {
|
160
|
+
if (combo.value.length > 1 && Ext.Array.contains(combo.value, "All")) {
|
161
|
+
combo.setValue('All');
|
162
|
+
}
|
163
|
+
}
|
164
|
+
}
|
165
|
+
});
|
166
|
+
break;
|
167
|
+
case 'data_record':
|
168
|
+
// make sure we have all the options we need
|
169
|
+
if (param.options && param.options.businessModule) {
|
170
|
+
container.items.push({
|
171
|
+
xtype: 'businessmoduledatarecordfield',
|
172
|
+
itemId: param.name,
|
173
|
+
multiSelect: (param.options.multiSelect == 'on'),
|
174
|
+
allowBlank: (param.required !== true),
|
175
|
+
fieldLabel: param.display_name,
|
176
|
+
extraParams: {
|
177
|
+
business_module_iid: param.options.businessModule
|
178
|
+
},
|
179
|
+
name: param.name,
|
180
|
+
value: defaultValue,
|
181
|
+
listeners: {
|
182
|
+
afterrender: function(combo) {
|
183
|
+
combo.store.load();
|
184
|
+
},
|
185
|
+
select: function(combo, records) {
|
186
|
+
if (combo.value.length > 1 && Ext.Array.contains(combo.value, "All")) {
|
187
|
+
combo.setValue('All');
|
188
|
+
}
|
189
|
+
}
|
190
|
+
}
|
191
|
+
});
|
192
|
+
}
|
193
|
+
|
194
|
+
break;
|
195
|
+
case 'service':
|
196
|
+
// make sure we have all the options we need
|
197
|
+
if (param.options.root && param.options.displayField && param.options.valueField) {
|
198
|
+
container.items.push({
|
199
|
+
xtype: 'combo',
|
200
|
+
fieldLabel: param.display_name,
|
201
|
+
name: param.name,
|
202
|
+
allowBlank: (param.required !== true),
|
203
|
+
value: defaultValue,
|
204
|
+
multiSelect: (param.options.multiSelect == 'on'),
|
205
|
+
displayField: param.options.displayField,
|
206
|
+
valueField: param.options.valueField,
|
207
|
+
queryMode: 'remote',
|
208
|
+
store: {
|
209
|
+
proxy: {
|
210
|
+
type: 'ajax',
|
211
|
+
url: param.options.url,
|
212
|
+
reader: {
|
213
|
+
type: 'json',
|
214
|
+
root: param.options.root
|
215
|
+
}
|
216
|
+
},
|
217
|
+
fields: [
|
218
|
+
param.options.displayField,
|
219
|
+
param.options.valueField
|
220
|
+
],
|
221
|
+
autoLoad: true
|
222
|
+
}
|
223
|
+
});
|
224
|
+
}
|
225
|
+
|
226
|
+
break;
|
227
|
+
}
|
228
|
+
});
|
229
|
+
|
230
|
+
me.items.push(container);
|
231
|
+
});
|
232
|
+
|
233
|
+
me.callParent();
|
234
|
+
},
|
235
|
+
|
236
|
+
getReportParams: function() {
|
237
|
+
var me = this,
|
238
|
+
paramsObj = {};
|
239
|
+
|
240
|
+
Ext.Array.each(me.query('field'), function(field) {
|
241
|
+
// if field has no value set it to empty string to make the erb parser happy
|
242
|
+
if (field.value) {
|
243
|
+
switch (field.xtype) {
|
244
|
+
case 'textfield':
|
245
|
+
paramsObj[field.name] = Ext.String.trim(field.value);
|
246
|
+
break;
|
247
|
+
case 'combo':
|
248
|
+
case 'businessmoduledatarecordfield':
|
249
|
+
var fieldName = (field.xtype == 'combo' ? 'name' : 'id');
|
250
|
+
if (Ext.Array.contains(field.value, "All")) {
|
251
|
+
var allValues = Ext.Array.remove(field.store.collect(fieldName), "All");
|
252
|
+
paramsObj[field.name] = allValues.join(',');
|
253
|
+
} else {
|
254
|
+
if (field.value.constructor === Array) {
|
255
|
+
paramsObj[field.name] = (field.value.length === 0) ? 'null' : field.value.join(',');
|
256
|
+
} else {
|
257
|
+
paramsObj[field.name] = field.value;
|
258
|
+
}
|
259
|
+
}
|
260
|
+
break;
|
261
|
+
case 'timefield':
|
262
|
+
if (field.value) {
|
263
|
+
paramsObj[field.name] = Ext.Date.format(new Date(field.value), 'H:i:s');
|
264
|
+
}
|
265
|
+
|
266
|
+
break;
|
267
|
+
case 'datefield':
|
268
|
+
case 'monthfield':
|
269
|
+
if (field.value) {
|
270
|
+
paramsObj[field.name] = Ext.Date.format(new Date(field.value), 'c');
|
271
|
+
}
|
272
|
+
|
273
|
+
break;
|
274
|
+
}
|
275
|
+
} else {
|
276
|
+
paramsObj[field.name] = '';
|
277
|
+
}
|
278
|
+
});
|
279
|
+
|
280
|
+
return paramsObj;
|
281
|
+
},
|
282
|
+
|
283
|
+
clearReportParams: function() {
|
284
|
+
var me = this;
|
285
|
+
Ext.each(me.query('field'), function(field) {
|
286
|
+
field.setValue('');
|
287
|
+
});
|
288
|
+
}
|
289
|
+
});
|