Commit 1340621c423163eb9d41a562e7020f7e13e184ea
1 parent
fb49873b
Exists in
master
and in
111 other branches
error msg when upload catalog + formattage
Showing
3 changed files
with
185 additions
and
236 deletions
Show diff stats
js/app/controllers/UploadModule.js
... | ... | @@ -4,56 +4,49 @@ |
4 | 4 | * @class amdaDesktop.UploadModule |
5 | 5 | * @extends amdaDesktop.AmdaModule |
6 | 6 | * @brief Upload Module controller definition |
7 | - * @author Elena | |
8 | - * @version $Id: UploadModule.js 2124 2014-02-21 14:06:14Z elena $ | |
7 | + * @author Elena | |
9 | 8 | */ |
10 | 9 | |
11 | 10 | Ext.define('amdaDesktop.UploadModule', { |
12 | 11 | extend: 'amdaDesktop.AmdaModule', |
13 | 12 | |
14 | 13 | requires: [ |
15 | - 'amdaUI.UploadUI' | |
16 | - ], | |
17 | - | |
14 | + 'amdaUI.UploadUI' | |
15 | + ], | |
16 | + | |
18 | 17 | contentId : 'uploadUI', |
19 | - | |
20 | 18 | |
21 | - /** | |
22 | - * @cfg {String} window definitions | |
23 | - * @required | |
24 | - */ | |
25 | - | |
19 | + /** | |
20 | + * @cfg {String} window definitions | |
21 | + * @required | |
22 | + */ | |
26 | 23 | width: 320, |
27 | 24 | height: 510, |
28 | - uiType : 'panelTabUpload', | |
25 | + uiType : 'panelTabUpload', | |
29 | 26 | helpTitle : 'Help on Upload Module', |
30 | 27 | helpFile : 'uploadHelp', |
31 | 28 | |
32 | 29 | init : function() { |
33 | - this.launcher = { | |
34 | - text : this.title, | |
35 | - iconCls : this.icon, | |
36 | - handler : this.createWindow, | |
37 | - scope : this | |
30 | + this.launcher = { | |
31 | + text : this.title, | |
32 | + iconCls : this.icon, | |
33 | + handler : this.createWindow, | |
34 | + scope : this | |
38 | 35 | }; |
39 | - }, | |
40 | - | |
41 | - uploadNotification : function(url,format) | |
42 | - { | |
43 | - var me = this; | |
44 | - loadMask.show(); | |
45 | - this.createWindow(function (o) | |
46 | - { | |
47 | - var desktop = myDesktopApp.getDesktop(); | |
48 | - var win = desktop.getWindow(me.id); | |
49 | - if (win) | |
50 | - { | |
51 | - win.items.items[0].forceUpload(url,format); | |
52 | - win.close(); | |
53 | - } | |
54 | - loadMask.hide(); | |
55 | - }); | |
56 | - | |
57 | - } | |
36 | + }, | |
58 | 37 | |
38 | + uploadNotification : function(url,format){ | |
39 | + var me = this; | |
40 | + loadMask.show(); | |
41 | + this.createWindow(function (o) | |
42 | + { | |
43 | + var desktop = myDesktopApp.getDesktop(); | |
44 | + var win = desktop.getWindow(me.id); | |
45 | + if (win){ | |
46 | + win.items.items[0].forceUpload(url,format); | |
47 | + win.close(); | |
48 | + } | |
49 | + loadMask.hide(); | |
50 | + }); | |
51 | + } | |
59 | 52 | }); |
60 | 53 | \ No newline at end of file |
... | ... |
js/app/views/CatalogUI.js
... | ... | @@ -17,17 +17,14 @@ Ext.define('amdaUI.CatalogUI', { |
17 | 17 | |
18 | 18 | isCatalog : true, |
19 | 19 | |
20 | - | |
21 | - constructor: function(config) | |
22 | - { | |
20 | + constructor: function(config) { | |
23 | 21 | this.init(config); |
24 | 22 | this.callParent(arguments); |
25 | 23 | this.toReconfigure = true; |
26 | 24 | if (this.object) this.loadObject(); |
27 | 25 | }, |
28 | 26 | |
29 | - setObject : function (object, toReconfigure) | |
30 | - { | |
27 | + setObject : function (object, toReconfigure) { | |
31 | 28 | if (toReconfigure) |
32 | 29 | this.toReconfigure = true; |
33 | 30 | // set object |
... | ... | @@ -39,8 +36,7 @@ Ext.define('amdaUI.CatalogUI', { |
39 | 36 | /** |
40 | 37 | * set params description into this.object |
41 | 38 | */ |
42 | - setParamInfo : function(parameters) | |
43 | - { | |
39 | + setParamInfo : function(parameters) { | |
44 | 40 | var params = []; |
45 | 41 | Ext.Array.each(parameters, function(item, index) { |
46 | 42 | params[index] = item; |
... | ... | @@ -51,54 +47,56 @@ Ext.define('amdaUI.CatalogUI', { |
51 | 47 | |
52 | 48 | /** |
53 | 49 | * update this.object from form |
54 | - */ | |
55 | - updateObject : function() | |
56 | - { | |
50 | + */ | |
51 | + updateObject : function(){ | |
57 | 52 | // get the basic form |
58 | - var basicForm = this.formPanel.getForm(); | |
59 | - var updateStatus = true; | |
53 | + var basicForm = this.formPanel.getForm(); | |
54 | + var updateStatus = true; | |
60 | 55 | |
61 | - var fieldsWithoutName = basicForm.getFields().items; | |
62 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | |
63 | - if(item !== this.fieldName) { | |
64 | - if (!item.isValid()) { | |
65 | - // set update isn't allowed | |
66 | - updateStatus = false; | |
67 | - } | |
68 | - } | |
69 | - }, this); | |
70 | - // if the update is allowed | |
71 | - if (updateStatus) { | |
72 | - /// real object update | |
73 | - // update TimeTable object with the content of form | |
74 | - basicForm.updateRecord(this.object); | |
75 | - } | |
76 | - // return the update status | |
77 | - return updateStatus; | |
56 | + var fieldsWithoutName = basicForm.getFields().items; | |
57 | + Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | |
58 | + if(item !== this.fieldName) { | |
59 | + if (!item.isValid()) { | |
60 | + // set update isn't allowed | |
61 | + updateStatus = false; | |
62 | + } | |
63 | + } | |
64 | + }, this); | |
65 | + // if the update is allowed | |
66 | + if (updateStatus) { | |
67 | + /// real object update | |
68 | + // update TimeTable object with the content of form | |
69 | + basicForm.updateRecord(this.object); | |
70 | + } | |
71 | + // return the update status | |
72 | + return updateStatus; | |
78 | 73 | }, |
79 | 74 | |
80 | - | |
81 | - updateCount : function() | |
82 | - { | |
75 | + updateCount : function() { | |
83 | 76 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); |
84 | 77 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); |
85 | - }, | |
86 | - | |
87 | - | |
78 | + }, | |
88 | 79 | |
89 | - onAfterInit: function(result, e) { | |
90 | - | |
80 | + onAfterInit: function(result, e) | |
81 | + { | |
91 | 82 | var me = this; |
92 | - | |
93 | - if (!result || !result.success) | |
83 | + if (!result) { | |
84 | + myDesktopApp.errorMsg(e.message); | |
85 | + Ext.defer(function(){Ext.Msg.toFront()},10); | |
86 | + | |
87 | + return; | |
88 | + } | |
89 | + else if (!result.success) | |
94 | 90 | { |
95 | 91 | if (result.message) |
96 | 92 | myDesktopApp.errorMsg(result.message); |
97 | 93 | else |
98 | 94 | myDesktopApp.errorMsg('Unknown error during catalog cache initialisation'); |
95 | + | |
96 | + Ext.defer(function(){Ext.Msg.toFront()},10); | |
99 | 97 | return; |
100 | 98 | } |
101 | - | |
99 | + | |
102 | 100 | if (me.toReconfigure) |
103 | 101 | { |
104 | 102 | var fields = [], columns = [], i = 3, width, index; |
... | ... | @@ -121,7 +119,7 @@ Ext.define('amdaUI.CatalogUI', { |
121 | 119 | { |
122 | 120 | index = 'param'+(i-1).toString(); |
123 | 121 | fields[i+2] = Ext.create('Ext.data.Field',{ name : index }); |
124 | - | |
122 | + | |
125 | 123 | if (obj.type == 1) // dateTime |
126 | 124 | { |
127 | 125 | columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : false, dataIndex: index, |
... | ... | @@ -135,9 +133,7 @@ Ext.define('amdaUI.CatalogUI', { |
135 | 133 | } |
136 | 134 | i++; |
137 | 135 | }); |
138 | - | |
139 | - | |
140 | - | |
136 | + | |
141 | 137 | var store = Ext.create('Ext.data.Store', { |
142 | 138 | fields: fields, |
143 | 139 | autoDestroy: false, |
... | ... | @@ -147,10 +143,7 @@ Ext.define('amdaUI.CatalogUI', { |
147 | 143 | remoteSort: true, |
148 | 144 | proxy: { |
149 | 145 | type: 'direct', |
150 | - api : | |
151 | - { | |
152 | - read : AmdaAction.readTTCacheIntervals | |
153 | - }, | |
146 | + api : { read : AmdaAction.readTTCacheIntervals }, | |
154 | 147 | // remplir automatiquement tt, sharedtt , catalog, shared catalog |
155 | 148 | extraParams : {'typeTT' : 'catalog'}, |
156 | 149 | reader: |
... | ... | @@ -164,9 +157,9 @@ Ext.define('amdaUI.CatalogUI', { |
164 | 157 | scope : me, |
165 | 158 | load: function(store,records) { |
166 | 159 | // myDesktopApp.EventManager.fireEvent('refresh'); |
167 | - me.TTGrid.getView().refresh(); | |
168 | - me.TTGrid.getSelectionModel().refresh(); | |
169 | - me.updateCount(); | |
160 | + me.TTGrid.getView().refresh(); | |
161 | + me.TTGrid.getSelectionModel().refresh(); | |
162 | + me.updateCount(); | |
170 | 163 | //Statistical plugin |
171 | 164 | // this.fireEvent("refresh"); |
172 | 165 | } |
... | ... | @@ -184,7 +177,7 @@ Ext.define('amdaUI.CatalogUI', { |
184 | 177 | // me.TTGrid.getStore().sorters.clear(); |
185 | 178 | // //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection(); |
186 | 179 | |
187 | - //set cache token to the Catalog object | |
180 | + //set cache token to the Catalog object | |
188 | 181 | me.object.set('cacheToken', result.token); |
189 | 182 | me.setParamInfo(result.parameters); |
190 | 183 | |
... | ... | @@ -196,35 +189,28 @@ Ext.define('amdaUI.CatalogUI', { |
196 | 189 | /** |
197 | 190 | * load object catalog into this view |
198 | 191 | */ |
199 | - loadObject : function() | |
200 | - { | |
192 | + loadObject : function(){ | |
201 | 193 | // load object into form |
202 | 194 | this.formPanel.getForm().loadRecord(this.object); |
203 | 195 | |
204 | 196 | this.status = null; |
205 | 197 | |
206 | - if (this.object.get('fromPlugin')) | |
207 | - { | |
208 | - if (this.object.get('objFormat') && this.object.get('objFormat') != '') | |
209 | - { | |
198 | + if (this.object.get('fromPlugin')){ | |
199 | + if (this.object.get('objFormat') && this.object.get('objFormat') != ''){ | |
210 | 200 | //From uploaded file |
211 | 201 | AmdaAction.initTTCacheFromUploadedFile(this.object.get('objName'), this.object.get('objFormat'), this.isCatalog, this.onAfterInit, this); |
212 | 202 | } |
213 | - else | |
214 | - { | |
203 | + else { | |
215 | 204 | //From tmp object (ie Statistics result) |
216 | 205 | AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), this.isCatalog, this.onAfterInit, this); |
217 | 206 | } |
218 | 207 | } |
219 | - else | |
220 | - { | |
208 | + else { | |
221 | 209 | var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType; |
222 | - if (this.object.get('id') == '') | |
223 | - { | |
224 | - | |
210 | + if (this.object.get('id') == '') { | |
211 | + //TODO ? | |
225 | 212 | } |
226 | - else | |
227 | - { | |
213 | + else { | |
228 | 214 | //From existing TT file |
229 | 215 | AmdaAction.initTTCacheFromTT(this.object.get('id'), typeTT, this.onAfterInit, this); |
230 | 216 | } |
... | ... | @@ -244,8 +230,7 @@ Ext.define('amdaUI.CatalogUI', { |
244 | 230 | // store / columns are the same - not needed to reconfigure grid |
245 | 231 | this.toReconfigure = false; |
246 | 232 | // if the name has been modified this is a creation |
247 | - if (this.fclose()) | |
248 | - { | |
233 | + if (this.fclose()) { | |
249 | 234 | if (this.object.isModified('name') || this.object.get('fromPlugin')) { |
250 | 235 | // if object already has an id : it's a 'rename' of an existing |
251 | 236 | if (this.object.get('id')){ |
... | ... | @@ -267,16 +252,14 @@ Ext.define('amdaUI.CatalogUI', { |
267 | 252 | } else { |
268 | 253 | //update |
269 | 254 | module.linkedNode.update(); |
270 | - } | |
271 | - | |
255 | + } | |
272 | 256 | } |
273 | 257 | }, |
274 | 258 | |
275 | 259 | /** |
276 | 260 | * overwrite metod called by Save button |
277 | 261 | */ |
278 | - overwriteProcess : function(btn) | |
279 | - { | |
262 | + overwriteProcess : function(btn) { | |
280 | 263 | if (btn == 'cancel') return; |
281 | 264 | |
282 | 265 | this.fieldName.clearInvalid(); |
... | ... | @@ -288,13 +271,12 @@ Ext.define('amdaUI.CatalogUI', { |
288 | 271 | * Check if changes were made before closing window |
289 | 272 | * @return true if changes |
290 | 273 | */ |
291 | - fclose : function() | |
292 | - { | |
274 | + fclose : function() { | |
293 | 275 | if (this.status == null) |
294 | 276 | return false; |
295 | 277 | |
296 | 278 | var isDirty = this.formPanel.getForm().isDirty() || (this.status.isModified) || (this.status.nbModified > 0) || (this.status.nbNew > 0); |
297 | - return isDirty; | |
279 | + return isDirty; | |
298 | 280 | }, |
299 | 281 | |
300 | 282 | init : function (config) |
... | ... | @@ -310,9 +292,9 @@ Ext.define('amdaUI.CatalogUI', { |
310 | 292 | validateOnChange: false, |
311 | 293 | validateOnBlur: false, |
312 | 294 | validFlag: false, |
313 | - validator : function() { | |
314 | - return this.validFlag; | |
315 | - } | |
295 | + validator : function() { | |
296 | + return this.validFlag; | |
297 | + } | |
316 | 298 | }); |
317 | 299 | |
318 | 300 | var cellEditing = Ext.create('Ext.grid.plugin.CellEditing',{ |
... | ... | @@ -348,8 +330,7 @@ Ext.define('amdaUI.CatalogUI', { |
348 | 330 | //Interval is modified on the server side |
349 | 331 | me.editing = true; |
350 | 332 | |
351 | - AmdaAction.modifyTTCacheInterval(obj, function (result, e) { | |
352 | - | |
333 | + AmdaAction.modifyTTCacheInterval(obj, function (result, e) { | |
353 | 334 | var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); |
354 | 335 | if (module) |
355 | 336 | module.getUiContent().status = result.status; |
... | ... | @@ -365,7 +346,7 @@ Ext.define('amdaUI.CatalogUI', { |
365 | 346 | }, this); |
366 | 347 | } |
367 | 348 | else |
368 | - me.editing = false; | |
349 | + me.editing = false; | |
369 | 350 | } |
370 | 351 | } |
371 | 352 | }); |
... | ... | @@ -375,85 +356,81 @@ Ext.define('amdaUI.CatalogUI', { |
375 | 356 | columns: [ ], |
376 | 357 | frame: true, |
377 | 358 | columnLines: true, |
378 | - // selType: 'cellmodel', | |
359 | + // selType: 'cellmodel', | |
379 | 360 | plugins: [ cellEditing, { ptype : 'bufferedrenderer'} ], |
380 | 361 | dockedItems: [{ |
381 | 362 | xtype: 'toolbar', |
382 | 363 | items: [{ |
383 | - iconCls: 'icon-add', | |
384 | - scope: this, | |
385 | - handler: function(){ | |
386 | - | |
387 | - cellEditing.cancelEdit(); | |
388 | - var store = this.TTGrid.getStore(); | |
389 | - | |
390 | - var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | |
391 | - var row = 0; | |
392 | - if (selection) | |
393 | - row = store.indexOf(selection) + 1; | |
394 | - this.TTGrid.getSelectionModel().deselectAll(); | |
395 | - | |
396 | - var me = this; | |
397 | - AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) { | |
398 | - this.status = result.status; | |
399 | - this.TTGrid.getStore().reload({ | |
400 | - callback : function(records, options, success) { | |
401 | - me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | |
402 | - me.TTGrid.getView().select(row); | |
403 | - cellEditing.startEditByPosition({row: row, column: 1}); | |
404 | - }, me); | |
405 | - } | |
406 | - }); | |
407 | - }, this); | |
408 | - } | |
409 | - },{ | |
410 | - iconCls: 'icon-delete', | |
411 | - disabled: true, | |
412 | - itemId: 'delete', | |
413 | - scope: this, | |
414 | - handler: function(){ | |
415 | - var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | |
416 | - if (selection) | |
417 | - { | |
418 | - var rowId = selection.get('cacheId'); | |
364 | + iconCls: 'icon-add', | |
365 | + scope: this, | |
366 | + handler: function(){ | |
367 | + cellEditing.cancelEdit(); | |
368 | + var store = this.TTGrid.getStore(); | |
369 | + | |
370 | + var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | |
371 | + var row = 0; | |
372 | + if (selection) | |
373 | + row = store.indexOf(selection) + 1; | |
419 | 374 | this.TTGrid.getSelectionModel().deselectAll(); |
420 | - AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) { | |
375 | + | |
376 | + var me = this; | |
377 | + AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) { | |
421 | 378 | this.status = result.status; |
422 | - this.TTGrid.getStore().reload(); | |
379 | + this.TTGrid.getStore().reload({ | |
380 | + callback : function(records, options, success) { | |
381 | + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | |
382 | + me.TTGrid.getView().select(row); | |
383 | + cellEditing.startEditByPosition({row: row, column: 1}); | |
384 | + }, me); | |
385 | + } | |
386 | + }); | |
423 | 387 | }, this); |
424 | 388 | } |
425 | - } | |
389 | + },{ | |
390 | + iconCls: 'icon-delete', | |
391 | + disabled: true, | |
392 | + itemId: 'delete', | |
393 | + scope: this, | |
394 | + handler: function(){ | |
395 | + var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | |
396 | + if (selection) | |
397 | + { | |
398 | + var rowId = selection.get('cacheId'); | |
399 | + this.TTGrid.getSelectionModel().deselectAll(); | |
400 | + AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) { | |
401 | + this.status = result.status; | |
402 | + this.TTGrid.getStore().reload(); | |
403 | + }, this); | |
404 | + } | |
405 | + } | |
426 | 406 | }] |
427 | 407 | }] |
428 | 408 | }); |
429 | 409 | |
430 | - this.formPanel = Ext.create('Ext.form.Panel', | |
431 | - { | |
410 | + this.formPanel = Ext.create('Ext.form.Panel', { | |
432 | 411 | region : 'center', |
433 | 412 | layout: 'hbox', |
434 | 413 | bodyStyle: {background : '#dfe8f6'}, |
435 | 414 | defaults: { border : false, align: 'stretch', bodyStyle: {background : '#dfe8f6'}, padding: '3'}, |
436 | 415 | fieldDefaults: { labelWidth: 80, labelAlign : 'top' }, |
437 | - items: [ | |
438 | - { | |
416 | + items: [{ | |
439 | 417 | xtype: 'form', |
440 | 418 | flex: 1, |
441 | 419 | buttonAlign: 'left', |
442 | - // title : 'Information', | |
420 | + // title : 'Information', | |
443 | 421 | layout: {type: 'vbox', pack: 'start', align: 'stretch'}, |
444 | 422 | items : [ |
445 | 423 | this.fieldName, |
446 | 424 | { |
447 | 425 | xtype: 'fieldcontainer', |
448 | 426 | layout: 'hbox', |
449 | - items: [ | |
450 | - { | |
427 | + items: [{ | |
451 | 428 | xtype:'datefield', fieldLabel:'Creation date', |
452 | 429 | name: 'created', disabled: true, |
453 | 430 | hideTrigger: true, format: 'Y/m/d H:i:s' |
454 | 431 | }, |
455 | 432 | { xtype: 'splitter' }, |
456 | - { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true} | |
433 | + { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true } | |
457 | 434 | ] |
458 | 435 | }, |
459 | 436 | { |
... | ... | @@ -466,13 +443,11 @@ Ext.define('amdaUI.CatalogUI', { |
466 | 443 | xtype: 'component', |
467 | 444 | height: 180 |
468 | 445 | }], |
469 | - dockedItems:[ | |
470 | - { | |
446 | + dockedItems:[{ | |
471 | 447 | xtype: 'toolbar', |
472 | 448 | dock: 'bottom', |
473 | 449 | ui: 'footer', |
474 | - items: [ | |
475 | - { | |
450 | + items: [{ | |
476 | 451 | type: 'button', |
477 | 452 | text: 'Create New Catalog', |
478 | 453 | scope : this, |
... | ... | @@ -484,7 +459,8 @@ Ext.define('amdaUI.CatalogUI', { |
484 | 459 | var obj = module.linkedNode.get('object'); |
485 | 460 | |
486 | 461 | if (obj && obj.get('id') == '' && !obj.get('fromPlugin')) { |
487 | - var me = this | |
462 | + var me = this; | |
463 | + | |
488 | 464 | Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){ |
489 | 465 | if (btn == 'ok'){ |
490 | 466 | AmdaAction.initTTCache(me.isCatalog, text, me.onAfterInit, me); |
... | ... | @@ -515,28 +491,23 @@ Ext.define('amdaUI.CatalogUI', { |
515 | 491 | basicForm.updateRecord(this.object); |
516 | 492 | |
517 | 493 | var me = this; |
518 | - this.checkIntervalsStatusForSave(function () | |
519 | - { | |
494 | + this.checkIntervalsStatusForSave(function () { | |
520 | 495 | //Name validation |
521 | 496 | var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); |
522 | 497 | |
523 | 498 | if (!module) return; |
524 | 499 | module.linkedNode.isValidName(me.fieldName.getValue(), function (res) |
525 | 500 | { |
526 | - if (!res) | |
527 | - { | |
501 | + if (!res) { | |
528 | 502 | me.fieldName.validFlag = 'Error during object validation'; |
529 | 503 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
530 | 504 | me.fieldName.validate(); |
531 | 505 | return; |
532 | 506 | } |
533 | 507 | |
534 | - if (!res.valid) | |
535 | - { | |
536 | - if (res.error) | |
537 | - { | |
538 | - if (res.error.search('subtree') != -1) | |
539 | - { | |
508 | + if (!res.valid) { | |
509 | + if (res.error) { | |
510 | + if (res.error.search('subtree') != -1) { | |
540 | 511 | Ext.MessageBox.show({title:'Warning', |
541 | 512 | msg: res.error+'<br/>Do you want to overwrite it?', |
542 | 513 | width: 300, |
... | ... | @@ -550,8 +521,7 @@ Ext.define('amdaUI.CatalogUI', { |
550 | 521 | else |
551 | 522 | me.fieldName.validFlag = res.error; |
552 | 523 | } |
553 | - else | |
554 | - { | |
524 | + else { | |
555 | 525 | me.fieldName.validFlag = 'Invalid object name'; |
556 | 526 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
557 | 527 | } |
... | ... | @@ -565,20 +535,17 @@ Ext.define('amdaUI.CatalogUI', { |
565 | 535 | }); |
566 | 536 | }); |
567 | 537 | } |
568 | - else | |
569 | - { | |
538 | + else { | |
570 | 539 | Ext.Msg.alert('No intervals', 'Your time table is invalid, <br>you must have at least one interval'); |
571 | 540 | } |
572 | 541 | } |
573 | 542 | } |
574 | - }, | |
575 | - { | |
543 | + },{ | |
576 | 544 | type: 'button', |
577 | 545 | text: 'Reset', |
578 | 546 | scope : this, |
579 | 547 | disabled: true, |
580 | - handler: function() | |
581 | - { | |
548 | + handler: function() { | |
582 | 549 | // var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); |
583 | 550 | // module.createLinkedNode(); |
584 | 551 | // module.createObject(); |
... | ... | @@ -594,24 +561,20 @@ Ext.define('amdaUI.CatalogUI', { |
594 | 561 | type: 'button', |
595 | 562 | text: 'Visualize', |
596 | 563 | scope: this, |
597 | - handler: function() | |
598 | - { | |
564 | + handler: function() { | |
599 | 565 | var me = this; |
600 | 566 | |
601 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) | |
602 | - { | |
567 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) { | |
603 | 568 | //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute' |
604 | - var temporaryNode = Ext.create('amdaModel.CatalogNode', { | |
605 | - leaf : true | |
606 | - }); | |
569 | + var temporaryNode = Ext.create('amdaModel.CatalogNode', { leaf : true }); | |
607 | 570 | |
608 | 571 | if (temporaryNode) temporaryNode.set('object',me.object); |
609 | 572 | module.setLinkedNode(temporaryNode); |
610 | 573 | |
611 | - module.createWindow(); | |
574 | + module.createWindow(); | |
612 | 575 | }); |
613 | 576 | } |
614 | - }] | |
577 | + }] | |
615 | 578 | }] |
616 | 579 | }, |
617 | 580 | { |
... | ... | @@ -619,19 +582,15 @@ Ext.define('amdaUI.CatalogUI', { |
619 | 582 | bodyStyle: {background : '#dfe8f6'}, |
620 | 583 | //padding: '3', |
621 | 584 | flex: 2, |
622 | - items : [ | |
623 | - this.TTGrid | |
624 | - ] | |
585 | + items : [ this.TTGrid ] | |
625 | 586 | }] |
626 | 587 | }); |
627 | 588 | |
628 | - this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections) | |
629 | - { | |
589 | + this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections) { | |
630 | 590 | this.TTGrid.down('#delete').setDisabled(selections.length === 0); |
631 | 591 | }, this); |
632 | 592 | |
633 | - var myConf = | |
634 | - { | |
593 | + var myConf = { | |
635 | 594 | layout: 'border', |
636 | 595 | items: [ |
637 | 596 | this.formPanel, |
... | ... | @@ -651,9 +610,7 @@ Ext.define('amdaUI.CatalogUI', { |
651 | 610 | } |
652 | 611 | } |
653 | 612 | ] |
654 | - }; | |
655 | - | |
613 | + }; | |
656 | 614 | Ext.apply (this, Ext.apply(arguments, myConf)); |
657 | - } | |
658 | - | |
615 | + } | |
659 | 616 | }); |
... | ... |
php/api.php
1 | 1 | <?php |
2 | 2 | |
3 | - require('config.php'); | |
4 | - header('Content-Type: text/javascript'); | |
3 | + require('config.php'); | |
4 | + header('Content-Type: text/javascript'); | |
5 | 5 | |
6 | - $actions = array(); | |
7 | - foreach($API as $aname => &$a){ | |
8 | - $methods = array(); | |
9 | - foreach($a['methods'] as $mname => &$m){ | |
10 | - $md = array( | |
11 | - 'name'=>$mname, | |
12 | - 'len'=>$m['len'] | |
13 | - ); | |
14 | - if(isset($m['formHandler']) && $m['formHandler']){ | |
15 | - $md['formHandler'] = true; | |
16 | - } | |
17 | - $methods[] = $md; | |
6 | + $actions = array(); | |
7 | + foreach($API as $aname => &$a){ | |
8 | + $methods = array(); | |
9 | + foreach($a['methods'] as $mname => &$m){ | |
10 | + $md = array( | |
11 | + 'name'=>$mname, | |
12 | + 'len'=>$m['len'] | |
13 | + ); | |
14 | + if(isset($m['formHandler']) && $m['formHandler']){ | |
15 | + $md['formHandler'] = true; | |
16 | + } | |
17 | + $methods[] = $md; | |
18 | + } | |
19 | + $actions[$aname] = $methods; | |
18 | 20 | } |
19 | - $actions[$aname] = $methods; | |
20 | - } | |
21 | 21 | |
22 | - $cfg = array( | |
23 | - 'url'=>'php/router.php', | |
24 | - 'type'=>'remoting', | |
25 | - 'id' => 'amda-provider', | |
26 | - 'maxRetries' => 0, | |
27 | - 'actions'=>$actions | |
28 | - ); | |
22 | + $cfg = array( | |
23 | + 'url'=>'php/router.php', | |
24 | + 'type'=>'remoting', | |
25 | + 'id' => 'amda-provider', | |
26 | + 'maxRetries' => 0, | |
27 | + 'actions'=>$actions | |
28 | + ); | |
29 | 29 | |
30 | - echo 'Ext.app.REMOTING_API = '; | |
31 | - | |
32 | - echo json_encode($cfg); | |
33 | - echo ';'; | |
30 | + echo 'Ext.app.REMOTING_API = '; | |
34 | 31 | |
32 | + echo json_encode($cfg); | |
33 | + echo ';'; | |
35 | 34 | ?> |
36 | 35 | |
... | ... |