erp_forms 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +84 -0
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/forms_controller.rb +8 -2
- data/app/controllers/erp_forms/erp_app/desktop/dynamic_forms/models_controller.rb +2 -2
- data/app/models/dynamic_form_document.rb +6 -1
- data/app/widgets/dynamic_forms/base.rb +0 -4
- data/lib/erp_forms/dynamic_form_field.rb +1 -0
- data/lib/erp_forms/engine.rb +3 -0
- data/lib/erp_forms/version.rb +7 -1
- data/lib/erp_forms.rb +1 -0
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/dynamic_data_grid.js +3 -5
- data/public/javascripts/erp_app/desktop/applications/dynamic_forms/west_region.js +448 -433
- metadata +79 -79
@@ -1,468 +1,483 @@
|
|
1
1
|
Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
2
|
+
extend:"Ext.tab.Panel",
|
3
|
+
alias:'widget.dynamic_forms_westregion',
|
4
|
+
setWindowStatus : function(status){
|
5
|
+
this.findParentByType('statuswindow').setStatus(status);
|
6
|
+
},
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
clearWindowStatus : function(){
|
9
|
+
this.findParentByType('statuswindow').clearStatus();
|
10
|
+
},
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/delete',
|
26
|
-
method: 'POST',
|
27
|
-
params:{
|
28
|
-
id:node.data.modelId
|
29
|
-
},
|
30
|
-
success: function(response) {
|
31
|
-
self.clearWindowStatus();
|
32
|
-
var obj = Ext.decode(response.responseText);
|
33
|
-
if(obj.success){
|
34
|
-
node.remove(true);
|
35
|
-
}
|
36
|
-
else{
|
37
|
-
Ext.Msg.alert('Error', 'Error deleting model');
|
38
|
-
}
|
39
|
-
},
|
40
|
-
failure: function(response) {
|
41
|
-
self.clearWindowStatus();
|
42
|
-
Ext.Msg.alert('Error', 'Error deleting model');
|
43
|
-
}
|
44
|
-
});
|
45
|
-
}
|
46
|
-
});
|
47
|
-
},
|
48
|
-
|
49
|
-
deleteForm : function(node){
|
50
|
-
var self = this;
|
51
|
-
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this form? WARNING: Data will be orphaned if there is no form for this model.', function(btn){
|
52
|
-
if(btn == 'no'){
|
53
|
-
return false;
|
54
|
-
}
|
55
|
-
else
|
56
|
-
if(btn == 'yes')
|
57
|
-
{
|
58
|
-
self.setWindowStatus('Deleting form...');
|
59
|
-
var conn = new Ext.data.Connection();
|
60
|
-
conn.request({
|
61
|
-
url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/delete',
|
62
|
-
method: 'POST',
|
63
|
-
params:{
|
64
|
-
id:node.data.formId
|
65
|
-
},
|
66
|
-
success: function(response) {
|
67
|
-
self.clearWindowStatus();
|
68
|
-
var obj = Ext.decode(response.responseText);
|
69
|
-
if(obj.success){
|
70
|
-
node.remove(true);
|
71
|
-
}
|
72
|
-
else{
|
73
|
-
Ext.Msg.alert('Error', 'Error deleting form');
|
74
|
-
}
|
75
|
-
},
|
76
|
-
failure: function(response) {
|
77
|
-
self.clearWindowStatus();
|
78
|
-
Ext.Msg.alert('Error', 'Error deleting form');
|
79
|
-
}
|
80
|
-
});
|
81
|
-
}
|
82
|
-
});
|
83
|
-
},
|
84
|
-
|
85
|
-
setDefaultForm : function(node){
|
86
|
-
var self = this;
|
87
|
-
self.setWindowStatus('Setting Default form...');
|
88
|
-
var conn = new Ext.data.Connection();
|
89
|
-
conn.request({
|
90
|
-
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/set_default_form',
|
12
|
+
deleteModel : function(node){
|
13
|
+
var self = this;
|
14
|
+
Ext.MessageBox.confirm('Confirm',
|
15
|
+
'Are you sure you want to delete this dynamic form model? WARNING: All forms belonging to this model will be deleted and any/all data will be orphaned!',
|
16
|
+
function(btn){
|
17
|
+
if(btn == 'no'){
|
18
|
+
return false;
|
19
|
+
}
|
20
|
+
else if(btn == 'yes')
|
21
|
+
{
|
22
|
+
self.setWindowStatus('Deleting Dynamic Model...');
|
23
|
+
Ext.Ajax.request({
|
24
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/delete',
|
91
25
|
method: 'POST',
|
92
26
|
params:{
|
93
|
-
|
94
|
-
model_name:node.data.modelName
|
27
|
+
id:node.data.modelId
|
95
28
|
},
|
96
29
|
success: function(response) {
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
}
|
30
|
+
self.clearWindowStatus();
|
31
|
+
var obj = Ext.decode(response.responseText);
|
32
|
+
if(obj.success){
|
33
|
+
//node.remove(true); // remove node causing a reload of entire tree with error, so we are going to simply reload tree for now
|
34
|
+
self.sitesTree.getStore().load({
|
35
|
+
node: self.sitesTree.getRootNode()
|
36
|
+
});
|
37
|
+
}
|
38
|
+
else{
|
39
|
+
Ext.Msg.alert('Error', 'Error deleting model');
|
40
|
+
}
|
109
41
|
},
|
110
42
|
failure: function(response) {
|
111
|
-
|
112
|
-
|
43
|
+
self.clearWindowStatus();
|
44
|
+
Ext.Msg.alert('Error', 'Error deleting model');
|
113
45
|
}
|
46
|
+
});
|
47
|
+
}
|
48
|
+
});
|
49
|
+
},
|
50
|
+
|
51
|
+
deleteForm : function(node){
|
52
|
+
var self = this;
|
53
|
+
Ext.MessageBox.confirm('Confirm', 'Are you sure you want to delete this form? WARNING: Data will be orphaned if there is no form for this model.', function(btn){
|
54
|
+
if(btn == 'no'){
|
55
|
+
return false;
|
56
|
+
}
|
57
|
+
else
|
58
|
+
if(btn == 'yes')
|
59
|
+
{
|
60
|
+
self.setWindowStatus('Deleting form...');
|
61
|
+
Ext.Ajax.request({
|
62
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/delete',
|
63
|
+
method: 'POST',
|
64
|
+
params:{
|
65
|
+
id:node.data.formId
|
66
|
+
},
|
67
|
+
success: function(response) {
|
68
|
+
self.clearWindowStatus();
|
69
|
+
var obj = Ext.decode(response.responseText);
|
70
|
+
if(obj.success){
|
71
|
+
node.remove(true);
|
72
|
+
}
|
73
|
+
else{
|
74
|
+
Ext.Msg.alert('Error', 'Error deleting form');
|
75
|
+
}
|
76
|
+
},
|
77
|
+
failure: function(response) {
|
78
|
+
self.clearWindowStatus();
|
79
|
+
Ext.Msg.alert('Error', 'Error deleting form');
|
80
|
+
}
|
114
81
|
});
|
115
|
-
|
82
|
+
}
|
83
|
+
});
|
84
|
+
},
|
116
85
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
86
|
+
setDefaultForm : function(node){
|
87
|
+
var self = this;
|
88
|
+
self.setWindowStatus('Setting Default form...');
|
89
|
+
Ext.Ajax.request({
|
90
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/models/set_default_form',
|
91
|
+
method: 'POST',
|
92
|
+
params:{
|
93
|
+
id:node.data.formId,
|
94
|
+
model_name:node.data.modelName
|
95
|
+
},
|
96
|
+
success: function(response) {
|
97
|
+
self.clearWindowStatus();
|
98
|
+
var obj = Ext.decode(response.responseText);
|
99
|
+
if(obj.success){
|
100
|
+
//reload model tree node
|
101
|
+
self.sitesTree.getStore().load({
|
102
|
+
// node:node.parentNode
|
103
|
+
});
|
104
|
+
node.parentNode.expand();
|
105
|
+
}
|
106
|
+
else{
|
107
|
+
Ext.Msg.alert('Error', 'Error setting default form');
|
108
|
+
}
|
109
|
+
},
|
110
|
+
failure: function(response) {
|
111
|
+
self.clearWindowStatus();
|
112
|
+
Ext.Msg.alert('Error', 'Error setting default form');
|
113
|
+
}
|
114
|
+
});
|
115
|
+
},
|
141
116
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
117
|
+
getDynamicForm : function(record){
|
118
|
+
var self = this;
|
119
|
+
self.setWindowStatus('Loading dynamic form...');
|
120
|
+
Ext.Ajax.request({
|
121
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get',
|
122
|
+
method: 'POST',
|
123
|
+
params:{
|
124
|
+
id:record.get('formId')
|
125
|
+
},
|
126
|
+
success: function(response) {
|
127
|
+
self.initialConfig['centerRegion'].editSectionLayout(
|
128
|
+
sectionName,
|
129
|
+
websiteId,
|
130
|
+
sectionId,
|
131
|
+
response.responseText,
|
132
|
+
[{
|
133
|
+
text: 'Insert Content Area',
|
134
|
+
handler: function(btn){
|
135
|
+
var codeMirror = btn.findParentByType('codemirror');
|
136
|
+
Ext.MessageBox.prompt('New File', 'Please enter content area name:', function(btn, text){
|
137
|
+
if(btn == 'ok'){
|
138
|
+
codeMirror.insertContent('<%=render_content_area(:'+text+')%>');
|
139
|
+
}
|
140
|
+
|
141
|
+
});
|
150
142
|
}
|
151
|
-
|
152
|
-
|
143
|
+
}]);
|
144
|
+
self.clearWindowStatus();
|
145
|
+
},
|
146
|
+
failure: function(response) {
|
147
|
+
self.clearWindowStatus();
|
148
|
+
Ext.Msg.alert('Error', 'Error loading dynamic form.');
|
149
|
+
}
|
150
|
+
});
|
151
|
+
},
|
153
152
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
153
|
+
getDynamicData : function(record, title){
|
154
|
+
var self = this;
|
155
|
+
var centerRegionLayout = Ext.create("Ext.panel.Panel",{
|
156
|
+
layout:'border',
|
157
|
+
title: record.data.text + " Dynamic Data",
|
158
|
+
closable:true,
|
159
|
+
items:[
|
160
|
+
{
|
161
|
+
xtype:'dynamic_forms_DynamicDataGridPanel',
|
162
|
+
model_name:record.data.text,
|
163
|
+
dataUrl: '/erp_forms/erp_app/desktop/dynamic_forms/data/index/'+record.data.text,
|
164
|
+
setupUrl: '/erp_forms/erp_app/desktop/dynamic_forms/data/setup/'+record.data.text,
|
165
|
+
region:'center',
|
166
|
+
height:300,
|
167
|
+
collapsible:false,
|
168
|
+
centerRegion:self
|
169
|
+
}],
|
170
|
+
tbar:{
|
171
|
+
items:[
|
172
|
+
{
|
173
|
+
text: "New " + record.data.text + " Record",
|
174
|
+
iconCls:'icon-add',
|
175
|
+
handler:function(btn){
|
176
|
+
self.setWindowStatus('Getting form...');
|
177
|
+
Ext.Ajax.request({
|
178
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get',
|
179
|
+
method: 'POST',
|
180
|
+
params:{
|
163
181
|
model_name:record.data.text,
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
var newRecordWindow = Ext.create("Ext.window.Window",{
|
190
|
-
layout:'fit',
|
191
|
-
title:'New Record',
|
192
|
-
y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
|
193
|
-
plain: true,
|
194
|
-
buttonAlign:'center',
|
195
|
-
items: form_definition
|
196
|
-
});
|
197
|
-
newRecordWindow.show();
|
198
|
-
},
|
199
|
-
failure: function(response) {
|
200
|
-
self.clearWindowStatus();
|
201
|
-
Ext.Msg.alert('Error', 'Error getting form');
|
202
|
-
}
|
203
|
-
});
|
204
|
-
}
|
205
|
-
}
|
206
|
-
]
|
207
|
-
}
|
208
|
-
});
|
182
|
+
form_action: 'create'
|
183
|
+
},
|
184
|
+
success: function(response) {
|
185
|
+
self.clearWindowStatus();
|
186
|
+
form_definition = Ext.decode(response.responseText);
|
187
|
+
var newRecordWindow = Ext.create("Ext.window.Window",{
|
188
|
+
layout:'fit',
|
189
|
+
title:'New Record',
|
190
|
+
y: 100, // this fixes chrome and safari rendering the window at the bottom of the screen
|
191
|
+
plain: true,
|
192
|
+
buttonAlign:'center',
|
193
|
+
items: form_definition
|
194
|
+
});
|
195
|
+
newRecordWindow.show();
|
196
|
+
},
|
197
|
+
failure: function(response) {
|
198
|
+
self.clearWindowStatus();
|
199
|
+
Ext.Msg.alert('Error', 'Error getting form');
|
200
|
+
}
|
201
|
+
});
|
202
|
+
}
|
203
|
+
}
|
204
|
+
]
|
205
|
+
}
|
206
|
+
});
|
209
207
|
|
210
|
-
|
211
|
-
|
212
|
-
|
208
|
+
this.centerRegion.workArea.add(centerRegionLayout);
|
209
|
+
this.centerRegion.workArea.setActiveTab(this.centerRegion.workArea.items.length - 1);
|
210
|
+
},
|
213
211
|
|
214
|
-
|
215
|
-
|
212
|
+
initComponent: function() {
|
213
|
+
var self = this;
|
216
214
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
215
|
+
var store = Ext.create('Ext.data.TreeStore', {
|
216
|
+
proxy:{
|
217
|
+
type: 'ajax',
|
218
|
+
url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get_tree'
|
219
|
+
},
|
220
|
+
root: {
|
221
|
+
text: 'Dynamic Forms',
|
222
|
+
expanded: true
|
223
|
+
},
|
224
|
+
fields:[
|
225
|
+
{
|
226
|
+
name:'id'
|
227
|
+
},
|
228
|
+
{
|
229
|
+
name:'iconCls'
|
230
|
+
},
|
231
|
+
{
|
232
|
+
name:'text',
|
233
|
+
sortDir: 'ASC'
|
234
|
+
},
|
235
|
+
{
|
236
|
+
name:'isModel'
|
237
|
+
},
|
238
|
+
{
|
239
|
+
name:'modelName'
|
240
|
+
},
|
241
|
+
{
|
242
|
+
name:'isDefault'
|
243
|
+
},
|
244
|
+
{
|
245
|
+
name:'isForm'
|
246
|
+
},
|
247
|
+
{
|
248
|
+
name:'modelId'
|
249
|
+
},
|
250
|
+
{
|
251
|
+
name:'formId'
|
252
|
+
},
|
253
|
+
{
|
254
|
+
name:'leaf'
|
255
|
+
},
|
256
|
+
{
|
257
|
+
name:'children'
|
258
|
+
}
|
259
|
+
],
|
260
|
+
listeners:{
|
261
|
+
// these listeners are a workaround for a extjs 4.0.7 bug
|
262
|
+
// reference: http://www.sencha.com/forum/showthread.php?151211-Reloading-TreeStore-adds-all-records-to-store-getRemovedRecords&p=661157#post661157
|
263
|
+
'beforeload': function()
|
264
|
+
{
|
265
|
+
this.clearOnLoad = false;
|
266
|
+
this.getRootNode().removeAll();
|
267
|
+
},
|
268
|
+
'afterload': function()
|
269
|
+
{
|
270
|
+
this.removed = [];
|
271
|
+
}
|
272
|
+
}
|
273
|
+
});
|
263
274
|
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
e.stopEvent();
|
289
|
-
var items = [];
|
275
|
+
this.sitesTree = new Ext.tree.TreePanel({
|
276
|
+
store:store,
|
277
|
+
dataUrl: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get_tree',
|
278
|
+
region: 'center',
|
279
|
+
rootVisible:false,
|
280
|
+
enableDD :false,
|
281
|
+
listeners:{
|
282
|
+
'load':function(){
|
283
|
+
self.sitesTree.getStore().sort('text', 'ASC');
|
284
|
+
},
|
285
|
+
'itemclick':function(view, record, item, index, e){
|
286
|
+
e.stopEvent();
|
287
|
+
if(record.data['isModel']){
|
288
|
+
if (record.data['children'].length > 0){
|
289
|
+
self.getDynamicData(record);
|
290
|
+
}
|
291
|
+
}
|
292
|
+
else if(record.data['isForm']){
|
293
|
+
self.getDynamicForm(record);
|
294
|
+
}
|
295
|
+
},
|
296
|
+
'itemcontextmenu':function(view, record, htmlItem, index, e){
|
297
|
+
e.stopEvent();
|
298
|
+
var items = [];
|
290
299
|
|
291
|
-
|
300
|
+
if(record.data['isModel']){
|
292
301
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
302
|
+
// can only display data if there is a form to provide a definition
|
303
|
+
if (record.data['children'].length > 0){
|
304
|
+
items.push({
|
305
|
+
text:'View Dynamic Data',
|
306
|
+
iconCls:'icon-document',
|
307
|
+
listeners:{
|
308
|
+
'click':function(){
|
309
|
+
self.getDynamicData(record);
|
310
|
+
}
|
311
|
+
}
|
312
|
+
});
|
313
|
+
}
|
305
314
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
+
items.push({
|
316
|
+
text:'Add Dynamic Form',
|
317
|
+
iconCls:'icon-add',
|
318
|
+
listeners:{
|
319
|
+
'click':function(){
|
320
|
+
//self.addDynamicForm(record);
|
321
|
+
Ext.Msg.alert('Info', 'Form Builder not yet implemented');
|
322
|
+
}
|
323
|
+
}
|
324
|
+
});
|
315
325
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
items.push({
|
331
|
-
text:'Edit Dynamic Form',
|
332
|
-
iconCls:'icon-edit',
|
333
|
-
listeners:{
|
334
|
-
'click':function(){
|
335
|
-
self.getDynamicForm(record);
|
336
|
-
}
|
337
|
-
}
|
338
|
-
});
|
339
|
-
if(!record.data['isDefault']){
|
340
|
-
items.push({
|
341
|
-
text:'Set As Default',
|
342
|
-
iconCls:'icon-edit',
|
343
|
-
listeners:{
|
344
|
-
'click':function(){
|
345
|
-
self.setDefaultForm(record);
|
346
|
-
}
|
347
|
-
}
|
348
|
-
});
|
349
|
-
}
|
326
|
+
if(record.data['text'] != 'DynamicFormDocument'){
|
327
|
+
items.push({
|
328
|
+
text:'Delete Model',
|
329
|
+
iconCls:'icon-delete',
|
330
|
+
listeners:{
|
331
|
+
'click':function(){
|
332
|
+
self.deleteModel(record);
|
333
|
+
}
|
334
|
+
}
|
335
|
+
});
|
336
|
+
}
|
337
|
+
}
|
338
|
+
else if(record.data['isForm']){
|
350
339
|
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
340
|
+
items.push({
|
341
|
+
text:'Edit Dynamic Form',
|
342
|
+
iconCls:'icon-edit',
|
343
|
+
listeners:{
|
344
|
+
'click':function(){
|
345
|
+
//self.getDynamicForm(record);
|
346
|
+
Ext.Msg.alert('Info', 'Form Builder not yet implemented');
|
347
|
+
}
|
348
|
+
}
|
349
|
+
});
|
350
|
+
if(!record.data['isDefault']){
|
351
|
+
items.push({
|
352
|
+
text:'Set As Default',
|
353
|
+
iconCls:'icon-edit',
|
354
|
+
listeners:{
|
355
|
+
'click':function(){
|
356
|
+
//self.setDefaultForm(record);
|
357
|
+
Ext.Msg.alert('Info', 'Form Builder not yet implemented');
|
358
|
+
}
|
366
359
|
}
|
360
|
+
});
|
367
361
|
}
|
368
|
-
});
|
369
362
|
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
363
|
+
items.push({
|
364
|
+
text:'Delete',
|
365
|
+
iconCls:'icon-delete',
|
366
|
+
listeners:{
|
367
|
+
'click':function(){
|
368
|
+
//self.deleteForm(record);
|
369
|
+
Ext.Msg.alert('Info', 'Form Builder not yet implemented');
|
370
|
+
}
|
371
|
+
}
|
372
|
+
});
|
373
|
+
}
|
374
|
+
|
375
|
+
var contextMenu = Ext.create("Ext.menu.Menu",{
|
376
|
+
items:items
|
377
|
+
});
|
378
|
+
contextMenu.showAt(e.xy);
|
379
|
+
}
|
380
|
+
}
|
381
|
+
});
|
382
|
+
|
383
|
+
var layout = new Ext.Panel({
|
384
|
+
layout: 'border',
|
385
|
+
autoDestroy:true,
|
386
|
+
title:'Dynamic Forms',
|
387
|
+
items: [this.sitesTree],
|
388
|
+
tbar:{
|
389
|
+
items:[
|
390
|
+
{
|
391
|
+
text:'New Dynamic Form Model',
|
392
|
+
iconCls:'icon-add',
|
393
|
+
handler:function(btn){
|
394
|
+
var newModelWindow = Ext.create("Ext.window.Window",{
|
395
|
+
layout:'fit',
|
396
|
+
width:375,
|
397
|
+
title:'New Dynamic Form Model',
|
398
|
+
height:100,
|
399
|
+
plain: true,
|
400
|
+
buttonAlign:'center',
|
401
|
+
items: new Ext.FormPanel({
|
402
|
+
labelWidth: 110,
|
403
|
+
frame:false,
|
404
|
+
fileUpload: true,
|
405
|
+
bodyStyle:'padding:5px 5px 0',
|
406
|
+
url:'/erp_forms/erp_app/desktop/dynamic_forms/models/create',
|
407
|
+
defaults: {
|
408
|
+
width: 225
|
409
|
+
},
|
410
|
+
items: [
|
377
411
|
{
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
layout:'fit',
|
383
|
-
width:375,
|
384
|
-
title:'New Dynamic Form Model',
|
385
|
-
height:100,
|
386
|
-
plain: true,
|
387
|
-
buttonAlign:'center',
|
388
|
-
items: new Ext.FormPanel({
|
389
|
-
labelWidth: 110,
|
390
|
-
frame:false,
|
391
|
-
fileUpload: true,
|
392
|
-
bodyStyle:'padding:5px 5px 0',
|
393
|
-
url:'/erp_forms/erp_app/desktop/dynamic_forms/models/create',
|
394
|
-
defaults: {
|
395
|
-
width: 225
|
396
|
-
},
|
397
|
-
items: [
|
398
|
-
{
|
399
|
-
xtype:'textfield',
|
400
|
-
fieldLabel:'Model Name',
|
401
|
-
allowBlank:false,
|
402
|
-
name:'model_name'
|
403
|
-
}
|
404
|
-
]
|
405
|
-
}),
|
406
|
-
buttons: [{
|
407
|
-
text:'Submit',
|
408
|
-
listeners:{
|
409
|
-
'click':function(button){
|
410
|
-
var window = button.findParentByType('window');
|
411
|
-
var formPanel = window.query('form')[0];
|
412
|
-
self.setWindowStatus('Adding new dynamic form model ...');
|
413
|
-
formPanel.getForm().submit({
|
414
|
-
success:function(form, action){
|
415
|
-
self.clearWindowStatus();
|
416
|
-
var obj = Ext.decode(action.response.responseText);
|
417
|
-
if(obj.success){
|
418
|
-
self.sitesTree.getStore().load();
|
419
|
-
newModelWindow.close();
|
420
|
-
}
|
421
|
-
else{
|
422
|
-
Ext.Msg.alert("Error", obj.message);
|
423
|
-
}
|
424
|
-
},
|
425
|
-
failure:function(form, action){
|
426
|
-
self.clearWindowStatus();
|
427
|
-
var obj = Ext.decode(action.response.responseText);
|
428
|
-
if(obj != null){
|
429
|
-
Ext.Msg.alert("Error", obj.message);
|
430
|
-
}
|
431
|
-
else{
|
432
|
-
Ext.Msg.alert("Error", "Error importing website");
|
433
|
-
}
|
434
|
-
}
|
435
|
-
});
|
436
|
-
}
|
437
|
-
}
|
438
|
-
},{
|
439
|
-
text: 'Close',
|
440
|
-
handler: function(){
|
441
|
-
newModelWindow.close();
|
442
|
-
}
|
443
|
-
}]
|
444
|
-
});
|
445
|
-
newModelWindow.show();
|
446
|
-
}
|
412
|
+
xtype:'textfield',
|
413
|
+
fieldLabel:'Model Name',
|
414
|
+
allowBlank:false,
|
415
|
+
name:'model_name'
|
447
416
|
}
|
448
417
|
]
|
449
|
-
|
450
|
-
|
418
|
+
}),
|
419
|
+
buttons: [{
|
420
|
+
text:'Submit',
|
421
|
+
listeners:{
|
422
|
+
'click':function(button){
|
423
|
+
var window = button.findParentByType('window');
|
424
|
+
var formPanel = window.query('form')[0];
|
425
|
+
self.setWindowStatus('Adding new dynamic form model ...');
|
426
|
+
formPanel.getForm().submit({
|
427
|
+
success:function(form, action){
|
428
|
+
self.clearWindowStatus();
|
429
|
+
var obj = Ext.decode(action.response.responseText);
|
430
|
+
if(obj.success){
|
431
|
+
self.sitesTree.getStore().load({
|
432
|
+
node: self.sitesTree.getRootNode()
|
433
|
+
});
|
434
|
+
newModelWindow.close();
|
435
|
+
}
|
436
|
+
else{
|
437
|
+
Ext.Msg.alert("Error", obj.message);
|
438
|
+
}
|
439
|
+
},
|
440
|
+
failure:function(form, action){
|
441
|
+
self.clearWindowStatus();
|
442
|
+
var obj = Ext.decode(action.response.responseText);
|
443
|
+
if(obj != null){
|
444
|
+
Ext.Msg.alert("Error", obj.message);
|
445
|
+
}
|
446
|
+
else{
|
447
|
+
Ext.Msg.alert("Error", "Error importing website");
|
448
|
+
}
|
449
|
+
}
|
450
|
+
});
|
451
|
+
}
|
452
|
+
}
|
453
|
+
},{
|
454
|
+
text: 'Close',
|
455
|
+
handler: function(){
|
456
|
+
newModelWindow.close();
|
457
|
+
}
|
458
|
+
}]
|
459
|
+
});
|
460
|
+
newModelWindow.show();
|
461
|
+
}
|
462
|
+
}
|
463
|
+
]
|
464
|
+
}
|
465
|
+
});
|
451
466
|
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
467
|
+
this.items = [layout];
|
468
|
+
this.callParent(arguments);
|
469
|
+
this.setActiveTab(0);
|
470
|
+
},
|
456
471
|
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
472
|
+
constructor : function(config) {
|
473
|
+
config = Ext.apply({
|
474
|
+
id: 'westregionPanel',
|
475
|
+
region:'west',
|
476
|
+
split:true,
|
477
|
+
width:200,
|
478
|
+
collapsible:false
|
479
|
+
}, config);
|
465
480
|
|
466
|
-
|
467
|
-
|
481
|
+
this.callParent([config]);
|
482
|
+
}
|
468
483
|
});
|