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.
@@ -1,468 +1,483 @@
1
1
  Ext.define("Compass.ErpApp.Desktop.Applications.DynamicForms.WestRegion",{
2
- extend:"Ext.tab.Panel",
3
- alias:'widget.dynamic_forms_westregion',
4
- setWindowStatus : function(status){
5
- this.findParentByType('statuswindow').setStatus(status);
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
- clearWindowStatus : function(){
9
- this.findParentByType('statuswindow').clearStatus();
10
- },
8
+ clearWindowStatus : function(){
9
+ this.findParentByType('statuswindow').clearStatus();
10
+ },
11
11
 
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
- var conn = new Ext.data.Connection();
24
- conn.request({
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
- id:node.data.formId,
94
- model_name:node.data.modelName
27
+ id:node.data.modelId
95
28
  },
96
29
  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
- }
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
- self.clearWindowStatus();
112
- Ext.Msg.alert('Error', 'Error setting default form');
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
- getDynamicForm : function(record){
118
- var self = this;
119
- self.setWindowStatus('Loading section template...');
120
- var conn = new Ext.data.Connection();
121
- conn.request({
122
- url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get',
123
- method: 'POST',
124
- params:{
125
- id:record.get('formId')
126
- },
127
- success: function(response) {
128
- self.initialConfig['centerRegion'].editSectionLayout(
129
- sectionName,
130
- websiteId,
131
- sectionId,
132
- response.responseText,
133
- [{
134
- text: 'Insert Content Area',
135
- handler: function(btn){
136
- var codeMirror = btn.findParentByType('codemirror');
137
- Ext.MessageBox.prompt('New File', 'Please enter content area name:', function(btn, text){
138
- if(btn == 'ok'){
139
- codeMirror.insertContent('<%=render_content_area(:'+text+')%>');
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
- self.clearWindowStatus();
146
- },
147
- failure: function(response) {
148
- self.clearWindowStatus();
149
- Ext.Msg.alert('Error', 'Error loading section layout.');
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
- getDynamicData : function(record, title){
155
- var self = this;
156
- var centerRegionLayout = Ext.create("Ext.panel.Panel",{
157
- layout:'border',
158
- title: record.data.text + " Dynamic Data",
159
- closable:true,
160
- items:[
161
- {
162
- xtype:'dynamic_forms_DynamicDataGridPanel',
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
- dataUrl: '/erp_forms/erp_app/desktop/dynamic_forms/data/index/'+record.data.text,
165
- setupUrl: '/erp_forms/erp_app/desktop/dynamic_forms/data/setup/'+record.data.text,
166
- region:'center',
167
- height:300,
168
- collapsible:false,
169
- centerRegion:self
170
- }],
171
- tbar:{
172
- items:[
173
- {
174
- text: "New " + record.data.text + " Record",
175
- iconCls:'icon-add',
176
- handler:function(btn){
177
- self.setWindowStatus('Getting form...');
178
- var conn = new Ext.data.Connection();
179
- conn.request({
180
- url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get',
181
- method: 'POST',
182
- params:{
183
- model_name:record.data.text,
184
- form_action: 'create'
185
- },
186
- success: function(response) {
187
- self.clearWindowStatus();
188
- form_definition = Ext.decode(response.responseText);
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
- this.centerRegion.workArea.add(centerRegionLayout);
211
- this.centerRegion.workArea.setActiveTab(this.centerRegion.workArea.items.length - 1);
212
- },
208
+ this.centerRegion.workArea.add(centerRegionLayout);
209
+ this.centerRegion.workArea.setActiveTab(this.centerRegion.workArea.items.length - 1);
210
+ },
213
211
 
214
- initComponent: function() {
215
- var self = this;
212
+ initComponent: function() {
213
+ var self = this;
216
214
 
217
- var store = Ext.create('Ext.data.TreeStore', {
218
- proxy:{
219
- type: 'ajax',
220
- url: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get_tree'
221
- },
222
- root: {
223
- text: 'Dynamic Forms',
224
- expanded: true
225
- },
226
- fields:[
227
- {
228
- name:'id'
229
- },
230
- {
231
- name:'iconCls'
232
- },
233
- {
234
- name:'text',
235
- sortDir: 'ASC'
236
- },
237
- {
238
- name:'isModel'
239
- },
240
- {
241
- name:'modelName'
242
- },
243
- {
244
- name:'isDefault'
245
- },
246
- {
247
- name:'isForm'
248
- },
249
- {
250
- name:'modelId'
251
- },
252
- {
253
- name:'formId'
254
- },
255
- {
256
- name:'leaf'
257
- },
258
- {
259
- name:'children'
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
- this.sitesTree = new Ext.tree.TreePanel({
265
- viewConfig: {
266
- //TODO_EXTJS4 this is added to fix error should be removed when extjs 4 releases fix.
267
- loadMask: false
268
- },
269
- store:store,
270
- dataUrl: '/erp_forms/erp_app/desktop/dynamic_forms/forms/get_tree',
271
- region: 'center',
272
- rootVisible:false,
273
- enableDD :true,
274
- listeners:{
275
- 'load':function(){
276
- self.sitesTree.getStore().sort('text', 'ASC');
277
- },
278
- 'itemclick':function(view, record, item, index, e){
279
- e.stopEvent();
280
- if(record.data['isModel']){
281
- self.getDynamicData(record);
282
- }
283
- else if(record.data['isForm']){
284
- self.getDynamicForm(record);
285
- }
286
- },
287
- 'itemcontextmenu':function(view, record, htmlItem, index, e){
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
- if(record.data['isModel']){
300
+ if(record.data['isModel']){
292
301
 
293
- // can only display data if there is a form to provide a definition
294
- if (record.data['children'].length > 0){
295
- items.push({
296
- text:'View Dynamic Data',
297
- iconCls:'icon-document',
298
- listeners:{
299
- 'click':function(){
300
- self.getDynamicData(record);
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
- items.push({
307
- text:'Add Dynamic Form',
308
- iconCls:'icon-add',
309
- listeners:{
310
- 'click':function(){
311
- self.addDynamicForm(record);
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
- if(record.data['text'] != 'DynamicFormDocument'){
317
- items.push({
318
- text:'Delete Model',
319
- iconCls:'icon-delete',
320
- listeners:{
321
- 'click':function(){
322
- self.deleteModel(record);
323
- }
324
- }
325
- });
326
- }
327
- }
328
- else if(record.data['isForm']){
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
- items.push({
352
- text:'Delete',
353
- iconCls:'icon-delete',
354
- listeners:{
355
- 'click':function(){
356
- self.deleteForm(record);
357
- }
358
- }
359
- });
360
- }
361
-
362
- var contextMenu = Ext.create("Ext.menu.Menu",{
363
- items:items
364
- });
365
- contextMenu.showAt(e.xy);
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
- var layout = new Ext.Panel({
371
- layout: 'border',
372
- autoDestroy:true,
373
- title:'Dynamic Forms',
374
- items: [this.sitesTree],
375
- tbar:{
376
- items:[
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
- text:'New Dynamic Form Model',
379
- iconCls:'icon-add',
380
- handler:function(btn){
381
- var newModelWindow = Ext.create("Ext.window.Window",{
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
- this.items = [layout];
453
- this.callParent(arguments);
454
- this.setActiveTab(0);
455
- },
467
+ this.items = [layout];
468
+ this.callParent(arguments);
469
+ this.setActiveTab(0);
470
+ },
456
471
 
457
- constructor : function(config) {
458
- config = Ext.apply({
459
- id: 'westregionPanel',
460
- region:'west',
461
- split:true,
462
- width:200,
463
- collapsible:false
464
- }, config);
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
- this.callParent([config]);
467
- }
481
+ this.callParent([config]);
482
+ }
468
483
  });