Commit 70aabdee119dcbbff6eea4e508b0fe51f0528022
1 parent
3a5f60a1
Exists in
master
and in
112 other branches
catalog draft
Showing
4 changed files
with
359 additions
and
348 deletions
Show diff stats
js/app/views/CatalogUI.js
@@ -13,13 +13,15 @@ Ext.define('amdaUI.CatalogUI', { | @@ -13,13 +13,15 @@ Ext.define('amdaUI.CatalogUI', { | ||
13 | 13 | ||
14 | isCatalog : true, | 14 | isCatalog : true, |
15 | 15 | ||
16 | - constructor: function(config) { | ||
17 | - this.init(config); | 16 | + constructor: function(config) |
17 | + { | ||
18 | + this.init(config); | ||
18 | this.callParent(arguments);; | 19 | this.callParent(arguments);; |
19 | - if (this.object) this.loadObject(); | 20 | + if (this.object) this.loadObject(); |
20 | }, | 21 | }, |
21 | 22 | ||
22 | - setObject : function (object) { | 23 | + setObject : function (object) |
24 | + { | ||
23 | // set object | 25 | // set object |
24 | this.object = object; | 26 | this.object = object; |
25 | 27 | ||
@@ -30,21 +32,21 @@ Ext.define('amdaUI.CatalogUI', { | @@ -30,21 +32,21 @@ Ext.define('amdaUI.CatalogUI', { | ||
30 | /** | 32 | /** |
31 | * set params description into this.object | 33 | * set params description into this.object |
32 | */ | 34 | */ |
33 | - setParamInfo : function(parameters) { | ||
34 | - | ||
35 | - var params = []; | ||
36 | - Ext.Array.each(parameters, function(item, index) { | ||
37 | - params[index] = item; | ||
38 | - }, this); | ||
39 | - | ||
40 | - this.object.set('parameters', params); | ||
41 | - | 35 | + setParamInfo : function(parameters) |
36 | + { | ||
37 | + var params = []; | ||
38 | + Ext.Array.each(parameters, function(item, index) { | ||
39 | + params[index] = item; | ||
40 | + }, this); | ||
41 | + | ||
42 | + this.object.set('parameters', params); | ||
42 | }, | 43 | }, |
43 | 44 | ||
44 | /** | 45 | /** |
45 | * update this.object from form | 46 | * update this.object from form |
46 | */ | 47 | */ |
47 | - updateObject : function(){ | 48 | + updateObject : function() |
49 | + { | ||
48 | // get the basic form | 50 | // get the basic form |
49 | var basicForm = this.formPanel.getForm(); | 51 | var basicForm = this.formPanel.getForm(); |
50 | var updateStatus = true; | 52 | var updateStatus = true; |
@@ -69,7 +71,8 @@ Ext.define('amdaUI.CatalogUI', { | @@ -69,7 +71,8 @@ Ext.define('amdaUI.CatalogUI', { | ||
69 | }, | 71 | }, |
70 | 72 | ||
71 | 73 | ||
72 | - updateCount : function() { | 74 | + updateCount : function() |
75 | + { | ||
73 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); | 76 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); |
74 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); | 77 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); |
75 | }, | 78 | }, |
@@ -77,258 +80,263 @@ Ext.define('amdaUI.CatalogUI', { | @@ -77,258 +80,263 @@ Ext.define('amdaUI.CatalogUI', { | ||
77 | /** | 80 | /** |
78 | * load object catalog into this view | 81 | * load object catalog into this view |
79 | */ | 82 | */ |
80 | - loadObject : function(){ | ||
81 | - // load object into form | ||
82 | - this.formPanel.getForm().loadRecord(this.object); | ||
83 | - | ||
84 | - this.status = null; | 83 | + loadObject : function() |
84 | + { | ||
85 | + // load object into form | ||
86 | + this.formPanel.getForm().loadRecord(this.object); | ||
85 | 87 | ||
86 | - var me = this; | ||
87 | - | ||
88 | - var onAfterInit = function(result, e) { | ||
89 | - | ||
90 | - if (!result || !result.success) | ||
91 | - { | ||
92 | - if (result.message) | ||
93 | - myDesktopApp.errorMsg(result.message); | ||
94 | - else | ||
95 | - myDesktopApp.errorMsg('Unknown error during catalog cache initialisation'); | ||
96 | - return; | ||
97 | - } | ||
98 | - | ||
99 | - | ||
100 | - var fields = [], columns = [], i = 2, width, index; | ||
101 | - | ||
102 | - fields[0] = Ext.create('Ext.data.Field',{ name : 'start' }); | ||
103 | - fields[1] = Ext.create('Ext.data.Field',{ name : 'stop' }); | ||
104 | - | ||
105 | - columns[0] = Ext.create('Ext.grid.column.RowNumberer'); | ||
106 | - | ||
107 | - columns[1] = Ext.create('Ext.grid.column.Column', { text: 'Start Time', sortable : false, dataIndex: 'start', | ||
108 | - width : 120, menuDisabled: true }); | ||
109 | - columns[2] = Ext.create('Ext.grid.column.Column', { text: 'Stop Time', sortable : false, dataIndex: 'stop', | ||
110 | - width : 120, menuDisabled: true }); | ||
111 | - | ||
112 | - Ext.Array.each(result.parameters, function(obj) { | ||
113 | - index = 'param'+i.toString(); | ||
114 | - fields[i] = Ext.create('Ext.data.Field',{ name : index }); | ||
115 | - width = 50. * parseInt(obj.size); | ||
116 | - columns[i+1] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : false, dataIndex: index, | ||
117 | - width : width, menuDisabled: true }); | ||
118 | - i++; | ||
119 | - }); | ||
120 | - | ||
121 | - | ||
122 | - var store = Ext.create('Ext.data.Store', { | ||
123 | - fields: fields, | ||
124 | - autoDestroy: false, | ||
125 | - pageSize : 200, | ||
126 | - buffered : true, | ||
127 | - purgePageCount: 0, | ||
128 | - remoteSort: true, | ||
129 | - proxy: { | ||
130 | - type: 'direct', | ||
131 | - api : | ||
132 | - { | ||
133 | - read : AmdaAction.readTTCacheIntervals | ||
134 | - }, | ||
135 | - // remplir automatiquement tt, sharedtt , catalog, shared catalog | ||
136 | - extraParams : {'typeTT' : 'catalog'}, | ||
137 | - reader: | ||
138 | - { | ||
139 | - type: 'json', | ||
140 | - root: 'intervals', | ||
141 | - totalProperty : 'totalCount' | ||
142 | - } | ||
143 | - }, | ||
144 | - listeners: { | ||
145 | - scope : me, | ||
146 | - load: function(store,records) { | ||
147 | - // myDesktopApp.EventManager.fireEvent('refresh'); | ||
148 | - me.TTGrid.getView().refresh(); | ||
149 | - me.TTGrid.getSelectionModel().refresh(); | ||
150 | - me.updateCount(); | ||
151 | - //Statistical plugin | ||
152 | - // this.fireEvent("refresh"); | ||
153 | - } | ||
154 | - } | ||
155 | - }); | ||
156 | - | ||
157 | - me.TTGrid.reconfigure(store, columns); | ||
158 | - | ||
159 | -// | ||
160 | -// me.TTGrid.getSelectionModel().deselectAll(); | ||
161 | -// | ||
162 | -// // clear filters | ||
163 | -// me.TTGrid.getStore().clearFilter(true); | ||
164 | -// | ||
165 | -// //clear sort | ||
166 | -// me.TTGrid.getStore().sorters.clear(); | ||
167 | -// //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection(); | ||
168 | -// | ||
169 | - //set cache token to the Catalog object | ||
170 | - me.object.set('cacheToken', result.token); | ||
171 | - me.setParamInfo(result.parameters); | ||
172 | - | ||
173 | - me.TTGrid.getStore().load(); | 88 | + this.status = null; |
89 | + | ||
90 | + var me = this; | ||
174 | 91 | ||
175 | - me.status = result.status; | 92 | + var onAfterInit = function(result, e) |
93 | + { | ||
94 | + if (!result || !result.success) | ||
95 | + { | ||
96 | + if (result.message) | ||
97 | + myDesktopApp.errorMsg(result.message); | ||
98 | + else | ||
99 | + myDesktopApp.errorMsg('Unknown error during catalog cache initialisation'); | ||
100 | + return; | ||
101 | + } | ||
102 | + | ||
103 | + var fields = [], columns = [], i = 3, width, index; | ||
104 | + | ||
105 | + var fieldsConfig = [{ name : 'start' },{ name : 'stop' },{ name: 'cacheId', type : 'int'}, | ||
106 | + { name: 'isNew', type : 'boolean', defaultValue: false }, | ||
107 | + { name: 'isModified', type : 'boolean', defaultValue: false} | ||
108 | + ]; | ||
109 | + | ||
110 | + for (var j = 0; j < 5; j++) fields[j] = Ext.create('Ext.data.Field', fieldsConfig[j]); | ||
111 | + | ||
112 | + columns[0] = Ext.create('Ext.grid.column.RowNumberer'); | ||
176 | 113 | ||
177 | - }; | 114 | + columns[1] = Ext.create('Ext.grid.column.Column', { text: 'Start Time', sortable : false, dataIndex: 'start', |
115 | + width : 120, menuDisabled: true }); | ||
116 | + columns[2] = Ext.create('Ext.grid.column.Column', { text: 'Stop Time', sortable : false, dataIndex: 'stop', | ||
117 | + width : 120, menuDisabled: true }); | ||
118 | + | ||
119 | + Ext.Array.each(result.parameters, function(obj) | ||
120 | + { | ||
121 | + index = 'param'+(i-1).toString(); | ||
122 | + fields[i+2] = Ext.create('Ext.data.Field',{ name : index }); | ||
123 | + width = 50. * parseInt(obj.size); | ||
124 | + columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : false, dataIndex: index, | ||
125 | + width : width, menuDisabled: true }); | ||
126 | + i++; | ||
127 | + }); | ||
128 | + | ||
129 | + | ||
130 | + | ||
131 | + var store = Ext.create('Ext.data.Store', { | ||
132 | + fields: fields, | ||
133 | + autoDestroy: false, | ||
134 | + pageSize : 200, | ||
135 | + buffered : true, | ||
136 | + purgePageCount: 0, | ||
137 | + remoteSort: true, | ||
138 | + proxy: { | ||
139 | + type: 'direct', | ||
140 | + api : | ||
141 | + { | ||
142 | + read : AmdaAction.readTTCacheIntervals | ||
143 | + }, | ||
144 | + // remplir automatiquement tt, sharedtt , catalog, shared catalog | ||
145 | + extraParams : {'typeTT' : 'catalog'}, | ||
146 | + reader: | ||
147 | + { | ||
148 | + type: 'json', | ||
149 | + root: 'intervals', | ||
150 | + totalProperty : 'totalCount' | ||
151 | + } | ||
152 | + }, | ||
153 | + listeners: { | ||
154 | + scope : me, | ||
155 | + load: function(store,records) { | ||
156 | + // myDesktopApp.EventManager.fireEvent('refresh'); | ||
157 | + me.TTGrid.getView().refresh(); | ||
158 | + me.TTGrid.getSelectionModel().refresh(); | ||
159 | + me.updateCount(); | ||
160 | + //Statistical plugin | ||
161 | + // this.fireEvent("refresh"); | ||
162 | + } | ||
163 | + } | ||
164 | + }); | ||
165 | + | ||
166 | + me.TTGrid.reconfigure(store, columns); | ||
167 | + | ||
168 | + me.TTGrid.getSelectionModel().deselectAll(); | ||
169 | + // | ||
170 | + // // clear filters | ||
171 | + // me.TTGrid.getStore().clearFilter(true); | ||
172 | + // | ||
173 | + // //clear sort | ||
174 | + // me.TTGrid.getStore().sorters.clear(); | ||
175 | + // //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection(); | ||
176 | + // | ||
177 | + //set cache token to the Catalog object | ||
178 | + me.object.set('cacheToken', result.token); | ||
179 | + me.setParamInfo(result.parameters); | ||
180 | + | ||
181 | + me.TTGrid.getStore().load(); | ||
182 | + | ||
183 | + me.status = result.status; | ||
184 | + }; | ||
178 | 185 | ||
179 | - if (this.object.get('fromPlugin')) | ||
180 | - { | ||
181 | - if (this.object.get('objFormat') && this.object.get('objFormat') != '') | ||
182 | - { | ||
183 | - //From uploaded file | ||
184 | - //AmdaAction.initTTCacheFromUploadedFile(this.object.get('objName'), this.object.get('objFormat'), onAfterInit); | ||
185 | - } | ||
186 | - else | ||
187 | - { | ||
188 | - //From tmp object (ie Search result) | ||
189 | - AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), this.isCatalog, onAfterInit); | ||
190 | - } | ||
191 | - } | ||
192 | - else | ||
193 | - { | ||
194 | - var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType; | ||
195 | - if (this.object.get('id') == '') | ||
196 | - { | ||
197 | - //Init empty cache | ||
198 | - AmdaAction.initTTCache(this.isCatalog, onAfterInit); | ||
199 | - } | ||
200 | - else | ||
201 | - { | ||
202 | - //From existing TT file | ||
203 | - AmdaAction.initTTCacheFromTT(this.object.get('id'), 'catalog', onAfterInit); | ||
204 | - } | ||
205 | - } | 186 | + if (this.object.get('fromPlugin')) |
187 | + { | ||
188 | + if (this.object.get('objFormat') && this.object.get('objFormat') != '') | ||
189 | + { | ||
190 | + //From uploaded file | ||
191 | + //AmdaAction.initTTCacheFromUploadedFile(this.object.get('objName'), this.object.get('objFormat'), onAfterInit); | ||
192 | + } | ||
193 | + else | ||
194 | + { | ||
195 | + //From tmp object (ie Search result) | ||
196 | + AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), this.isCatalog, onAfterInit); | ||
197 | + } | ||
198 | + } | ||
199 | + else | ||
200 | + { | ||
201 | + var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType; | ||
202 | + if (this.object.get('id') == '') | ||
203 | + { | ||
204 | + //Init empty cache | ||
205 | + AmdaAction.initTTCache(this.isCatalog, onAfterInit); | ||
206 | + } | ||
207 | + else | ||
208 | + { | ||
209 | + //From existing TT file | ||
210 | + AmdaAction.initTTCacheFromTT(this.object.get('id'), 'catalog', onAfterInit); | ||
211 | + } | ||
212 | + } | ||
206 | }, | 213 | }, |
214 | + | ||
207 | checkIntervalsStatusForSave : function(onStatusOk) { | 215 | checkIntervalsStatusForSave : function(onStatusOk) { |
208 | - onStatusOk(); | 216 | + onStatusOk(); |
209 | }, | 217 | }, |
210 | 218 | ||
211 | /* | 219 | /* |
212 | * save method called by Save button | 220 | * save method called by Save button |
213 | */ | 221 | */ |
214 | - saveProcess : function(toRename){ | ||
215 | - var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); | 222 | + saveProcess : function(toRename) |
223 | + { | ||
224 | + var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id); | ||
216 | 225 | ||
217 | // if the name has been modified this is a creation | 226 | // if the name has been modified this is a creation |
218 | - if (this.fclose()) { | ||
219 | - | ||
220 | - if (this.object.isModified('name') || this.object.get('fromPlugin')) { | ||
221 | - | ||
222 | - // if object already has an id : it's a 'rename' of an existing | ||
223 | - if (this.object.get('id')){ | ||
224 | - // the context Node is the parent node of current edited one | ||
225 | - var contextNode = module.linkedNode.parentNode; | ||
226 | - // link a new node to the TimeTableModule | ||
227 | - module.createLinkedNode(); | ||
228 | - // set the contextNode | ||
229 | - module.linkedNode.set('contextNode',contextNode); | ||
230 | - // create a new object linked | ||
231 | - module.createObject(this.object.getJsonValues()); | ||
232 | - | ||
233 | - var obj = module.linkedNode.get('object'); | ||
234 | - // synchronisation of objects | ||
235 | - this.object = obj; | ||
236 | - if (toRename) module.linkedNode.toRename = true; | ||
237 | - } | ||
238 | - module.linkedNode.create({callback : function() {module.linkedNode.update();}, scope : this}); | ||
239 | - } else { | ||
240 | - //update | ||
241 | - module.linkedNode.update(); | ||
242 | - } | ||
243 | - } | 227 | + if (this.fclose()) |
228 | + { | ||
229 | + if (this.object.isModified('name') || this.object.get('fromPlugin')) { | ||
230 | + // if object already has an id : it's a 'rename' of an existing | ||
231 | + if (this.object.get('id')){ | ||
232 | + // the context Node is the parent node of current edited one | ||
233 | + var contextNode = module.linkedNode.parentNode; | ||
234 | + // link a new node to the TimeTableModule | ||
235 | + module.createLinkedNode(); | ||
236 | + // set the contextNode | ||
237 | + module.linkedNode.set('contextNode',contextNode); | ||
238 | + // create a new object linked | ||
239 | + module.createObject(this.object.getJsonValues()); | ||
240 | + | ||
241 | + var obj = module.linkedNode.get('object'); | ||
242 | + // synchronisation of objects | ||
243 | + this.object = obj; | ||
244 | + if (toRename) module.linkedNode.toRename = true; | ||
245 | + } | ||
246 | + module.linkedNode.create({callback : function() {module.linkedNode.update();}, scope : this}); | ||
247 | + } else { | ||
248 | + //update | ||
249 | + module.linkedNode.update(); | ||
250 | + } | ||
251 | + } | ||
244 | }, | 252 | }, |
245 | 253 | ||
246 | /** | 254 | /** |
247 | * Check if changes were made before closing window | 255 | * Check if changes were made before closing window |
248 | * @return true if changes | 256 | * @return true if changes |
249 | */ | 257 | */ |
250 | - fclose : function() { | 258 | + fclose : function() |
259 | + { | ||
251 | if (this.status == null) | 260 | if (this.status == null) |
252 | return false; | 261 | return false; |
253 | 262 | ||
254 | var isDirty = this.formPanel.getForm().isDirty() || (this.status.isModified) || (this.status.nbModified > 0) || (this.status.nbNew > 0); | 263 | var isDirty = this.formPanel.getForm().isDirty() || (this.status.isModified) || (this.status.nbModified > 0) || (this.status.nbNew > 0); |
255 | - return isDirty; | 264 | + return isDirty; |
256 | }, | 265 | }, |
257 | 266 | ||
258 | 267 | ||
259 | - init : function (config) { | 268 | + init : function (config) |
269 | + { | ||
270 | + this.object = config.object; | ||
260 | 271 | ||
261 | - this.object = config.object; | ||
262 | - | ||
263 | - this.fieldName = new Ext.form.field.Text({ | ||
264 | - fieldLabel: 'Name', | ||
265 | - allowBlank : false, | ||
266 | - stripCharsRe: /(^\s+|\s+$)/g, | ||
267 | - emptyText: 'Please no spaces!', | ||
268 | - name: 'name', | ||
269 | - validateOnChange: false, | ||
270 | - validateOnBlur: false, | ||
271 | - validFlag: false, | ||
272 | - validator : function() { | ||
273 | - return this.validFlag; | ||
274 | - } | ||
275 | - }); | 272 | + this.fieldName = new Ext.form.field.Text({ |
273 | + fieldLabel: 'Name', | ||
274 | + allowBlank : false, | ||
275 | + stripCharsRe: /(^\s+|\s+$)/g, | ||
276 | + emptyText: 'Please no spaces!', | ||
277 | + name: 'name', | ||
278 | + validateOnChange: false, | ||
279 | + validateOnBlur: false, | ||
280 | + validFlag: false, | ||
281 | + validator : function() { | ||
282 | + return this.validFlag; | ||
283 | + } | ||
284 | + }); | ||
276 | 285 | ||
277 | 286 | ||
278 | - this.TTGrid = Ext.create('Ext.grid.Panel', { | ||
279 | -// title: 'Catalog', | ||
280 | - height: 530, | ||
281 | - columns: [ | ||
282 | - { text: '', dataIndex: '' } | ||
283 | - | ||
284 | - ], | ||
285 | - frame: true, | ||
286 | - dockedItems: [{ | ||
287 | - xtype: 'toolbar', | ||
288 | - items: [{ | ||
289 | - iconCls: 'icon-add', | ||
290 | - scope: this, | ||
291 | - handler: function(){ | ||
292 | -// cellEditing.cancelEdit(); | ||
293 | -// | ||
294 | -// var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | ||
295 | -// var row = 0; | ||
296 | -// if (selection) | ||
297 | -// row = store.indexOf(selection) + 1; | ||
298 | -// this.TTGrid.getSelectionModel().deselectAll(); | ||
299 | -// | ||
300 | -// var me = this; | ||
301 | -// AmdaAction.addTTCacheInterval({'index' : row}, function (result, e) { | ||
302 | -// this.status = result.status; | ||
303 | -// this.TTGrid.getStore().reload({ | ||
304 | -// callback : function(records, options, success) { | ||
305 | -// me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | ||
306 | -// me.TTGrid.getView().select(row); | ||
307 | -// cellEditing.startEditByPosition({row: row, column: 1}); | ||
308 | -// }, me); | ||
309 | -// } | ||
310 | -// }); | ||
311 | -// }, this); | ||
312 | - } | ||
313 | - }, { | ||
314 | - iconCls: 'icon-delete', | ||
315 | - disabled: true, | ||
316 | - itemId: 'delete', | ||
317 | - scope: this, | ||
318 | - handler: function(){ | ||
319 | -// var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | ||
320 | -// if (selection) { | ||
321 | -// var rowId = selection.get('cacheId'); | ||
322 | -// this.TTGrid.getSelectionModel().deselectAll(); | ||
323 | -// AmdaAction.removeTTCacheIntervalFromId(rowId, function (result, e) { | ||
324 | -// this.status = result.status; | ||
325 | -// this.TTGrid.getStore().reload(); | ||
326 | -// }, this); | ||
327 | -// } | ||
328 | - } | ||
329 | - }] | ||
330 | - }] | ||
331 | - }); | 287 | + this.TTGrid = Ext.create('Ext.grid.Panel', { |
288 | + height: 530, | ||
289 | + columns: [ ], | ||
290 | + frame: true, | ||
291 | + dockedItems: [{ | ||
292 | + xtype: 'toolbar', | ||
293 | + items: [{ | ||
294 | + iconCls: 'icon-add', | ||
295 | + scope: this, | ||
296 | + handler: function(){ | ||
297 | + alert('NOT IMPLEMENTED YET'); | ||
298 | + // cellEditing.cancelEdit(); | ||
299 | + // | ||
300 | + // var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | ||
301 | + // var row = 0; | ||
302 | + // if (selection) | ||
303 | + // row = store.indexOf(selection) + 1; | ||
304 | + // this.TTGrid.getSelectionModel().deselectAll(); | ||
305 | + // | ||
306 | + // var me = this; | ||
307 | + // AmdaAction.addTTCacheInterval({'index' : row}, function (result, e) { | ||
308 | + // this.status = result.status; | ||
309 | + // this.TTGrid.getStore().reload({ | ||
310 | + // callback : function(records, options, success) { | ||
311 | + // me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() { | ||
312 | + // me.TTGrid.getView().select(row); | ||
313 | + // cellEditing.startEditByPosition({row: row, column: 1}); | ||
314 | + // }, me); | ||
315 | + // } | ||
316 | + // }); | ||
317 | + // }, this); | ||
318 | + } | ||
319 | + },{ | ||
320 | + iconCls: 'icon-delete', | ||
321 | + disabled: true, | ||
322 | + itemId: 'delete', | ||
323 | + scope: this, | ||
324 | + handler: function(){ | ||
325 | + var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0]; | ||
326 | + if (selection) | ||
327 | + { | ||
328 | + var rowId = selection.get('cacheId'); | ||
329 | + console.log(selection); | ||
330 | + this.TTGrid.getSelectionModel().deselectAll(); | ||
331 | + AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) { | ||
332 | + this.status = result.status; | ||
333 | + this.TTGrid.getStore().reload(); | ||
334 | + }, this); | ||
335 | + } | ||
336 | + } | ||
337 | + }] | ||
338 | + }] | ||
339 | + }); | ||
332 | 340 | ||
333 | this.formPanel = Ext.create('Ext.form.Panel', { | 341 | this.formPanel = Ext.create('Ext.form.Panel', { |
334 | region : 'center', | 342 | region : 'center', |
@@ -456,10 +464,10 @@ Ext.define('amdaUI.CatalogUI', { | @@ -456,10 +464,10 @@ Ext.define('amdaUI.CatalogUI', { | ||
456 | ] | 464 | ] |
457 | } | 465 | } |
458 | ] | 466 | ] |
459 | - }); | 467 | + }); |
460 | 468 | ||
461 | this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections){ | 469 | this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections){ |
462 | - this.TTGrid.down('#delete').setDisabled(selections.length === 0); | 470 | + this.TTGrid.down('#delete').setDisabled(selections.length === 0); |
463 | }, this); | 471 | }, this); |
464 | 472 | ||
465 | var myConf = { | 473 | var myConf = { |
@@ -474,7 +482,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -474,7 +482,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
474 | height: 100, | 482 | height: 100, |
475 | autoHide: false, | 483 | autoHide: false, |
476 | bodyStyle: 'padding:5px', | 484 | bodyStyle: 'padding:5px', |
477 | - iconCls: 'icon-information', | 485 | + iconCls: 'icon-information', |
478 | loader: { | 486 | loader: { |
479 | autoLoad: true, | 487 | autoLoad: true, |
480 | url: helpDir+'downloadHOWTO' | 488 | url: helpDir+'downloadHOWTO' |
@@ -483,7 +491,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -483,7 +491,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
483 | ] | 491 | ] |
484 | }; | 492 | }; |
485 | 493 | ||
486 | - Ext.apply (this, Ext.apply(arguments, myConf)); | 494 | + Ext.apply (this, Ext.apply(arguments, myConf)); |
487 | } | 495 | } |
488 | 496 | ||
489 | }); | 497 | }); |
js/app/views/TimeTableUI.js
@@ -2,14 +2,10 @@ | @@ -2,14 +2,10 @@ | ||
2 | * Project : AMDA-NG | 2 | * Project : AMDA-NG |
3 | * Name : TimeTableUI.js | 3 | * Name : TimeTableUI.js |
4 | * @class amdaUI.TimeTableUI | 4 | * @class amdaUI.TimeTableUI |
5 | - * @extends Ext.container.Container | 5 | + * @extends Ext.container.Container |
6 | * @brief Time Table Module UI definition (View) | 6 | * @brief Time Table Module UI definition (View) |
7 | * @author Myriam | 7 | * @author Myriam |
8 | * @version $Id: TimeTableUI.js 2075 2014-02-11 11:30:14Z elena $ | 8 | * @version $Id: TimeTableUI.js 2075 2014-02-11 11:30:14Z elena $ |
9 | - ******************************************************************************** | ||
10 | - * FT Id : Date : Name - Description | ||
11 | - ******************************************************************************* | ||
12 | - * 08/06/2011: Myriam - Migration extjs4 | ||
13 | */ | 9 | */ |
14 | 10 | ||
15 | Ext.define('amdaUI.TimeTableUI', { | 11 | Ext.define('amdaUI.TimeTableUI', { |
@@ -17,20 +13,19 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -17,20 +13,19 @@ Ext.define('amdaUI.TimeTableUI', { | ||
17 | alias: 'widget.panelTimeTable', | 13 | alias: 'widget.panelTimeTable', |
18 | 14 | ||
19 | requires: [ | 15 | requires: [ |
20 | - 'Ext.ux.grid.FiltersFeature', | ||
21 | - 'Ext.ux.grid.filter.DateFilter', | ||
22 | - 'Ext.ux.grid.filter.NumericFilter', | ||
23 | - 'amdaUI.OperationsTT', | ||
24 | - 'amdaUI.StatisticalPlug', | ||
25 | - 'Ext.grid.plugin.BufferedRenderer' | 16 | + 'Ext.ux.grid.FiltersFeature', |
17 | + 'Ext.ux.grid.filter.DateFilter', | ||
18 | + 'Ext.ux.grid.filter.NumericFilter', | ||
19 | + 'amdaUI.OperationsTT', | ||
20 | + 'amdaUI.StatisticalPlug', | ||
21 | + 'Ext.grid.plugin.BufferedRenderer' | ||
26 | ], | 22 | ], |
27 | 23 | ||
28 | statics: { | 24 | statics: { |
29 | - COL_TO_HIDE : 'colToHide' | ||
30 | - }, | 25 | + COL_TO_HIDE : 'colToHide' |
26 | + }, | ||
31 | 27 | ||
32 | - status: null, | ||
33 | - isCatalog : false, | 28 | + status: null, |
34 | 29 | ||
35 | constructor: function(config) { | 30 | constructor: function(config) { |
36 | this.init(config); | 31 | this.init(config); |
@@ -43,7 +38,8 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -43,7 +38,8 @@ Ext.define('amdaUI.TimeTableUI', { | ||
43 | * set the current editing object | 38 | * set the current editing object |
44 | * this method will be used on timetable edition when this win is already opened | 39 | * this method will be used on timetable edition when this win is already opened |
45 | */ | 40 | */ |
46 | - setObject : function (object) { | 41 | + setObject : function (object) |
42 | + { | ||
47 | // set object | 43 | // set object |
48 | this.object = object; | 44 | this.object = object; |
49 | 45 | ||
@@ -117,7 +113,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -117,7 +113,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
117 | else | 113 | else |
118 | { | 114 | { |
119 | //From tmp object (ie Search result) | 115 | //From tmp object (ie Search result) |
120 | - AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), this.isCatalog, onAfterInit); | 116 | + AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), onAfterInit); |
121 | } | 117 | } |
122 | } | 118 | } |
123 | else | 119 | else |
@@ -139,33 +135,35 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -139,33 +135,35 @@ Ext.define('amdaUI.TimeTableUI', { | ||
139 | /** | 135 | /** |
140 | * update this.object from form | 136 | * update this.object from form |
141 | */ | 137 | */ |
142 | - updateObject : function(){ | 138 | + updateObject : function() |
139 | + { | ||
143 | this.updateCount(); | 140 | this.updateCount(); |
144 | 141 | ||
145 | // get the basic form | 142 | // get the basic form |
146 | - var basicForm = this.formPanel.getForm(); | ||
147 | - var updateStatus = true; | 143 | + var basicForm = this.formPanel.getForm(); |
144 | + var updateStatus = true; | ||
148 | 145 | ||
149 | - var fieldsWithoutName = basicForm.getFields().items; | ||
150 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | ||
151 | - if(item !== this.fieldName) { | ||
152 | - if (!item.isValid()) { | ||
153 | - // set update isn't allowed | ||
154 | - updateStatus = false; | ||
155 | - } | ||
156 | - } | ||
157 | - }, this); | 146 | + var fieldsWithoutName = basicForm.getFields().items; |
147 | + Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | ||
148 | + if(item !== this.fieldName) { | ||
149 | + if (!item.isValid()) { | ||
150 | + // set update isn't allowed | ||
151 | + updateStatus = false; | ||
152 | + } | ||
153 | + } | ||
154 | + }, this); | ||
158 | // if the update is allowed | 155 | // if the update is allowed |
159 | - if (updateStatus) { | ||
160 | - /// real object update | ||
161 | - // update TimeTable object with the content of form | ||
162 | - basicForm.updateRecord(this.object); | ||
163 | - } | ||
164 | - // return the update status | ||
165 | - return updateStatus; | 156 | + if (updateStatus) { |
157 | + /// real object update | ||
158 | + // update TimeTable object with the content of form | ||
159 | + basicForm.updateRecord(this.object); | ||
160 | + } | ||
161 | + // return the update status | ||
162 | + return updateStatus; | ||
166 | }, | 163 | }, |
167 | 164 | ||
168 | - updateCount : function() { | 165 | + updateCount : function() |
166 | + { | ||
169 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); | 167 | this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount()); |
170 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); | 168 | this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals')); |
171 | }, | 169 | }, |
@@ -173,7 +171,8 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -173,7 +171,8 @@ Ext.define('amdaUI.TimeTableUI', { | ||
173 | /* | 171 | /* |
174 | * save method called by Save button | 172 | * save method called by Save button |
175 | */ | 173 | */ |
176 | - saveProcess : function(toRename){ | 174 | + saveProcess : function(toRename) |
175 | + { | ||
177 | var timeTableModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt.id); | 176 | var timeTableModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.tt.id); |
178 | 177 | ||
179 | // if the name has been modified this is a creation | 178 | // if the name has been modified this is a creation |
@@ -182,8 +181,8 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -182,8 +181,8 @@ Ext.define('amdaUI.TimeTableUI', { | ||
182 | timeTableModule.createLinkedNode(); | 181 | timeTableModule.createLinkedNode(); |
183 | timeTableModule.createObject(this.object.getJsonValues()); | 182 | timeTableModule.createObject(this.object.getJsonValues()); |
184 | var ttobj = timeTableModule.linkedNode.get('object'); | 183 | var ttobj = timeTableModule.linkedNode.get('object'); |
185 | - // synchronisation of objects | ||
186 | - this.object = ttobj; | 184 | + // synchronisation of objects |
185 | + this.object = ttobj; | ||
187 | timeTableModule.linkedNode.create(); | 186 | timeTableModule.linkedNode.create(); |
188 | } | 187 | } |
189 | else if (this.fclose() /*TimeTable object has been modified*/) { | 188 | else if (this.fclose() /*TimeTable object has been modified*/) { |
@@ -216,24 +215,26 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -216,24 +215,26 @@ Ext.define('amdaUI.TimeTableUI', { | ||
216 | /** | 215 | /** |
217 | * overwrite metod called by Save button | 216 | * overwrite metod called by Save button |
218 | */ | 217 | */ |
219 | - overwriteProcess : function(btn){ | 218 | + overwriteProcess : function(btn) |
219 | + { | ||
220 | if (btn == 'cancel') return; | 220 | if (btn == 'cancel') return; |
221 | 221 | ||
222 | - this.fieldName.clearInvalid(); | 222 | + this.fieldName.clearInvalid(); |
223 | this.saveProcess(true); | 223 | this.saveProcess(true); |
224 | 224 | ||
225 | }, | 225 | }, |
226 | 226 | ||
227 | - addInterval : function(start, stop) { | 227 | + addInterval : function(start, stop) |
228 | + { | ||
228 | this.TTGrid.getSelectionModel().deselectAll(); | 229 | this.TTGrid.getSelectionModel().deselectAll(); |
229 | - AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop},function (result, e) { | 230 | + AmdaAction.addTTCacheInterval({'start' : start, 'stop' : stop},function (result, e) { |
230 | this.TTGrid.getStore().reload(); | 231 | this.TTGrid.getStore().reload(); |
231 | this.status = result.status; | 232 | this.status = result.status; |
232 | - }, this); | 233 | + }, this); |
233 | }, | 234 | }, |
234 | 235 | ||
235 | - init : function(config) { | ||
236 | - | 236 | + init : function(config) |
237 | + { | ||
237 | this.object = config.object; | 238 | this.object = config.object; |
238 | 239 | ||
239 | this.fieldName = new Ext.form.field.Text({ | 240 | this.fieldName = new Ext.form.field.Text({ |
php/classes/AmdaAction.php
@@ -998,9 +998,11 @@ class AmdaAction { | @@ -998,9 +998,11 @@ class AmdaAction { | ||
998 | return $cacheMgr->addInterval($o->index, $o->start, $o->stop); | 998 | return $cacheMgr->addInterval($o->index, $o->start, $o->stop); |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | - public function removeTTCacheIntervalFromId($id) | 1001 | + public function removeTTCacheIntervalFromId($id, $isCatalog = false) |
1002 | { | 1002 | { |
1003 | - $cacheMgr = new TimeTableCacheMgr(); | 1003 | + if ($isCatalog) $cacheMgr = new CatalogCacheMgr(); |
1004 | + else $cacheMgr = new TimeTableCacheMgr(); | ||
1005 | + | ||
1004 | return $cacheMgr->removeIntervalFromId($id); | 1006 | return $cacheMgr->removeIntervalFromId($id); |
1005 | } | 1007 | } |
1006 | 1008 | ||
@@ -1236,7 +1238,7 @@ class AmdaAction { | @@ -1236,7 +1238,7 @@ class AmdaAction { | ||
1236 | //AKKA - New action to clean user WS | 1238 | //AKKA - New action to clean user WS |
1237 | public function cleanUserWS() | 1239 | public function cleanUserWS() |
1238 | { | 1240 | { |
1239 | - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | 1241 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); |
1240 | return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN); | 1242 | return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN); |
1241 | } | 1243 | } |
1242 | 1244 |
php/config.php
@@ -251,12 +251,12 @@ $API = array( | @@ -251,12 +251,12 @@ $API = array( | ||
251 | 'len'=>2 | 251 | 'len'=>2 |
252 | // 'formHandler'=>true | 252 | // 'formHandler'=>true |
253 | ), | 253 | ), |
254 | - 'compilParam' => array( | ||
255 | - 'len'=>1 | ||
256 | - ), | ||
257 | - 'compilParamDelete' => array( | ||
258 | - 'len'=>1 | ||
259 | - ), | 254 | + 'compilParam' => array( |
255 | + 'len'=>1 | ||
256 | + ), | ||
257 | + 'compilParamDelete' => array( | ||
258 | + 'len'=>1 | ||
259 | + ), | ||
260 | 'killPlotRequest' =>array( | 260 | 'killPlotRequest' =>array( |
261 | 'len'=>1 | 261 | 'len'=>1 |
262 | ), | 262 | ), |
@@ -272,39 +272,39 @@ $API = array( | @@ -272,39 +272,39 @@ $API = array( | ||
272 | 'saveTTCacheIntervalsInTT'=>array( | 272 | 'saveTTCacheIntervalsInTT'=>array( |
273 | 'len'=>1 | 273 | 'len'=>1 |
274 | ), | 274 | ), |
275 | - 'initTTCache' => array ( | ||
276 | - 'len'=>1 | ||
277 | - ) , | ||
278 | - 'initTTCacheFromTT' => array( | ||
279 | - 'len'=>2 | ||
280 | - ), | ||
281 | - 'initTTCacheFromTmpObject' => array( | ||
282 | - 'len'=>3 | ||
283 | - ), | ||
284 | - 'initTTCacheFromUploadedFile' => array( | ||
285 | - 'len'=>2 | ||
286 | - ), | ||
287 | - 'readTTCacheIntervals'=>array( | ||
288 | - 'len'=>1 | ||
289 | - ), | ||
290 | - 'addTTCacheInterval'=>array ( | ||
291 | - 'len'=>1 | ||
292 | - ), | ||
293 | - 'removeTTCacheIntervalFromId'=>array ( | ||
294 | - 'len'=>1 | ||
295 | - ), | ||
296 | - 'modifyTTCacheInterval' => array( | ||
297 | - 'len'=>1 | ||
298 | - ), | ||
299 | - 'operationTTCacheIntervals' => array( | ||
300 | - 'len'=>2 | ||
301 | - ), | ||
302 | - 'mergeTTCacheIntervals' => array ( | ||
303 | - 'len'=>0 | ||
304 | - ), | ||
305 | - 'getTTCacheStatistics' => array ( | ||
306 | - 'len'=>0 | ||
307 | - ), | 275 | + 'initTTCache' => array ( |
276 | + 'len'=>1 | ||
277 | + ) , | ||
278 | + 'initTTCacheFromTT' => array( | ||
279 | + 'len'=>2 | ||
280 | + ), | ||
281 | + 'initTTCacheFromTmpObject' => array( | ||
282 | + 'len'=>3 | ||
283 | + ), | ||
284 | + 'initTTCacheFromUploadedFile' => array( | ||
285 | + 'len'=>2 | ||
286 | + ), | ||
287 | + 'readTTCacheIntervals'=>array( | ||
288 | + 'len'=>1 | ||
289 | + ), | ||
290 | + 'addTTCacheInterval'=>array ( | ||
291 | + 'len'=>1 | ||
292 | + ), | ||
293 | + 'removeTTCacheIntervalFromId'=>array ( | ||
294 | + 'len'=>2 | ||
295 | + ), | ||
296 | + 'modifyTTCacheInterval' => array( | ||
297 | + 'len'=>1 | ||
298 | + ), | ||
299 | + 'operationTTCacheIntervals' => array( | ||
300 | + 'len'=>2 | ||
301 | + ), | ||
302 | + 'mergeTTCacheIntervals' => array ( | ||
303 | + 'len'=>0 | ||
304 | + ), | ||
305 | + 'getTTCacheStatistics' => array ( | ||
306 | + 'len'=>0 | ||
307 | + ), | ||
308 | 'sendFeedback'=>array( | 308 | 'sendFeedback'=>array( |
309 | 'len'=>1 | 309 | 'len'=>1 |
310 | ), | 310 | ), |
@@ -356,23 +356,23 @@ $API = array( | @@ -356,23 +356,23 @@ $API = array( | ||
356 | 'getUserInfo'=>array( | 356 | 'getUserInfo'=>array( |
357 | 'len'=>0 | 357 | 'len'=>0 |
358 | ), | 358 | ), |
359 | - 'convertWS'=>array( | ||
360 | - 'len'=>0 | ||
361 | - ), | ||
362 | - 'getRun'=>array( | ||
363 | - 'len'=>1 | ||
364 | - ), | ||
365 | - 'addRun'=>array( | ||
366 | - 'len'=>1 | ||
367 | - ), | ||
368 | - //AKKA - New action to clean user WS | ||
369 | - 'cleanUserWS'=>array( | ||
370 | - 'len'=>0 | ||
371 | - ), | ||
372 | - 'deleteSpecialInfo'=>array( | ||
373 | - 'len'=>1 | ||
374 | - ) | ||
375 | - ) | 359 | + 'convertWS'=>array( |
360 | + 'len'=>0 | ||
361 | + ), | ||
362 | + 'getRun'=>array( | ||
363 | + 'len'=>1 | ||
364 | + ), | ||
365 | + 'addRun'=>array( | ||
366 | + 'len'=>1 | ||
367 | + ), | ||
368 | + //AKKA - New action to clean user WS | ||
369 | + 'cleanUserWS'=>array( | ||
370 | + 'len'=>0 | ||
371 | + ), | ||
372 | + 'deleteSpecialInfo'=>array( | ||
373 | + 'len'=>1 | ||
374 | + ) | ||
375 | + ) | ||
376 | ) | 376 | ) |
377 | ); | 377 | ); |
378 | ?> | 378 | ?> |