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,155 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.Reports.Settings", {
|
2
|
+
extend: "Ext.form.Panel",
|
3
|
+
alias: 'widget.railsdbadminreportssettings',
|
4
|
+
title: 'Report Settings',
|
5
|
+
report: null,
|
6
|
+
reportId: null,
|
7
|
+
labelWidth: 110,
|
8
|
+
frame: false,
|
9
|
+
bodyStyle: 'padding:5px 5px 0',
|
10
|
+
url: '/rails_db_admin/erp_app/desktop/reports/update',
|
11
|
+
tbar: [
|
12
|
+
{
|
13
|
+
xtype: 'button',
|
14
|
+
text: 'Save',
|
15
|
+
iconCls: 'icon-save',
|
16
|
+
handler: function (btn) {
|
17
|
+
var me = btn.up('railsdbadminreportssettings');
|
18
|
+
|
19
|
+
if (me.isValid()) {
|
20
|
+
me.getForm().submit({
|
21
|
+
waitMsg: 'Updating Report...',
|
22
|
+
params: {
|
23
|
+
id: me.reportId
|
24
|
+
},
|
25
|
+
success: function (form, action) {
|
26
|
+
if (action.result.success) {
|
27
|
+
var values = form.getValues();
|
28
|
+
|
29
|
+
me.report.set('internalIdentifier', values['report_iid']);
|
30
|
+
me.report.set('text', values['report_name']);
|
31
|
+
me.report.set('reportName', values['report_name']);
|
32
|
+
me.report.set('reportMetaData', values);
|
33
|
+
me.report.commit(false);
|
34
|
+
}
|
35
|
+
else {
|
36
|
+
Ext.Msg.error("Error", obj.message);
|
37
|
+
}
|
38
|
+
},
|
39
|
+
failure: function (form, action) {
|
40
|
+
if (action.result.message) {
|
41
|
+
Ext.Msg.error("Error", action.result.message);
|
42
|
+
}
|
43
|
+
else {
|
44
|
+
Ext.Msg.error("Error", "Error updating report.");
|
45
|
+
}
|
46
|
+
}
|
47
|
+
});
|
48
|
+
}
|
49
|
+
}
|
50
|
+
}
|
51
|
+
],
|
52
|
+
|
53
|
+
items: [
|
54
|
+
{
|
55
|
+
xtype: 'textfield',
|
56
|
+
fieldLabel: 'Report Name',
|
57
|
+
name: 'report_name',
|
58
|
+
allowBlank: false
|
59
|
+
},
|
60
|
+
{
|
61
|
+
xtype: 'textfield',
|
62
|
+
fieldLabel: 'Unique Name',
|
63
|
+
name: 'report_iid',
|
64
|
+
allowBlank: false
|
65
|
+
},
|
66
|
+
{
|
67
|
+
xtype: 'checkbox',
|
68
|
+
fieldLabel: 'Auto Execute',
|
69
|
+
name: 'auto_execute'
|
70
|
+
},
|
71
|
+
{
|
72
|
+
xtype: 'fieldset',
|
73
|
+
title: 'Print Settings',
|
74
|
+
defaults: {
|
75
|
+
width: 245
|
76
|
+
},
|
77
|
+
items: [
|
78
|
+
{
|
79
|
+
xtype: 'combo',
|
80
|
+
fieldLabel: 'Orientation',
|
81
|
+
name: 'print_orientation',
|
82
|
+
queryMode: 'local',
|
83
|
+
forceSelection: true,
|
84
|
+
selectOnFocus: true,
|
85
|
+
displayField: 'orientation',
|
86
|
+
valueField: 'orientation',
|
87
|
+
store: new Ext.data.ArrayStore({
|
88
|
+
fields: ['orientation'],
|
89
|
+
data: [['Portrait'],['Landscape']]
|
90
|
+
})
|
91
|
+
},
|
92
|
+
{
|
93
|
+
xtype: 'combo',
|
94
|
+
fieldLabel: 'Page Size',
|
95
|
+
name: 'print_page_size',
|
96
|
+
displayField: 'pageSize',
|
97
|
+
valueField: 'size',
|
98
|
+
store: {
|
99
|
+
fields: ['pageSize', 'size'],
|
100
|
+
data: [
|
101
|
+
{pageSize: 'A4', size: 'A4'},
|
102
|
+
{pageSize: 'A3', size: 'A3'},
|
103
|
+
{pageSize: 'A2', size: 'A2'},
|
104
|
+
{pageSize: 'A1', size: 'A1'},
|
105
|
+
{pageSize: 'A0', size: 'A0'}
|
106
|
+
]
|
107
|
+
}
|
108
|
+
},
|
109
|
+
{
|
110
|
+
xtype: 'textfield',
|
111
|
+
fieldLabel: 'Top Margin',
|
112
|
+
name: 'print_margin_top'
|
113
|
+
},
|
114
|
+
{
|
115
|
+
xtype: 'textfield',
|
116
|
+
fieldLabel: 'Right Margin',
|
117
|
+
name: 'print_margin_right'
|
118
|
+
|
119
|
+
},
|
120
|
+
{
|
121
|
+
xtype: 'textfield',
|
122
|
+
fieldLabel: 'Bottom Margin',
|
123
|
+
name: 'print_margin_bottom'
|
124
|
+
},
|
125
|
+
{
|
126
|
+
xtype: 'textfield',
|
127
|
+
fieldLabel: 'Left Margin',
|
128
|
+
name: 'print_margin_left'
|
129
|
+
}
|
130
|
+
]
|
131
|
+
}
|
132
|
+
],
|
133
|
+
|
134
|
+
setReportSettings: function (report) {
|
135
|
+
var me = this,
|
136
|
+
reportMetaData = Ext.clone(report.get('reportMetaData'));
|
137
|
+
|
138
|
+
me.report = report;
|
139
|
+
me.reportId = report.get('reportId');
|
140
|
+
|
141
|
+
reportMetaData = Ext.applyIf(reportMetaData, {
|
142
|
+
report_name: report.get('reportName'),
|
143
|
+
report_iid: report.get('internalIdentifier'),
|
144
|
+
print_page_size: 'A4',
|
145
|
+
print_margin_top: 10,
|
146
|
+
print_margin_right: 10,
|
147
|
+
print_margin_bottom: 10,
|
148
|
+
print_margin_left: 10,
|
149
|
+
print_orientation: 'Portrait',
|
150
|
+
auto_execute: false
|
151
|
+
});
|
152
|
+
|
153
|
+
me.getForm().setValues(reportMetaData);
|
154
|
+
}
|
155
|
+
});
|
@@ -0,0 +1,391 @@
|
|
1
|
+
Ext.define("Compass.ErpApp.Desktop.Applications.RailsDbAdmin.Reports.TreePanel", {
|
2
|
+
extend: "Compass.ErpApp.Shared.FileManagerTree",
|
3
|
+
alias: 'widget.railsdbadmin_reportstreepanel',
|
4
|
+
|
5
|
+
newReport: function () {
|
6
|
+
var me = this;
|
7
|
+
|
8
|
+
Ext.create("Ext.window.Window", {
|
9
|
+
title: 'New Report',
|
10
|
+
plain: true,
|
11
|
+
buttonAlign: 'center',
|
12
|
+
defaultFocus: 'title',
|
13
|
+
items: Ext.create('Ext.FormPanel', {
|
14
|
+
labelWidth: 110,
|
15
|
+
frame: false,
|
16
|
+
bodyStyle: 'padding:5px 5px 0',
|
17
|
+
url: '/rails_db_admin/erp_app/desktop/reports/create',
|
18
|
+
defaults: {
|
19
|
+
width: 225
|
20
|
+
},
|
21
|
+
items: [
|
22
|
+
{
|
23
|
+
xtype: 'textfield',
|
24
|
+
fieldLabel: 'Title',
|
25
|
+
allowBlank: false,
|
26
|
+
name: 'name',
|
27
|
+
itemId: 'title'
|
28
|
+
},
|
29
|
+
{
|
30
|
+
xtype: 'textfield',
|
31
|
+
fieldLabel: 'Unique Name',
|
32
|
+
allowBlank: false,
|
33
|
+
name: 'internal_identifier'
|
34
|
+
}
|
35
|
+
]
|
36
|
+
}),
|
37
|
+
buttons: [
|
38
|
+
{
|
39
|
+
text: 'Submit',
|
40
|
+
listeners: {
|
41
|
+
'click': function (button) {
|
42
|
+
var window = button.up('window');
|
43
|
+
var formPanel = window.down('form');
|
44
|
+
formPanel.getForm().submit({
|
45
|
+
waitMsg: 'Creating Report...',
|
46
|
+
success: function (form, action) {
|
47
|
+
var obj = Ext.decode(action.response.responseText);
|
48
|
+
if (obj.success) {
|
49
|
+
button.up('window').close();
|
50
|
+
me.getStore().load();
|
51
|
+
}
|
52
|
+
else {
|
53
|
+
Ext.Msg.alert("Error", obj.msg);
|
54
|
+
}
|
55
|
+
},
|
56
|
+
failure: function (form, action) {
|
57
|
+
var obj = Ext.decode(action.response.responseText);
|
58
|
+
if (obj.msg) {
|
59
|
+
Ext.Msg.alert("Error", obj.msg);
|
60
|
+
}
|
61
|
+
else {
|
62
|
+
Ext.Msg.alert("Error", "Error creating report.");
|
63
|
+
}
|
64
|
+
}
|
65
|
+
});
|
66
|
+
}
|
67
|
+
}
|
68
|
+
},
|
69
|
+
{
|
70
|
+
text: 'Close',
|
71
|
+
handler: function (btn) {
|
72
|
+
btn.up('window').close();
|
73
|
+
}
|
74
|
+
}
|
75
|
+
]
|
76
|
+
}).show();
|
77
|
+
},
|
78
|
+
|
79
|
+
uploadReport: function () {
|
80
|
+
var me = this;
|
81
|
+
Ext.create("Ext.window.Window", {
|
82
|
+
modal: true,
|
83
|
+
title: 'New Report',
|
84
|
+
buttonAlign: 'center',
|
85
|
+
items: {
|
86
|
+
xtype: 'form',
|
87
|
+
timeout: 300,
|
88
|
+
frame: false,
|
89
|
+
bodyStyle: 'padding:5px 5px 0',
|
90
|
+
fileUpload: true,
|
91
|
+
url: '/rails_db_admin/erp_app/desktop/reports/create',
|
92
|
+
items: [
|
93
|
+
{
|
94
|
+
xtype: 'fileuploadfield',
|
95
|
+
width: '350px',
|
96
|
+
fieldLabel: 'Upload Report',
|
97
|
+
buttonText: 'Upload',
|
98
|
+
buttonOnly: false,
|
99
|
+
allowBlank: true,
|
100
|
+
name: 'report_data'
|
101
|
+
}
|
102
|
+
]
|
103
|
+
},
|
104
|
+
buttons: [
|
105
|
+
{
|
106
|
+
text: 'Submit',
|
107
|
+
listeners: {
|
108
|
+
'click': function (button) {
|
109
|
+
var window = this.up('window'),
|
110
|
+
form = window.query('form')[0].getForm();
|
111
|
+
|
112
|
+
if (form.isValid()) {
|
113
|
+
form.submit({
|
114
|
+
timeout: 300000,
|
115
|
+
waitMsg: 'Creating report...',
|
116
|
+
success: function (form, action) {
|
117
|
+
var obj = Ext.decode(action.response.responseText);
|
118
|
+
if (obj.success) {
|
119
|
+
me.getStore().load();
|
120
|
+
}
|
121
|
+
window.close();
|
122
|
+
},
|
123
|
+
failure: function (form, action) {
|
124
|
+
Ext.Msg.alert("Error", "Error creating report");
|
125
|
+
}
|
126
|
+
});
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
},
|
131
|
+
{
|
132
|
+
text: 'Close',
|
133
|
+
handler: function (btn) {
|
134
|
+
btn.up('window').close();
|
135
|
+
}
|
136
|
+
}
|
137
|
+
]
|
138
|
+
}).show();
|
139
|
+
},
|
140
|
+
|
141
|
+
deleteReport: function (id) {
|
142
|
+
var me = this;
|
143
|
+
|
144
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this report?', function (btn) {
|
145
|
+
if (btn === 'no') {
|
146
|
+
return false;
|
147
|
+
}
|
148
|
+
else if (btn === 'yes') {
|
149
|
+
var waitMsg = Ext.Msg.wait("Deleting report...", "Status");
|
150
|
+
Ext.Ajax.request({
|
151
|
+
url: '/rails_db_admin/erp_app/desktop/reports/delete',
|
152
|
+
params: {
|
153
|
+
id: id
|
154
|
+
},
|
155
|
+
success: function (responseObject) {
|
156
|
+
waitMsg.close();
|
157
|
+
var obj = Ext.decode(responseObject.responseText);
|
158
|
+
if (obj.success) {
|
159
|
+
me.getStore().load();
|
160
|
+
}
|
161
|
+
else {
|
162
|
+
Ext.Msg.alert('Status', 'Error deleting report');
|
163
|
+
}
|
164
|
+
},
|
165
|
+
failure: function () {
|
166
|
+
waitMsg.close();
|
167
|
+
Ext.Msg.alert('Status', 'Error deleting report');
|
168
|
+
}
|
169
|
+
});
|
170
|
+
}
|
171
|
+
});
|
172
|
+
},
|
173
|
+
|
174
|
+
editQuery: function (report) {
|
175
|
+
var me = this;
|
176
|
+
var waitMsg = Ext.Msg.wait("Loading query...", "Status");
|
177
|
+
|
178
|
+
Ext.Ajax.request({
|
179
|
+
url: '/rails_db_admin/erp_app/desktop/reports/query',
|
180
|
+
params: {
|
181
|
+
id: report.get('reportId')
|
182
|
+
},
|
183
|
+
success: function (responseObject) {
|
184
|
+
waitMsg.close();
|
185
|
+
|
186
|
+
var obj = Ext.decode(responseObject.responseText);
|
187
|
+
if (obj.success) {
|
188
|
+
me.initialConfig.module.editQuery(report, obj.query);
|
189
|
+
}
|
190
|
+
else {
|
191
|
+
Ext.Msg.error('Status', 'Error loading report');
|
192
|
+
}
|
193
|
+
},
|
194
|
+
failure: function () {
|
195
|
+
waitMsg.close();
|
196
|
+
Ext.Msg.error('Status', 'Error loading report');
|
197
|
+
}
|
198
|
+
});
|
199
|
+
},
|
200
|
+
|
201
|
+
loadReport: function(report){
|
202
|
+
var me = this;
|
203
|
+
|
204
|
+
me.initialConfig.module.loadReport(report);
|
205
|
+
},
|
206
|
+
|
207
|
+
exportReport: function (reportId) {
|
208
|
+
var waitMsg = Ext.Msg.wait("Exporting Report...", "Status");
|
209
|
+
|
210
|
+
window.open('/rails_db_admin/erp_app/desktop/reports/export?id=' + reportId, '_blank');
|
211
|
+
|
212
|
+
waitMsg.hide();
|
213
|
+
},
|
214
|
+
|
215
|
+
constructor: function (config) {
|
216
|
+
var me = this;
|
217
|
+
|
218
|
+
config = Ext.apply({
|
219
|
+
autoLoadRoot: true,
|
220
|
+
rootVisible: true,
|
221
|
+
multiSelect: true,
|
222
|
+
handleRootContextMenu: true,
|
223
|
+
addViewContentsToContextMenu: true,
|
224
|
+
title: 'Reports',
|
225
|
+
rootText: 'Reports',
|
226
|
+
autoScroll: true,
|
227
|
+
allowDownload: true,
|
228
|
+
url: '/rails_db_admin/erp_app/desktop/reports/index',
|
229
|
+
controllerPath: '/rails_db_admin/erp_app/desktop/reports',
|
230
|
+
standardUploadUrl: '/rails_db_admin/erp_app/desktop/reports/upload_file',
|
231
|
+
fields: [
|
232
|
+
'text',
|
233
|
+
'iconCls',
|
234
|
+
'leaf',
|
235
|
+
'reportIid',
|
236
|
+
'reportId',
|
237
|
+
'isReport',
|
238
|
+
'handleContextMenu',
|
239
|
+
'internalIdentifier',
|
240
|
+
'reportName',
|
241
|
+
{name: 'reportMetaData', type: 'object'}
|
242
|
+
],
|
243
|
+
animate: false,
|
244
|
+
listeners: {
|
245
|
+
'showImage': function (fileManager, node, themeId) {
|
246
|
+
var reportId = null;
|
247
|
+
var reportNode = node;
|
248
|
+
while (reportId == null && !Compass.ErpApp.Utility.isBlank(reportNode.parentNode)) {
|
249
|
+
if (reportNode.data.isReport) {
|
250
|
+
reportId = reportNode.data.id;
|
251
|
+
}
|
252
|
+
else {
|
253
|
+
reportNode = reportNode.parentNode;
|
254
|
+
}
|
255
|
+
}
|
256
|
+
me.initialConfig.module.showImage(node, reportId);
|
257
|
+
},
|
258
|
+
'contentLoaded': function (fileManager, node, content) {
|
259
|
+
var itemId = Compass.ErpApp.Utility.Encryption.MD5(node.data.id);
|
260
|
+
var centerRegion = Ext.getCmp('rails_db_admin').down('#centerRegion');
|
261
|
+
var item = centerRegion.getComponent(itemId);
|
262
|
+
var mode = Compass.ErpApp.Shared.CodeMirror.determineCodeMirrorMode(node.data.text);
|
263
|
+
|
264
|
+
if (Compass.ErpApp.Utility.isBlank(item)) {
|
265
|
+
item = Ext.create('Compass.ErpApp.Shared.CodeMirror', {
|
266
|
+
mode: mode,
|
267
|
+
sourceCode: content,
|
268
|
+
title: node.data.text,
|
269
|
+
closable: true,
|
270
|
+
itemId: itemId,
|
271
|
+
listeners: {
|
272
|
+
'save': function (codeMirror, content) {
|
273
|
+
var waitMsg = Ext.Msg.wait("Saving Report...", "Status");
|
274
|
+
Ext.Ajax.request({
|
275
|
+
url: '/rails_db_admin/erp_app/desktop/reports/update_file',
|
276
|
+
method: 'POST',
|
277
|
+
params: {
|
278
|
+
node: node.data.id,
|
279
|
+
content: content
|
280
|
+
},
|
281
|
+
success: function (responseObject) {
|
282
|
+
waitMsg.close();
|
283
|
+
var obj = Ext.decode(responseObject.responseText);
|
284
|
+
if (!obj.success) {
|
285
|
+
Ext.Msg.alert('Status', 'Error saving report');
|
286
|
+
}
|
287
|
+
},
|
288
|
+
failure: function () {
|
289
|
+
waitMsg.close();
|
290
|
+
Ext.Msg.alert('Status', 'Error saving report');
|
291
|
+
}
|
292
|
+
});
|
293
|
+
}
|
294
|
+
}
|
295
|
+
});
|
296
|
+
|
297
|
+
centerRegion.add(item);
|
298
|
+
}
|
299
|
+
centerRegion.setActiveTab(item);
|
300
|
+
},
|
301
|
+
'itemclick': function (view, record, item, index, e) {
|
302
|
+
e.stopEvent();
|
303
|
+
if (record.data.leaf && record.parentNode.data.isReport) {
|
304
|
+
me.editQuery(record.parentNode);
|
305
|
+
}
|
306
|
+
else if (record.data.leaf) {
|
307
|
+
var msg = Ext.Msg.wait("Loading", "Retrieving contents...");
|
308
|
+
Ext.Ajax.request({
|
309
|
+
url: '/rails_db_admin/erp_app/desktop/reports/get_contents',
|
310
|
+
method: 'POST',
|
311
|
+
params: {
|
312
|
+
node: record.data.id
|
313
|
+
},
|
314
|
+
success: function (response) {
|
315
|
+
msg.hide();
|
316
|
+
me.fireEvent('contentLoaded', me, record, response.responseText);
|
317
|
+
},
|
318
|
+
failure: function () {
|
319
|
+
Ext.Msg.alert('Status', 'Error loading contents');
|
320
|
+
msg.hide();
|
321
|
+
}
|
322
|
+
});
|
323
|
+
}
|
324
|
+
else if (record.data.isReport) {
|
325
|
+
me.loadReport(record);
|
326
|
+
Ext.getCmp('reports_accordian_panel').down('railsdbadminreportssettings').expand();
|
327
|
+
}
|
328
|
+
},
|
329
|
+
'handleContextMenu': function (fileManager, node, item, index, e) {
|
330
|
+
var items = [];
|
331
|
+
if (node.isRoot()) {
|
332
|
+
items.push(
|
333
|
+
{
|
334
|
+
text: "New Report",
|
335
|
+
iconCls: 'icon-settings',
|
336
|
+
listeners: {
|
337
|
+
'click': function () {
|
338
|
+
me.newReport();
|
339
|
+
}
|
340
|
+
}
|
341
|
+
},
|
342
|
+
{
|
343
|
+
text: "Upload",
|
344
|
+
iconCls: 'icon-theme-upload',
|
345
|
+
listeners: {
|
346
|
+
'click': function () {
|
347
|
+
me.uploadReport();
|
348
|
+
}
|
349
|
+
}
|
350
|
+
});
|
351
|
+
}
|
352
|
+
else if (node.data.isReport) {
|
353
|
+
items.push(
|
354
|
+
{
|
355
|
+
text: "Delete Report",
|
356
|
+
iconCls: 'icon-delete',
|
357
|
+
listeners: {
|
358
|
+
scope: node,
|
359
|
+
'click': function () {
|
360
|
+
me.deleteReport(node.data.reportId);
|
361
|
+
}
|
362
|
+
}
|
363
|
+
},
|
364
|
+
{
|
365
|
+
text: 'Export',
|
366
|
+
iconCls: 'icon-document_out',
|
367
|
+
listeners: {
|
368
|
+
'click': function () {
|
369
|
+
me.exportReport(node.data.reportId);
|
370
|
+
}
|
371
|
+
}
|
372
|
+
}
|
373
|
+
);
|
374
|
+
}
|
375
|
+
|
376
|
+
if(items.length > 0){
|
377
|
+
var contextMenu = Ext.create('Ext.menu.Menu', {
|
378
|
+
items: items
|
379
|
+
});
|
380
|
+
contextMenu.showAt(e.xy);
|
381
|
+
}
|
382
|
+
|
383
|
+
return false;
|
384
|
+
}
|
385
|
+
}
|
386
|
+
}, config);
|
387
|
+
|
388
|
+
this.callParent([config]);
|
389
|
+
}
|
390
|
+
});
|
391
|
+
|