Commit 0cde4f7619eff151c6a7d14921bab58646399162
Exists in
master
and in
63 other branches
10312 Merge fixed
Showing
32 changed files
with
1668 additions
and
1668 deletions
Show diff stats
js/app/controllers/PlotModule.js
@@ -214,6 +214,21 @@ Ext.define('amdaDesktop.PlotModule', { | @@ -214,6 +214,21 @@ Ext.define('amdaDesktop.PlotModule', { | ||
214 | if (!this.plotResultWindowsManager.get(winResultId)) return null; | 214 | if (!this.plotResultWindowsManager.get(winResultId)) return null; |
215 | return this.plotResultWindowsManager.get(winResultId); | 215 | return this.plotResultWindowsManager.get(winResultId); |
216 | }, | 216 | }, |
217 | + | ||
218 | + setTimeInterval : function(timeObj){ | ||
219 | + var me = this; | ||
220 | + var desktop = this.app.getDesktop(); | ||
221 | + var win = desktop.getWindow(this.id); | ||
222 | + if (win) { | ||
223 | + me.getUiContent().setTimeFromData(timeObj); | ||
224 | + win.show(); | ||
225 | + } | ||
226 | + else { | ||
227 | + this.createWindow(function () { | ||
228 | + me.getUiContent().setTimeFromData(timeObj); | ||
229 | + }); | ||
230 | + } | ||
231 | + }, | ||
217 | 232 | ||
218 | addParameter : function(paramNode) { | 233 | addParameter : function(paramNode) { |
219 | var me = this; | 234 | var me = this; |
@@ -324,6 +339,7 @@ Ext.define('amdaDesktop.PlotModule', { | @@ -324,6 +339,7 @@ Ext.define('amdaDesktop.PlotModule', { | ||
324 | downloadValues.durationHour = plotValues.durationHour; | 339 | downloadValues.durationHour = plotValues.durationHour; |
325 | downloadValues.durationMin = plotValues.durationMin; | 340 | downloadValues.durationMin = plotValues.durationMin; |
326 | downloadValues.durationSec = plotValues.durationSec; | 341 | downloadValues.durationSec = plotValues.durationSec; |
342 | + downloadValues.durationMs = plotValues.durationMs; | ||
327 | if (plotValues.timeTables) | 343 | if (plotValues.timeTables) |
328 | downloadValues.timeTables = plotValues.timeTables; | 344 | downloadValues.timeTables = plotValues.timeTables; |
329 | downloadValues.list = []; | 345 | downloadValues.list = []; |
js/app/models/AmdaTimeObject.js
@@ -37,26 +37,31 @@ Ext.define('amdaModel.AmdaTimeObject', { | @@ -37,26 +37,31 @@ Ext.define('amdaModel.AmdaTimeObject', { | ||
37 | { name: 'folderId', type: 'string'}, | 37 | { name: 'folderId', type: 'string'}, |
38 | { name: 'processId', type: 'string'}, | 38 | { name: 'processId', type: 'string'}, |
39 | { name: 'timesrc', type: 'string'/*, defaultValue: amdaModel.AmdaTimeObject.inputTimeSrc[1] /*'Interval'*/ }, | 39 | { name: 'timesrc', type: 'string'/*, defaultValue: amdaModel.AmdaTimeObject.inputTimeSrc[1] /*'Interval'*/ }, |
40 | - { name: 'startDate', type: 'date', defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1), | 40 | + { |
41 | + name: 'startDate', | ||
42 | + type: 'date', | ||
43 | + defaultValue:Ext.Date.add(Ext.Date.clearTime(new Date()),Ext.Date.DAY,-1), | ||
41 | convert: function(value,rec) { | 44 | convert: function(value,rec) { |
42 | if (!Ext.isDate(value)) { | 45 | if (!Ext.isDate(value)) { |
43 | - var valueString = new String(value); | ||
44 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | 46 | + var valueString = new String(value).replaceAll('\/','\-'); |
47 | + var date = new Date(valueString); | ||
45 | return date; | 48 | return date; |
46 | } | 49 | } |
47 | return value; | 50 | return value; |
48 | } | 51 | } |
49 | }, | 52 | }, |
50 | { | 53 | { |
51 | - name: 'stopDate', type: 'date', defaultValue: Ext.Date.clearTime (new Date()), persist: false, | ||
52 | - convert: function(value,rec) { | ||
53 | - if (!Ext.isDate(value)){ | ||
54 | - var valueString = new String(value); | ||
55 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | ||
56 | - return date; | 54 | + name: 'stopDate', |
55 | + type: 'date', | ||
56 | + defaultValue: Ext.Date.clearTime (new Date()), persist: false, | ||
57 | + convert: function(value,rec) { | ||
58 | + if (!Ext.isDate(value)) { | ||
59 | + var valueString = new String(value).replaceAll('\/','\-'); | ||
60 | + var date = new Date(valueString); | ||
61 | + return date; | ||
57 | } | 62 | } |
58 | return value; | 63 | return value; |
59 | - } | 64 | + } |
60 | }, | 65 | }, |
61 | { | 66 | { |
62 | name: 'durationDay', type: 'int', | 67 | name: 'durationDay', type: 'int', |
@@ -90,7 +95,15 @@ Ext.define('amdaModel.AmdaTimeObject', { | @@ -90,7 +95,15 @@ Ext.define('amdaModel.AmdaTimeObject', { | ||
90 | 95 | ||
91 | return Ext.String.leftPad(Math.floor(diffS), 2, '0'); | 96 | return Ext.String.leftPad(Math.floor(diffS), 2, '0'); |
92 | } | 97 | } |
93 | - }, | 98 | + }, |
99 | + { | ||
100 | + name: 'durationMs', type: 'int', | ||
101 | + convert: function(value, rec) { | ||
102 | + var diffS = (rec.get('stopDate') - rec.get('startDate'))%1000; | ||
103 | + | ||
104 | + return Ext.String.leftPad(Math.floor(diffS), 3, '0'); | ||
105 | + } | ||
106 | + }, | ||
94 | { name: 'timeTables', defaultValue: null } // array of TTobject | 107 | { name: 'timeTables', defaultValue: null } // array of TTobject |
95 | ] | 108 | ] |
96 | }); | 109 | }); |
js/app/models/Catalog.js
@@ -37,7 +37,7 @@ Ext.define('amdaModel.Catalog', { | @@ -37,7 +37,7 @@ Ext.define('amdaModel.Catalog', { | ||
37 | // } | 37 | // } |
38 | values.objName = this.get('objName'); | 38 | values.objName = this.get('objName'); |
39 | values.objFormat = this.get('objFormat'); | 39 | values.objFormat = this.get('objFormat'); |
40 | - values.folderId = this.get('folderId'); | 40 | + values.folderId = this.get('folderId'); |
41 | values.nbIntervals = this.get('nbIntervals'); | 41 | values.nbIntervals = this.get('nbIntervals'); |
42 | values.cacheToken = this.get('cacheToken'); | 42 | values.cacheToken = this.get('cacheToken'); |
43 | values.parameters = this.get('parameters'); | 43 | values.parameters = this.get('parameters'); |
js/app/models/Download.js
@@ -163,12 +163,13 @@ Ext.define('amdaModel.Download', { | @@ -163,12 +163,13 @@ Ext.define('amdaModel.Download', { | ||
163 | } | 163 | } |
164 | }); | 164 | }); |
165 | } else { | 165 | } else { |
166 | - myValues.startDate = this.get('startDate'); | ||
167 | - myValues.stopDate = this.get('stopDate'); | 166 | + myValues.startDate = Ext.Date.format(this.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
167 | + myValues.stopDate = Ext.Date.format(this.get('stopDate'), 'Y-m-d\\TH:i:s.u'); | ||
168 | myValues.durationDay = this.get('durationDay'); | 168 | myValues.durationDay = this.get('durationDay'); |
169 | myValues.durationHour = this.get('durationHour'); | 169 | myValues.durationHour = this.get('durationHour'); |
170 | myValues.durationMin = this.get('durationMin'); | 170 | myValues.durationMin = this.get('durationMin'); |
171 | myValues.durationSec = this.get('durationSec'); | 171 | myValues.durationSec = this.get('durationSec'); |
172 | + myValues.durationMs = this.get('durationMs'); | ||
172 | } | 173 | } |
173 | 174 | ||
174 | // if there's at least one parameter | 175 | // if there's at least one parameter |
js/app/models/DownloadNode.js
@@ -73,12 +73,13 @@ Ext.define('amdaModel.DownloadNode', { | @@ -73,12 +73,13 @@ Ext.define('amdaModel.DownloadNode', { | ||
73 | }); | 73 | }); |
74 | } | 74 | } |
75 | else { | 75 | else { |
76 | - myValues.startDate = obj.get('startDate'); | ||
77 | - myValues.stopDate = obj.get('stopDate'); | 76 | + myValues.startDate = Ext.Date.format(obj.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
77 | + myValues.stopDate = Ext.Date.format(obj.get('startDate'), 'Y-m-d\\TH:i:s.u'); | ||
78 | myValues.durationDay = obj.get('durationDay'); | 78 | myValues.durationDay = obj.get('durationDay'); |
79 | myValues.durationHour = obj.get('durationHour'); | 79 | myValues.durationHour = obj.get('durationHour'); |
80 | myValues.durationMin = obj.get('durationMin'); | 80 | myValues.durationMin = obj.get('durationMin'); |
81 | myValues.durationSec = obj.get('durationSec'); | 81 | myValues.durationSec = obj.get('durationSec'); |
82 | + myValues.durationMs = obj.get('durationMs'); | ||
82 | } | 83 | } |
83 | 84 | ||
84 | myValues.name = obj.get('name'); | 85 | myValues.name = obj.get('name'); |
js/app/models/InteractiveNode.js
@@ -476,14 +476,14 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -476,14 +476,14 @@ Ext.define('amdaModel.InteractiveNode', { | ||
476 | 476 | ||
477 | var startDate = new Date(startString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | 477 | var startDate = new Date(startString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); |
478 | var stopDate = new Date(stopString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | 478 | var stopDate = new Date(stopString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); |
479 | - | 479 | + |
480 | if (stopDate - startDate > 86400000 ) { | 480 | if (stopDate - startDate > 86400000 ) { |
481 | var startTime = Ext.Date.add(stopDate, Ext.Date.DAY, -1); | 481 | var startTime = Ext.Date.add(stopDate, Ext.Date.DAY, -1); |
482 | // var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d H:i:s'), stop: Ext.Date.format(stopDate, 'Y/m/d H:i:s')}; | 482 | // var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d H:i:s'), stop: Ext.Date.format(stopDate, 'Y/m/d H:i:s')}; |
483 | - var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d'), stop: Ext.Date.format(stopDate, 'Y/m/d')}; | 483 | + var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d H:i:s.u'), stop: Ext.Date.format(stopDate, 'Y/m/d H:i:s.u')}; |
484 | } | 484 | } |
485 | else { | 485 | else { |
486 | - var timeObj = {start: node.get('globalStart'), stop: node.get('globalStop')}; | 486 | + var timeObj = {start: Ext.Date.format(startTime, 'Y/m/d H:i:s.u'), stop: Ext.Date.format(stopDate, 'Y/m/d H:i:s.u')}; |
487 | } | 487 | } |
488 | return timeObj; | 488 | return timeObj; |
489 | }, | 489 | }, |
js/app/models/PlotObjects/MultiplotRequestObject.js
@@ -126,12 +126,13 @@ Ext.define('amdaPlotObj.MultiplotRequestObject', { | @@ -126,12 +126,13 @@ Ext.define('amdaPlotObj.MultiplotRequestObject', { | ||
126 | } | 126 | } |
127 | }); | 127 | }); |
128 | } else { | 128 | } else { |
129 | - requestValues['startDate'] = this.get('startDate'); | ||
130 | - requestValues['stopDate'] = this.get('stopDate'); | 129 | + requestValues['startDate'] = Ext.Date.format(this.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
130 | + requestValues['stopDate'] = Ext.Date.format(this.get('stopDate'), 'Y-m-d\\TH:i:s.u'); | ||
131 | requestValues['durationDay'] = this.get('durationDay'); | 131 | requestValues['durationDay'] = this.get('durationDay'); |
132 | requestValues['durationHour'] = this.get('durationHour'); | 132 | requestValues['durationHour'] = this.get('durationHour'); |
133 | requestValues['durationMin'] = this.get('durationMin'); | 133 | requestValues['durationMin'] = this.get('durationMin'); |
134 | requestValues['durationSec'] = this.get('durationSec'); | 134 | requestValues['durationSec'] = this.get('durationSec'); |
135 | + requestValues['durationMs'] = this.get('durationMs'); | ||
135 | } | 136 | } |
136 | 137 | ||
137 | requestValues['plots'] = []; | 138 | requestValues['plots'] = []; |
js/app/models/PlotObjects/PlotRequestObject.js
@@ -288,12 +288,13 @@ Ext.define('amdaPlotObj.PlotRequestObject', { | @@ -288,12 +288,13 @@ Ext.define('amdaPlotObj.PlotRequestObject', { | ||
288 | } | 288 | } |
289 | }); | 289 | }); |
290 | } else { | 290 | } else { |
291 | - requestValues['startDate'] = this.get('startDate'); | ||
292 | - requestValues['stopDate'] = this.get('stopDate'); | 291 | + requestValues['startDate'] = Ext.Date.format(this.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
292 | + requestValues['stopDate'] = Ext.Date.format(this.get('stopDate'), 'Y-m-d\\TH:i:s.u'); | ||
293 | requestValues['durationDay'] = this.get('durationDay'); | 293 | requestValues['durationDay'] = this.get('durationDay'); |
294 | requestValues['durationHour'] = this.get('durationHour'); | 294 | requestValues['durationHour'] = this.get('durationHour'); |
295 | requestValues['durationMin'] = this.get('durationMin'); | 295 | requestValues['durationMin'] = this.get('durationMin'); |
296 | requestValues['durationSec'] = this.get('durationSec'); | 296 | requestValues['durationSec'] = this.get('durationSec'); |
297 | + requestValues['durationMs'] = this.get('durationMs'); | ||
297 | } | 298 | } |
298 | 299 | ||
299 | requestValues['page-layout-type'] = this.get('page-layout-type'); | 300 | requestValues['page-layout-type'] = this.get('page-layout-type'); |
js/app/models/Search.js
@@ -65,12 +65,13 @@ Ext.define('amdaModel.Search', { | @@ -65,12 +65,13 @@ Ext.define('amdaModel.Search', { | ||
65 | } | 65 | } |
66 | }); | 66 | }); |
67 | } else { | 67 | } else { |
68 | - myValues.startDate = this.get('startDate'); | ||
69 | - myValues.stopDate = this.get('stopDate'); | 68 | + myValues.startDate = Ext.Date.format(this.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
69 | + myValues.stopDate = Ext.Date.format(this.get('stopDate'), 'Y-m-d\\TH:i:s.u'); | ||
70 | myValues.durationDay = this.get('durationDay'); | 70 | myValues.durationDay = this.get('durationDay'); |
71 | myValues.durationHour = this.get('durationHour'); | 71 | myValues.durationHour = this.get('durationHour'); |
72 | myValues.durationMin = this.get('durationMin'); | 72 | myValues.durationMin = this.get('durationMin'); |
73 | myValues.durationSec = this.get('durationSec'); | 73 | myValues.durationSec = this.get('durationSec'); |
74 | + myValues.durationMs = this.get('durationMs'); | ||
74 | } | 75 | } |
75 | 76 | ||
76 | myValues.leaf = true; | 77 | myValues.leaf = true; |
js/app/models/Statistic.js
@@ -104,12 +104,13 @@ Ext.define('amdaModel.Statistic', { | @@ -104,12 +104,13 @@ Ext.define('amdaModel.Statistic', { | ||
104 | }); | 104 | }); |
105 | } else | 105 | } else |
106 | { | 106 | { |
107 | - values.startDate = this.get('startDate'); | ||
108 | - values.stopDate = this.get('stopDate'); | 107 | + values.startDate = Ext.Date.format(this.get('startDate'), 'Y-m-d\\TH:i:s.u'); |
108 | + values.stopDate = Ext.Date.format(this.get('stopDate'), 'Y-m-d\\TH:i:s.u'); | ||
109 | values.durationDay = this.get('durationDay'); | 109 | values.durationDay = this.get('durationDay'); |
110 | values.durationHour = this.get('durationHour'); | 110 | values.durationHour = this.get('durationHour'); |
111 | values.durationMin = this.get('durationMin'); | 111 | values.durationMin = this.get('durationMin'); |
112 | values.durationSec = this.get('durationSec'); | 112 | values.durationSec = this.get('durationSec'); |
113 | + values.durationMs = this.get('durationMs'); | ||
113 | } | 114 | } |
114 | 115 | ||
115 | values.leaf = true; | 116 | values.leaf = true; |
js/app/models/TimeTable.js
@@ -29,19 +29,15 @@ Ext.define('amdaModel.Interval', { | @@ -29,19 +29,15 @@ Ext.define('amdaModel.Interval', { | ||
29 | { name: 'start', type : 'date', defaultValue : new Date(), | 29 | { name: 'start', type : 'date', defaultValue : new Date(), |
30 | convert: function(value,rec) { | 30 | convert: function(value,rec) { |
31 | if (!Ext.isDate(value)){ | 31 | if (!Ext.isDate(value)){ |
32 | - var valueString = new String(value); | ||
33 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | ||
34 | - return date; | 32 | + return new Date(value); |
35 | } | 33 | } |
36 | return value; | 34 | return value; |
37 | } | 35 | } |
38 | }, | 36 | }, |
39 | { name: 'stop', type : 'date', defaultValue : new Date(), | 37 | { name: 'stop', type : 'date', defaultValue : new Date(), |
40 | convert: function(value,rec) { | 38 | convert: function(value,rec) { |
41 | - if (!Ext.isDate(value)){ | ||
42 | - var valueString = new String(value); | ||
43 | - var date = new Date(valueString.replace(/\-/g,'\/').replace(/[T|Z]/g,' ')); | ||
44 | - return date; | 39 | + if (!Ext.isDate(value)){ |
40 | + return new Date(value); | ||
45 | } | 41 | } |
46 | return value; | 42 | return value; |
47 | } | 43 | } |
js/app/views/CatalogUI.js
@@ -179,8 +179,8 @@ Ext.define('amdaUI.CatalogUI', { | @@ -179,8 +179,8 @@ Ext.define('amdaUI.CatalogUI', { | ||
179 | return; | 179 | return; |
180 | } | 180 | } |
181 | Ext.Array.each(result.intervals, function (item, index) { | 181 | Ext.Array.each(result.intervals, function (item, index) { |
182 | - starts[index] = (item.start); | ||
183 | - stops[index] = (item.stop); | 182 | + starts[index] = Ext.Date.format(item.start, 'Y-m-d\\TH:i:s.u'); |
183 | + stops[index] = Ext.Date.format(item.start, 'Y-m-d\\TH:i:s.u'); | ||
184 | }); | 184 | }); |
185 | if(starts.length !== 0 || stops.length !== 0) { | 185 | if(starts.length !== 0 || stops.length !== 0) { |
186 | 186 | ||
@@ -205,7 +205,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -205,7 +205,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
205 | var timeTabNode = Ext.create('amdaModel.TimeTableNode', {leaf: true}); | 205 | var timeTabNode = Ext.create('amdaModel.TimeTableNode', {leaf: true}); |
206 | ttObj.set('relatedCatalogId', catId) | 206 | ttObj.set('relatedCatalogId', catId) |
207 | creatDate = new Date(this.object.get('created')); | 207 | creatDate = new Date(this.object.get('created')); |
208 | - date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s'); | 208 | + date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s.u'); |
209 | descr = 'Generated by CDPP/Amda Catalog Module \n' + 'From Catalog: ' + this.object.get('name') + '\nOn: ' + date + '\n'; | 209 | descr = 'Generated by CDPP/Amda Catalog Module \n' + 'From Catalog: ' + this.object.get('name') + '\nOn: ' + date + '\n'; |
210 | ttObj.set('description', descr + this.object.get('description')); | 210 | ttObj.set('description', descr + this.object.get('description')); |
211 | ttObj.set('contact', this.object.get('contact')); | 211 | ttObj.set('contact', this.object.get('contact')); |
@@ -271,11 +271,10 @@ Ext.define('amdaUI.CatalogUI', { | @@ -271,11 +271,10 @@ Ext.define('amdaUI.CatalogUI', { | ||
271 | { | 271 | { |
272 | name: 'start', | 272 | name: 'start', |
273 | type: 'date', | 273 | type: 'date', |
274 | - dateFormat: 'Y-m-d\\TH:i:s', | 274 | + dateFormat: 'Y-m-d\\TH:i:s.u', |
275 | convert: function (value, rec) { | 275 | convert: function (value, rec) { |
276 | if (!Ext.isDate(value)) { | 276 | if (!Ext.isDate(value)) { |
277 | - var valueString = new String(value); | ||
278 | - return new Date(valueString.replace(/\-/g, '\/').replace(/[T|Z]/g, ' ')); | 277 | + return new Date(value); |
279 | } | 278 | } |
280 | return value; | 279 | return value; |
281 | } | 280 | } |
@@ -283,11 +282,10 @@ Ext.define('amdaUI.CatalogUI', { | @@ -283,11 +282,10 @@ Ext.define('amdaUI.CatalogUI', { | ||
283 | { | 282 | { |
284 | name: 'stop', | 283 | name: 'stop', |
285 | type: 'date', | 284 | type: 'date', |
286 | - dateFormat: 'Y-m-d\\TH:i:s', | 285 | + dateFormat: 'Y-m-d\\TH:i:s.u', |
287 | convert: function (value, rec) { | 286 | convert: function (value, rec) { |
288 | if (!Ext.isDate(value)) { | 287 | if (!Ext.isDate(value)) { |
289 | - var valueString = new String(value); | ||
290 | - return new Date(valueString.replace(/\-/g, '\/').replace(/[T|Z]/g, ' ')); | 288 | + return new Date(value); |
291 | } | 289 | } |
292 | return value; | 290 | return value; |
293 | } | 291 | } |
@@ -365,40 +363,36 @@ Ext.define('amdaUI.CatalogUI', { | @@ -365,40 +363,36 @@ Ext.define('amdaUI.CatalogUI', { | ||
365 | } | 363 | } |
366 | }, | 364 | }, |
367 | { | 365 | { |
368 | - xtype: 'datecolumn', | ||
369 | - text: 'Start Time', | ||
370 | - format: 'Y-m-d\\TH:i:s', | ||
371 | - sortable: true, | ||
372 | - dataIndex: 'start', | ||
373 | - width: 120, | ||
374 | - minWidth: 50, | ||
375 | - menuDisabled: false, | ||
376 | - editor: { | ||
377 | - xtype: 'datefield', | ||
378 | - allowBlank: false, | ||
379 | - hideTrigger: true, | ||
380 | - format: 'Y-m-d\\TH:i:s' | ||
381 | - }, | ||
382 | - filter: {type: 'date', dateFormat: 'Y-m-d'} | 366 | + header: 'Start Time', dataIndex: 'start', width: 120, |
367 | + editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s.u'}, | ||
368 | + renderer: function (value) { | ||
369 | + if (value != null) { | ||
370 | + if (Ext.isDate(value)) { | ||
371 | + return Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); | ||
372 | + } else { | ||
373 | + return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s.u'); | ||
374 | + } | ||
375 | + } else { | ||
376 | + return value; | ||
377 | + } | ||
378 | + } | ||
383 | }, | 379 | }, |
384 | { | 380 | { |
385 | - xtype: 'datecolumn', | ||
386 | - text: 'Stop Time', | ||
387 | - format: 'Y-m-d\\TH:i:s', | ||
388 | - sortable: true, | ||
389 | - dataIndex: 'stop', | ||
390 | - width: 120, | ||
391 | - minWidth: 50, | ||
392 | - menuDisabled: false, | ||
393 | - editor: { | ||
394 | - xtype: 'datefield', | ||
395 | - allowBlank: false, | ||
396 | - hideTrigger: true, | ||
397 | - format: 'Y-m-d\\TH:i:s' | ||
398 | - }, | ||
399 | - filter: {type: 'date', dateFormat: 'Y-m-d'} | 381 | + header: 'Stop Time', dataIndex: 'stop', width: 120, |
382 | + editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s.u'}, | ||
383 | + renderer: function (value) { | ||
384 | + if (value != null) { | ||
385 | + if (Ext.isDate(value)) { | ||
386 | + return Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); | ||
387 | + } else { | ||
388 | + return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s.u'); | ||
389 | + } | ||
390 | + } else { | ||
391 | + return value; | ||
392 | + } | ||
393 | + } | ||
400 | }, | 394 | }, |
401 | - { | 395 | + { |
402 | xtype: 'gridcolumn', | 396 | xtype: 'gridcolumn', |
403 | text: 'Duration (day)', | 397 | text: 'Duration (day)', |
404 | sortable: true, | 398 | sortable: true, |
@@ -506,7 +500,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -506,7 +500,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
506 | case 1: //dateTime | 500 | case 1: //dateTime |
507 | field = Ext.apply({}, field, { | 501 | field = Ext.apply({}, field, { |
508 | type: 'date', | 502 | type: 'date', |
509 | - dateFormat: 'Y-m-d\\TH:i:s', | 503 | + dateFormat: 'Y-m-d\\TH:i:s.u', |
510 | convert: function (value, rec) { | 504 | convert: function (value, rec) { |
511 | if (!Ext.isDate(value)) { | 505 | if (!Ext.isDate(value)) { |
512 | var valueString = new String(value); | 506 | var valueString = new String(value); |
@@ -523,7 +517,7 @@ Ext.define('amdaUI.CatalogUI', { | @@ -523,7 +517,7 @@ Ext.define('amdaUI.CatalogUI', { | ||
523 | xtype: 'datefield', | 517 | xtype: 'datefield', |
524 | allowBlank: false, | 518 | allowBlank: false, |
525 | hideTrigger: true, | 519 | hideTrigger: true, |
526 | - format: 'Y-m-d\\TH:i:s' | 520 | + format: 'Y-m-d\\TH:i:s.u' |
527 | }, | 521 | }, |
528 | filter: {type: 'date', dateFormat: 'Y-m-d'} | 522 | filter: {type: 'date', dateFormat: 'Y-m-d'} |
529 | }); | 523 | }); |
@@ -894,7 +888,10 @@ Ext.define('amdaUI.CatalogUI', { | @@ -894,7 +888,10 @@ Ext.define('amdaUI.CatalogUI', { | ||
894 | 'isCatalog': true, | 888 | 'isCatalog': true, |
895 | 'data': {} | 889 | 'data': {} |
896 | }; | 890 | }; |
897 | - obj['data'][activeColumn.dataIndex] = value; | 891 | + if(activeColumn.dataIndex == "start" || activeColumn.dataIndex == "stop") |
892 | + obj['data'][activeColumn.dataIndex] = Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); | ||
893 | + else | ||
894 | + obj['data'][activeColumn.dataIndex] = value; | ||
898 | 895 | ||
899 | //Interval is modified on the server side | 896 | //Interval is modified on the server side |
900 | me.editing = true; | 897 | me.editing = true; |
@@ -1065,10 +1062,10 @@ Ext.define('amdaUI.CatalogUI', { | @@ -1065,10 +1062,10 @@ Ext.define('amdaUI.CatalogUI', { | ||
1065 | items :[{ | 1062 | items :[{ |
1066 | fieldLabel: 'Start Time', | 1063 | fieldLabel: 'Start Time', |
1067 | name: 'surveyStart', | 1064 | name: 'surveyStart', |
1068 | - emptyText: 'YYYY/MM/DDThh:mm:ss', | ||
1069 | - format: 'Y-m-d\\TH:i:s', | 1065 | + emptyText: 'YYYY/MM/DDThh:mm:ss.fff', |
1066 | + format: 'Y-m-d\\TH:i:s.u', | ||
1070 | enforceMaxLength: true, | 1067 | enforceMaxLength: true, |
1071 | - maxLength: 19, | 1068 | + maxLength: 25, |
1072 | labelWidth: 60, | 1069 | labelWidth: 60, |
1073 | labelAlign: 'left', | 1070 | labelAlign: 'left', |
1074 | listeners: { | 1071 | listeners: { |
@@ -1080,11 +1077,11 @@ Ext.define('amdaUI.CatalogUI', { | @@ -1080,11 +1077,11 @@ Ext.define('amdaUI.CatalogUI', { | ||
1080 | }, { | 1077 | }, { |
1081 | fieldLabel: 'Stop Time', | 1078 | fieldLabel: 'Stop Time', |
1082 | name: 'surveyStop', | 1079 | name: 'surveyStop', |
1083 | - emptyText: 'YYYY/MM/DDThh:mm:ss', | ||
1084 | - format: 'Y-m-d\\TH:i:s', | 1080 | + emptyText: 'YYYY/MM/DDThh:mm:ss.fff', |
1081 | + format: 'Y-m-d\\TH:i:s.u', | ||
1085 | labelAlign: 'left', | 1082 | labelAlign: 'left', |
1086 | enforceMaxLength: true, | 1083 | enforceMaxLength: true, |
1087 | - maxLength: 19, | 1084 | + maxLength: 25, |
1088 | labelWidth: 60, | 1085 | labelWidth: 60, |
1089 | align: 'left', | 1086 | align: 'left', |
1090 | listeners: { | 1087 | listeners: { |
js/app/views/DownloadUI.js
@@ -16,7 +16,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -16,7 +16,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
16 | 'amdaUI.TimeSelectorUI', | 16 | 'amdaUI.TimeSelectorUI', |
17 | 'amdaUI.ParamArgumentsPlug', | 17 | 'amdaUI.ParamArgumentsPlug', |
18 | 'amdaUI.SendToSampButtonUI', | 18 | 'amdaUI.SendToSampButtonUI', |
19 | - 'amdaModel.Download', | 19 | + 'amdaModel.Download', |
20 | 'amdaModel.DownloadParam', | 20 | 'amdaModel.DownloadParam', |
21 | 'amdaModel.RequestParamObject' | 21 | 'amdaModel.RequestParamObject' |
22 | ], | 22 | ], |
@@ -33,8 +33,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -33,8 +33,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
33 | paramArgsPlug.onApply = this.onApplyParameterArgs; | 33 | paramArgsPlug.onApply = this.onApplyParameterArgs; |
34 | }, | 34 | }, |
35 | 35 | ||
36 | - saveRequest: function() | ||
37 | - { | 36 | + saveRequest: function () { |
38 | var me = this; | 37 | var me = this; |
39 | 38 | ||
40 | if (!this.updateObject()) { | 39 | if (!this.updateObject()) { |
@@ -52,38 +51,35 @@ Ext.define('amdaUI.DownloadUI', { | @@ -52,38 +51,35 @@ Ext.define('amdaUI.DownloadUI', { | ||
52 | } | 51 | } |
53 | 52 | ||
54 | downloadModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) { | 53 | downloadModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) { |
55 | - if (!res) | ||
56 | - { | 54 | + if (!res) { |
57 | me.fieldName.validFlag = 'Error during object validation'; | 55 | me.fieldName.validFlag = 'Error during object validation'; |
58 | myDesktopApp.errorMsg(me.fieldName.validFlag); | 56 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
59 | me.fieldName.validate(); | 57 | me.fieldName.validate(); |
60 | return; | 58 | return; |
61 | } | 59 | } |
62 | 60 | ||
63 | - if (!res.valid) | ||
64 | - { | ||
65 | - if (res.error) | ||
66 | - { | 61 | + if (!res.valid) { |
62 | + if (res.error) { | ||
67 | if (res.error.search('subtree') != -1) { | 63 | if (res.error.search('subtree') != -1) { |
68 | - Ext.MessageBox.show({title:'Warning', | ||
69 | - msg: res.error+'<br/>Do you want to overwrite it?', | 64 | + Ext.MessageBox.show({ |
65 | + title: 'Warning', | ||
66 | + msg: res.error + '<br/>Do you want to overwrite it?', | ||
70 | width: 300, | 67 | width: 300, |
71 | buttons: Ext.MessageBox.OKCANCEL, | 68 | buttons: Ext.MessageBox.OKCANCEL, |
72 | - fn : function(btn) { | 69 | + fn: function (btn) { |
73 | if (btn == 'cancel') return; | 70 | if (btn == 'cancel') return; |
74 | this.fieldName.clearInvalid(); | 71 | this.fieldName.clearInvalid(); |
75 | this.saveProcess(true); | 72 | this.saveProcess(true); |
76 | }, | 73 | }, |
77 | icon: Ext.MessageBox.WARNING, | 74 | icon: Ext.MessageBox.WARNING, |
78 | - scope : me | 75 | + scope: me |
79 | }); | 76 | }); |
80 | me.fieldName.validFlag = true; | 77 | me.fieldName.validFlag = true; |
81 | } | 78 | } |
82 | else | 79 | else |
83 | me.fieldName.validFlag = res.error; | 80 | me.fieldName.validFlag = res.error; |
84 | } | 81 | } |
85 | - else | ||
86 | - { | 82 | + else { |
87 | me.fieldName.validFlag = 'Invalid object name'; | 83 | me.fieldName.validFlag = 'Invalid object name'; |
88 | myDesktopApp.errorMsg(me.fieldName.validFlag); | 84 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
89 | } | 85 | } |
@@ -97,14 +93,13 @@ Ext.define('amdaUI.DownloadUI', { | @@ -97,14 +93,13 @@ Ext.define('amdaUI.DownloadUI', { | ||
97 | }); | 93 | }); |
98 | }, | 94 | }, |
99 | 95 | ||
100 | - saveProcess: function(toRename) { | 96 | + saveProcess: function (toRename) { |
101 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | 97 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
102 | if (this.object.isModified('name')) { | 98 | if (this.object.isModified('name')) { |
103 | - if (this.object.get('id')) | ||
104 | - { | 99 | + if (this.object.get('id')) { |
105 | var contextNode = downloadModule.linkedNode.parentNode; | 100 | var contextNode = downloadModule.linkedNode.parentNode; |
106 | downloadModule.createLinkedNode(); | 101 | downloadModule.createLinkedNode(); |
107 | - downloadModule.linkedNode.set('contextNode',contextNode); | 102 | + downloadModule.linkedNode.set('contextNode', contextNode); |
108 | downloadModule.createObject(this.object.getJsonValues()); | 103 | downloadModule.createObject(this.object.getJsonValues()); |
109 | var downloadObj = downloadModule.linkedNode.get('object'); | 104 | var downloadObj = downloadModule.linkedNode.get('object'); |
110 | this.object = downloadObj; | 105 | this.object = downloadObj; |
@@ -113,13 +108,12 @@ Ext.define('amdaUI.DownloadUI', { | @@ -113,13 +108,12 @@ Ext.define('amdaUI.DownloadUI', { | ||
113 | downloadModule.linkedNode.create(); | 108 | downloadModule.linkedNode.create(); |
114 | } | 109 | } |
115 | else { | 110 | else { |
116 | - downloadModule.linkedNode.set('contextNode',downloadModule.contextNode); | 111 | + downloadModule.linkedNode.set('contextNode', downloadModule.contextNode); |
117 | downloadModule.linkedNode.update(); | 112 | downloadModule.linkedNode.update(); |
118 | } | 113 | } |
119 | }, | 114 | }, |
120 | 115 | ||
121 | - addTT: function (newTTName, newTTid) | ||
122 | - { | 116 | + addTT: function (newTTName, newTTid) { |
123 | var tabPanel = this.formPanel.down(); | 117 | var tabPanel = this.formPanel.down(); |
124 | var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | 118 | var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); |
125 | 119 | ||
@@ -131,7 +125,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -131,7 +125,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
131 | // if no corresponding TT found | 125 | // if no corresponding TT found |
132 | if (existingIndex == -1) { | 126 | if (existingIndex == -1) { |
133 | // adding the time table to the TTGrid of TT download | 127 | // adding the time table to the TTGrid of TT download |
134 | - var r = Ext.create('amdaModel.TTobject', {id: newTTid, name: newTTName}); | 128 | + var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName }); |
135 | this.TTGrid.store.insert(this.TTGrid.store.getCount(), r); | 129 | this.TTGrid.store.insert(this.TTGrid.store.getCount(), r); |
136 | } | 130 | } |
137 | } | 131 | } |
@@ -159,20 +153,18 @@ Ext.define('amdaUI.DownloadUI', { | @@ -159,20 +153,18 @@ Ext.define('amdaUI.DownloadUI', { | ||
159 | var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | 153 | var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); |
160 | var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | 154 | var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); |
161 | 155 | ||
162 | - this.down('form').getForm().setValues({startDate: dateStart, stopDate: dateStop}); | 156 | + this.down('form').getForm().setValues({ startDate: dateStart, stopDate: dateStop }); |
163 | this.timeSelector.intervalSel.updateDuration(); | 157 | this.timeSelector.intervalSel.updateDuration(); |
164 | }, | 158 | }, |
165 | 159 | ||
166 | - addParameter: function(paramNode, updateTime) | ||
167 | - { | 160 | + addParameter: function (paramNode, updateTime) { |
168 | if (this.doNotifyDrop(paramNode)) { | 161 | if (this.doNotifyDrop(paramNode)) { |
169 | return this.doParamDrop(paramNode); | 162 | return this.doParamDrop(paramNode); |
170 | } | 163 | } |
171 | return false; | 164 | return false; |
172 | }, | 165 | }, |
173 | 166 | ||
174 | - addParam: function (paramId, isLeaf, needArgs, components, predefined_args) | ||
175 | - { | 167 | + addParam: function (paramId, isLeaf, needArgs, components, predefined_args) { |
176 | // adding the parameter to the paramGrid | 168 | // adding the parameter to the paramGrid |
177 | var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | 169 | var paramObj = amdaModel.RequestParamObject.getEmptyObj(); |
178 | paramObj.paramid = paramId; | 170 | paramObj.paramid = paramId; |
@@ -189,9 +181,9 @@ Ext.define('amdaUI.DownloadUI', { | @@ -189,9 +181,9 @@ Ext.define('amdaUI.DownloadUI', { | ||
189 | } | 181 | } |
190 | } | 182 | } |
191 | 183 | ||
192 | - if (predefined_args) { | ||
193 | - paramObj.template_args = predefined_args; | ||
194 | - } | 184 | + if (predefined_args) { |
185 | + paramObj.template_args = predefined_args; | ||
186 | + } | ||
195 | 187 | ||
196 | var r = Ext.create('amdaModel.DownloadParam', paramObj); | 188 | var r = Ext.create('amdaModel.DownloadParam', paramObj); |
197 | var pos = this.paramGrid.store.getCount(); | 189 | var pos = this.paramGrid.store.getCount(); |
@@ -219,8 +211,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -219,8 +211,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
219 | /** | 211 | /** |
220 | * update this.object from form | 212 | * update this.object from form |
221 | */ | 213 | */ |
222 | - updateObject: function () | ||
223 | - { | 214 | + updateObject: function () { |
224 | // get the basic form | 215 | // get the basic form |
225 | var tabPanel = this.formPanel.down(); | 216 | var tabPanel = this.formPanel.down(); |
226 | var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | 217 | var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); |
@@ -229,8 +220,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -229,8 +220,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
229 | var values = basicForm.getValues(); | 220 | var values = basicForm.getValues(); |
230 | 221 | ||
231 | // data download | 222 | // data download |
232 | - if (downloadSrc === 0) | ||
233 | - { | 223 | + if (downloadSrc === 0) { |
234 | var timeformat = values.timeformat; | 224 | var timeformat = values.timeformat; |
235 | var timeSource = this.timeSelector.getActiveTimeSource(); | 225 | var timeSource = this.timeSelector.getActiveTimeSource(); |
236 | var filestructure = values.filestructure; | 226 | var filestructure = values.filestructure; |
@@ -244,7 +234,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -244,7 +234,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
244 | Ext.Array.each(fieldsWithoutName, function (item, index, allItems) { | 234 | Ext.Array.each(fieldsWithoutName, function (item, index, allItems) { |
245 | if ((item.name != 'name') && !item.isValid()) { | 235 | if ((item.name != 'name') && !item.isValid()) { |
246 | if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | 236 | if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && |
247 | - ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | 237 | + ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { |
248 | updateStatus = true; | 238 | updateStatus = true; |
249 | } else { | 239 | } else { |
250 | // set update isn't allowed | 240 | // set update isn't allowed |
@@ -255,20 +245,18 @@ Ext.define('amdaUI.DownloadUI', { | @@ -255,20 +245,18 @@ Ext.define('amdaUI.DownloadUI', { | ||
255 | }, this); | 245 | }, this); |
256 | 246 | ||
257 | if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | 247 | if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' |
258 | - && this.timeSelector.TTGrid.getStore().count() == 0) { | 248 | + && this.timeSelector.TTGrid.getStore().count() == 0) { |
259 | myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' | 249 | myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' |
260 | - + '<br>You must add one or choose Time Selection `by Interval`'); | 250 | + + '<br>You must add one or choose Time Selection `by Interval`'); |
261 | updateStatus = false; | 251 | updateStatus = false; |
262 | } | 252 | } |
263 | 253 | ||
264 | - if (updateStatus && (this.object.params().count() == 0)) | ||
265 | - { | 254 | + if (updateStatus && (this.object.params().count() == 0)) { |
266 | myDesktopApp.warningMsg('You must define at least one parameter to download'); | 255 | myDesktopApp.warningMsg('You must define at least one parameter to download'); |
267 | updateStatus = false; | 256 | updateStatus = false; |
268 | } | 257 | } |
269 | 258 | ||
270 | - if (updateStatus) | ||
271 | - { | 259 | + if (updateStatus) { |
272 | /// real object update | 260 | /// real object update |
273 | // update TimeTable object with the content of form | 261 | // update TimeTable object with the content of form |
274 | basicForm.updateRecord(this.object); | 262 | basicForm.updateRecord(this.object); |
@@ -287,9 +275,8 @@ Ext.define('amdaUI.DownloadUI', { | @@ -287,9 +275,8 @@ Ext.define('amdaUI.DownloadUI', { | ||
287 | } | 275 | } |
288 | } | 276 | } |
289 | //TT download | 277 | //TT download |
290 | - else | ||
291 | - { | ||
292 | - var timeformat = values.timeformatTT ? values.timeformatTT :amdaModel.DownloadConfig.defaultValues.timeformatTT; | 278 | + else { |
279 | + var timeformat = values.timeformatTT ? values.timeformatTT : amdaModel.DownloadConfig.defaultValues.timeformatTT; | ||
293 | var compression = values.compressionTT; | 280 | var compression = values.compressionTT; |
294 | var fileformat = values.fileformatTT; | 281 | var fileformat = values.fileformatTT; |
295 | if (this.TTGrid.getStore().count() == 0) { | 282 | if (this.TTGrid.getStore().count() == 0) { |
@@ -297,7 +284,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -297,7 +284,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
297 | updateStatus = false; | 284 | updateStatus = false; |
298 | } | 285 | } |
299 | else if (compression === 'none' | 286 | else if (compression === 'none' |
300 | - && this.TTGrid.getStore().count() > 1) { | 287 | + && this.TTGrid.getStore().count() > 1) { |
301 | myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please'); | 288 | myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please'); |
302 | updateStatus = false; | 289 | updateStatus = false; |
303 | } | 290 | } |
@@ -323,8 +310,8 @@ Ext.define('amdaUI.DownloadUI', { | @@ -323,8 +310,8 @@ Ext.define('amdaUI.DownloadUI', { | ||
323 | // set parameters | 310 | // set parameters |
324 | this.paramGrid.reconfigure(this.object.params()); | 311 | this.paramGrid.reconfigure(this.object.params()); |
325 | //this.paramGrid.getStore().loadData(this.object.params().data.items); | 312 | //this.paramGrid.getStore().loadData(this.object.params().data.items); |
326 | - // select "Parameters" tab | ||
327 | - var tabPanel = this.formPanel.down(); | 313 | + // select "Parameters" tab |
314 | + var tabPanel = this.formPanel.down(); | ||
328 | tabPanel.setActiveTab(0); | 315 | tabPanel.setActiveTab(0); |
329 | }, | 316 | }, |
330 | 317 | ||
@@ -334,7 +321,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -334,7 +321,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
334 | doDownload: function (sendToSamp, clientId) { | 321 | doDownload: function (sendToSamp, clientId) { |
335 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | 322 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
336 | if (downloadModule) | 323 | if (downloadModule) |
337 | - downloadModule.linkedNode.execute({'sendToSamp': (sendToSamp == true), 'clientId': clientId}); | 324 | + downloadModule.linkedNode.execute({ 'sendToSamp': (sendToSamp == true), 'clientId': clientId }); |
338 | }, | 325 | }, |
339 | 326 | ||
340 | actionItem: function (grid, cell, cellIndex, record, row, recordIndex, e) { | 327 | actionItem: function (grid, cell, cellIndex, record, row, recordIndex, e) { |
@@ -372,18 +359,18 @@ Ext.define('amdaUI.DownloadUI', { | @@ -372,18 +359,18 @@ Ext.define('amdaUI.DownloadUI', { | ||
372 | } | 359 | } |
373 | }, | 360 | }, |
374 | onTTFileFormatChange: function (combo, newValue, oldValue) { | 361 | onTTFileFormatChange: function (combo, newValue, oldValue) { |
375 | - if (!this.formPanel) | 362 | + if (!this.formPanel) |
376 | return; | 363 | return; |
377 | 364 | ||
378 | var refTimeFormatField = this.formPanel.getForm().findField('timeformatTT'); | 365 | var refTimeFormatField = this.formPanel.getForm().findField('timeformatTT'); |
379 | 366 | ||
380 | if (refTimeFormatField && newValue !== oldValue) { | 367 | if (refTimeFormatField && newValue !== oldValue) { |
381 | - if (newValue === 'space' ){ | ||
382 | - refTimeFormatField.setValue('YYYY-MM-DDThh:mm:ss'); | ||
383 | - refTimeFormatField.setDisabled(true); | ||
384 | - }else{ | ||
385 | - refTimeFormatField.setDisabled(false); | ||
386 | - } | 368 | + if (newValue === 'space') { |
369 | + refTimeFormatField.setValue('YYYY-MM-DDThh:mm:ss'); | ||
370 | + refTimeFormatField.setDisabled(true); | ||
371 | + } else { | ||
372 | + refTimeFormatField.setDisabled(false); | ||
373 | + } | ||
387 | } | 374 | } |
388 | }, | 375 | }, |
389 | 376 | ||
@@ -405,45 +392,38 @@ Ext.define('amdaUI.DownloadUI', { | @@ -405,45 +392,38 @@ Ext.define('amdaUI.DownloadUI', { | ||
405 | } | 392 | } |
406 | }, | 393 | }, |
407 | 394 | ||
408 | - doNotifyDrop: function(record) | ||
409 | - { | ||
410 | - if (record.get('nodeType') == 'localParam' && record.get('notyet')) | ||
411 | - { | 395 | + doNotifyDrop: function (record) { |
396 | + if (record.get('nodeType') == 'localParam' && record.get('notyet')) { | ||
412 | return false; | 397 | return false; |
413 | } | 398 | } |
414 | if (((record.get('nodeType') == 'localParam') || | 399 | if (((record.get('nodeType') == 'localParam') || |
415 | - (record.get('nodeType') == 'remoteParam') || | ||
416 | - (record.get('nodeType') == 'remoteSimuParam') || | ||
417 | - (record.get('nodeType') == 'derivedParam') || | ||
418 | - (record.get('nodeType') == 'myDataParam') || | ||
419 | - (record.get('nodeType') == 'alias')) && | ||
420 | - (record.isLeaf() || record.get('isParameter')) && | ||
421 | - !record.get('disable')) | ||
422 | - { | 400 | + (record.get('nodeType') == 'remoteParam') || |
401 | + (record.get('nodeType') == 'remoteSimuParam') || | ||
402 | + (record.get('nodeType') == 'derivedParam') || | ||
403 | + (record.get('nodeType') == 'myDataParam') || | ||
404 | + (record.get('nodeType') == 'alias')) && | ||
405 | + (record.isLeaf() || record.get('isParameter')) && | ||
406 | + !record.get('disable')) { | ||
423 | return true; | 407 | return true; |
424 | } | 408 | } |
425 | 409 | ||
426 | return false; | 410 | return false; |
427 | }, | 411 | }, |
428 | 412 | ||
429 | - doParamDrop: function(record) | ||
430 | - { | 413 | + doParamDrop: function (record) { |
431 | var idToSent; | 414 | var idToSent; |
432 | var components = null; | 415 | var components = null; |
433 | var predefinedArgs = record.get('predefinedArgs'); | 416 | var predefinedArgs = record.get('predefinedArgs'); |
434 | - switch (record.get('nodeType')) | ||
435 | - { | ||
436 | - case 'localParam' : | 417 | + switch (record.get('nodeType')) { |
418 | + case 'localParam': | ||
437 | case 'remoteParam': | 419 | case 'remoteParam': |
438 | case 'remoteSimuParam': | 420 | case 'remoteSimuParam': |
439 | idToSent = record.get('id'); | 421 | idToSent = record.get('id'); |
440 | if (record.get('alias') != "") | 422 | if (record.get('alias') != "") |
441 | idToSent = "#" + record.get('alias'); | 423 | idToSent = "#" + record.get('alias'); |
442 | var component_info = record.get('component_info'); | 424 | var component_info = record.get('component_info'); |
443 | - if (component_info && component_info.parentId) | ||
444 | - { | ||
445 | - if (component_info.index1 || component_info.index2) | ||
446 | - { | 425 | + if (component_info && component_info.parentId) { |
426 | + if (component_info.index1 || component_info.index2) { | ||
447 | idToSent = component_info.parentId; | 427 | idToSent = component_info.parentId; |
448 | components = []; | 428 | components = []; |
449 | if (component_info.index1) | 429 | if (component_info.index1) |
@@ -452,48 +432,42 @@ Ext.define('amdaUI.DownloadUI', { | @@ -452,48 +432,42 @@ Ext.define('amdaUI.DownloadUI', { | ||
452 | components['index2'] = component_info.index2; | 432 | components['index2'] = component_info.index2; |
453 | predefinedArgs = record.parentNode.get('predefinedArgs'); | 433 | predefinedArgs = record.parentNode.get('predefinedArgs'); |
454 | } | 434 | } |
455 | - if (record.get('needsArgs')) | ||
456 | - { | 435 | + if (record.get('needsArgs')) { |
457 | idToSent = component_info.parentId; | 436 | idToSent = component_info.parentId; |
458 | - if (component_info.index1) | ||
459 | - { | 437 | + if (component_info.index1) { |
460 | components = []; | 438 | components = []; |
461 | components['index1'] = component_info.index1; | 439 | components['index1'] = component_info.index1; |
462 | } | 440 | } |
463 | } | 441 | } |
464 | } | 442 | } |
465 | break; | 443 | break; |
466 | - case 'alias' : | 444 | + case 'alias': |
467 | idToSent = "#" + record.get('text'); | 445 | idToSent = "#" + record.get('text'); |
468 | break; | 446 | break; |
469 | - case 'derivedParam' : | ||
470 | - if (record.modelName == 'amdaModel.DerivedParamComponentNode') | ||
471 | - { | 447 | + case 'derivedParam': |
448 | + if (record.modelName == 'amdaModel.DerivedParamComponentNode') { | ||
472 | paramId = record.get('text'); | 449 | paramId = record.get('text'); |
473 | var parentId = paramId.substr(0, paramId.length - 3); | 450 | var parentId = paramId.substr(0, paramId.length - 3); |
474 | idToSent = "ws_" + parentId; | 451 | idToSent = "ws_" + parentId; |
475 | var regExp = /\(([\d]+)\)/; | 452 | var regExp = /\(([\d]+)\)/; |
476 | var component_index = regExp.exec(paramId); | 453 | var component_index = regExp.exec(paramId); |
477 | - if (component_index) | ||
478 | - { | 454 | + if (component_index) { |
479 | components = []; | 455 | components = []; |
480 | components['index1'] = component_index[1]; | 456 | components['index1'] = component_index[1]; |
481 | } | 457 | } |
482 | - } | 458 | + } |
483 | else { | 459 | else { |
484 | idToSent = "ws_" + record.get('text'); | 460 | idToSent = "ws_" + record.get('text'); |
485 | } | 461 | } |
486 | break; | 462 | break; |
487 | - case 'myDataParam' : | ||
488 | - if (record.modelName == 'amdaModel.MyDataParamComponentNode') | ||
489 | - { | 463 | + case 'myDataParam': |
464 | + if (record.modelName == 'amdaModel.MyDataParamComponentNode') { | ||
490 | paramId = record.get('text'); | 465 | paramId = record.get('text'); |
491 | var parentId = paramId.substr(0, paramId.length - 3); | 466 | var parentId = paramId.substr(0, paramId.length - 3); |
492 | idToSent = "wsd_" + parentId; | 467 | idToSent = "wsd_" + parentId; |
493 | var regExp = /\(([\d]+)\)/; | 468 | var regExp = /\(([\d]+)\)/; |
494 | var component_index = regExp.exec(paramId); | 469 | var component_index = regExp.exec(paramId); |
495 | - if (component_index) | ||
496 | - { | 470 | + if (component_index) { |
497 | components = []; | 471 | components = []; |
498 | components['index1'] = component_index[1]; | 472 | components['index1'] = component_index[1]; |
499 | } | 473 | } |
@@ -502,14 +476,14 @@ Ext.define('amdaUI.DownloadUI', { | @@ -502,14 +476,14 @@ Ext.define('amdaUI.DownloadUI', { | ||
502 | idToSent = "wsd_" + record.get('text'); | 476 | idToSent = "wsd_" + record.get('text'); |
503 | } | 477 | } |
504 | break; | 478 | break; |
505 | - default : | 479 | + default: |
506 | return false; | 480 | return false; |
507 | } | 481 | } |
508 | 482 | ||
509 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | 483 | var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
510 | if (downModule) { | 484 | if (downModule) { |
511 | if (predefinedArgs) { | 485 | if (predefinedArgs) { |
512 | - downModule.parseTemplatedParam(idToSent, function(param_info) { | 486 | + downModule.parseTemplatedParam(idToSent, function (param_info) { |
513 | downModule.addParam(param_info.paramid, record.get('leaf'), record.get('needsArgs'), components, param_info.template_args); | 487 | downModule.addParam(param_info.paramid, record.get('leaf'), record.get('needsArgs'), components, param_info.template_args); |
514 | }); | 488 | }); |
515 | } | 489 | } |
@@ -532,20 +506,19 @@ Ext.define('amdaUI.DownloadUI', { | @@ -532,20 +506,19 @@ Ext.define('amdaUI.DownloadUI', { | ||
532 | init: function (config) { | 506 | init: function (config) { |
533 | var me = this; | 507 | var me = this; |
534 | 508 | ||
535 | - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector', flex: 1}); | 509 | + this.timeSelector = new amdaUI.TimeSelectorUI({ id: 'downloadTimeSelector', flex: 1 }); |
536 | 510 | ||
537 | this.fieldName = new Ext.form.field.Text({ | 511 | this.fieldName = new Ext.form.field.Text({ |
538 | labelAlign: 'left', | 512 | labelAlign: 'left', |
539 | labelWidth: 90, | 513 | labelWidth: 90, |
540 | fieldLabel: 'Request Name', | 514 | fieldLabel: 'Request Name', |
541 | - name : 'name', | ||
542 | - allowBlank : false, | 515 | + name: 'name', |
516 | + allowBlank: false, | ||
543 | stripCharsRe: /(^\s+|\s+$)/g, | 517 | stripCharsRe: /(^\s+|\s+$)/g, |
544 | validateOnChange: false, | 518 | validateOnChange: false, |
545 | validateOnBlur: false, | 519 | validateOnBlur: false, |
546 | validFlag: false, | 520 | validFlag: false, |
547 | - validator : function() | ||
548 | - { | 521 | + validator: function () { |
549 | return this.validFlag; | 522 | return this.validFlag; |
550 | } | 523 | } |
551 | }); | 524 | }); |
@@ -553,9 +526,9 @@ Ext.define('amdaUI.DownloadUI', { | @@ -553,9 +526,9 @@ Ext.define('amdaUI.DownloadUI', { | ||
553 | var downloadCont = this; | 526 | var downloadCont = this; |
554 | this.paramGrid = Ext.create('Ext.grid.Panel', { | 527 | this.paramGrid = Ext.create('Ext.grid.Panel', { |
555 | flex: 2, | 528 | flex: 2, |
556 | - store: Ext.create('Ext.data.Store', {model: 'amdaModel.DownloadParam'}), | 529 | + store: Ext.create('Ext.data.Store', { model: 'amdaModel.DownloadParam' }), |
557 | columns: [ | 530 | columns: [ |
558 | - {xtype: 'rownumberer', width: 20}, | 531 | + { xtype: 'rownumberer', width: 20 }, |
559 | { | 532 | { |
560 | header: "Parameter Name", | 533 | header: "Parameter Name", |
561 | dataIndex: 'name', | 534 | dataIndex: 'name', |
@@ -568,53 +541,50 @@ Ext.define('amdaUI.DownloadUI', { | @@ -568,53 +541,50 @@ Ext.define('amdaUI.DownloadUI', { | ||
568 | }, | 541 | }, |
569 | { | 542 | { |
570 | menuDisabled: true, width: 30, renderer: function () { | 543 | menuDisabled: true, width: 30, renderer: function () { |
571 | - return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; | 544 | + return '<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; |
572 | } | 545 | } |
573 | }, | 546 | }, |
574 | { | 547 | { |
575 | menuDisabled: true, width: 30, renderer: function () { | 548 | menuDisabled: true, width: 30, renderer: function () { |
576 | - return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | 549 | + return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; |
577 | } | 550 | } |
578 | } | 551 | } |
579 | ], | 552 | ], |
580 | //TODO - BRE - Wait the fix for drag&drop issue | 553 | //TODO - BRE - Wait the fix for drag&drop issue |
581 | listeners: | 554 | listeners: |
582 | - { | ||
583 | - render: function (o, op) | ||
584 | - { | ||
585 | - var me = this; | ||
586 | - var el = me.body.dom; | ||
587 | - me.dropTarget = Ext.create('Ext.dd.DropTarget', el, { | ||
588 | - ddGroup: 'explorerTree', | ||
589 | - notifyEnter: function (ddSource, e, data) { }, | ||
590 | - notifyOver: function (ddSource, e, data) | ||
591 | - { | ||
592 | - if (!downloadCont.doNotifyDrop(data.records[0])) { | ||
593 | - this.valid = false; | ||
594 | - return this.dropNotAllowed; | ||
595 | - } | ||
596 | - this.valid = true; | ||
597 | - return this.dropAllowed; | ||
598 | - }, | ||
599 | - notifyDrop: function (ddSource, e, data) | ||
600 | - { | ||
601 | - if (!this.valid) | ||
602 | - return false; | ||
603 | - return downloadCont.doParamDrop(data.records[0]); | ||
604 | - } | ||
605 | - }); | 555 | + { |
556 | + render: function (o, op) { | ||
557 | + var me = this; | ||
558 | + var el = me.body.dom; | ||
559 | + me.dropTarget = Ext.create('Ext.dd.DropTarget', el, { | ||
560 | + ddGroup: 'explorerTree', | ||
561 | + notifyEnter: function (ddSource, e, data) { }, | ||
562 | + notifyOver: function (ddSource, e, data) { | ||
563 | + if (!downloadCont.doNotifyDrop(data.records[0])) { | ||
564 | + this.valid = false; | ||
565 | + return this.dropNotAllowed; | ||
566 | + } | ||
567 | + this.valid = true; | ||
568 | + return this.dropAllowed; | ||
569 | + }, | ||
570 | + notifyDrop: function (ddSource, e, data) { | ||
571 | + if (!this.valid) | ||
572 | + return false; | ||
573 | + return downloadCont.doParamDrop(data.records[0]); | ||
606 | } | 574 | } |
607 | - } | 575 | + }); |
576 | + } | ||
577 | + } | ||
608 | }); | 578 | }); |
609 | 579 | ||
610 | this.paramGrid.on('cellclick', this.actionItem, this); | 580 | this.paramGrid.on('cellclick', this.actionItem, this); |
611 | 581 | ||
612 | this.TTGrid = Ext.create('Ext.grid.Panel', { | 582 | this.TTGrid = Ext.create('Ext.grid.Panel', { |
613 | flex: 2, | 583 | flex: 2, |
614 | - store: Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}), | 584 | + store: Ext.create('Ext.data.Store', { model: 'amdaModel.TTobject' }), |
615 | columns: [ | 585 | columns: [ |
616 | - {xtype: 'rownumberer', width: 20}, | ||
617 | - {header: "TimeTable/Catalog Name", dataIndex: 'name', flex: 1, sortable: false, menuDisabled: true}, | 586 | + { xtype: 'rownumberer', width: 20 }, |
587 | + { header: "TimeTable/Catalog Name", dataIndex: 'name', flex: 1, sortable: false, menuDisabled: true }, | ||
618 | { | 588 | { |
619 | menuDisabled: true, width: 30, renderer: function () { | 589 | menuDisabled: true, width: 30, renderer: function () { |
620 | return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | 590 | return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; |
@@ -622,42 +592,37 @@ Ext.define('amdaUI.DownloadUI', { | @@ -622,42 +592,37 @@ Ext.define('amdaUI.DownloadUI', { | ||
622 | } | 592 | } |
623 | ], | 593 | ], |
624 | listeners: | 594 | listeners: |
625 | - { | ||
626 | - render: function (o, op) | ||
627 | - { | ||
628 | - var me = this; | ||
629 | - var el = me.body.dom; | ||
630 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | ||
631 | - ddGroup: 'explorerTree', | ||
632 | - notifyEnter: function (ddSource, e, data) | ||
633 | - { | ||
634 | - | ||
635 | - }, | ||
636 | - notifyOver: function (ddSource, e, data) | ||
637 | - { | ||
638 | - var nodeType = data.records[0].get('nodeType'); | ||
639 | - if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') || | ||
640 | - (nodeType == 'catalog' || nodeType == 'sharedcatalog') && | ||
641 | - (data.records[0].get('leaf'))) | ||
642 | - { | ||
643 | - this.valid = true; | ||
644 | - return this.dropAllowed; | ||
645 | - } | ||
646 | - this.valid = false; | ||
647 | - return this.dropNotAllowed; | ||
648 | - }, | ||
649 | - notifyDrop: function (ddSource, e, data) | ||
650 | - { | ||
651 | - if (!this.valid) | ||
652 | - return false; | ||
653 | - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | ||
654 | - if (downModule) | ||
655 | - downModule.getUiContent().addTTdownload(data.records[0].get('text'), data.records[0].get('id')); | ||
656 | - return true; | ||
657 | - } | ||
658 | - }); | 595 | + { |
596 | + render: function (o, op) { | ||
597 | + var me = this; | ||
598 | + var el = me.body.dom; | ||
599 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | ||
600 | + ddGroup: 'explorerTree', | ||
601 | + notifyEnter: function (ddSource, e, data) { | ||
602 | + | ||
603 | + }, | ||
604 | + notifyOver: function (ddSource, e, data) { | ||
605 | + var nodeType = data.records[0].get('nodeType'); | ||
606 | + if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') || | ||
607 | + (nodeType == 'catalog' || nodeType == 'sharedcatalog') && | ||
608 | + (data.records[0].get('leaf'))) { | ||
609 | + this.valid = true; | ||
610 | + return this.dropAllowed; | ||
611 | + } | ||
612 | + this.valid = false; | ||
613 | + return this.dropNotAllowed; | ||
614 | + }, | ||
615 | + notifyDrop: function (ddSource, e, data) { | ||
616 | + if (!this.valid) | ||
617 | + return false; | ||
618 | + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | ||
619 | + if (downModule) | ||
620 | + downModule.getUiContent().addTTdownload(data.records[0].get('text'), data.records[0].get('id')); | ||
621 | + return true; | ||
659 | } | 622 | } |
660 | - } | 623 | + }); |
624 | + } | ||
625 | + } | ||
661 | }); | 626 | }); |
662 | 627 | ||
663 | this.TTGrid.on('cellclick', this.actionItem, this); | 628 | this.TTGrid.on('cellclick', this.actionItem, this); |
@@ -671,7 +636,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -671,7 +636,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
671 | layout: { | 636 | layout: { |
672 | type: 'hbox', | 637 | type: 'hbox', |
673 | align: 'stretch', | 638 | align: 'stretch', |
674 | - defaultMargins: {top: 10, left: 10, bottom: 5, right: 10} | 639 | + defaultMargins: { top: 10, left: 10, bottom: 5, right: 10 } |
675 | }, | 640 | }, |
676 | items: [ | 641 | items: [ |
677 | { | 642 | { |
@@ -724,7 +689,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -724,7 +689,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
724 | name: 'filestructure', | 689 | name: 'filestructure', |
725 | store: amdaModel.DownloadConfig.filestructureData, | 690 | store: amdaModel.DownloadConfig.filestructureData, |
726 | listeners: { | 691 | listeners: { |
727 | - change: {fn: this.onFileStructureChange}, | 692 | + change: { fn: this.onFileStructureChange }, |
728 | scope: this | 693 | scope: this |
729 | } | 694 | } |
730 | }, | 695 | }, |
@@ -739,7 +704,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -739,7 +704,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
739 | boxLabelAlign: 'before', | 704 | boxLabelAlign: 'before', |
740 | name: 'refparamSampling', checked: false, disabled: true, | 705 | name: 'refparamSampling', checked: false, disabled: true, |
741 | listeners: { | 706 | listeners: { |
742 | - change: {fn: this.onRefParamSamplingChange}, | 707 | + change: { fn: this.onRefParamSamplingChange }, |
743 | scope: this | 708 | scope: this |
744 | } | 709 | } |
745 | }, | 710 | }, |
@@ -772,102 +737,104 @@ Ext.define('amdaUI.DownloadUI', { | @@ -772,102 +737,104 @@ Ext.define('amdaUI.DownloadUI', { | ||
772 | this.timeSelector | 737 | this.timeSelector |
773 | ] | 738 | ] |
774 | } | 739 | } |
775 | - ]}); | 740 | + ] |
741 | + }); | ||
776 | 742 | ||
777 | this.ttPanel = | 743 | this.ttPanel = |
744 | + { | ||
745 | + xtype: 'container', | ||
746 | + title: 'Time Tables / Catalogs', | ||
747 | + layout: { | ||
748 | + type: 'hbox', | ||
749 | + align: 'stretch', | ||
750 | + defaultMargins: { top: 10, left: 10, bottom: 5, right: 10 } | ||
751 | + }, | ||
752 | + items: [ | ||
753 | + this.TTGrid, | ||
778 | { | 754 | { |
779 | xtype: 'container', | 755 | xtype: 'container', |
780 | - title: 'Time Tables / Catalogs', | 756 | + flex: 2, |
757 | + defaults: { | ||
758 | + xtype: 'combo', | ||
759 | + labelWidth: 90, | ||
760 | + queryMode: 'local', | ||
761 | + editable: false | ||
762 | + }, | ||
781 | layout: { | 763 | layout: { |
782 | - type: 'hbox', | ||
783 | - align: 'stretch', | ||
784 | - defaultMargins: {top: 10, left: 10, bottom: 5, right: 10} | 764 | + type: 'vbox', |
765 | + align: 'stretch' | ||
785 | }, | 766 | }, |
786 | - items: [ | ||
787 | - this.TTGrid, | ||
788 | - { | ||
789 | - xtype: 'container', | ||
790 | - flex: 2, | ||
791 | - defaults: { | ||
792 | - xtype: 'combo', | ||
793 | - labelWidth: 90, | ||
794 | - queryMode: 'local', | ||
795 | - editable: false | ||
796 | - }, | ||
797 | - layout: { | ||
798 | - type: 'vbox', | ||
799 | - align: 'stretch' | ||
800 | - }, | ||
801 | - items: [{ | ||
802 | - fieldLabel: 'Time Format', | ||
803 | - name: 'timeformatTT', | ||
804 | - valueField: 'id', | ||
805 | - store: storeTimeFormat, | ||
806 | - displayField: 'name', | ||
807 | - queryMode: 'local', | ||
808 | - listConfig: { | ||
809 | - tpl: [ | ||
810 | - '<tpl for=".">', | ||
811 | - '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>', | ||
812 | - '</tpl>' | ||
813 | - ] | ||
814 | - } | ||
815 | - }, | ||
816 | - { | ||
817 | - fieldLabel: 'File Format ', | ||
818 | - name: 'fileformatTT', | ||
819 | - store: amdaModel.DownloadConfig.fileformatTTData, | ||
820 | - listeners: { | ||
821 | - change: {fn: this.onTTFileFormatChange}, | ||
822 | - scope: this | ||
823 | - } | ||
824 | - }, | ||
825 | - { | ||
826 | - fieldLabel: 'Compression ', | ||
827 | - name: 'compressionTT', | ||
828 | - store: amdaModel.DownloadConfig.filecompressTTData | ||
829 | - }, | ||
830 | - { | ||
831 | - xtype: 'panel', | ||
832 | - html: ['<div>', | ||
833 | - '<p><b>=> Format specifications:</b></p>', | ||
834 | - '<ul>', | ||
835 | - '<li><b>Plain text:</b> ASCII tabular file. A comment line starts with "#"</li>', | ||
836 | - '<li><b>VOTable:</b> <a target="_blank" href="https://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html">Version 1.3</a></li>', | ||
837 | - '<li><b>HPEvent:</b> <a target="_blank" href="https://spase-group.org/docs/conventions/HDMC-Event-List-Specification-v1.0.4.pdf">Version 1.0</a></li>', | ||
838 | - '</ul>', | ||
839 | - '</div>'].join("\n") | ||
840 | - } | ||
841 | - ]} | 767 | + items: [{ |
768 | + fieldLabel: 'Time Format', | ||
769 | + name: 'timeformatTT', | ||
770 | + valueField: 'id', | ||
771 | + store: storeTimeFormat, | ||
772 | + displayField: 'name', | ||
773 | + queryMode: 'local', | ||
774 | + listConfig: { | ||
775 | + tpl: [ | ||
776 | + '<tpl for=".">', | ||
777 | + '<li class="x-boundlist-item" data-qtip="{qtip}">{name}</li>', | ||
778 | + '</tpl>' | ||
779 | + ] | ||
780 | + } | ||
781 | + }, | ||
782 | + { | ||
783 | + fieldLabel: 'File Format ', | ||
784 | + name: 'fileformatTT', | ||
785 | + store: amdaModel.DownloadConfig.fileformatTTData, | ||
786 | + listeners: { | ||
787 | + change: { fn: this.onTTFileFormatChange }, | ||
788 | + scope: this | ||
789 | + } | ||
790 | + }, | ||
791 | + { | ||
792 | + fieldLabel: 'Compression ', | ||
793 | + name: 'compressionTT', | ||
794 | + store: amdaModel.DownloadConfig.filecompressTTData | ||
795 | + }, | ||
796 | + { | ||
797 | + xtype: 'panel', | ||
798 | + html: ['<div>', | ||
799 | + '<p><b>=> Format specifications:</b></p>', | ||
800 | + '<ul>', | ||
801 | + '<li><b>Plain text:</b> ASCII tabular file. A comment line starts with "#"</li>', | ||
802 | + '<li><b>VOTable:</b> <a target="_blank" href="https://www.ivoa.net/documents/VOTable/20130315/PR-VOTable-1.3-20130315.html">Version 1.3</a></li>', | ||
803 | + '<li><b>HPEvent:</b> <a target="_blank" href="https://spase-group.org/docs/conventions/HDMC-Event-List-Specification-v1.0.4.pdf">Version 1.0</a></li>', | ||
804 | + '</ul>', | ||
805 | + '</div>'].join("\n") | ||
806 | + } | ||
842 | ] | 807 | ] |
843 | - }; | 808 | + } |
809 | + ] | ||
810 | + }; | ||
844 | 811 | ||
845 | this.formPanel = new Ext.form.Panel({ | 812 | this.formPanel = new Ext.form.Panel({ |
846 | layout: 'fit', | 813 | layout: 'fit', |
847 | region: 'center', | 814 | region: 'center', |
848 | - bodyStyle: {background: '#dfe8f6'}, | 815 | + bodyStyle: { background: '#dfe8f6' }, |
849 | buttonAlign: 'left', | 816 | buttonAlign: 'left', |
850 | trackResetOnLoad: true, //reset to the last loaded record | 817 | trackResetOnLoad: true, //reset to the last loaded record |
851 | defaults: { | 818 | defaults: { |
852 | border: false | 819 | border: false |
853 | }, | 820 | }, |
854 | items: [{ | 821 | items: [{ |
855 | - xtype: 'tabpanel', | ||
856 | - activeTab: 0, | ||
857 | - bodyStyle: {background: '#dfe8f6'}, | ||
858 | - items: [ | ||
859 | - this.paramPanel, | ||
860 | - this.ttPanel | ||
861 | - ], | ||
862 | - listeners: { | ||
863 | - tabchange: function(tabPanel, newCard, oldCard, eOpts) { | ||
864 | - var saveBtn = this.down('#save-download'); | ||
865 | - saveBtn.setDisabled(newCard != this.paramPanel); | ||
866 | - }, | ||
867 | - scope: this | ||
868 | - } | 822 | + xtype: 'tabpanel', |
823 | + activeTab: 0, | ||
824 | + bodyStyle: { background: '#dfe8f6' }, | ||
825 | + items: [ | ||
826 | + this.paramPanel, | ||
827 | + this.ttPanel | ||
828 | + ], | ||
829 | + listeners: { | ||
830 | + tabchange: function (tabPanel, newCard, oldCard, eOpts) { | ||
831 | + var saveBtn = this.down('#save-download'); | ||
832 | + saveBtn.setDisabled(newCard != this.paramPanel); | ||
869 | }, | 833 | }, |
870 | - ], | 834 | + scope: this |
835 | + } | ||
836 | + }, | ||
837 | + ], | ||
871 | fbar: [ | 838 | fbar: [ |
872 | { | 839 | { |
873 | text: 'Download', | 840 | text: 'Download', |
@@ -904,7 +871,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -904,7 +871,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
904 | xtype: 'sendToSampButton', | 871 | xtype: 'sendToSampButton', |
905 | type: 'votable', | 872 | type: 'votable', |
906 | onSendToSamp: this.onSendVOTableToSamp, | 873 | onSendToSamp: this.onSendVOTableToSamp, |
907 | - sendOpt: {scope: this} | 874 | + sendOpt: { scope: this } |
908 | }] | 875 | }] |
909 | }); | 876 | }); |
910 | 877 | ||
@@ -928,7 +895,7 @@ Ext.define('amdaUI.DownloadUI', { | @@ -928,7 +895,7 @@ Ext.define('amdaUI.DownloadUI', { | ||
928 | } | 895 | } |
929 | } | 896 | } |
930 | ], | 897 | ], |
931 | - plugins: [{ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}] | 898 | + plugins: [{ ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin' }] |
932 | }; | 899 | }; |
933 | 900 | ||
934 | Ext.apply(this, Ext.apply(arguments, myConf)); | 901 | Ext.apply(this, Ext.apply(arguments, myConf)); |
js/app/views/IntervalUI.js
@@ -122,7 +122,7 @@ Ext.define('amdaUI.IntervalUI', { | @@ -122,7 +122,7 @@ Ext.define('amdaUI.IntervalUI', { | ||
122 | // get stop value | 122 | // get stop value |
123 | var stop = this.getStopTime(); | 123 | var stop = this.getStopTime(); |
124 | // if duration computable | 124 | // if duration computable |
125 | - if (stop != null && start != null) { | 125 | + if (Ext.isDate(start) && Ext.isDate(stop)) { |
126 | if ( stop <= start ) { | 126 | if ( stop <= start ) { |
127 | form.findField('stopDate').markInvalid('Stop Time must be after Start Time'); | 127 | form.findField('stopDate').markInvalid('Stop Time must be after Start Time'); |
128 | } else { | 128 | } else { |
@@ -140,6 +140,7 @@ Ext.define('amdaUI.IntervalUI', { | @@ -140,6 +140,7 @@ Ext.define('amdaUI.IntervalUI', { | ||
140 | form.findField('durationHour').setValue(Math.floor(diff/3600000 % 24)); | 140 | form.findField('durationHour').setValue(Math.floor(diff/3600000 % 24)); |
141 | form.findField('durationMin').setValue(Math.floor(diff/60000 % 60)); | 141 | form.findField('durationMin').setValue(Math.floor(diff/60000 % 60)); |
142 | form.findField('durationSec').setValue(Math.floor(diff/1000 % 60)); | 142 | form.findField('durationSec').setValue(Math.floor(diff/1000 % 60)); |
143 | + form.findField('durationMs').setValue(Math.floor(diff%1000 )); | ||
143 | 144 | ||
144 | if (durationDays > this.durationLimit) { | 145 | if (durationDays > this.durationLimit) { |
145 | form.findField('durationDay').markInvalid('Maximum interval is ' + this.durationLimit + ' days!'); | 146 | form.findField('durationDay').markInvalid('Maximum interval is ' + this.durationLimit + ' days!'); |
@@ -149,6 +150,7 @@ Ext.define('amdaUI.IntervalUI', { | @@ -149,6 +150,7 @@ Ext.define('amdaUI.IntervalUI', { | ||
149 | form.findField('durationHour').setValue(''); | 150 | form.findField('durationHour').setValue(''); |
150 | form.findField('durationMin').setValue(''); | 151 | form.findField('durationMin').setValue(''); |
151 | form.findField('durationSec').setValue(''); | 152 | form.findField('durationSec').setValue(''); |
153 | + form.findField('durationMs').setValue(''); | ||
152 | } | 154 | } |
153 | }, | 155 | }, |
154 | 156 | ||
@@ -158,7 +160,8 @@ Ext.define('amdaUI.IntervalUI', { | @@ -158,7 +160,8 @@ Ext.define('amdaUI.IntervalUI', { | ||
158 | form.findField('durationDay').isValid() && | 160 | form.findField('durationDay').isValid() && |
159 | form.findField('durationHour').isValid() && | 161 | form.findField('durationHour').isValid() && |
160 | form.findField('durationMin').isValid() && | 162 | form.findField('durationMin').isValid() && |
161 | - form.findField('durationSec').isValid() | 163 | + form.findField('durationSec').isValid() && |
164 | + form.findField('durationMs').isValid() | ||
162 | ); | 165 | ); |
163 | }, | 166 | }, |
164 | 167 | ||
@@ -185,7 +188,8 @@ Ext.define('amdaUI.IntervalUI', { | @@ -185,7 +188,8 @@ Ext.define('amdaUI.IntervalUI', { | ||
185 | var h = form.findField('durationHour').getValue(); | 188 | var h = form.findField('durationHour').getValue(); |
186 | var m = form.findField('durationMin').getValue(); | 189 | var m = form.findField('durationMin').getValue(); |
187 | var s = form.findField('durationSec').getValue(); | 190 | var s = form.findField('durationSec').getValue(); |
188 | - var duration = (d?d:0)*86400 + (h?h:0)*3600 + (m?m:0)*60 + (s?s:0) | 191 | + var ms = form.findField('durationMs').getValue(); |
192 | + var duration = (d?d:0)*86400 + (h?h:0)*3600 + (m?m:0)*60 + (s?s:0) + (ms?ms:0)/1000; | ||
189 | var stop = Ext.Date.add(start, Ext.Date.SECOND, duration); | 193 | var stop = Ext.Date.add(start, Ext.Date.SECOND, duration); |
190 | 194 | ||
191 | if (Ext.Date.isDST(stop) && !Ext.Date.isDST(start)) | 195 | if (Ext.Date.isDST(stop) && !Ext.Date.isDST(start)) |
@@ -226,12 +230,12 @@ Ext.define('amdaUI.IntervalUI', { | @@ -226,12 +230,12 @@ Ext.define('amdaUI.IntervalUI', { | ||
226 | xtype: 'datefield', | 230 | xtype: 'datefield', |
227 | // margin : '10 0 5 5', // (top, right, bottom, left). | 231 | // margin : '10 0 5 5', // (top, right, bottom, left). |
228 | name: fieldName, | 232 | name: fieldName, |
229 | - // width : 220, | ||
230 | - emptyText: 'YYYY/MM/DD hh:mm:ss', | ||
231 | - tip: 'Date formatted as YYYY/MM/DD hh:mm:ss', | ||
232 | - format: 'Y/m/d H:i:s', | 233 | + width : 230, |
234 | + emptyText: 'YYYY/MM/DD hh:mm:ss.uuu', | ||
235 | + tip: 'Date formatted as YYYY/MM/DD hh:mm:ss.uuu', | ||
236 | + format: 'Y/m/d H:i:s.u', | ||
233 | enforceMaxLength: true, | 237 | enforceMaxLength: true, |
234 | - maxLength: 19, | 238 | + maxLength: 25, |
235 | fieldLabel: fieldText, | 239 | fieldLabel: fieldText, |
236 | labelAlign: 'left', | 240 | labelAlign: 'left', |
237 | labelWidth: 60, | 241 | labelWidth: 60, |
@@ -296,7 +300,8 @@ Ext.define('amdaUI.IntervalUI', { | @@ -296,7 +300,8 @@ Ext.define('amdaUI.IntervalUI', { | ||
296 | { name: 'durationDay', emptyText: 'Days', tip: 'Days', maxValue: 73000, maxLength: 5, fieldLabel: 'Duration', labelWidth: 60, width: 110}, | 300 | { name: 'durationDay', emptyText: 'Days', tip: 'Days', maxValue: 73000, maxLength: 5, fieldLabel: 'Duration', labelWidth: 60, width: 110}, |
297 | { name: 'durationHour', emptyText: 'Hrs', tip: 'Hours', maxValue: 23}, | 301 | { name: 'durationHour', emptyText: 'Hrs', tip: 'Hours', maxValue: 23}, |
298 | { name: 'durationMin', emptyText: 'Mins', tip: 'Minutes', maxValue: 59}, | 302 | { name: 'durationMin', emptyText: 'Mins', tip: 'Minutes', maxValue: 59}, |
299 | - { name: 'durationSec', emptyText: 'Secs', tip: 'Seconds', maxValue: 59} | 303 | + { name: 'durationSec', emptyText: 'Secs', tip: 'Seconds', maxValue: 59}, |
304 | + { name: 'durationMs', emptyText: 'MS', tip: 'Milliseconds', maxLength: 3, maxValue: 999} | ||
300 | ] | 305 | ] |
301 | }; | 306 | }; |
302 | }, | 307 | }, |
js/app/views/ParameterUI.js
@@ -8,535 +8,509 @@ | @@ -8,535 +8,509 @@ | ||
8 | * @version $Id: ParameterUI.js 2257 2014-04-02 12:21:27Z elena $ | 8 | * @version $Id: ParameterUI.js 2257 2014-04-02 12:21:27Z elena $ |
9 | */ | 9 | */ |
10 | 10 | ||
11 | -Ext.define('amdaUI.ParameterUI', | ||
12 | -{ | ||
13 | - extend: 'Ext.container.Container', | ||
14 | - | ||
15 | - alias: 'widget.panelParam', | ||
16 | - | ||
17 | - requires: [ | ||
18 | - 'amdaUI.AliasUI', | ||
19 | - 'amdaUI.CalculatorUI', | ||
20 | - 'extensions.SelectableTextArea', | ||
21 | - 'amdaUI.ParamArgumentsPlug', | ||
22 | - 'amdaModel.RequestParamObject' | ||
23 | - ], | ||
24 | - | ||
25 | - constructor: function(config) | ||
26 | - { | ||
27 | - this.init(config); | ||
28 | - this.callParent(arguments); | ||
29 | - // load object into form | ||
30 | - this.formPanel.getForm().loadRecord(this.object); | ||
31 | - var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); | ||
32 | - if (paramArgsPlug) | ||
33 | - paramArgsPlug.onApply = this.onApplyParameterArgs; | ||
34 | - }, | ||
35 | - | ||
36 | - addParamInEditor : function(param) | 11 | +Ext.define('amdaUI.ParameterUI', |
37 | { | 12 | { |
38 | - var selection = this.constructionField.getSelection(); | ||
39 | - this.constructionField.setValue(selection.beforeText + param + selection.afterText); | ||
40 | - this.constructionField.focus(); | ||
41 | - this.constructionField.setCaretPosition(this.constructionField.getValue().length); | ||
42 | - }, | ||
43 | - | ||
44 | - onApplyParameterArgs : function(uiScope, paramRequestObject) | ||
45 | - { | ||
46 | - var fullParam = paramRequestObject.getParamFullName(); | ||
47 | - uiScope.addParamInEditor(fullParam); | ||
48 | - }, | ||
49 | - | ||
50 | - addParam : function(newParamName, isLeaf, needArgs, components) | ||
51 | - { | ||
52 | - //if (!isLeaf || needArgs || components) | ||
53 | - if ( needArgs ) | ||
54 | - this.editParameterArgs(newParamName, components); | ||
55 | - else | ||
56 | - this.addParamInEditor(newParamName); | ||
57 | - }, | ||
58 | - | ||
59 | - editParameterArgs: function(name, components) | ||
60 | - { | ||
61 | - var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | ||
62 | - paramObj.paramid = name; | ||
63 | - | ||
64 | - if (components) | ||
65 | - { | ||
66 | - if (components['index1']) { | ||
67 | - paramObj['dim1-index'] = components['index1']; | ||
68 | - ++paramObj['type']; | 13 | + extend: 'Ext.container.Container', |
14 | + | ||
15 | + alias: 'widget.panelParam', | ||
16 | + | ||
17 | + requires: [ | ||
18 | + 'amdaUI.AliasUI', | ||
19 | + 'amdaUI.CalculatorUI', | ||
20 | + 'extensions.SelectableTextArea', | ||
21 | + 'amdaUI.ParamArgumentsPlug', | ||
22 | + 'amdaModel.RequestParamObject' | ||
23 | + ], | ||
24 | + | ||
25 | + constructor: function (config) { | ||
26 | + this.init(config); | ||
27 | + this.callParent(arguments); | ||
28 | + // load object into form | ||
29 | + this.formPanel.getForm().loadRecord(this.object); | ||
30 | + var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); | ||
31 | + if (paramArgsPlug) | ||
32 | + paramArgsPlug.onApply = this.onApplyParameterArgs; | ||
33 | + }, | ||
34 | + | ||
35 | + addParamInEditor: function (param) { | ||
36 | + var selection = this.constructionField.getSelection(); | ||
37 | + this.constructionField.setValue(selection.beforeText + param + selection.afterText); | ||
38 | + this.constructionField.focus(); | ||
39 | + if (this.constructionField.getValue()[(selection.beforeText + param).length] == ',') { | ||
40 | + this.constructionField.setCaretPosition((selection.beforeText + param).length + 1); | ||
69 | } | 41 | } |
70 | - | ||
71 | - if (components['index2']) { | ||
72 | - paramObj['dim2-index'] = components['index2']; | ||
73 | - ++paramObj['type']; | 42 | + else { |
43 | + this.constructionField.setCaretPosition(this.constructionField.getValue().length); | ||
74 | } | 44 | } |
75 | - } | ||
76 | - | ||
77 | - var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); | ||
78 | - if (paramArgsPlug) { | ||
79 | - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | ||
80 | - paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject); | ||
81 | - } | ||
82 | - }, | ||
83 | - | ||
84 | - setObject : function (object) | ||
85 | - { | ||
86 | - this.object = object; | ||
87 | - // load object into form | ||
88 | - this.formPanel.getForm().loadRecord(this.object); | ||
89 | - }, | ||
90 | - | ||
91 | - /** | ||
92 | - * update this.object from form | ||
93 | - */ | ||
94 | - updateObject : function() | ||
95 | - { | ||
96 | - // get the basic form | ||
97 | - var basicForm = this.formPanel.getForm(); | ||
98 | - var updateStatus = true; | ||
99 | - | ||
100 | - var fieldsWithoutName = basicForm.getFields().items; | ||
101 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems) | ||
102 | - { | ||
103 | - if(item !== this.fieldName) | ||
104 | - { | ||
105 | - if (!item.isValid()) { | ||
106 | - // set update isn't allowed | ||
107 | - updateStatus = false; | 45 | + }, |
46 | + | ||
47 | + onApplyParameterArgs: function (uiScope, paramRequestObject) { | ||
48 | + var fullParam = paramRequestObject.getParamFullName(); | ||
49 | + uiScope.addParamInEditor(fullParam); | ||
50 | + }, | ||
51 | + | ||
52 | + addParam: function (newParamName, isLeaf, needArgs, components) { | ||
53 | + //if (!isLeaf || needArgs || components) | ||
54 | + if (needArgs) | ||
55 | + this.editParameterArgs(newParamName, components); | ||
56 | + else | ||
57 | + this.addParamInEditor(newParamName); | ||
58 | + }, | ||
59 | + | ||
60 | + editParameterArgs: function (name, components) { | ||
61 | + var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | ||
62 | + paramObj.paramid = name; | ||
63 | + | ||
64 | + if (components) { | ||
65 | + if (components['index1']) { | ||
66 | + paramObj['dim1-index'] = components['index1']; | ||
67 | + ++paramObj['type']; | ||
68 | + } | ||
69 | + | ||
70 | + if (components['index2']) { | ||
71 | + paramObj['dim2-index'] = components['index2']; | ||
72 | + ++paramObj['type']; | ||
108 | } | 73 | } |
109 | } | 74 | } |
110 | - }, this); | ||
111 | - // if the update is allowed | ||
112 | - if (updateStatus) { | ||
113 | - /// real object update | ||
114 | - // update TimeTable object with the content of form | ||
115 | - basicForm.updateRecord(this.object); | ||
116 | - } | ||
117 | - // return the update status | ||
118 | - return updateStatus; | ||
119 | - }, | ||
120 | - | ||
121 | - updateConstruct : function(oldval,newval) | ||
122 | - { | ||
123 | - // update constructionField (Construct parameter) in window parameter | ||
124 | - var expression = this.constructionField.value; | ||
125 | - oldval = oldval.replace(/[(]/g,"\\("); | ||
126 | - oldval = oldval.replace(/[)]/g,"\\)"); | ||
127 | - var reg=new RegExp(oldval, "g"); | ||
128 | - expression = expression.replace(reg, newval); | ||
129 | - this.constructionField.setValue(expression); | ||
130 | - }, | ||
131 | - | ||
132 | - | ||
133 | - /** | ||
134 | - * Generate info for parameter desplay | ||
135 | - */ | ||
136 | - generateParamInfo : function(onSuccess) | ||
137 | - { | ||
138 | - var me = this; | ||
139 | - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
140 | - | ||
141 | - var obj = { | ||
142 | - paramId : 'ws_'+this.object.get('name'), | ||
143 | - buildchain:this.object.get('buildchain'), | ||
144 | - timestep:this.object.get('timestep'), | ||
145 | - reference_param: this.object.get('reference_param'), | ||
146 | - sampling_mode: this.object.get('sampling_mode') | ||
147 | - }; | ||
148 | - loadMask.show(); | ||
149 | - AmdaAction.generateParamInfo(obj, function (result, e) { | ||
150 | - if (!result || !result.success) | ||
151 | - { | ||
152 | - loadMask.hide(); | ||
153 | - if (result.message) | ||
154 | - myDesktopApp.warningMsg(result.message); | ||
155 | - else | ||
156 | - myDesktopApp.warningMsg('Unknown error during parameter compilation'); | ||
157 | - return; | ||
158 | - } | ||
159 | - loadMask.hide(); | ||
160 | - paramModule.linkedNode.get('object').set('dim_1', parseInt(result.dimensions.dim_1)); | ||
161 | - paramModule.linkedNode.get('object').set('dim_2', parseInt(result.dimensions.dim_2)); | ||
162 | - if (onSuccess) | ||
163 | - onSuccess(); | ||
164 | -/* paramModule.linkedNode.update({scope : me, | ||
165 | - failure: function(record, operation) { | ||
166 | - | ||
167 | - }, | ||
168 | - callback: function() { | ||
169 | - } | ||
170 | - }); | ||
171 | - */ | ||
172 | - }); | ||
173 | - }, | ||
174 | - | ||
175 | - /** | ||
176 | - * save method called by Save button | ||
177 | - */ | ||
178 | - saveProcess : function(toRename) | ||
179 | - { | ||
180 | - if(this.object.dirty) | ||
181 | - { | ||
182 | - // Parameter Module | ||
183 | - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
184 | - // if the name has been modified this is a creation | ||
185 | - if (this.object.isModified('name')) | ||
186 | - { | ||
187 | - // if object already has an id : it's a 'rename' of an existing TimeTable | ||
188 | - if (this.object.get('id')) | ||
189 | - { | ||
190 | - // the context Node is the parent node of current edited one | ||
191 | - var contextNode = paramModule.linkedNode.parentNode; | ||
192 | - // link a new node to the TimeTableModule | ||
193 | - paramModule.createLinkedNode(); | ||
194 | - // set the contextNode | ||
195 | - paramModule.linkedNode.set('contextNode',contextNode); | ||
196 | - // create a new object linked | ||
197 | - paramModule.createObject(this.object.getJsonValues()); | ||
198 | - var paramobj = paramModule.linkedNode.get('object'); | ||
199 | - //synchronize objects | ||
200 | - this.object = paramobj; | ||
201 | - if (toRename) paramModule.linkedNode.toRename = true; | ||
202 | - } | ||
203 | - this.generateParamInfo(function () { | ||
204 | - paramModule.linkedNode.set('isParameter', true); | ||
205 | - paramModule.linkedNode.create({scope : this, callback : function() { | ||
206 | - }}); | ||
207 | - }); | ||
208 | - } else | ||
209 | - { | ||
210 | - paramModule.linkedNode.set('contextNode',paramModule.contextNode); | ||
211 | - this.generateParamInfo(function () { | ||
212 | - paramModule.linkedNode.update({scope : this, callback : function() { | ||
213 | - }}); | ||
214 | - }); | 75 | + |
76 | + var paramArgsPlug = this.getPlugin('derived-param-arguments-plugin'); | ||
77 | + if (paramArgsPlug) { | ||
78 | + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | ||
79 | + paramArgsPlug.show('derived-param-arguments-plugin', workinRequestParamObject); | ||
215 | } | 80 | } |
216 | - } | ||
217 | - }, | 81 | + }, |
218 | 82 | ||
219 | - /** | ||
220 | - * overwrite metod called by Save button | ||
221 | - */ | ||
222 | - overwriteProcess : function(btn) | ||
223 | - { | ||
224 | - if (btn == 'cancel') return; | ||
225 | - | ||
226 | - this.fieldName.clearInvalid(); | ||
227 | - this.saveProcess(true); | ||
228 | - }, | ||
229 | - | ||
230 | - /** | ||
231 | - * Check if brackets are balanced | ||
232 | - */ | ||
233 | - isBalanced : function(str) | ||
234 | - { | ||
235 | - str = (""+str).replace(/[^()\[\]{}]/g, ""); | ||
236 | - var bracket = { | ||
237 | - "]": "[", | ||
238 | - "}": "{", | ||
239 | - ")": "(" | ||
240 | - }, | ||
241 | - openBrackets = [], | ||
242 | - isClean = true, | ||
243 | - i = 0, | ||
244 | - len = str.length; | ||
245 | - | ||
246 | - for(; isClean && i<len; i++ ) | ||
247 | - { | ||
248 | - if( bracket[ str[ i ] ] ){ | ||
249 | - isClean = ( openBrackets.pop() === bracket[ str[ i ] ] ); | ||
250 | - } else { | ||
251 | - openBrackets.push(str[i]); | 83 | + setObject: function (object) { |
84 | + this.object = object; | ||
85 | + // load object into form | ||
86 | + this.formPanel.getForm().loadRecord(this.object); | ||
87 | + }, | ||
88 | + | ||
89 | + /** | ||
90 | + * update this.object from form | ||
91 | + */ | ||
92 | + updateObject: function () { | ||
93 | + // get the basic form | ||
94 | + var basicForm = this.formPanel.getForm(); | ||
95 | + var updateStatus = true; | ||
96 | + | ||
97 | + var fieldsWithoutName = basicForm.getFields().items; | ||
98 | + Ext.Array.each(fieldsWithoutName, function (item, index, allItems) { | ||
99 | + if (item !== this.fieldName) { | ||
100 | + if (!item.isValid()) { | ||
101 | + // set update isn't allowed | ||
102 | + updateStatus = false; | ||
103 | + } | ||
104 | + } | ||
105 | + }, this); | ||
106 | + // if the update is allowed | ||
107 | + if (updateStatus) { | ||
108 | + /// real object update | ||
109 | + // update TimeTable object with the content of form | ||
110 | + basicForm.updateRecord(this.object); | ||
252 | } | 111 | } |
253 | - } | ||
254 | - if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced'; | ||
255 | - | ||
256 | - return true; | ||
257 | - }, | ||
258 | - | ||
259 | - /** | ||
260 | - * Check if changes were made before closing window | ||
261 | - * @return true if changes | ||
262 | - */ | ||
263 | - fclose : function() | ||
264 | - { | ||
265 | - var isDirty = this.formPanel.getForm().isDirty(); | ||
266 | - return isDirty; | ||
267 | - }, | ||
268 | - | ||
269 | - init: function(config) | ||
270 | - { | ||
271 | - this.fieldName = new Ext.form.field.Text({ | 112 | + // return the update status |
113 | + return updateStatus; | ||
114 | + }, | ||
115 | + | ||
116 | + updateConstruct: function (oldval, newval) { | ||
117 | + // update constructionField (Construct parameter) in window parameter | ||
118 | + var expression = this.constructionField.value; | ||
119 | + oldval = oldval.replace(/[(]/g, "\\("); | ||
120 | + oldval = oldval.replace(/[)]/g, "\\)"); | ||
121 | + var reg = new RegExp(oldval, "g"); | ||
122 | + expression = expression.replace(reg, newval); | ||
123 | + this.constructionField.setValue(expression); | ||
124 | + }, | ||
125 | + | ||
126 | + | ||
127 | + /** | ||
128 | + * Generate info for parameter desplay | ||
129 | + */ | ||
130 | + generateParamInfo: function (onSuccess) { | ||
131 | + var me = this; | ||
132 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
133 | + | ||
134 | + var obj = { | ||
135 | + paramId: 'ws_' + this.object.get('name'), | ||
136 | + buildchain: this.object.get('buildchain'), | ||
137 | + timestep: this.object.get('timestep'), | ||
138 | + reference_param: this.object.get('reference_param'), | ||
139 | + sampling_mode: this.object.get('sampling_mode') | ||
140 | + }; | ||
141 | + loadMask.show(); | ||
142 | + AmdaAction.generateParamInfo(obj, function (result, e) { | ||
143 | + if (!result || !result.success) { | ||
144 | + loadMask.hide(); | ||
145 | + if (result.message) | ||
146 | + myDesktopApp.warningMsg(result.message); | ||
147 | + else | ||
148 | + myDesktopApp.warningMsg('Unknown error during parameter compilation'); | ||
149 | + return; | ||
150 | + } | ||
151 | + loadMask.hide(); | ||
152 | + paramModule.linkedNode.get('object').set('dim_1', parseInt(result.dimensions.dim_1)); | ||
153 | + paramModule.linkedNode.get('object').set('dim_2', parseInt(result.dimensions.dim_2)); | ||
154 | + if (onSuccess) | ||
155 | + onSuccess(); | ||
156 | + /* paramModule.linkedNode.update({scope : me, | ||
157 | + failure: function(record, operation) { | ||
158 | + | ||
159 | + }, | ||
160 | + callback: function() { | ||
161 | + } | ||
162 | + }); | ||
163 | + */ | ||
164 | + }); | ||
165 | + }, | ||
166 | + | ||
167 | + /** | ||
168 | + * save method called by Save button | ||
169 | + */ | ||
170 | + saveProcess: function (toRename) { | ||
171 | + if (this.object.dirty) { | ||
172 | + // Parameter Module | ||
173 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
174 | + // if the name has been modified this is a creation | ||
175 | + if (this.object.isModified('name')) { | ||
176 | + // if object already has an id : it's a 'rename' of an existing TimeTable | ||
177 | + if (this.object.get('id')) { | ||
178 | + // the context Node is the parent node of current edited one | ||
179 | + var contextNode = paramModule.linkedNode.parentNode; | ||
180 | + // link a new node to the TimeTableModule | ||
181 | + paramModule.createLinkedNode(); | ||
182 | + // set the contextNode | ||
183 | + paramModule.linkedNode.set('contextNode', contextNode); | ||
184 | + // create a new object linked | ||
185 | + paramModule.createObject(this.object.getJsonValues()); | ||
186 | + var paramobj = paramModule.linkedNode.get('object'); | ||
187 | + //synchronize objects | ||
188 | + this.object = paramobj; | ||
189 | + if (toRename) paramModule.linkedNode.toRename = true; | ||
190 | + } | ||
191 | + this.generateParamInfo(function () { | ||
192 | + paramModule.linkedNode.set('isParameter', true); | ||
193 | + paramModule.linkedNode.create({ | ||
194 | + scope: this, callback: function () { | ||
195 | + } | ||
196 | + }); | ||
197 | + }); | ||
198 | + } else { | ||
199 | + paramModule.linkedNode.set('contextNode', paramModule.contextNode); | ||
200 | + this.generateParamInfo(function () { | ||
201 | + paramModule.linkedNode.update({ | ||
202 | + scope: this, callback: function () { | ||
203 | + } | ||
204 | + }); | ||
205 | + }); | ||
206 | + } | ||
207 | + } | ||
208 | + }, | ||
209 | + | ||
210 | + /** | ||
211 | + * overwrite metod called by Save button | ||
212 | + */ | ||
213 | + overwriteProcess: function (btn) { | ||
214 | + if (btn == 'cancel') return; | ||
215 | + | ||
216 | + this.fieldName.clearInvalid(); | ||
217 | + this.saveProcess(true); | ||
218 | + }, | ||
219 | + | ||
220 | + /** | ||
221 | + * Check if brackets are balanced | ||
222 | + */ | ||
223 | + isBalanced: function (str) { | ||
224 | + str = ("" + str).replace(/[^()\[\]{}]/g, ""); | ||
225 | + var bracket = { | ||
226 | + "]": "[", | ||
227 | + "}": "{", | ||
228 | + ")": "(" | ||
229 | + }, | ||
230 | + openBrackets = [], | ||
231 | + isClean = true, | ||
232 | + i = 0, | ||
233 | + len = str.length; | ||
234 | + | ||
235 | + for (; isClean && i < len; i++) { | ||
236 | + if (bracket[str[i]]) { | ||
237 | + isClean = (openBrackets.pop() === bracket[str[i]]); | ||
238 | + } else { | ||
239 | + openBrackets.push(str[i]); | ||
240 | + } | ||
241 | + } | ||
242 | + if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced'; | ||
243 | + | ||
244 | + return true; | ||
245 | + }, | ||
246 | + | ||
247 | + /** | ||
248 | + * Check if changes were made before closing window | ||
249 | + * @return true if changes | ||
250 | + */ | ||
251 | + fclose: function () { | ||
252 | + var isDirty = this.formPanel.getForm().isDirty(); | ||
253 | + return isDirty; | ||
254 | + }, | ||
255 | + | ||
256 | + init: function (config) { | ||
257 | + this.fieldName = new Ext.form.field.Text({ | ||
272 | labelAlign: 'top', itemId: 'formParamName', | 258 | labelAlign: 'top', itemId: 'formParamName', |
273 | labelPad: 0, | 259 | labelPad: 0, |
274 | fieldLabel: 'Parameter Name', | 260 | fieldLabel: 'Parameter Name', |
275 | - name : 'name', | ||
276 | - allowBlank : false, //blankText : 'Name is required', | 261 | + name: 'name', |
262 | + allowBlank: false, //blankText : 'Name is required', | ||
277 | emptyText: 'Please only low case!', | 263 | emptyText: 'Please only low case!', |
278 | width: 150, | 264 | width: 150, |
279 | validateOnChange: false, | 265 | validateOnChange: false, |
280 | validateOnBlur: false, | 266 | validateOnBlur: false, |
281 | enableKeyEvents: true, | 267 | enableKeyEvents: true, |
282 | validFlag: false, | 268 | validFlag: false, |
283 | - validator : function() | ||
284 | - { | 269 | + validator: function () { |
285 | return this.validFlag; | 270 | return this.validFlag; |
286 | }, | 271 | }, |
287 | stripCharsRe: /(^\s+|\s+$)/g, | 272 | stripCharsRe: /(^\s+|\s+$)/g, |
288 | - listeners : | 273 | + listeners: |
289 | { | 274 | { |
290 | - keyUp : function(field, e, opt) | ||
291 | - { | 275 | + keyUp: function (field, e, opt) { |
292 | this.setValue(this.getValue().toLowerCase()); | 276 | this.setValue(this.getValue().toLowerCase()); |
293 | } | 277 | } |
294 | } | 278 | } |
295 | - }); | ||
296 | - | ||
297 | - this.constructionField = new extensions.SelectableTextArea({ | ||
298 | - labelAlign: 'top', | ||
299 | - labelPad: 0, | ||
300 | - itemId: 'formParamConstructParameter', | ||
301 | - fieldLabel:'<img amda_clicktip="constructParameter" src="js/resources/images/16x16/info_mini.png"/> Construct Parameter', | ||
302 | - allowBlank : false, blankText : 'Construct Parameter is required', | ||
303 | - name : 'buildchain', | ||
304 | - flex: 0.6, | ||
305 | - validateOnChange: false, | ||
306 | - validateOnBlur: false, | ||
307 | - validator : this.isBalanced, | ||
308 | - listeners : | ||
309 | - { | ||
310 | - render : function(o,op) | 279 | + }); |
280 | + | ||
281 | + this.constructionField = new extensions.SelectableTextArea({ | ||
282 | + labelAlign: 'top', | ||
283 | + labelPad: 0, | ||
284 | + itemId: 'formParamConstructParameter', | ||
285 | + fieldLabel: '<img amda_clicktip="constructParameter" src="js/resources/images/16x16/info_mini.png"/> Construct Parameter', | ||
286 | + allowBlank: false, blankText: 'Construct Parameter is required', | ||
287 | + name: 'buildchain', | ||
288 | + flex: 0.6, | ||
289 | + validateOnChange: false, | ||
290 | + validateOnBlur: false, | ||
291 | + validator: this.isBalanced, | ||
292 | + listeners: | ||
311 | { | 293 | { |
312 | - var me = this; | ||
313 | - var meEl = me.bodyEl; | ||
314 | - var dropTarget = Ext.create('Ext.dd.DropTarget', meEl, | ||
315 | - { | ||
316 | - ddGroup: 'explorerTree', | ||
317 | - notifyEnter : function(ddSource, e, data) {}, | ||
318 | - notifyOver : function(ddSource, e, data) | ||
319 | - { | ||
320 | - if (data.records[0].get('nodeType') == 'localParam' && data.records[0].get('notyet')) | ||
321 | - { | ||
322 | - this.valid = false; | ||
323 | - return this.dropNotAllowed; | ||
324 | - } | ||
325 | - | ||
326 | - if (((data.records[0].get('nodeType') == 'localParam') || | ||
327 | - (data.records[0].get('nodeType') == 'remoteParam') || | ||
328 | - (data.records[0].get('nodeType') == 'remoteSimuParam') || | ||
329 | - (data.records[0].get('nodeType') == 'derivedParam') || | ||
330 | - (data.records[0].get('nodeType')== 'myDataParam') || | ||
331 | - (data.records[0].get('nodeType') == 'alias')) && | ||
332 | - (data.records[0].isLeaf() || data.records[0].get('isParameter')) && | ||
333 | - !(data.records[0].data.disable)) | ||
334 | - { | ||
335 | - this.valid = true; | ||
336 | - return this.dropAllowed; | ||
337 | - } | ||
338 | - this.valid = false; | ||
339 | - return this.dropNotAllowed; | ||
340 | - }, | ||
341 | - notifyDrop : function(ddSource, e, data) | ||
342 | - { | ||
343 | - if (!this.valid) | ||
344 | - return false; | ||
345 | - var nameToSent; | ||
346 | - var components = null; | ||
347 | - switch (data.records[0].get('nodeType')) | 294 | + render: function (o, op) { |
295 | + var me = this; | ||
296 | + var meEl = me.bodyEl; | ||
297 | + var dropTarget = Ext.create('Ext.dd.DropTarget', meEl, | ||
348 | { | 298 | { |
349 | - case 'localParam' : | ||
350 | - case 'remoteParam' : | ||
351 | - case 'remoteSimuParam' : | ||
352 | - nameToSent = data.records[0].get('id'); | ||
353 | - if (data.records[0].get('alias')!= "" ) | ||
354 | - var nameToSent = "#"+data.records[0].get('alias'); | ||
355 | - var component_info = data.records[0].get('component_info'); | ||
356 | - if (component_info && component_info.parentId) | ||
357 | - { | ||
358 | - if ( component_info.index1 && component_info.index2 ) | ||
359 | - { | ||
360 | - nameToSent = component_info.parentId; | ||
361 | - components = []; | ||
362 | - if (component_info.index1) | ||
363 | - components['index1'] = component_info.index1; | ||
364 | - if (component_info.index2) | ||
365 | - components['index2'] = component_info.index2; | ||
366 | - } | ||
367 | - if ( data.records[0].get('needsArgs') ) | ||
368 | - { | ||
369 | - nameToSent = component_info.parentId; | ||
370 | - if (component_info.index1) | ||
371 | - { | ||
372 | - components = []; | ||
373 | - components['index1'] = component_info.index1; | 299 | + ddGroup: 'explorerTree', |
300 | + notifyEnter: function (ddSource, e, data) { }, | ||
301 | + notifyOver: function (ddSource, e, data) { | ||
302 | + if (data.records[0].get('nodeType') == 'localParam' && data.records[0].get('notyet')) { | ||
303 | + this.valid = false; | ||
304 | + return this.dropNotAllowed; | ||
305 | + } | ||
306 | + | ||
307 | + if (((data.records[0].get('nodeType') == 'localParam') || | ||
308 | + (data.records[0].get('nodeType') == 'remoteParam') || | ||
309 | + (data.records[0].get('nodeType') == 'remoteSimuParam') || | ||
310 | + (data.records[0].get('nodeType') == 'derivedParam') || | ||
311 | + (data.records[0].get('nodeType') == 'myDataParam') || | ||
312 | + (data.records[0].get('nodeType') == 'alias')) && | ||
313 | + (data.records[0].isLeaf() || data.records[0].get('isParameter')) && | ||
314 | + !(data.records[0].data.disable)) { | ||
315 | + this.valid = true; | ||
316 | + return this.dropAllowed; | ||
317 | + } | ||
318 | + this.valid = false; | ||
319 | + return this.dropNotAllowed; | ||
320 | + }, | ||
321 | + notifyDrop: function (ddSource, e, data) { | ||
322 | + if (!this.valid) | ||
323 | + return false; | ||
324 | + var nameToSent; | ||
325 | + var components = null; | ||
326 | + switch (data.records[0].get('nodeType')) { | ||
327 | + case 'localParam': | ||
328 | + case 'remoteParam': | ||
329 | + case 'remoteSimuParam': | ||
330 | + nameToSent = data.records[0].get('id'); | ||
331 | + if (data.records[0].get('alias') != "") | ||
332 | + var nameToSent = "#" + data.records[0].get('alias'); | ||
333 | + var component_info = data.records[0].get('component_info'); | ||
334 | + if (component_info && component_info.parentId) { | ||
335 | + if (component_info.index1 && component_info.index2) { | ||
336 | + nameToSent = component_info.parentId; | ||
337 | + components = []; | ||
338 | + if (component_info.index1) | ||
339 | + components['index1'] = component_info.index1; | ||
340 | + if (component_info.index2) | ||
341 | + components['index2'] = component_info.index2; | ||
342 | + } | ||
343 | + if (data.records[0].get('needsArgs')) { | ||
344 | + nameToSent = component_info.parentId; | ||
345 | + if (component_info.index1) { | ||
346 | + components = []; | ||
347 | + components['index1'] = component_info.index1; | ||
348 | + } | ||
349 | + } | ||
374 | } | 350 | } |
375 | - } | 351 | + break; |
352 | + case 'alias': | ||
353 | + nameToSent = "#" + data.records[0].get('text'); | ||
354 | + break; | ||
355 | + case 'derivedParam': | ||
356 | + nameToSent = "ws_" + data.records[0].get('text'); | ||
357 | + break; | ||
358 | + case 'myDataParam': | ||
359 | + var name = data.records[0].get('text'); | ||
360 | + nameToSent = "wsd_" + name; | ||
361 | + break; | ||
362 | + default: | ||
363 | + | ||
364 | + return false; | ||
376 | } | 365 | } |
377 | - break; | ||
378 | - case 'alias' : | ||
379 | - nameToSent = "#"+data.records[0].get('text'); | ||
380 | - break; | ||
381 | - case 'derivedParam' : | ||
382 | - nameToSent = "ws_"+data.records[0].get('text'); | ||
383 | - break; | ||
384 | - case 'myDataParam' : | ||
385 | - var name = data.records[0].get('text'); | ||
386 | - nameToSent = "wsd_"+name; | ||
387 | - break; | ||
388 | - default : | ||
389 | - | ||
390 | - return false; | ||
391 | - } | ||
392 | - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
393 | - if (paramModule) { | ||
394 | - if (data.records[0].get('predefinedArgs')) { | ||
395 | - paramModule.parseTemplatedParam(nameToSent, function(param_info) { | ||
396 | - paramModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args); | ||
397 | - }); | ||
398 | - } | ||
399 | - else { | ||
400 | - paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | 366 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); |
367 | + if (paramModule) { | ||
368 | + if (data.records[0].get('predefinedArgs')) { | ||
369 | + paramModule.parseTemplatedParam(nameToSent, function (param_info) { | ||
370 | + paramModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args); | ||
371 | + }); | ||
372 | + } | ||
373 | + else { | ||
374 | + paramModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | ||
375 | + } | ||
376 | + } | ||
377 | + return true; | ||
401 | } | 378 | } |
402 | - } | ||
403 | - return true; | ||
404 | - } | ||
405 | - }); | 379 | + }); |
380 | + } | ||
406 | } | 381 | } |
407 | - } | ||
408 | - //TODO: ?validator on formula structure? | ||
409 | -// listener : { | ||
410 | -// valid : function(field) { | ||
411 | -// | ||
412 | -// } | ||
413 | -// } | ||
414 | - }); | ||
415 | - | ||
416 | - var samplingmode_store = new Ext.data.ArrayStore({ | ||
417 | - fields: ['id', 'name'], | ||
418 | - data: [ | ||
419 | - ['timestep', 'Time Step'], | ||
420 | - ['refparam', 'Ref. Parameter'] | ||
421 | - ] | ||
422 | - }); | ||
423 | - | ||
424 | - this.timeStepField = new Ext.form.NumberField({ | ||
425 | - fieldLabel: '<img amda_clicktip="resamplingStep" src="js/resources/images/16x16/info_mini.png"/> Time Step (sec)', | ||
426 | - labelAlign: 'top', | ||
427 | - labelPad: 0, | ||
428 | - blankText : 'Time Step is required', | ||
429 | - name : 'timestep', | ||
430 | - minValue : 0.001, | ||
431 | - decimalPrecision : 10, | ||
432 | - hideTrigger: true, | ||
433 | - width: 150, | ||
434 | - validateOnBlur: false, | ||
435 | - allowBlank: false, | ||
436 | - isValid: function() { | ||
437 | - var me = this, | ||
438 | - disabled = me.disabled, | ||
439 | - validate = me.forceValidation || !disabled; | ||
440 | - | ||
441 | - if (!me.isVisible()) { | ||
442 | - return true; | 382 | + //TODO: ?validator on formula structure? |
383 | + // listener : { | ||
384 | + // valid : function(field) { | ||
385 | + // | ||
386 | + // } | ||
387 | + // } | ||
388 | + }); | ||
389 | + | ||
390 | + var samplingmode_store = new Ext.data.ArrayStore({ | ||
391 | + fields: ['id', 'name'], | ||
392 | + data: [ | ||
393 | + ['timestep', 'Time Step'], | ||
394 | + ['refparam', 'Ref. Parameter'] | ||
395 | + ] | ||
396 | + }); | ||
397 | + | ||
398 | + this.timeStepField = new Ext.form.NumberField({ | ||
399 | + fieldLabel: '<img amda_clicktip="resamplingStep" src="js/resources/images/16x16/info_mini.png"/> Time Step (sec)', | ||
400 | + labelAlign: 'top', | ||
401 | + labelPad: 0, | ||
402 | + blankText: 'Time Step is required', | ||
403 | + name: 'timestep', | ||
404 | + minValue: 0.001, | ||
405 | + decimalPrecision: 10, | ||
406 | + hideTrigger: true, | ||
407 | + width: 150, | ||
408 | + validateOnBlur: false, | ||
409 | + allowBlank: false, | ||
410 | + isValid: function () { | ||
411 | + var me = this, | ||
412 | + disabled = me.disabled, | ||
413 | + validate = me.forceValidation || !disabled; | ||
414 | + | ||
415 | + if (!me.isVisible()) { | ||
416 | + return true; | ||
417 | + } | ||
418 | + | ||
419 | + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
443 | } | 420 | } |
421 | + }); | ||
444 | 422 | ||
445 | - return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
446 | - } | ||
447 | - }); | ||
448 | - | ||
449 | - this.refParamField = new Ext.form.TextField({ | ||
450 | - fieldLabel: '<img amda_clicktip="resamplingRefParam" src="js/resources/images/16x16/info_mini.png"/> Reference Param.', | ||
451 | - labelAlign: 'top', | ||
452 | - labelPad: 0, | ||
453 | - name : 'reference_param', | ||
454 | - width: 150, | ||
455 | - hidden: true, | ||
456 | - allowBlank: false, | ||
457 | - listeners: { | ||
458 | - afterrender: function(field, eOpts ){ | ||
459 | - var paramTarget = new Ext.dd.DropTarget(field.el.dom, | ||
460 | - { | ||
461 | - ddGroup: 'explorerTree', | ||
462 | - notifyEnter: function(ddSource, e, data) { | ||
463 | - }, | ||
464 | - notifyDrop: function(ddSource, e, data) { | ||
465 | - var selectedRecord = ddSource.dragData.records[0]; | ||
466 | - switch (selectedRecord.$className) { | ||
467 | - case 'amdaModel.LocalParamNode' : | ||
468 | - case 'amdaModel.RemoteParamNode' : | ||
469 | - case 'amdaModel.RemoteSimuParamNode' : | ||
470 | - if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) | ||
471 | - return false; | ||
472 | - if (selectedRecord.get('alias') != "" ) | ||
473 | - field.setValue("#"+selectedRecord.get('alias')); | ||
474 | - else | ||
475 | - field.setValue(selectedRecord.get('id')); | ||
476 | - return true; | ||
477 | - case 'amdaModel.AliasNode' : | ||
478 | - if (!selectedRecord.isLeaf()) | ||
479 | - return false; | ||
480 | - field.setValue("#"+selectedRecord.get('text')); | ||
481 | - return true; | ||
482 | - case 'amdaModel.DerivedParamNode' : | ||
483 | - if (!selectedRecord.isLeaf()) | ||
484 | - return false; | ||
485 | - field.setValue("ws_"+selectedRecord.get('text')); | ||
486 | - return true; | ||
487 | - case 'amdaModel.MyDataParamNode' : | ||
488 | - if (!selectedRecord.isLeaf()) | 423 | + this.refParamField = new Ext.form.TextField({ |
424 | + fieldLabel: '<img amda_clicktip="resamplingRefParam" src="js/resources/images/16x16/info_mini.png"/> Reference Param.', | ||
425 | + labelAlign: 'top', | ||
426 | + labelPad: 0, | ||
427 | + name: 'reference_param', | ||
428 | + width: 150, | ||
429 | + hidden: true, | ||
430 | + allowBlank: false, | ||
431 | + listeners: { | ||
432 | + afterrender: function (field, eOpts) { | ||
433 | + var paramTarget = new Ext.dd.DropTarget(field.el.dom, | ||
434 | + { | ||
435 | + ddGroup: 'explorerTree', | ||
436 | + notifyEnter: function (ddSource, e, data) { | ||
437 | + }, | ||
438 | + notifyDrop: function (ddSource, e, data) { | ||
439 | + var selectedRecord = ddSource.dragData.records[0]; | ||
440 | + switch (selectedRecord.$className) { | ||
441 | + case 'amdaModel.LocalParamNode': | ||
442 | + case 'amdaModel.RemoteParamNode': | ||
443 | + case 'amdaModel.RemoteSimuParamNode': | ||
444 | + if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) | ||
445 | + return false; | ||
446 | + if (selectedRecord.get('alias') != "") | ||
447 | + field.setValue("#" + selectedRecord.get('alias')); | ||
448 | + else | ||
449 | + field.setValue(selectedRecord.get('id')); | ||
450 | + return true; | ||
451 | + case 'amdaModel.AliasNode': | ||
452 | + if (!selectedRecord.isLeaf()) | ||
453 | + return false; | ||
454 | + field.setValue("#" + selectedRecord.get('text')); | ||
455 | + return true; | ||
456 | + case 'amdaModel.DerivedParamNode': | ||
457 | + if (!selectedRecord.isLeaf()) | ||
458 | + return false; | ||
459 | + field.setValue("ws_" + selectedRecord.get('text')); | ||
460 | + return true; | ||
461 | + case 'amdaModel.MyDataParamNode': | ||
462 | + if (!selectedRecord.isLeaf()) | ||
463 | + return false; | ||
464 | + field.setValue("wsd_" + selectedRecord.get('text')); | ||
465 | + return true; | ||
466 | + default: | ||
489 | return false; | 467 | return false; |
490 | - field.setValue("wsd_"+selectedRecord.get('text')); | ||
491 | - return true; | ||
492 | - default: | ||
493 | - return false; | 468 | + } |
469 | + return true; | ||
494 | } | 470 | } |
495 | - return true; | ||
496 | } | 471 | } |
497 | - } | ||
498 | - ); | 472 | + ); |
473 | + }, | ||
474 | + scope: this | ||
499 | }, | 475 | }, |
500 | - scope: this | ||
501 | - }, | ||
502 | - isValid: function() { | ||
503 | - var me = this, | ||
504 | - disabled = me.disabled, | ||
505 | - validate = me.forceValidation || !disabled; | 476 | + isValid: function () { |
477 | + var me = this, | ||
478 | + disabled = me.disabled, | ||
479 | + validate = me.forceValidation || !disabled; | ||
480 | + | ||
481 | + if (!me.isVisible()) { | ||
482 | + return true; | ||
483 | + } | ||
506 | 484 | ||
507 | - if (!me.isVisible()) { | ||
508 | - return true; | 485 | + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; |
509 | } | 486 | } |
487 | + }); | ||
510 | 488 | ||
511 | - return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
512 | - } | ||
513 | - }); | ||
514 | - | ||
515 | - this.samplingDefContainer = new Ext.container.Container({ | ||
516 | - border: false, | ||
517 | - items: [ | ||
518 | - this.timeStepField, | ||
519 | - this.refParamField | ||
520 | - ], | ||
521 | - width: 150 | ||
522 | - }); | ||
523 | - | ||
524 | - this.formPanel = new Ext.form.Panel({ | ||
525 | - id: 'vbox-paramForm', | ||
526 | - bodyStyle: {background : '#dfe8f6'}, | ||
527 | - border: false, | ||
528 | - buttonAlign: 'left', | ||
529 | - region: 'center', | ||
530 | - trackResetOnLoad: true, //reset to the last loaded record | ||
531 | - layout: { | ||
532 | - type: 'vbox', | ||
533 | - defaultMargins: {top: 5, left:5, bottom:10, right:10}, | ||
534 | - align: 'stretch' | ||
535 | - }, | ||
536 | - defaults: { | ||
537 | - border: false | ||
538 | - }, | ||
539 | - items: [ | 489 | + this.samplingDefContainer = new Ext.container.Container({ |
490 | + border: false, | ||
491 | + items: [ | ||
492 | + this.timeStepField, | ||
493 | + this.refParamField | ||
494 | + ], | ||
495 | + width: 150 | ||
496 | + }); | ||
497 | + | ||
498 | + this.formPanel = new Ext.form.Panel({ | ||
499 | + id: 'vbox-paramForm', | ||
500 | + bodyStyle: { background: '#dfe8f6' }, | ||
501 | + border: false, | ||
502 | + buttonAlign: 'left', | ||
503 | + region: 'center', | ||
504 | + trackResetOnLoad: true, //reset to the last loaded record | ||
505 | + layout: { | ||
506 | + type: 'vbox', | ||
507 | + defaultMargins: { top: 5, left: 5, bottom: 10, right: 10 }, | ||
508 | + align: 'stretch' | ||
509 | + }, | ||
510 | + defaults: { | ||
511 | + border: false | ||
512 | + }, | ||
513 | + items: [ | ||
540 | { | 514 | { |
541 | flex: 1, | 515 | flex: 1, |
542 | xtype: 'container', | 516 | xtype: 'container', |
@@ -553,129 +527,123 @@ Ext.define('amdaUI.ParameterUI', | @@ -553,129 +527,123 @@ Ext.define('amdaUI.ParameterUI', | ||
553 | items: [ | 527 | items: [ |
554 | this.fieldName, | 528 | this.fieldName, |
555 | { | 529 | { |
556 | - xtype:'component', width: 20 | 530 | + xtype: 'component', width: 20 |
557 | }, | 531 | }, |
558 | { | 532 | { |
559 | fieldLabel: 'Last modification', | 533 | fieldLabel: 'Last modification', |
560 | xtype: 'displayfield', | 534 | xtype: 'displayfield', |
561 | - name : 'last_update', | 535 | + name: 'last_update', |
562 | width: 150, | 536 | width: 150, |
563 | - renderer: function(value, field) { | 537 | + renderer: function (value, field) { |
564 | var tpl = new Ext.XTemplate('<p style="font-style:italic;color:gray;margin:0;">{date}</>'); | 538 | var tpl = new Ext.XTemplate('<p style="font-style:italic;color:gray;margin:0;">{date}</>'); |
565 | var mod_date = 'Not saved'; | 539 | var mod_date = 'Not saved'; |
566 | if (value > 0) | 540 | if (value > 0) |
567 | - mod_date = Ext.Date.format(new Date(value*1000), "Y-m-d\\TH:i:s"); | ||
568 | - return tpl.apply({date: mod_date}); | 541 | + mod_date = Ext.Date.format(new Date(value * 1000), "Y-m-d\\TH:i:s"); |
542 | + return tpl.apply({ date: mod_date }); | ||
569 | }, | 543 | }, |
570 | }, | 544 | }, |
571 | - { | ||
572 | - xtype: 'combo', | ||
573 | - fieldLabel: 'Sampling mode', | ||
574 | - name: 'sampling_mode', | ||
575 | - queryMode: 'local', | ||
576 | - editable: false, | 545 | + { |
546 | + xtype: 'combo', | ||
547 | + fieldLabel: 'Sampling mode', | ||
548 | + name: 'sampling_mode', | ||
549 | + queryMode: 'local', | ||
550 | + editable: false, | ||
577 | valueField: 'id', | 551 | valueField: 'id', |
578 | displayField: 'name', | 552 | displayField: 'name', |
579 | store: samplingmode_store, | 553 | store: samplingmode_store, |
580 | value: samplingmode_store.first(), | 554 | value: samplingmode_store.first(), |
581 | listeners: { | 555 | listeners: { |
582 | - change: function(field, value) { | 556 | + change: function (field, value) { |
583 | this.timeStepField.setVisible(value != 'refparam'); | 557 | this.timeStepField.setVisible(value != 'refparam'); |
584 | this.refParamField.setVisible(value == 'refparam'); | 558 | this.refParamField.setVisible(value == 'refparam'); |
585 | }, | 559 | }, |
586 | scope: this | 560 | scope: this |
587 | } | 561 | } |
588 | - }, | ||
589 | - { | ||
590 | - xtype:'component', width: 20 | ||
591 | - }, | 562 | + }, |
563 | + { | ||
564 | + xtype: 'component', width: 20 | ||
565 | + }, | ||
592 | this.samplingDefContainer, | 566 | this.samplingDefContainer, |
593 | { | 567 | { |
594 | - itemId: 'formParamUnit', | 568 | + itemId: 'formParamUnit', |
595 | fieldLabel: 'Units', | 569 | fieldLabel: 'Units', |
596 | - name : 'units', | 570 | + name: 'units', |
597 | width: 150 | 571 | width: 150 |
598 | }, | 572 | }, |
599 | { | 573 | { |
600 | - xtype:'component', width: 20 | 574 | + xtype: 'component', width: 20 |
601 | }, | 575 | }, |
602 | - { | ||
603 | - itemId: 'formParamYTitle', | 576 | + { |
577 | + itemId: 'formParamYTitle', | ||
604 | fieldLabel: 'Y Title for Plot', | 578 | fieldLabel: 'Y Title for Plot', |
605 | - name : 'ytitle', | 579 | + name: 'ytitle', |
606 | width: 150 | 580 | width: 150 |
607 | }, | 581 | }, |
608 | { | 582 | { |
609 | itemId: 'formParamDescription', | 583 | itemId: 'formParamDescription', |
610 | - name: 'description', | ||
611 | - xtype: 'textarea', fieldLabel:'Description', | ||
612 | - width: 320, height: 75, | 584 | + name: 'description', |
585 | + xtype: 'textarea', fieldLabel: 'Description', | ||
586 | + width: 320, height: 75, | ||
613 | colspan: 3 | 587 | colspan: 3 |
614 | - }] | 588 | + }] |
615 | }, | 589 | }, |
616 | this.constructionField | 590 | this.constructionField |
617 | - ], | 591 | + ], |
618 | fbar: [ | 592 | fbar: [ |
619 | { | 593 | { |
620 | text: 'Save', | 594 | text: 'Save', |
621 | - scope : this, | ||
622 | - handler: function(){ | ||
623 | - if (this.updateObject()) | ||
624 | - { | ||
625 | - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | 595 | + scope: this, |
596 | + handler: function () { | ||
597 | + if (this.updateObject()) { | ||
598 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
626 | if (!paramModule) | 599 | if (!paramModule) |
627 | return; | 600 | return; |
628 | var me = this; | 601 | var me = this; |
629 | - paramModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) | ||
630 | - { | ||
631 | - if (!res) | ||
632 | - { | 602 | + paramModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) { |
603 | + if (!res) { | ||
633 | me.fieldName.validFlag = 'Error during object validation'; | 604 | me.fieldName.validFlag = 'Error during object validation'; |
634 | myDesktopApp.errorMsg(me.fieldName.validFlag); | 605 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
635 | me.fieldName.validate(); | 606 | me.fieldName.validate(); |
636 | return; | 607 | return; |
637 | } | 608 | } |
638 | - | ||
639 | - if (!res.valid) | ||
640 | - { | ||
641 | - if (res.error) | ||
642 | - { | ||
643 | - if (res.error.search('subtree') != -1) { | ||
644 | - Ext.MessageBox.show({title:'Warning', | ||
645 | - msg: res.error+'<br/>Do you want to overwrite it?', | ||
646 | - width: 300, | ||
647 | - buttons: Ext.MessageBox.OKCANCEL, | ||
648 | - fn : me.overwriteProcess, | ||
649 | - icon: Ext.MessageBox.WARNING, | ||
650 | - scope : me | 609 | + |
610 | + if (!res.valid) { | ||
611 | + if (res.error) { | ||
612 | + if (res.error.search('subtree') != -1) { | ||
613 | + Ext.MessageBox.show({ | ||
614 | + title: 'Warning', | ||
615 | + msg: res.error + '<br/>Do you want to overwrite it?', | ||
616 | + width: 300, | ||
617 | + buttons: Ext.MessageBox.OKCANCEL, | ||
618 | + fn: me.overwriteProcess, | ||
619 | + icon: Ext.MessageBox.WARNING, | ||
620 | + scope: me | ||
651 | }); | 621 | }); |
652 | me.fieldName.validFlag = true; | 622 | me.fieldName.validFlag = true; |
653 | } | 623 | } |
654 | else | 624 | else |
655 | me.fieldName.validFlag = res.error; | 625 | me.fieldName.validFlag = res.error; |
656 | } | 626 | } |
657 | - else | ||
658 | - { | 627 | + else { |
659 | me.fieldName.validFlag = 'Invalid object name'; | 628 | me.fieldName.validFlag = 'Invalid object name'; |
660 | myDesktopApp.errorMsg(me.fieldName.validFlag); | 629 | myDesktopApp.errorMsg(me.fieldName.validFlag); |
661 | } | 630 | } |
662 | me.fieldName.validate(); | 631 | me.fieldName.validate(); |
663 | return; | 632 | return; |
664 | } | 633 | } |
665 | - | 634 | + |
666 | me.fieldName.validFlag = true; | 635 | me.fieldName.validFlag = true; |
667 | me.fieldName.validate(); | 636 | me.fieldName.validate(); |
668 | - me.saveProcess(false); | ||
669 | - }); | 637 | + me.saveProcess(false); |
638 | + }); | ||
670 | } | 639 | } |
671 | } | 640 | } |
672 | }, | 641 | }, |
673 | { | 642 | { |
674 | text: 'Reset', | 643 | text: 'Reset', |
675 | scope: this, | 644 | scope: this, |
676 | - handler: function() | ||
677 | - { | ||
678 | - var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | 645 | + handler: function () { |
646 | + var paramModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.param.id); | ||
679 | paramModule.createLinkedNode(); | 647 | paramModule.createLinkedNode(); |
680 | paramModule.createObject(); | 648 | paramModule.createObject(); |
681 | this.setObject(paramModule.getLinkedNode().get('object')); | 649 | this.setObject(paramModule.getLinkedNode().get('object')); |
@@ -684,10 +652,10 @@ Ext.define('amdaUI.ParameterUI', | @@ -684,10 +652,10 @@ Ext.define('amdaUI.ParameterUI', | ||
684 | */ | 652 | */ |
685 | } | 653 | } |
686 | } | 654 | } |
687 | - ] | ||
688 | - }); | ||
689 | - | ||
690 | - var myConf = { | 655 | + ] |
656 | + }); | ||
657 | + | ||
658 | + var myConf = { | ||
691 | layout: 'border', | 659 | layout: 'border', |
692 | border: false, | 660 | border: false, |
693 | defaults: { layout: 'fit', border: false }, | 661 | defaults: { layout: 'fit', border: false }, |
@@ -703,31 +671,31 @@ Ext.define('amdaUI.ParameterUI', | @@ -703,31 +671,31 @@ Ext.define('amdaUI.ParameterUI', | ||
703 | iconCls: 'icon-information', | 671 | iconCls: 'icon-information', |
704 | bodyStyle: 'padding:5px', | 672 | bodyStyle: 'padding:5px', |
705 | loader: { | 673 | loader: { |
706 | - autoLoad: true, | ||
707 | - url: helpDir+'myParameterHOWTO' | 674 | + autoLoad: true, |
675 | + url: helpDir + 'myParameterHOWTO' | ||
708 | } | 676 | } |
709 | - } ], | ||
710 | - plugins: [ | ||
711 | - {ptype: 'calculator', myBtns:[], context: 'Parameter' }, | ||
712 | - {ptype: 'paramArgumentsPlugin', pluginId: 'derived-param-arguments-plugin'} | 677 | + }], |
678 | + plugins: [ | ||
679 | + { ptype: 'calculator', myBtns: [], context: 'Parameter' }, | ||
680 | + { ptype: 'paramArgumentsPlugin', pluginId: 'derived-param-arguments-plugin' } | ||
713 | ], | 681 | ], |
714 | - listeners:{ | 682 | + listeners: { |
715 | click: { | 683 | click: { |
716 | element: 'el', | 684 | element: 'el', |
717 | - fn: function(e,t) { | 685 | + fn: function (e, t) { |
718 | var me = t, | 686 | var me = t, |
719 | - text = me.getAttribute('amda_clicktip'); | 687 | + text = me.getAttribute('amda_clicktip'); |
720 | if (text) { | 688 | if (text) { |
721 | e.preventDefault(); | 689 | e.preventDefault(); |
722 | - AmdaAction.getInfo({name : text}, function(res,e) { | 690 | + AmdaAction.getInfo({ name: text }, function (res, e) { |
723 | if (res.success) myDesktopApp.infoMsg(res.result); | 691 | if (res.success) myDesktopApp.infoMsg(res.result); |
724 | - }); | 692 | + }); |
725 | } | 693 | } |
726 | } | 694 | } |
727 | } | 695 | } |
728 | } | 696 | } |
729 | }; | 697 | }; |
730 | - | 698 | + |
731 | Ext.apply(this, Ext.apply(arguments, myConf)); | 699 | Ext.apply(this, Ext.apply(arguments, myConf)); |
732 | - } | ||
733 | -}); | 700 | + } |
701 | + }); |
js/app/views/PlotComponents/PlotExtendShiftPlug.js
@@ -22,6 +22,8 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -22,6 +22,8 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
22 | win : null, | 22 | win : null, |
23 | form : null, | 23 | form : null, |
24 | interactiveId : '', | 24 | interactiveId : '', |
25 | + actionDone :'', | ||
26 | + durationDone: 0, | ||
25 | 27 | ||
26 | constructor: function(config) { | 28 | constructor: function(config) { |
27 | Ext.apply(this, config); | 29 | Ext.apply(this, config); |
@@ -44,7 +46,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -44,7 +46,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
44 | { | 46 | { |
45 | this.win = new Ext.Window({ | 47 | this.win = new Ext.Window({ |
46 | id: 'plot-extendshift-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID | 48 | id: 'plot-extendshift-win-' + this.hostCmp.ownerCt.getId(), // Plot window ID |
47 | - width: 230, | 49 | + width: 275, |
48 | height: 120, | 50 | height: 120, |
49 | x: 0, y: 0, | 51 | x: 0, y: 0, |
50 | baseCls:'x-panel', | 52 | baseCls:'x-panel', |
@@ -111,11 +113,23 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -111,11 +113,23 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
111 | var durationUnitField = this.form.getForm().findField('durationUnit'); | 113 | var durationUnitField = this.form.getForm().findField('durationUnit'); |
112 | var duration = this.toSec(durationField.getValue(), durationUnitField.getValue()); | 114 | var duration = this.toSec(durationField.getValue(), durationUnitField.getValue()); |
113 | if (duration) { | 115 | if (duration) { |
114 | - this.hostCmp.callInteractivePlot({'action' : actionType, 'interactiveId' : this.interactiveId, 'duration' : duration}); | 116 | + this.durationDone = duration; |
117 | + this.actionDone = actionType; | ||
118 | + this.hostCmp.callInteractivePlot({'action' : actionType, 'interactiveId' : this.interactiveId, 'duration' : duration}); | ||
119 | + Ext.getCmp('undo-PlotExtendShiftPlug').enable(); | ||
115 | } | 120 | } |
116 | else | 121 | else |
117 | myDesktopApp.errorMsg('No duration defined'); | 122 | myDesktopApp.errorMsg('No duration defined'); |
118 | }, | 123 | }, |
124 | + undoAction : function(){ | ||
125 | + if( this.durationDone){ | ||
126 | + this.hostCmp.callInteractivePlot({'action' : this.actionDone , 'interactiveId' : this.interactiveId, 'duration' : -this.durationDone}); | ||
127 | + Ext.getCmp('undo-PlotExtendShiftPlug').disable(); | ||
128 | + } | ||
129 | + else | ||
130 | + myDesktopApp.errorMsg('No duration defined'); | ||
131 | + | ||
132 | + }, | ||
119 | 133 | ||
120 | /** | 134 | /** |
121 | * Main form | 135 | * Main form |
@@ -123,7 +137,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -123,7 +137,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
123 | getFormConfig: function(){ | 137 | getFormConfig: function(){ |
124 | this.form = new Ext.form.FormPanel( { | 138 | this.form = new Ext.form.FormPanel( { |
125 | frame: true, | 139 | frame: true, |
126 | - width: 230, | 140 | + width: 275, |
127 | height: 120, | 141 | height: 120, |
128 | layout: { | 142 | layout: { |
129 | type: 'vbox', | 143 | type: 'vbox', |
@@ -171,6 +185,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -171,6 +185,7 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
171 | } | 185 | } |
172 | ], | 186 | ], |
173 | buttons: [ | 187 | buttons: [ |
188 | + | ||
174 | { | 189 | { |
175 | text: 'Extend/Shrink', | 190 | text: 'Extend/Shrink', |
176 | scope : this, | 191 | scope : this, |
@@ -178,13 +193,23 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | @@ -178,13 +193,23 @@ Ext.define('amdaPlotComp.PlotExtendShiftPlug', { | ||
178 | this.executeAction('extend'); | 193 | this.executeAction('extend'); |
179 | } | 194 | } |
180 | }, | 195 | }, |
181 | - '->', | 196 | + '-', |
182 | { | 197 | { |
183 | text: 'Shift', | 198 | text: 'Shift', |
184 | scope : this, | 199 | scope : this, |
185 | handler: function(bt,event) { | 200 | handler: function(bt,event) { |
186 | this.executeAction('shift'); | 201 | this.executeAction('shift'); |
187 | } | 202 | } |
203 | + }, | ||
204 | + '-', | ||
205 | + { | ||
206 | + text: 'Undo', | ||
207 | + id:'undo-PlotExtendShiftPlug', | ||
208 | + scope : this, | ||
209 | + disabled : true, | ||
210 | + handler: function(bt,event) { | ||
211 | + this.undoAction(); | ||
212 | + } | ||
188 | } | 213 | } |
189 | ] | 214 | ] |
190 | }); | 215 | }); |
js/app/views/PlotComponents/PlotSauvaudForm.js
@@ -49,7 +49,7 @@ Ext.define('amdaPlotComp.PlotSauvaudForm', { | @@ -49,7 +49,7 @@ Ext.define('amdaPlotComp.PlotSauvaudForm', { | ||
49 | { 'key': 0, 'value': 'dim1' }, | 49 | { 'key': 0, 'value': 'dim1' }, |
50 | { 'key': 1, 'value': 'dim2' }, | 50 | { 'key': 1, 'value': 'dim2' }, |
51 | ]; | 51 | ]; |
52 | - const dimField = this.addStandardCombo('right_dimension', 'Right Dim', dataStore , function (name, value, oldValue) { | 52 | + const dimField = this.addStandardCombo('right_dimension', 'Switch Dimension', dataStore , function (name, value, oldValue) { |
53 | if (ref.object.get('right_dim') != value) { | 53 | if (ref.object.get('right_dim') != value) { |
54 | ref.object.set('right_dim', value); | 54 | ref.object.set('right_dim', value); |
55 | } | 55 | } |
js/app/views/PlotComponents/PlotTabContent.js
@@ -39,6 +39,7 @@ Ext.define('amdaPlotComp.PlotTabContent', { | @@ -39,6 +39,7 @@ Ext.define('amdaPlotComp.PlotTabContent', { | ||
39 | 39 | ||
40 | setTime : function(startDate, stopDate) { | 40 | setTime : function(startDate, stopDate) { |
41 | this.timeSelector.intervalSel.setInterval(startDate, stopDate); | 41 | this.timeSelector.intervalSel.setInterval(startDate, stopDate); |
42 | + this.timeSelector.setActiveTimeSource(amdaModel.AmdaTimeObject.inputTimeSrc[1]); | ||
42 | 43 | ||
43 | }, | 44 | }, |
44 | getTimeSelector: function(){ | 45 | getTimeSelector: function(){ |
js/app/views/PlotComponents/PlotZoomPlug.js
@@ -193,7 +193,13 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | @@ -193,7 +193,13 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | ||
193 | 193 | ||
194 | this.hostCmp.panelImage.resetZoom(); | 194 | this.hostCmp.panelImage.resetZoom(); |
195 | }, | 195 | }, |
196 | - | 196 | + setTimePlot : function(){ |
197 | + var timeObj = new Object(); | ||
198 | + timeObj.start = this.form.getForm().findField('zoom-min-time').getValue(); | ||
199 | + timeObj.stop = this.form.getForm().findField('zoom-max-time').getValue(); | ||
200 | + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); | ||
201 | + plotModule.setTimeInterval(timeObj); | ||
202 | + }, | ||
197 | /** | 203 | /** |
198 | * Main form | 204 | * Main form |
199 | */ | 205 | */ |
@@ -212,11 +218,11 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | @@ -212,11 +218,11 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | ||
212 | items: [ | 218 | items: [ |
213 | { | 219 | { |
214 | xtype: 'datefield', name: 'zoom-min-time', fieldLabel: 'Start Time', | 220 | xtype: 'datefield', name: 'zoom-min-time', fieldLabel: 'Start Time', |
215 | - format: 'Y-m-d\\TH:i:s' | 221 | + format: 'Y/m/d H:i:s.u', |
216 | }, | 222 | }, |
217 | { | 223 | { |
218 | xtype: 'datefield', name: 'zoom-max-time', fieldLabel: 'Stop Time', | 224 | xtype: 'datefield', name: 'zoom-max-time', fieldLabel: 'Stop Time', |
219 | - format: 'Y-m-d\\TH:i:s' | 225 | + format: 'Y/m/d H:i:s.u' |
220 | }, | 226 | }, |
221 | { | 227 | { |
222 | xtype: 'numberfield', name: 'zoom-min-float', fieldLabel: 'Min Value' | 228 | xtype: 'numberfield', name: 'zoom-min-float', fieldLabel: 'Min Value' |
@@ -232,6 +238,15 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | @@ -232,6 +238,15 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | ||
232 | handler: function () { | 238 | handler: function () { |
233 | this.resetMinMaxValue(); | 239 | this.resetMinMaxValue(); |
234 | } | 240 | } |
241 | + }, | ||
242 | + { | ||
243 | + xtype: 'button', | ||
244 | + width: 100, | ||
245 | + text: 'Use interval in plot', | ||
246 | + scope: this, | ||
247 | + handler: function () { | ||
248 | + this.setTimePlot(); | ||
249 | + } | ||
235 | } | 250 | } |
236 | ] | 251 | ] |
237 | }; | 252 | }; |
@@ -372,7 +387,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | @@ -372,7 +387,7 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | ||
372 | 387 | ||
373 | this.form = new Ext.form.FormPanel({ | 388 | this.form = new Ext.form.FormPanel({ |
374 | frame: true, | 389 | frame: true, |
375 | - width: 250, | 390 | + width: 255, |
376 | layout: { | 391 | layout: { |
377 | type: 'vbox', | 392 | type: 'vbox', |
378 | pack: 'start', | 393 | pack: 'start', |
@@ -392,8 +407,8 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | @@ -392,8 +407,8 @@ Ext.define('amdaPlotComp.PlotZoomPlug', { | ||
392 | scope: this, | 407 | scope: this, |
393 | handler: function () { | 408 | handler: function () { |
394 | if (this.zoomType == 'timeAxis') { | 409 | if (this.zoomType == 'timeAxis') { |
395 | - var minZoom = this.form.getForm().findField('zoom-min-time').getValue(); | ||
396 | - var maxZoom = this.form.getForm().findField('zoom-max-time').getValue(); | 410 | + var minZoom = Ext.Date.format(this.form.getForm().findField('zoom-min-time').getValue(), 'Y-m-d H:i:s.u'); |
411 | + var maxZoom = Ext.Date.format(this.form.getForm().findField('zoom-max-time').getValue(),'Y-m-d H:i:s.u'); | ||
397 | } | 412 | } |
398 | else { | 413 | else { |
399 | var minZoom = this.form.getForm().findField('zoom-min-float').getValue(); | 414 | var minZoom = this.form.getForm().findField('zoom-min-float').getValue(); |
js/app/views/PlotTabResultUI.js
@@ -502,9 +502,25 @@ Ext.define('amdaUI.PlotTabResultUI', { | @@ -502,9 +502,25 @@ Ext.define('amdaUI.PlotTabResultUI', { | ||
502 | this.callInteractivePlot({ 'action': 'goto', 'interactiveId': this.interactiveId, 'ttFileIndex': ttFileIndex, 'intIndex': ttintervalIndex }); | 502 | this.callInteractivePlot({ 'action': 'goto', 'interactiveId': this.interactiveId, 'ttFileIndex': ttFileIndex, 'intIndex': ttintervalIndex }); |
503 | } | 503 | } |
504 | }, | 504 | }, |
505 | - '-', | 505 | + '-', |
506 | { | 506 | { |
507 | - text: 'Go to Interval #', | 507 | + text: 'Use This Time Inteval', |
508 | + scope: this, | ||
509 | + handler: function(){ | ||
510 | + var timeObj = new Object(); | ||
511 | + var startTime = new Date(this.crtContext.page.startTime*1000); | ||
512 | + timeObj.start = Ext.Date.add(startTime, Ext.Date.MINUTE, startTime.getTimezoneOffset()); | ||
513 | + | ||
514 | + var stopTime = new Date(this.crtContext.page.stopTime*1000); | ||
515 | + timeObj.stop = Ext.Date.add(stopTime, Ext.Date.MINUTE, stopTime.getTimezoneOffset()); | ||
516 | + | ||
517 | + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id); | ||
518 | + plotModule.setTimeInterval(timeObj); | ||
519 | + } | ||
520 | + }, | ||
521 | + '-', | ||
522 | + { | ||
523 | + text: 'Go to Interval #', | ||
508 | scope: this, | 524 | scope: this, |
509 | handler: function (bt) { | 525 | handler: function (bt) { |
510 | var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-' + this.interactiveId); | 526 | var ttGotoNumberField = this.navToolBar.items.get('tt-goto-number-' + this.interactiveId); |
js/app/views/PlotUI.js
@@ -140,12 +140,9 @@ Ext.define('amdaUI.PlotUI', { | @@ -140,12 +140,9 @@ Ext.define('amdaUI.PlotUI', { | ||
140 | setTimeFromData : function(obj) { | 140 | setTimeFromData : function(obj) { |
141 | if (!obj.start || !obj.stop) | 141 | if (!obj.start || !obj.stop) |
142 | return; | 142 | return; |
143 | - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | ||
144 | - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | ||
145 | - | ||
146 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); | 143 | var plotTab = this.plotTabs.getCurrentPlotTabContent(); |
147 | if (plotTab) | 144 | if (plotTab) |
148 | - plotTab.setTime(dateStart, dateStop); | 145 | + plotTab.setTime(obj.start, obj.stop); |
149 | }, | 146 | }, |
150 | 147 | ||
151 | savePlotRequest : function() { | 148 | savePlotRequest : function() { |
js/app/views/SearchUI.js
@@ -8,769 +8,728 @@ | @@ -8,769 +8,728 @@ | ||
8 | * @version $Id: SearchUI.js 2467 2014-07-10 16:06:26Z myriam $ | 8 | * @version $Id: SearchUI.js 2467 2014-07-10 16:06:26Z myriam $ |
9 | */ | 9 | */ |
10 | 10 | ||
11 | -Ext.define('amdaUI.SearchUI', | ||
12 | -{ | ||
13 | - extend: 'Ext.container.Container', | ||
14 | - alias: 'widget.panelSearch', | ||
15 | - | ||
16 | - requires: [ | ||
17 | - 'amdaUI.CalculatorUI', | ||
18 | - 'amdaUI.TimeSelectorUI', | ||
19 | - 'extensions.SelectableTextArea', | ||
20 | - 'amdaUI.ParamArgumentsPlug', | ||
21 | - 'amdaModel.RequestParamObject' | ||
22 | - ], | ||
23 | - | ||
24 | - constructor: function(config) | ||
25 | - { | ||
26 | - this.init(config); | ||
27 | - this.callParent(arguments); | ||
28 | - // load object into view | ||
29 | - this.loadObject(); | ||
30 | - | ||
31 | - var searchArgsPlug = this.getPlugin('search-param-components-plugin'); | ||
32 | - if (searchArgsPlug) | ||
33 | - searchArgsPlug.onApply = this.onApplyParameterArgs; | ||
34 | - }, | ||
35 | - | ||
36 | - addTT : function(newTTName,newTTid) | 11 | +Ext.define('amdaUI.SearchUI', |
37 | { | 12 | { |
38 | - this.timeSelector.addTT(newTTName,newTTid); | ||
39 | - }, | ||
40 | - | ||
41 | - addTTs : function(TTarray) | ||
42 | - { | ||
43 | - // set TTTab | ||
44 | - this.timeSelector.setTTTab(TTarray); | ||
45 | - }, | ||
46 | - | ||
47 | - addParam : function(newParamName, isLeaf, needArgs, components) | ||
48 | - { | ||
49 | - if (needArgs || components) | 13 | + extend: 'Ext.container.Container', |
14 | + alias: 'widget.panelSearch', | ||
15 | + | ||
16 | + requires: [ | ||
17 | + 'amdaUI.CalculatorUI', | ||
18 | + 'amdaUI.TimeSelectorUI', | ||
19 | + 'extensions.SelectableTextArea', | ||
20 | + 'amdaUI.ParamArgumentsPlug', | ||
21 | + 'amdaModel.RequestParamObject' | ||
22 | + ], | ||
23 | + | ||
24 | + constructor: function (config) { | ||
25 | + this.init(config); | ||
26 | + this.callParent(arguments); | ||
27 | + // load object into view | ||
28 | + this.loadObject(); | ||
29 | + | ||
30 | + var searchArgsPlug = this.getPlugin('search-param-components-plugin'); | ||
31 | + if (searchArgsPlug) | ||
32 | + searchArgsPlug.onApply = this.onApplyParameterArgs; | ||
33 | + }, | ||
34 | + | ||
35 | + addTT: function (newTTName, newTTid) { | ||
36 | + this.timeSelector.addTT(newTTName, newTTid); | ||
37 | + }, | ||
38 | + | ||
39 | + addTTs: function (TTarray) { | ||
40 | + // set TTTab | ||
41 | + this.timeSelector.setTTTab(TTarray); | ||
42 | + }, | ||
43 | + | ||
44 | + addParam: function (newParamName, isLeaf, needArgs, components) { | ||
45 | + if (needArgs || components) | ||
50 | this.editParameterArgs(newParamName, components); | 46 | this.editParameterArgs(newParamName, components); |
51 | - else | ||
52 | - this.addParamInEditor(newParamName); | ||
53 | - }, | ||
54 | - | ||
55 | - addParamInEditor : function(param) | ||
56 | - { | ||
57 | - var selection = this.constructionField.getSelection(); | ||
58 | - this.constructionField.setValue(selection.beforeText + param + selection.afterText); | ||
59 | - this.constructionField.focus(); | ||
60 | - this.constructionField.setCaretPosition(this.constructionField.getValue().length); | ||
61 | - }, | ||
62 | - | ||
63 | - onApplyParameterArgs : function(uiScope, paramRequestObject) | ||
64 | - { | ||
65 | - var fullParam = paramRequestObject.getParamFullName(); | ||
66 | - uiScope.addParamInEditor(fullParam); | ||
67 | - }, | ||
68 | - | ||
69 | - editParameterArgs: function(name, components) | ||
70 | - { | ||
71 | - var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | ||
72 | - paramObj.paramid = name; | ||
73 | - | ||
74 | - if (components) { | ||
75 | - if (components['index1']) { | ||
76 | - paramObj['dim1-index'] = components['index1']; | ||
77 | - ++paramObj['type']; | 47 | + else |
48 | + this.addParamInEditor(newParamName); | ||
49 | + }, | ||
50 | + | ||
51 | + addParamInEditor: function (param) { | ||
52 | + var selection = this.constructionField.getSelection(); | ||
53 | + this.constructionField.setValue(selection.beforeText + param + selection.afterText); | ||
54 | + this.constructionField.focus(); | ||
55 | + this.constructionField.setCaretPosition(this.constructionField.getValue().length); | ||
56 | + }, | ||
57 | + | ||
58 | + onApplyParameterArgs: function (uiScope, paramRequestObject) { | ||
59 | + var fullParam = paramRequestObject.getParamFullName(); | ||
60 | + uiScope.addParamInEditor(fullParam); | ||
61 | + }, | ||
62 | + | ||
63 | + editParameterArgs: function (name, components) { | ||
64 | + var paramObj = amdaModel.RequestParamObject.getEmptyObj(); | ||
65 | + paramObj.paramid = name; | ||
66 | + | ||
67 | + if (components) { | ||
68 | + if (components['index1']) { | ||
69 | + paramObj['dim1-index'] = components['index1']; | ||
70 | + ++paramObj['type']; | ||
71 | + } | ||
72 | + | ||
73 | + if (components['index2']) { | ||
74 | + paramObj['dim2-index'] = components['index2']; | ||
75 | + ++paramObj['type']; | ||
76 | + } | ||
78 | } | 77 | } |
79 | - | ||
80 | - if (components['index2']) { | ||
81 | - paramObj['dim2-index'] = components['index2']; | ||
82 | - ++paramObj['type']; | 78 | + |
79 | + var paramArgsPlug = this.getPlugin('search-param-components-plugin'); | ||
80 | + if (paramArgsPlug) { | ||
81 | + var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | ||
82 | + paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject); | ||
83 | } | 83 | } |
84 | - } | ||
85 | - | ||
86 | - var paramArgsPlug = this.getPlugin('search-param-components-plugin'); | ||
87 | - if (paramArgsPlug) { | ||
88 | - var workinRequestParamObject = Ext.create('amdaModel.RequestParamObject', paramObj); | ||
89 | - paramArgsPlug.show('search-param-components-plugin', workinRequestParamObject); | ||
90 | - } | ||
91 | - }, | ||
92 | - | ||
93 | - /** | ||
94 | - * Set Start-Stop from parameter info (Local & MyData) | ||
95 | - */ | ||
96 | - setTimeFromData : function(obj) | ||
97 | - { | ||
98 | - if (!obj.start || !obj.stop) | ||
99 | - return; | ||
100 | - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | ||
101 | - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | ||
102 | - | ||
103 | - this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop }); | ||
104 | - }, | ||
105 | - | ||
106 | - setObject : function(obj) | ||
107 | - { | ||
108 | - this.object = obj; | ||
109 | - this.loadObject(); | ||
110 | - }, | ||
111 | - | ||
112 | - /** | ||
113 | - * update this.object from form | ||
114 | - */ | ||
115 | - updateObject : function() | ||
116 | - { | ||
117 | - // get the basic form | ||
118 | - var basicForm = this.formPanel.getForm(); | ||
119 | - // get the timeSource selected | ||
120 | - var timeSource = this.timeSelector.getActiveTimeSource(); | ||
121 | - var updateStatus = true; | ||
122 | - | ||
123 | - var fieldsWithoutName = basicForm.getFields().items; | ||
124 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems) | ||
125 | - { | ||
126 | - if(item !== this.fieldName) | ||
127 | - { | ||
128 | - if (!item.isValid()) | ||
129 | - { | ||
130 | - if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | 84 | + }, |
85 | + | ||
86 | + /** | ||
87 | + * Set Start-Stop from parameter info (Local & MyData) | ||
88 | + */ | ||
89 | + setTimeFromData: function (obj) { | ||
90 | + if (!obj.start || !obj.stop) | ||
91 | + return; | ||
92 | + var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | ||
93 | + var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | ||
94 | + | ||
95 | + this.down('form').getForm().setValues({ startDate: dateStart, stopDate: dateStop }); | ||
96 | + }, | ||
97 | + | ||
98 | + setObject: function (obj) { | ||
99 | + this.object = obj; | ||
100 | + this.loadObject(); | ||
101 | + }, | ||
102 | + | ||
103 | + /** | ||
104 | + * update this.object from form | ||
105 | + */ | ||
106 | + updateObject: function () { | ||
107 | + // get the basic form | ||
108 | + var basicForm = this.formPanel.getForm(); | ||
109 | + // get the timeSource selected | ||
110 | + var timeSource = this.timeSelector.getActiveTimeSource(); | ||
111 | + var updateStatus = true; | ||
112 | + | ||
113 | + var fieldsWithoutName = basicForm.getFields().items; | ||
114 | + Ext.Array.each(fieldsWithoutName, function (item, index, allItems) { | ||
115 | + if (item !== this.fieldName) { | ||
116 | + if (!item.isValid()) { | ||
117 | + if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | ||
131 | ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | 118 | ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { |
132 | - updateStatus = true; | 119 | + updateStatus = true; |
133 | } | 120 | } |
134 | - else { | ||
135 | - // set update isn't allowed | ||
136 | - updateStatus = false; | ||
137 | - return false; | ||
138 | - } | 121 | + else { |
122 | + // set update isn't allowed | ||
123 | + updateStatus = false; | ||
124 | + return false; | ||
125 | + } | ||
126 | + } | ||
127 | + } | ||
128 | + }, this); | ||
129 | + | ||
130 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | ||
131 | + && this.timeSelector.TTGrid.getStore().count() == 0) { | ||
132 | + | ||
133 | + Ext.Msg.show({ | ||
134 | + title: 'Warning', msg: 'You chose Time Selection `by TimeTable` but no timeTable was added!' | ||
135 | + + '<br>You must add one or choose Time Selection `by Interval`', | ||
136 | + icon: Ext.MessageBox.WARNING, buttons: Ext.Msg.OK | ||
137 | + }); | ||
138 | + updateStatus = false; | ||
139 | + } | ||
140 | + // if the update is allowed | ||
141 | + if (updateStatus) { | ||
142 | + /// real object update | ||
143 | + // update TimeTable object with the content of form | ||
144 | + basicForm.updateRecord(this.object); | ||
145 | + this.object.set('timesrc', timeSource); | ||
146 | + // set valid intervals into TimeTable object | ||
147 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) { | ||
148 | + this.object.set('timeTables', this.timeSelector.TTGrid.getStore().data.items); | ||
139 | } | 149 | } |
140 | } | 150 | } |
141 | - }, this); | 151 | + // return the update status |
152 | + return updateStatus; | ||
153 | + }, | ||
142 | 154 | ||
143 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | ||
144 | - && this.timeSelector.TTGrid.getStore().count() == 0) { | 155 | + /** |
156 | + * load this.object into form | ||
157 | + */ | ||
158 | + loadObject: function () { | ||
159 | + // load object into form | ||
160 | + this.formPanel.getForm().loadRecord(this.object); | ||
161 | + // set object's TTs into the timeselector | ||
162 | + this.addTTs(this.object.get('timeTables')); | ||
163 | + }, | ||
145 | 164 | ||
146 | - Ext.Msg.show({ | ||
147 | - title: 'Warning', msg: 'You chose Time Selection `by TimeTable` but no timeTable was added!' | ||
148 | - +'<br>You must add one or choose Time Selection `by Interval`', | ||
149 | - icon: Ext.MessageBox.WARNING, buttons: Ext.Msg.OK | ||
150 | - }); | ||
151 | - updateStatus = false; | ||
152 | - } | ||
153 | - // if the update is allowed | ||
154 | - if (updateStatus) | ||
155 | - { | ||
156 | - /// real object update | ||
157 | - // update TimeTable object with the content of form | ||
158 | - basicForm.updateRecord(this.object); | ||
159 | - this.object.set('timesrc', timeSource); | ||
160 | - // set valid intervals into TimeTable object | ||
161 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) { | ||
162 | - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); | 165 | + /** |
166 | + * save method called by Save button to launch the save process | ||
167 | + */ | ||
168 | + saveProcess: function (toRename) { | ||
169 | + // if the TimeTable object has been modified | ||
170 | + if (this.object.dirty) { | ||
171 | + // Search module | ||
172 | + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);//('search-win'); | ||
173 | + // if the name has been modified this is a creation | ||
174 | + if (this.object.isModified('name')) { | ||
175 | + // if object already has an id : it's a 'rename' of an existing Condition | ||
176 | + if (this.object.get('id')) { | ||
177 | + // the context Node is the parent node of current edited one | ||
178 | + var contextNode = searchModule.linkedNode.parentNode; | ||
179 | + // link a new node to the TimeTableModule | ||
180 | + searchModule.createLinkedNode(); | ||
181 | + // set the contextNode | ||
182 | + searchModule.linkedNode.set('contextNode', contextNode); | ||
183 | + // create a new object linked | ||
184 | + searchModule.createObject(this.object.getJsonValues()); | ||
185 | + var searchObj = searchModule.linkedNode.get('object'); | ||
186 | + // synchronisation of objects | ||
187 | + this.object = searchObj; | ||
188 | + if (toRename) searchModule.linkedNode.toRename = true; | ||
189 | + } | ||
190 | + searchModule.linkedNode.create(); | ||
191 | + } else { | ||
192 | + searchModule.linkedNode.set('contextNode', searchModule.contextNode); | ||
193 | + // this.object.fireEvent('modify'); | ||
194 | + searchModule.linkedNode.update(); | ||
195 | + } | ||
163 | } | 196 | } |
164 | - } | ||
165 | - // return the update status | ||
166 | - return updateStatus; | ||
167 | - }, | ||
168 | - | ||
169 | - /** | ||
170 | - * load this.object into form | 197 | + }, |
198 | + | ||
199 | + /** | ||
200 | + * overwrite metod called by Save button | ||
201 | + */ | ||
202 | + overwriteProcess: function (btn) { | ||
203 | + if (btn == 'cancel') return; | ||
204 | + | ||
205 | + this.fieldName.clearInvalid(); | ||
206 | + this.saveProcess(true); | ||
207 | + }, | ||
208 | + | ||
209 | + /** | ||
210 | + * search method called by 'Do Search' button to launch the search process | ||
211 | + */ | ||
212 | + doSearch: function () { | ||
213 | + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
214 | + searchModule.linkedNode.execute(); | ||
215 | + // fire execution | ||
216 | + // this.object.fireEvent('execute',this.object.dirty); | ||
217 | + }, | ||
218 | + | ||
219 | + /** | ||
220 | + * Check if brackets are balanced | ||
171 | */ | 221 | */ |
172 | - loadObject : function() | ||
173 | - { | ||
174 | - // load object into form | ||
175 | - this.formPanel.getForm().loadRecord(this.object); | ||
176 | - // set object's TTs into the timeselector | ||
177 | - this.addTTs(this.object.get('timeTables')); | ||
178 | - }, | ||
179 | - | ||
180 | - /** | ||
181 | - * save method called by Save button to launch the save process | ||
182 | - */ | ||
183 | - saveProcess : function(toRename) | ||
184 | - { | ||
185 | - // if the TimeTable object has been modified | ||
186 | - if (this.object.dirty) | ||
187 | - { | ||
188 | - // Search module | ||
189 | - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id);//('search-win'); | ||
190 | - // if the name has been modified this is a creation | ||
191 | - if (this.object.isModified('name')) | ||
192 | - { | ||
193 | - // if object already has an id : it's a 'rename' of an existing Condition | ||
194 | - if (this.object.get('id')) | ||
195 | - { | ||
196 | - // the context Node is the parent node of current edited one | ||
197 | - var contextNode = searchModule.linkedNode.parentNode; | ||
198 | - // link a new node to the TimeTableModule | ||
199 | - searchModule.createLinkedNode(); | ||
200 | - // set the contextNode | ||
201 | - searchModule.linkedNode.set('contextNode',contextNode); | ||
202 | - // create a new object linked | ||
203 | - searchModule.createObject(this.object.getJsonValues()); | ||
204 | - var searchObj = searchModule.linkedNode.get('object'); | ||
205 | - // synchronisation of objects | ||
206 | - this.object = searchObj; | ||
207 | - if (toRename) searchModule.linkedNode.toRename = true; | ||
208 | - } | ||
209 | - searchModule.linkedNode.create(); | ||
210 | - } else { | ||
211 | - searchModule.linkedNode.set('contextNode',searchModule.contextNode); | ||
212 | - // this.object.fireEvent('modify'); | ||
213 | - searchModule.linkedNode.update(); | ||
214 | - } | ||
215 | - } | ||
216 | - }, | ||
217 | - | ||
218 | - /** | ||
219 | - * overwrite metod called by Save button | ||
220 | - */ | ||
221 | - overwriteProcess : function(btn) | ||
222 | - { | ||
223 | - if (btn == 'cancel') return; | ||
224 | - | ||
225 | - this.fieldName.clearInvalid(); | ||
226 | - this.saveProcess(true); | ||
227 | - }, | ||
228 | - | ||
229 | - /** | ||
230 | - * search method called by 'Do Search' button to launch the search process | ||
231 | - */ | ||
232 | - doSearch : function() | ||
233 | - { | ||
234 | - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
235 | - searchModule.linkedNode.execute(); | ||
236 | - // fire execution | ||
237 | - // this.object.fireEvent('execute',this.object.dirty); | ||
238 | - }, | ||
239 | - | ||
240 | - /** | ||
241 | - * Check if brackets are balanced | ||
242 | - */ | ||
243 | - isBalanced : function(str) | ||
244 | - { | ||
245 | - str = (""+str).replace(/[^()\[\]{}]/g, ""); | ||
246 | - var bracket = { | ||
247 | - "]": "[", | ||
248 | - "}": "{", | ||
249 | - ")": "(" | ||
250 | - }, | ||
251 | - openBrackets = [], | ||
252 | - isClean = true, | ||
253 | - i = 0, | ||
254 | - len = str.length; | ||
255 | - | ||
256 | - for(; isClean && i<len; i++ ){ | ||
257 | - if( bracket[ str[ i ] ] ){ | ||
258 | - isClean = ( openBrackets.pop() === bracket[ str[ i ] ] ); | ||
259 | - }else{ | 222 | + isBalanced: function (str) { |
223 | + str = ("" + str).replace(/[^()\[\]{}]/g, ""); | ||
224 | + var bracket = { | ||
225 | + "]": "[", | ||
226 | + "}": "{", | ||
227 | + ")": "(" | ||
228 | + }, | ||
229 | + openBrackets = [], | ||
230 | + isClean = true, | ||
231 | + i = 0, | ||
232 | + len = str.length; | ||
233 | + | ||
234 | + for (; isClean && i < len; i++) { | ||
235 | + if (bracket[str[i]]) { | ||
236 | + isClean = (openBrackets.pop() === bracket[str[i]]); | ||
237 | + } else { | ||
260 | openBrackets.push(str[i]); | 238 | openBrackets.push(str[i]); |
261 | } | 239 | } |
262 | - } | ||
263 | - if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced'; | ||
264 | - | ||
265 | - return true; | ||
266 | - }, | ||
267 | - | ||
268 | - /** | ||
269 | - * Update constructionField (Search Condition) in window search | ||
270 | - */ | ||
271 | - updateConstruct : function(oldval,newval) | ||
272 | - { | ||
273 | - var expression = this.constructionField.value; | ||
274 | - oldval = oldval.replace(/[(]/g,"\\("); | ||
275 | - oldval = oldval.replace(/[)]/g,"\\)"); | ||
276 | - var reg=new RegExp(oldval, "g"); | ||
277 | - expression = expression.replace(reg, newval); | ||
278 | - this.constructionField.setValue(expression); | ||
279 | - }, | ||
280 | - | ||
281 | - /** | ||
282 | - * Check if changes were made before closing window | ||
283 | - * @return true if changes | ||
284 | - */ | ||
285 | - fclose : function() | ||
286 | - { | ||
287 | - var form = this.formPanel.getForm(); | ||
288 | - var isDirty = form.isDirty(); | ||
289 | - return isDirty; | ||
290 | - }, | ||
291 | - | ||
292 | - /** | ||
293 | - * Component configiration / init | ||
294 | - */ | ||
295 | - init : function(config) | ||
296 | - { | ||
297 | - this.timeSelector = new amdaUI.TimeSelectorUI({id: 'SearchTimeSelector',flex: 2}); | ||
298 | - | ||
299 | - this.fieldName = new Ext.form.field.Text({ | 240 | + } |
241 | + if (!(isClean && !openBrackets.length)) return 'Brackets are not balanced'; | ||
242 | + | ||
243 | + return true; | ||
244 | + }, | ||
245 | + | ||
246 | + /** | ||
247 | + * Update constructionField (Search Condition) in window search | ||
248 | + */ | ||
249 | + updateConstruct: function (oldval, newval) { | ||
250 | + var expression = this.constructionField.value; | ||
251 | + oldval = oldval.replace(/[(]/g, "\\("); | ||
252 | + oldval = oldval.replace(/[)]/g, "\\)"); | ||
253 | + var reg = new RegExp(oldval, "g"); | ||
254 | + expression = expression.replace(reg, newval); | ||
255 | + this.constructionField.setValue(expression); | ||
256 | + }, | ||
257 | + | ||
258 | + /** | ||
259 | + * Check if changes were made before closing window | ||
260 | + * @return true if changes | ||
261 | + */ | ||
262 | + fclose: function () { | ||
263 | + var form = this.formPanel.getForm(); | ||
264 | + var isDirty = form.isDirty(); | ||
265 | + return isDirty; | ||
266 | + }, | ||
267 | + | ||
268 | + /** | ||
269 | + * Component configiration / init | ||
270 | + */ | ||
271 | + init: function (config) { | ||
272 | + this.timeSelector = new amdaUI.TimeSelectorUI({ id: 'SearchTimeSelector', flex: 2 }); | ||
273 | + | ||
274 | + this.fieldName = new Ext.form.field.Text({ | ||
300 | labelAlign: 'top', itemId: 'formParamName', | 275 | labelAlign: 'top', itemId: 'formParamName', |
301 | fieldLabel: 'Request Name', | 276 | fieldLabel: 'Request Name', |
302 | labelPad: 0, | 277 | labelPad: 0, |
303 | - name : 'name', | 278 | + name: 'name', |
304 | width: 165, | 279 | width: 165, |
305 | - allowBlank : false, | 280 | + allowBlank: false, |
306 | stripCharsRe: /(^\s+|\s+$)/g, | 281 | stripCharsRe: /(^\s+|\s+$)/g, |
307 | validateOnChange: false, | 282 | validateOnChange: false, |
308 | validateOnBlur: false, | 283 | validateOnBlur: false, |
309 | validFlag: false, | 284 | validFlag: false, |
310 | - validator : function() | ||
311 | - { | 285 | + validator: function () { |
312 | return this.validFlag; | 286 | return this.validFlag; |
313 | } | 287 | } |
314 | - }); | 288 | + }); |
315 | 289 | ||
316 | - this.constructionField = new extensions.SelectableTextArea( | ||
317 | - { | ||
318 | - labelAlign: 'top', | ||
319 | - labelPad: 0, | ||
320 | - itemId: 'formSearchCondition', | ||
321 | - fieldLabel:'<img amda_clicktip="constructParameter" src="js/resources/images/16x16/info_mini.png"/> Data Mining Condition', | ||
322 | - allowBlank : false, blankText : 'Condition expression is required', | ||
323 | - name: 'expression', | ||
324 | - validateOnChange: false, | ||
325 | - validateOnBlur: false, | ||
326 | - validator : this.isBalanced, | ||
327 | - flex : 2, | ||
328 | - listeners : | 290 | + this.constructionField = new extensions.SelectableTextArea( |
329 | { | 291 | { |
330 | - render : function(o,op) | 292 | + labelAlign: 'top', |
293 | + labelPad: 0, | ||
294 | + itemId: 'formSearchCondition', | ||
295 | + fieldLabel: '<img amda_clicktip="constructParameter" src="js/resources/images/16x16/info_mini.png"/> Data Mining Condition', | ||
296 | + allowBlank: false, blankText: 'Condition expression is required', | ||
297 | + name: 'expression', | ||
298 | + validateOnChange: false, | ||
299 | + validateOnBlur: false, | ||
300 | + validator: this.isBalanced, | ||
301 | + flex: 2, | ||
302 | + listeners: | ||
331 | { | 303 | { |
332 | - var me = this; | ||
333 | - var el = me.bodyEl; | ||
334 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, | ||
335 | - { | ||
336 | - ddGroup: 'explorerTree', | ||
337 | - notifyEnter : function(ddSource, e, data){ }, | ||
338 | - notifyOver : function(ddSource, e, data) | ||
339 | - { | ||
340 | - if (data.records[0].get('nodeType') == 'localParam' && data.records[0].get('notyet')) { | ||
341 | - this.valid = false; | ||
342 | - return this.dropNotAllowed; | ||
343 | - } | ||
344 | - if (((data.records[0].get('nodeType') == 'localParam') || | ||
345 | - (data.records[0].get('nodeType') == 'remoteParam') || | ||
346 | - (data.records[0].get('nodeType') == 'remoteSimuParam') || | ||
347 | - (data.records[0].get('nodeType') == 'derivedParam') || | ||
348 | - (data.records[0].get('nodeType') == 'myDataParam') || | ||
349 | - (data.records[0].get('nodeType') == 'alias')) && | ||
350 | - (data.records[0].isLeaf() || data.records[0].get('isParameter')) && | ||
351 | - !data.records[0].data.disable) | ||
352 | - { | ||
353 | - this.valid = true; | ||
354 | - return this.dropAllowed; | ||
355 | - } | ||
356 | - | ||
357 | - this.valid = false; | ||
358 | - return this.dropNotAllowed; | ||
359 | - }, | ||
360 | - notifyDrop : function(ddSource, e, data) | ||
361 | - { | ||
362 | - if (!this.valid) return false; | ||
363 | - | ||
364 | - var nameToSent; | ||
365 | - var components = null; | ||
366 | - switch (data.records[0].get('nodeType')) | 304 | + render: function (o, op) { |
305 | + var me = this; | ||
306 | + var el = me.bodyEl; | ||
307 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, | ||
367 | { | 308 | { |
368 | - case 'localParam' : | ||
369 | - case 'remoteParam' : | ||
370 | - case 'remoteSimuParam' : | ||
371 | - nameToSent = data.records[0].get('id'); | ||
372 | - if (data.records[0].get('alias')!= "" ) | ||
373 | - nameToSent = "#"+data.records[0].get('alias'); | ||
374 | - var component_info = data.records[0].get('component_info'); | ||
375 | - if (component_info && component_info.parentId) | ||
376 | - { | ||
377 | - if ( component_info.index1 && component_info.index2 ) | ||
378 | - { | ||
379 | - nameToSent = component_info.parentId; | ||
380 | - components = []; | ||
381 | - if (component_info.index1) | ||
382 | - components['index1'] = component_info.index1; | ||
383 | - if (component_info.index2) | ||
384 | - components['index2'] = component_info.index2; | ||
385 | - } | ||
386 | - if ( data.records[0].get('needsArgs') ) | ||
387 | - { | ||
388 | - nameToSent = component_info.parentId; | ||
389 | - if (component_info.index1) | ||
390 | - { | ||
391 | - components = []; | ||
392 | - components['index1'] = component_info.index1; | 309 | + ddGroup: 'explorerTree', |
310 | + notifyEnter: function (ddSource, e, data) { }, | ||
311 | + notifyOver: function (ddSource, e, data) { | ||
312 | + if (data.records[0].get('nodeType') == 'localParam' && data.records[0].get('notyet')) { | ||
313 | + this.valid = false; | ||
314 | + return this.dropNotAllowed; | ||
315 | + } | ||
316 | + if (((data.records[0].get('nodeType') == 'localParam') || | ||
317 | + (data.records[0].get('nodeType') == 'remoteParam') || | ||
318 | + (data.records[0].get('nodeType') == 'remoteSimuParam') || | ||
319 | + (data.records[0].get('nodeType') == 'derivedParam') || | ||
320 | + (data.records[0].get('nodeType') == 'myDataParam') || | ||
321 | + (data.records[0].get('nodeType') == 'alias')) && | ||
322 | + (data.records[0].isLeaf() || data.records[0].get('isParameter')) && | ||
323 | + !data.records[0].data.disable) { | ||
324 | + this.valid = true; | ||
325 | + return this.dropAllowed; | ||
326 | + } | ||
327 | + | ||
328 | + this.valid = false; | ||
329 | + return this.dropNotAllowed; | ||
330 | + }, | ||
331 | + notifyDrop: function (ddSource, e, data) { | ||
332 | + if (!this.valid) return false; | ||
333 | + | ||
334 | + var nameToSent; | ||
335 | + var components = null; | ||
336 | + switch (data.records[0].get('nodeType')) { | ||
337 | + case 'localParam': | ||
338 | + case 'remoteParam': | ||
339 | + case 'remoteSimuParam': | ||
340 | + nameToSent = data.records[0].get('id'); | ||
341 | + if (data.records[0].get('alias') != "") | ||
342 | + nameToSent = "#" + data.records[0].get('alias'); | ||
343 | + var component_info = data.records[0].get('component_info'); | ||
344 | + if (component_info && component_info.parentId) { | ||
345 | + if (component_info.index1 && component_info.index2) { | ||
346 | + nameToSent = component_info.parentId; | ||
347 | + components = []; | ||
348 | + if (component_info.index1) | ||
349 | + components['index1'] = component_info.index1; | ||
350 | + if (component_info.index2) | ||
351 | + components['index2'] = component_info.index2; | ||
352 | + } | ||
353 | + if (data.records[0].get('needsArgs')) { | ||
354 | + nameToSent = component_info.parentId; | ||
355 | + if (component_info.index1) { | ||
356 | + components = []; | ||
357 | + components['index1'] = component_info.index1; | ||
358 | + } | ||
393 | } | 359 | } |
394 | - } | 360 | + } |
361 | + break; | ||
362 | + case 'alias': | ||
363 | + nameToSent = "#" + data.records[0].get('text'); | ||
364 | + break; | ||
365 | + case 'derivedParam': | ||
366 | + nameToSent = "ws_" + data.records[0].get('text'); | ||
367 | + break; | ||
368 | + case 'myDataParam': | ||
369 | + var name = data.records[0].get('text'); | ||
370 | + nameToSent = "wsd_" + name; | ||
371 | + var size = data.records[0].get('size'); | ||
372 | + if (size && size > 1) { | ||
373 | + nameToSent += "(0)"; | ||
374 | + myDesktopApp.warningMsg("parameter " + name + " is array of size: " + size + "<br/>Please put index"); | ||
375 | + } | ||
376 | + break; | ||
377 | + default: | ||
378 | + return false; | ||
379 | + } | ||
380 | + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
381 | + | ||
382 | + if (searchModule) { | ||
383 | + if (data.records[0].get('predefinedArgs')) { | ||
384 | + searchModule.parseTemplatedParam(nameToSent, function (param_info) { | ||
385 | + searchModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args); | ||
386 | + }); | ||
395 | } | 387 | } |
396 | - break; | ||
397 | - case 'alias' : | ||
398 | - nameToSent = "#"+data.records[0].get('text'); | ||
399 | - break; | ||
400 | - case 'derivedParam' : | ||
401 | - nameToSent = "ws_"+data.records[0].get('text'); | ||
402 | - break; | ||
403 | - case 'myDataParam' : | ||
404 | - var name = data.records[0].get('text'); | ||
405 | - nameToSent = "wsd_"+name; | ||
406 | - var size = data.records[0].get('size'); | ||
407 | - if (size && size > 1) { | ||
408 | - nameToSent += "(0)"; | ||
409 | - myDesktopApp.warningMsg("parameter "+name+" is array of size: "+size+"<br/>Please put index"); | 388 | + else { |
389 | + searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | ||
410 | } | 390 | } |
411 | - break; | ||
412 | - default : | ||
413 | - return false; | ||
414 | - } | ||
415 | - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
416 | - | ||
417 | - if (searchModule) { | ||
418 | - if (data.records[0].get('predefinedArgs')) { | ||
419 | - searchModule.parseTemplatedParam(nameToSent, function(param_info) { | ||
420 | - searchModule.addParam(param_info.paramid, data.records[0].get('leaf'), true, components, param_info.template_args); | ||
421 | - }); | ||
422 | - } | ||
423 | - else { | ||
424 | - searchModule.addParam(nameToSent, data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | ||
425 | } | 391 | } |
392 | + return true; | ||
426 | } | 393 | } |
427 | - return true; | ||
428 | - } | ||
429 | - }); | 394 | + }); |
395 | + } | ||
430 | } | 396 | } |
397 | + }); | ||
398 | + | ||
399 | + var samplingmode_store = new Ext.data.ArrayStore({ | ||
400 | + fields: ['id', 'name'], | ||
401 | + data: [ | ||
402 | + ['timestep', 'Time Step'], | ||
403 | + ['refparam', 'Ref. Parameter'] | ||
404 | + ] | ||
405 | + }); | ||
406 | + | ||
407 | + this.timeStepField = new Ext.form.NumberField({ | ||
408 | + fieldLabel: '<img amda_clicktip="resamplingStep" src="js/resources/images/16x16/info_mini.png"/> Time Step (sec)', | ||
409 | + labelAlign: 'top', | ||
410 | + labelPad: 0, | ||
411 | + blankText: 'Time Step is required', | ||
412 | + name: 'sampling', | ||
413 | + minValue: 0.001, | ||
414 | + decimalPrecision: 10, | ||
415 | + hideTrigger: true, | ||
416 | + width: 165, | ||
417 | + validateOnBlur: false, | ||
418 | + allowBlank: false, | ||
419 | + isValid: function () { | ||
420 | + var me = this, | ||
421 | + disabled = me.disabled, | ||
422 | + validate = me.forceValidation || !disabled; | ||
423 | + | ||
424 | + if (!me.isVisible()) { | ||
425 | + return true; | ||
426 | + } | ||
427 | + | ||
428 | + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
431 | } | 429 | } |
432 | - }); | ||
433 | - | ||
434 | - var samplingmode_store = new Ext.data.ArrayStore({ | ||
435 | - fields: ['id', 'name'], | ||
436 | - data: [ | ||
437 | - ['timestep', 'Time Step'], | ||
438 | - ['refparam', 'Ref. Parameter'] | ||
439 | - ] | ||
440 | - }); | ||
441 | - | ||
442 | - this.timeStepField = new Ext.form.NumberField({ | ||
443 | - fieldLabel: '<img amda_clicktip="resamplingStep" src="js/resources/images/16x16/info_mini.png"/> Time Step (sec)', | ||
444 | - labelAlign: 'top', | ||
445 | - labelPad: 0, | ||
446 | - blankText : 'Time Step is required', | ||
447 | - name : 'sampling', | ||
448 | - minValue : 0.001, | ||
449 | - decimalPrecision : 10, | ||
450 | - hideTrigger: true, | ||
451 | - width: 165, | ||
452 | - validateOnBlur: false, | ||
453 | - allowBlank: false, | ||
454 | - isValid: function() { | ||
455 | - var me = this, | ||
456 | - disabled = me.disabled, | ||
457 | - validate = me.forceValidation || !disabled; | ||
458 | - | ||
459 | - if (!me.isVisible()) { | ||
460 | - return true; | ||
461 | - } | 430 | + }); |
462 | 431 | ||
463 | - return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
464 | - } | ||
465 | - }); | ||
466 | - | ||
467 | - this.refParamField = new Ext.form.TextField({ | ||
468 | - fieldLabel: '<img amda_clicktip="resamplingRefParam" src="js/resources/images/16x16/info_mini.png"/> Reference Param.', | ||
469 | - labelAlign: 'top', | ||
470 | - labelPad: 0, | ||
471 | - name : 'reference_param', | ||
472 | - width: 165, | ||
473 | - hidden: true, | ||
474 | - allowBlank: false, | ||
475 | - listeners: { | ||
476 | - afterrender: function(field, eOpts ){ | ||
477 | - var paramTarget = new Ext.dd.DropTarget(field.el.dom, | ||
478 | - { | ||
479 | - ddGroup: 'explorerTree', | ||
480 | - notifyEnter: function(ddSource, e, data) { | ||
481 | - }, | ||
482 | - notifyDrop: function(ddSource, e, data) { | ||
483 | - var selectedRecord = ddSource.dragData.records[0]; | ||
484 | - switch (selectedRecord.$className) { | ||
485 | - case 'amdaModel.LocalParamNode' : | ||
486 | - case 'amdaModel.RemoteParamNode' : | ||
487 | - case 'amdaModel.RemoteSimuParamNode' : | ||
488 | - if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) | ||
489 | - return false; | ||
490 | - if (selectedRecord.get('alias') != "" ) | ||
491 | - field.setValue("#"+selectedRecord.get('alias')); | ||
492 | - else | ||
493 | - field.setValue(selectedRecord.get('id')); | ||
494 | - return true; | ||
495 | - case 'amdaModel.AliasNode' : | ||
496 | - if (!selectedRecord.isLeaf()) | ||
497 | - return false; | ||
498 | - field.setValue("#"+selectedRecord.get('text')); | ||
499 | - return true; | ||
500 | - case 'amdaModel.DerivedParamNode' : | ||
501 | - if (!selectedRecord.isLeaf()) | ||
502 | - return false; | ||
503 | - field.setValue("ws_"+selectedRecord.get('text')); | ||
504 | - return true; | ||
505 | - case 'amdaModel.MyDataParamNode' : | ||
506 | - if (!selectedRecord.isLeaf()) | 432 | + this.refParamField = new Ext.form.TextField({ |
433 | + fieldLabel: '<img amda_clicktip="resamplingRefParam" src="js/resources/images/16x16/info_mini.png"/> Reference Param.', | ||
434 | + labelAlign: 'top', | ||
435 | + labelPad: 0, | ||
436 | + name: 'reference_param', | ||
437 | + width: 165, | ||
438 | + hidden: true, | ||
439 | + allowBlank: false, | ||
440 | + listeners: { | ||
441 | + afterrender: function (field, eOpts) { | ||
442 | + var paramTarget = new Ext.dd.DropTarget(field.el.dom, | ||
443 | + { | ||
444 | + ddGroup: 'explorerTree', | ||
445 | + notifyEnter: function (ddSource, e, data) { | ||
446 | + }, | ||
447 | + notifyDrop: function (ddSource, e, data) { | ||
448 | + var selectedRecord = ddSource.dragData.records[0]; | ||
449 | + switch (selectedRecord.$className) { | ||
450 | + case 'amdaModel.LocalParamNode': | ||
451 | + case 'amdaModel.RemoteParamNode': | ||
452 | + case 'amdaModel.RemoteSimuParamNode': | ||
453 | + if (!selectedRecord.get('isParameter') || selectedRecord.get('disable')) | ||
454 | + return false; | ||
455 | + if (selectedRecord.get('alias') != "") | ||
456 | + field.setValue("#" + selectedRecord.get('alias')); | ||
457 | + else | ||
458 | + field.setValue(selectedRecord.get('id')); | ||
459 | + return true; | ||
460 | + case 'amdaModel.AliasNode': | ||
461 | + if (!selectedRecord.isLeaf()) | ||
462 | + return false; | ||
463 | + field.setValue("#" + selectedRecord.get('text')); | ||
464 | + return true; | ||
465 | + case 'amdaModel.DerivedParamNode': | ||
466 | + if (!selectedRecord.isLeaf()) | ||
467 | + return false; | ||
468 | + field.setValue("ws_" + selectedRecord.get('text')); | ||
469 | + return true; | ||
470 | + case 'amdaModel.MyDataParamNode': | ||
471 | + if (!selectedRecord.isLeaf()) | ||
472 | + return false; | ||
473 | + field.setValue("wsd_" + selectedRecord.get('text')); | ||
474 | + return true; | ||
475 | + default: | ||
507 | return false; | 476 | return false; |
508 | - field.setValue("wsd_"+selectedRecord.get('text')); | ||
509 | - return true; | ||
510 | - default: | ||
511 | - return false; | 477 | + } |
478 | + return true; | ||
512 | } | 479 | } |
513 | - return true; | ||
514 | } | 480 | } |
515 | - } | ||
516 | - ); | 481 | + ); |
482 | + }, | ||
483 | + scope: this | ||
517 | }, | 484 | }, |
518 | - scope: this | ||
519 | - }, | ||
520 | - isValid: function() { | ||
521 | - var me = this, | ||
522 | - disabled = me.disabled, | ||
523 | - validate = me.forceValidation || !disabled; | 485 | + isValid: function () { |
486 | + var me = this, | ||
487 | + disabled = me.disabled, | ||
488 | + validate = me.forceValidation || !disabled; | ||
524 | 489 | ||
525 | - if (!me.isVisible()) { | ||
526 | - return true; | 490 | + if (!me.isVisible()) { |
491 | + return true; | ||
492 | + } | ||
493 | + | ||
494 | + return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
527 | } | 495 | } |
496 | + }); | ||
528 | 497 | ||
529 | - return validate ? me.validateValue(me.processRawValue(me.getRawValue())) : disabled; | ||
530 | - } | ||
531 | - }); | ||
532 | - | ||
533 | - this.samplingDefContainer = new Ext.container.Container({ | ||
534 | - border: false, | ||
535 | - items: [ | ||
536 | - this.timeStepField, | ||
537 | - this.refParamField | ||
538 | - ], | ||
539 | - width: 165 | ||
540 | - }); | ||
541 | - | ||
542 | - this.formPanel = new Ext.form.Panel( | ||
543 | - { | ||
544 | - region : 'center', | ||
545 | - bodyStyle: { background : '#dfe8f6' }, | ||
546 | - border: false, buttonAlign: 'left', | ||
547 | - trackResetOnLoad: true, //reset to the last loaded record | ||
548 | - layout : { | ||
549 | - type : 'vbox', | ||
550 | - align: 'stretch', | ||
551 | - defaultMargins: {top: 5, left:5, bottom:10, right:10} | ||
552 | - }, | ||
553 | - id: 'formSearch', | ||
554 | - defaults: { | ||
555 | - border: false | ||
556 | - }, | ||
557 | - items : [ | ||
558 | - { | ||
559 | - xtype: 'container', | ||
560 | - flex: 2.5, | 498 | + this.samplingDefContainer = new Ext.container.Container({ |
499 | + border: false, | ||
500 | + items: [ | ||
501 | + this.timeStepField, | ||
502 | + this.refParamField | ||
503 | + ], | ||
504 | + width: 165 | ||
505 | + }); | ||
506 | + | ||
507 | + this.formPanel = new Ext.form.Panel( | ||
508 | + { | ||
509 | + region: 'center', | ||
510 | + bodyStyle: { background: '#dfe8f6' }, | ||
511 | + border: false, buttonAlign: 'left', | ||
512 | + trackResetOnLoad: true, //reset to the last loaded record | ||
561 | layout: { | 513 | layout: { |
562 | - type: 'hbox', | ||
563 | - align: 'stretch' | 514 | + type: 'vbox', |
515 | + align: 'stretch', | ||
516 | + defaultMargins: { top: 5, left: 5, bottom: 10, right: 10 } | ||
517 | + }, | ||
518 | + id: 'formSearch', | ||
519 | + defaults: { | ||
520 | + border: false | ||
564 | }, | 521 | }, |
565 | items: [ | 522 | items: [ |
566 | { | 523 | { |
567 | - flex: 3, | ||
568 | xtype: 'container', | 524 | xtype: 'container', |
569 | - border: false, | 525 | + flex: 2.5, |
570 | layout: { | 526 | layout: { |
571 | - type: 'table', | ||
572 | - columns: 3 | ||
573 | - }, | ||
574 | - defaultType: 'textfield', | ||
575 | - defaults: { | ||
576 | - labelAlign: 'top', | ||
577 | - labelPad: 0 | 527 | + type: 'hbox', |
528 | + align: 'stretch' | ||
578 | }, | 529 | }, |
579 | - items: [ | ||
580 | - this.fieldName, | ||
581 | - { xtype: 'component', width: 45}, | 530 | + items: [ |
582 | { | 531 | { |
583 | - fieldLabel: 'Last modification', | ||
584 | - xtype: 'displayfield', | ||
585 | - name : 'last_update', | ||
586 | - width: 165, | ||
587 | - renderer: function(value, field) { | ||
588 | - var tpl = new Ext.XTemplate('<p style="font-style:italic;color:gray;margin:0;">{date}</>'); | ||
589 | - var mod_date = 'Not saved'; | ||
590 | - if (value > 0) | ||
591 | - mod_date = Ext.Date.format(new Date(value*1000), "Y-m-d\\TH:i:s"); | ||
592 | - return tpl.apply({date: mod_date}); | 532 | + flex: 3, |
533 | + xtype: 'container', | ||
534 | + border: false, | ||
535 | + layout: { | ||
536 | + type: 'table', | ||
537 | + columns: 3 | ||
593 | }, | 538 | }, |
594 | - }, | ||
595 | - { | ||
596 | - xtype: 'combo', | ||
597 | - fieldLabel: 'Sampling mode', | ||
598 | - name: 'sampling_mode', | ||
599 | - queryMode: 'local', | ||
600 | - editable: false, | ||
601 | - valueField: 'id', | ||
602 | - displayField: 'name', | ||
603 | - store: samplingmode_store, | ||
604 | - value: samplingmode_store.first(), | ||
605 | - width: 165, | ||
606 | - listeners: { | ||
607 | - change: function(field, value) { | ||
608 | - this.timeStepField.setVisible(value != 'refparam'); | ||
609 | - this.refParamField.setVisible(value == 'refparam'); | 539 | + defaultType: 'textfield', |
540 | + defaults: { | ||
541 | + labelAlign: 'top', | ||
542 | + labelPad: 0 | ||
543 | + }, | ||
544 | + items: [ | ||
545 | + this.fieldName, | ||
546 | + { xtype: 'component', width: 45 }, | ||
547 | + { | ||
548 | + fieldLabel: 'Last modification', | ||
549 | + xtype: 'displayfield', | ||
550 | + name: 'last_update', | ||
551 | + width: 165, | ||
552 | + renderer: function (value, field) { | ||
553 | + var tpl = new Ext.XTemplate('<p style="font-style:italic;color:gray;margin:0;">{date}</>'); | ||
554 | + var mod_date = 'Not saved'; | ||
555 | + if (value > 0) | ||
556 | + mod_date = Ext.Date.format(new Date(value * 1000), "Y-m-d\\TH:i:s"); | ||
557 | + return tpl.apply({ date: mod_date }); | ||
558 | + }, | ||
610 | }, | 559 | }, |
611 | - scope: this | ||
612 | - } | ||
613 | - }, | ||
614 | - { | ||
615 | - xtype:'component', width: 45 | ||
616 | - }, | ||
617 | - this.samplingDefContainer, | ||
618 | - { | ||
619 | - xtype :'displayfield', width: 165, | ||
620 | - hideLabel: true, | ||
621 | - fieldStyle: 'display:inline-block;text-align:right', | ||
622 | - value: '<b style="top: 50%;position: relative;">Data Gap <img amda_clicktip="dataGap" src="js/resources/images/16x16/info_mini.png"/></b>' | ||
623 | - }, | ||
624 | - { | ||
625 | - xtype:'component', width: 45 | ||
626 | - }, | ||
627 | - { | ||
628 | - xtype: 'numberfield', name: 'gap', | ||
629 | - fieldLabel: 'if no data for interval', minValue : 1, | ||
630 | - labelAlign: 'top', hideTrigger : true, width: 165 | 560 | + { |
561 | + xtype: 'combo', | ||
562 | + fieldLabel: 'Sampling mode', | ||
563 | + name: 'sampling_mode', | ||
564 | + queryMode: 'local', | ||
565 | + editable: false, | ||
566 | + valueField: 'id', | ||
567 | + displayField: 'name', | ||
568 | + store: samplingmode_store, | ||
569 | + value: samplingmode_store.first(), | ||
570 | + width: 165, | ||
571 | + listeners: { | ||
572 | + change: function (field, value) { | ||
573 | + this.timeStepField.setVisible(value != 'refparam'); | ||
574 | + this.refParamField.setVisible(value == 'refparam'); | ||
575 | + }, | ||
576 | + scope: this | ||
577 | + } | ||
578 | + }, | ||
579 | + { | ||
580 | + xtype: 'component', width: 45 | ||
581 | + }, | ||
582 | + this.samplingDefContainer, | ||
583 | + { | ||
584 | + xtype: 'displayfield', width: 165, | ||
585 | + hideLabel: true, | ||
586 | + fieldStyle: 'display:inline-block;text-align:right', | ||
587 | + value: '<b style="top: 50%;position: relative;">Data Gap <img amda_clicktip="dataGap" src="js/resources/images/16x16/info_mini.png"/></b>' | ||
588 | + }, | ||
589 | + { | ||
590 | + xtype: 'component', width: 45 | ||
591 | + }, | ||
592 | + { | ||
593 | + xtype: 'numberfield', name: 'gap', | ||
594 | + fieldLabel: 'if no data for interval', minValue: 1, | ||
595 | + labelAlign: 'top', hideTrigger: true, width: 165 | ||
596 | + }, | ||
597 | + { | ||
598 | + xtype: 'textarea', | ||
599 | + name: 'description', | ||
600 | + fieldLabel: 'Description', | ||
601 | + width: 375, height: 70, | ||
602 | + colspan: 3 | ||
603 | + } | ||
604 | + ] | ||
631 | }, | 605 | }, |
632 | - { | ||
633 | - xtype: 'textarea', | ||
634 | - name: 'description', | ||
635 | - fieldLabel:'Description', | ||
636 | - width: 375, height: 70, | ||
637 | - colspan: 3 | 606 | + this.timeSelector |
607 | + ] | ||
608 | + }, | ||
609 | + this.constructionField | ||
610 | + ], | ||
611 | + fbar: [ | ||
612 | + { | ||
613 | + text: 'Do Search', | ||
614 | + scope: this, | ||
615 | + handler: function (button) { | ||
616 | + // update object with user's values | ||
617 | + // if the return is true (object had been updated) | ||
618 | + if (this.updateObject()) { | ||
619 | + // launch the search process | ||
620 | + this.doSearch(); | ||
638 | } | 621 | } |
639 | - ] | ||
640 | - }, | ||
641 | - this.timeSelector | ||
642 | - ] | ||
643 | - }, | ||
644 | - this.constructionField | ||
645 | - ], | ||
646 | - fbar: [ | ||
647 | - { | ||
648 | - text: 'Do Search', | ||
649 | - scope : this, | ||
650 | - handler: function(button){ | ||
651 | - // update object with user's values | ||
652 | - // if the return is true (object had been updated) | ||
653 | - if(this.updateObject()){ | ||
654 | - // launch the search process | ||
655 | - this.doSearch(); | ||
656 | } | 622 | } |
657 | - } | ||
658 | - }, | ||
659 | - { | ||
660 | - text: 'Save Request', | ||
661 | - scope: this, | ||
662 | - handler: function() | ||
663 | - { | ||
664 | - // update object with user's values | ||
665 | - // if the return is true (object had been updated) | ||
666 | - if (this.updateObject()) | 623 | + }, |
667 | { | 624 | { |
668 | - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
669 | - if (!searchModule) | ||
670 | - return; | ||
671 | - var me = this; | ||
672 | - | ||
673 | - searchModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) { | ||
674 | - if (!res) | ||
675 | - { | ||
676 | - me.fieldName.validFlag = 'Error during object validation'; | ||
677 | - myDesktopApp.errorMsg(me.fieldName.validFlag); | ||
678 | - me.fieldName.validate(); | ||
679 | - return; | ||
680 | - } | ||
681 | - | ||
682 | - if (!res.valid) | ||
683 | - { | ||
684 | - if (res.error) | ||
685 | - { | ||
686 | - if (res.error.search('subtree') != -1) { | ||
687 | - Ext.MessageBox.show({title:'Warning', | ||
688 | - msg: res.error+'<br/>Do you want to overwrite it?', | ||
689 | - width: 300, | ||
690 | - buttons: Ext.MessageBox.OKCANCEL, | ||
691 | - fn : me.overwriteProcess, | ||
692 | - icon: Ext.MessageBox.WARNING, | ||
693 | - scope : me | ||
694 | - }); | ||
695 | - me.fieldName.validFlag = true; | 625 | + text: 'Save Request', |
626 | + scope: this, | ||
627 | + handler: function () { | ||
628 | + // update object with user's values | ||
629 | + // if the return is true (object had been updated) | ||
630 | + if (this.updateObject()) { | ||
631 | + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
632 | + if (!searchModule) | ||
633 | + return; | ||
634 | + var me = this; | ||
635 | + | ||
636 | + searchModule.linkedNode.isValidName(this.fieldName.getValue(), function (res) { | ||
637 | + if (!res) { | ||
638 | + me.fieldName.validFlag = 'Error during object validation'; | ||
639 | + myDesktopApp.errorMsg(me.fieldName.validFlag); | ||
640 | + me.fieldName.validate(); | ||
641 | + return; | ||
696 | } | 642 | } |
697 | - else | ||
698 | - me.fieldName.validFlag = res.error; | ||
699 | - } | ||
700 | - else | ||
701 | - { | ||
702 | - me.fieldName.validFlag = 'Invalid object name'; | ||
703 | - myDesktopApp.errorMsg(me.fieldName.validFlag); | ||
704 | - } | ||
705 | - me.fieldName.validate(); | ||
706 | - return; | 643 | + |
644 | + if (!res.valid) { | ||
645 | + if (res.error) { | ||
646 | + if (res.error.search('subtree') != -1) { | ||
647 | + Ext.MessageBox.show({ | ||
648 | + title: 'Warning', | ||
649 | + msg: res.error + '<br/>Do you want to overwrite it?', | ||
650 | + width: 300, | ||
651 | + buttons: Ext.MessageBox.OKCANCEL, | ||
652 | + fn: me.overwriteProcess, | ||
653 | + icon: Ext.MessageBox.WARNING, | ||
654 | + scope: me | ||
655 | + }); | ||
656 | + me.fieldName.validFlag = true; | ||
657 | + } | ||
658 | + else | ||
659 | + me.fieldName.validFlag = res.error; | ||
660 | + } | ||
661 | + else { | ||
662 | + me.fieldName.validFlag = 'Invalid object name'; | ||
663 | + myDesktopApp.errorMsg(me.fieldName.validFlag); | ||
664 | + } | ||
665 | + me.fieldName.validate(); | ||
666 | + return; | ||
667 | + } | ||
668 | + | ||
669 | + me.fieldName.validFlag = true; | ||
670 | + me.fieldName.validate(); | ||
671 | + me.saveProcess(false); | ||
672 | + }); | ||
707 | } | 673 | } |
708 | - | ||
709 | - me.fieldName.validFlag = true; | ||
710 | - me.fieldName.validate(); | ||
711 | - me.saveProcess(false); | ||
712 | - }); | ||
713 | - } | ||
714 | - } | ||
715 | - }, | ||
716 | - { | ||
717 | - text: 'Reset', | ||
718 | - scope : this, | ||
719 | - handler: function() | ||
720 | - { | ||
721 | - var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
722 | - searchModule.createLinkedNode(); | ||
723 | - searchModule.createObject(); | ||
724 | - this.setObject(searchModule.getLinkedNode().get('object')); | ||
725 | - } | ||
726 | - } | ||
727 | - ] | ||
728 | - }); | ||
729 | - | ||
730 | - var myConf = { | ||
731 | - layout: 'border', | ||
732 | - defaults: { layout: 'fit', border: false }, | ||
733 | - items: | ||
734 | - [ | ||
735 | - this.formPanel, | ||
736 | - { | ||
737 | - xtype: 'panel', region: 'south', | ||
738 | - title: 'Information', | ||
739 | - collapsible: true, | ||
740 | - collapseMode: 'header', | ||
741 | - height: 100, | ||
742 | - autoHide: false, | ||
743 | - iconCls: 'icon-information', | ||
744 | - bodyStyle: 'padding:5px', | ||
745 | - loader: | ||
746 | - { | ||
747 | - autoLoad: true, | ||
748 | - url: helpDir+'dataMiningHOWTO' | ||
749 | - } | ||
750 | - } | ||
751 | - ], | ||
752 | - plugins: [ | ||
753 | - {ptype: 'calculator', myBtns:[], context: 'Condition'}, | ||
754 | - {ptype: 'paramArgumentsPlugin', pluginId: 'search-param-components-plugin'} | ||
755 | - ], | ||
756 | - listeners:{ | ||
757 | - click: { | ||
758 | - element: 'el', | ||
759 | - fn: function(e,t) { | ||
760 | - var me = t, | ||
761 | - text = me.getAttribute('amda_clicktip'); | ||
762 | - if (text) { | ||
763 | - e.preventDefault(); | ||
764 | - AmdaAction.getInfo({name : text}, function(res,e) { | ||
765 | - if (res.success) myDesktopApp.infoMsg(res.result); | ||
766 | - }); | 674 | + } |
675 | + }, | ||
676 | + { | ||
677 | + text: 'Reset', | ||
678 | + scope: this, | ||
679 | + handler: function () { | ||
680 | + var searchModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.search.id); | ||
681 | + searchModule.createLinkedNode(); | ||
682 | + searchModule.createObject(); | ||
683 | + this.setObject(searchModule.getLinkedNode().get('object')); | ||
684 | + } | ||
685 | + } | ||
686 | + ] | ||
687 | + }); | ||
688 | + | ||
689 | + var myConf = { | ||
690 | + layout: 'border', | ||
691 | + defaults: { layout: 'fit', border: false }, | ||
692 | + items: | ||
693 | + [ | ||
694 | + this.formPanel, | ||
695 | + { | ||
696 | + xtype: 'panel', region: 'south', | ||
697 | + title: 'Information', | ||
698 | + collapsible: true, | ||
699 | + collapseMode: 'header', | ||
700 | + height: 100, | ||
701 | + autoHide: false, | ||
702 | + iconCls: 'icon-information', | ||
703 | + bodyStyle: 'padding:5px', | ||
704 | + loader: | ||
705 | + { | ||
706 | + autoLoad: true, | ||
707 | + url: helpDir + 'dataMiningHOWTO' | ||
708 | + } | ||
709 | + } | ||
710 | + ], | ||
711 | + plugins: [ | ||
712 | + { ptype: 'calculator', myBtns: [], context: 'Condition' }, | ||
713 | + { ptype: 'paramArgumentsPlugin', pluginId: 'search-param-components-plugin' } | ||
714 | + ], | ||
715 | + listeners: { | ||
716 | + click: { | ||
717 | + element: 'el', | ||
718 | + fn: function (e, t) { | ||
719 | + var me = t, | ||
720 | + text = me.getAttribute('amda_clicktip'); | ||
721 | + if (text) { | ||
722 | + e.preventDefault(); | ||
723 | + AmdaAction.getInfo({ name: text }, function (res, e) { | ||
724 | + if (res.success) myDesktopApp.infoMsg(res.result); | ||
725 | + }); | ||
726 | + } | ||
767 | } | 727 | } |
768 | } | 728 | } |
769 | } | 729 | } |
770 | - } | ||
771 | - }; | 730 | + }; |
731 | + | ||
732 | + Ext.apply(this, Ext.apply(arguments, myConf)); | ||
733 | + } | ||
772 | 734 | ||
773 | - Ext.apply(this, Ext.apply(arguments, myConf)); | ||
774 | - } | ||
775 | - | ||
776 | -}); | 735 | + }); |
js/app/views/StatisticsUI.js
@@ -177,17 +177,17 @@ Ext.define('amdaUI.StatisticsUI', | @@ -177,17 +177,17 @@ Ext.define('amdaUI.StatisticsUI', | ||
177 | 177 | ||
178 | /** | 178 | /** |
179 | * Set Start-Stop from parameter info (Local & MyData) | 179 | * Set Start-Stop from parameter info (Local & MyData) |
180 | - */ | 180 | + |
181 | setTimeFromData: function (obj) { | 181 | setTimeFromData: function (obj) { |
182 | if (!obj.start || !obj.stop) | 182 | if (!obj.start || !obj.stop) |
183 | return; | 183 | return; |
184 | 184 | ||
185 | - var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | ||
186 | - var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | 185 | + //var dateStart = new Date(obj.start.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); |
186 | + //var dateStop = new Date(obj.stop.replace(/[T|Z]/g, ' ').replace(/\-/g, '\/')); | ||
187 | 187 | ||
188 | - this.formPanel.items.items[1].getForm().setValues({startDate: dateStart, stopDate: dateStop}); | ||
189 | - this.timeSelector.intervalSel.updateDuration(); | ||
190 | - }, | 188 | + //this.formPanel.items.items[1].getForm().setValues({startDate: dateStart, stopDate: dateStop}); |
189 | + // this.timeSelector.intervalSel.updateDuration(); | ||
190 | + }, */ | ||
191 | 191 | ||
192 | generateCatalog: function () | 192 | generateCatalog: function () |
193 | { | 193 | { |
js/app/views/TimeSelectorUI.js
@@ -61,6 +61,9 @@ Ext.define('amdaUI.TimeSelectorUI', { | @@ -61,6 +61,9 @@ Ext.define('amdaUI.TimeSelectorUI', { | ||
61 | getActiveTimeSource: function() { | 61 | getActiveTimeSource: function() { |
62 | return this.timeSrc.getActiveTab().getItemId(); | 62 | return this.timeSrc.getActiveTab().getItemId(); |
63 | }, | 63 | }, |
64 | + setActiveTimeSource : function (timeSrcIndex){ | ||
65 | + this.timeSrc.setActiveTab(timeSrcIndex); | ||
66 | + }, | ||
64 | 67 | ||
65 | isValid: function(acceptEmptyTTList = true) { | 68 | isValid: function(acceptEmptyTTList = true) { |
66 | if (this.getActiveTimeSource() === amdaModel.AmdaTimeObject.inputTimeSrc[0]) { | 69 | if (this.getActiveTimeSource() === amdaModel.AmdaTimeObject.inputTimeSrc[0]) { |
js/app/views/TimeTableUI.js
@@ -298,7 +298,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -298,7 +298,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
298 | var catNode = Ext.create('amdaModel.CatalogNode', {leaf: true}); | 298 | var catNode = Ext.create('amdaModel.CatalogNode', {leaf: true}); |
299 | catObj.set('relatedTimeTableId', id); | 299 | catObj.set('relatedTimeTableId', id); |
300 | creatDate = new Date(this.object.get('created')); | 300 | creatDate = new Date(this.object.get('created')); |
301 | - date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s'); | 301 | + date = Ext.Date.format(creatDate, 'Y-m-d\\TH:i:s.u'); |
302 | descr = 'Generated by CDPP/Amda Time Table Module \n' + 'From Time Table: ' + this.object.get('name') + ' which was generated on: ' + date + '\n'; | 302 | descr = 'Generated by CDPP/Amda Time Table Module \n' + 'From Time Table: ' + this.object.get('name') + ' which was generated on: ' + date + '\n'; |
303 | catObj.set('description', descr + this.object.get('description')); | 303 | catObj.set('description', descr + this.object.get('description')); |
304 | var nbParam = parseInt(text); | 304 | var nbParam = parseInt(text); |
@@ -510,8 +510,8 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -510,8 +510,8 @@ Ext.define('amdaUI.TimeTableUI', { | ||
510 | {type: 'numeric', dataIndex: 'durationHour'}, | 510 | {type: 'numeric', dataIndex: 'durationHour'}, |
511 | {type: 'numeric', dataIndex: 'durationMin'}, | 511 | {type: 'numeric', dataIndex: 'durationMin'}, |
512 | {type: 'numeric', dataIndex: 'durationSec'}, | 512 | {type: 'numeric', dataIndex: 'durationSec'}, |
513 | - {type: 'date', dataIndex: 'start', dateFormat: 'Y-m-d'}, | ||
514 | - {type: 'date', dataIndex: 'stop', dateFormat: 'Y-m-d'} | 513 | + {type: 'date', dataIndex: 'start', dateFormat: 'c'}, |
514 | + {type: 'date', dataIndex: 'stop', dateFormat: 'c'} | ||
515 | ] | 515 | ] |
516 | }; | 516 | }; |
517 | var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { | 517 | var cellEditing = Ext.create('Ext.grid.plugin.CellEditing', { |
@@ -542,7 +542,7 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -542,7 +542,7 @@ Ext.define('amdaUI.TimeTableUI', { | ||
542 | 'isCatalog': false, | 542 | 'isCatalog': false, |
543 | 'data': {} | 543 | 'data': {} |
544 | }; | 544 | }; |
545 | - obj['data'][activeColumn.dataIndex] = value; | 545 | + obj['data'][activeColumn.dataIndex] = Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); |
546 | 546 | ||
547 | //context.grid.getSelectionModel().deselectAll(); | 547 | //context.grid.getSelectionModel().deselectAll(); |
548 | //Interval is modified on the server side | 548 | //Interval is modified on the server side |
@@ -612,13 +612,13 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -612,13 +612,13 @@ Ext.define('amdaUI.TimeTableUI', { | ||
612 | }, | 612 | }, |
613 | { | 613 | { |
614 | header: 'Start Time', dataIndex: 'start', width: 120, | 614 | header: 'Start Time', dataIndex: 'start', width: 120, |
615 | - editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s'}, | 615 | + editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s.u'}, |
616 | renderer: function (value) { | 616 | renderer: function (value) { |
617 | if (value != null) { | 617 | if (value != null) { |
618 | if (Ext.isDate(value)) { | 618 | if (Ext.isDate(value)) { |
619 | - return Ext.Date.format(value, 'Y-m-d\\TH:i:s'); | 619 | + return Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); |
620 | } else { | 620 | } else { |
621 | - return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s'); | 621 | + return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s.u'); |
622 | } | 622 | } |
623 | } else { | 623 | } else { |
624 | return value; | 624 | return value; |
@@ -627,13 +627,13 @@ Ext.define('amdaUI.TimeTableUI', { | @@ -627,13 +627,13 @@ Ext.define('amdaUI.TimeTableUI', { | ||
627 | }, | 627 | }, |
628 | { | 628 | { |
629 | header: 'Stop Time', dataIndex: 'stop', width: 120, | 629 | header: 'Stop Time', dataIndex: 'stop', width: 120, |
630 | - editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s'}, | 630 | + editor: {xtype: 'datefield', allowBlank: false, hideTrigger: true, format: 'Y-m-d\\TH:i:s.u'}, |
631 | renderer: function (value) { | 631 | renderer: function (value) { |
632 | if (value != null) { | 632 | if (value != null) { |
633 | if (Ext.isDate(value)) { | 633 | if (Ext.isDate(value)) { |
634 | - return Ext.Date.format(value, 'Y-m-d\\TH:i:s'); | 634 | + return Ext.Date.format(value, 'Y-m-d\\TH:i:s.u'); |
635 | } else { | 635 | } else { |
636 | - return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s'); | 636 | + return Ext.Date.format(new Date(value), 'Y-m-d\\TH:i:s.u'); |
637 | } | 637 | } |
638 | } else { | 638 | } else { |
639 | return value; | 639 | return value; |
php/classes/AmdaAction.php
@@ -247,8 +247,8 @@ class AmdaAction | @@ -247,8 +247,8 @@ class AmdaAction | ||
247 | $info .= "<br/>Time Range : depending on mission selection"; | 247 | $info .= "<br/>Time Range : depending on mission selection"; |
248 | else | 248 | else |
249 | $info .= "<br/>Time Range : undefined"; | 249 | $info .= "<br/>Time Range : undefined"; |
250 | - $child->setAttribute('dataStart', date("Y-m-d\TH:i:s\Z", strtotime(' -1 day'))); | ||
251 | - $child->setAttribute('dataStop', date("Y-m-d\TH:i:s\Z", time())); | 250 | + $child->setAttribute('dataStart', date("Y-m-d\TH:i:s.u\Z", strtotime(' -1 day'))); |
251 | + $child->setAttribute('dataStop', date("Y-m-d\TH:i:s.u\Z", time())); | ||
252 | } else { | 252 | } else { |
253 | $info .= "<br/>Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop'); | 253 | $info .= "<br/>Time Range: ".$child->getAttribute('dataStart')."-".$child->getAttribute('dataStop'); |
254 | } | 254 | } |
@@ -366,7 +366,7 @@ class AmdaAction | @@ -366,7 +366,7 @@ class AmdaAction | ||
366 | else { | 366 | else { |
367 | if (!empty($timeRestriction)) { | 367 | if (!empty($timeRestriction)) { |
368 | $disable = FALSE; | 368 | $disable = FALSE; |
369 | - $formattedTimeRestriction = date("Y-m-d\TH:i:s\Z",strtotime($timeRestriction)+1); | 369 | + $formattedTimeRestriction = date("Y-m-d\TH:i:s.u\Z",strtotime($timeRestriction)+1); |
370 | $info .= "<br/><b>After $formattedTimeRestriction data are restricted to group ".$child->getAttribute('group')."</b>"; | 370 | $info .= "<br/><b>After $formattedTimeRestriction data are restricted to group ".$child->getAttribute('group')."</b>"; |
371 | } | 371 | } |
372 | else { | 372 | else { |
@@ -478,15 +478,15 @@ class AmdaAction | @@ -478,15 +478,15 @@ class AmdaAction | ||
478 | 478 | ||
479 | if ($child->tagName == 'parameter'){ | 479 | if ($child->tagName == 'parameter'){ |
480 | if ($child->parentNode->hasAttribute('dataStart')){ | 480 | if ($child->parentNode->hasAttribute('dataStart')){ |
481 | - $globalStart = date('Y-m-d\TH:i:s\Z', strtotime($child->parentNode->getAttribute('dataStart'))); | ||
482 | - $globalStop = date('Y-m-d\TH:i:s\Z', strtotime($child->parentNode->getAttribute('dataStop'))); | 481 | + $globalStart = date('Y-m-d\TH:i:s.u\Z', strtotime($child->parentNode->getAttribute('dataStart'))); |
482 | + $globalStop = date('Y-m-d\TH:i:s.u\Z', strtotime($child->parentNode->getAttribute('dataStop'))); | ||
483 | } | 483 | } |
484 | } | 484 | } |
485 | 485 | ||
486 | if ( $child->tagName == 'component'){ | 486 | if ( $child->tagName == 'component'){ |
487 | if ($child->parentNode->parentNode->hasAttribute('dataStart')){ | 487 | if ($child->parentNode->parentNode->hasAttribute('dataStart')){ |
488 | - $globalStart = date('Y-m-d\TH:i:s\Z', strtotime($child->parentNode->getAttribute('dataStart'))); | ||
489 | - $globalStop = date('Y-m-d\TH:i:s\Z', strtotime($child->parentNode->getAttribute('dataStop'))); | 488 | + $globalStart = date('Y-m-d\TH:i:s.u\Z', strtotime($child->parentNode->getAttribute('dataStart'))); |
489 | + $globalStop = date('Y-m-d\TH:i:s.u\Z', strtotime($child->parentNode->getAttribute('dataStop'))); | ||
490 | } | 490 | } |
491 | } | 491 | } |
492 | 492 | ||
@@ -678,7 +678,7 @@ class AmdaAction | @@ -678,7 +678,7 @@ class AmdaAction | ||
678 | $result = $this->executeRequest((Object) array( | 678 | $result = $this->executeRequest((Object) array( |
679 | 'compression' => 'none', | 679 | 'compression' => 'none', |
680 | 'fileformat' => 'internal', | 680 | 'fileformat' => 'internal', |
681 | - 'timeformat' => 'YYYY-MM-DDThh:mm:ss', | 681 | + 'timeformat' => 'YYYY-MM-DDThh:mm:ss.u', |
682 | 'sendToSamp' => FALSE, | 682 | 'sendToSamp' => FALSE, |
683 | 'list' => array( | 683 | 'list' => array( |
684 | (Object) array( | 684 | (Object) array( |
php/classes/CatalogCacheIntervalObject.php
@@ -59,7 +59,7 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject | @@ -59,7 +59,7 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject | ||
59 | fwrite($handle,pack('d', floatval($value))); | 59 | fwrite($handle,pack('d', floatval($value))); |
60 | break; | 60 | break; |
61 | case 1: //date (timestamp) | 61 | case 1: //date (timestamp) |
62 | - fwrite($handle,pack('L', TimeUtils::iso2stamp($value))); | 62 | + fwrite($handle,pack('d', TimeUtils::iso2stamp($value))); |
63 | break; | 63 | break; |
64 | case 2: //string | 64 | case 2: //string |
65 | fwrite($handle,pack('L', strlen($value))); | 65 | fwrite($handle,pack('L', strlen($value))); |
@@ -101,7 +101,7 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject | @@ -101,7 +101,7 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject | ||
101 | $val = $res['val']; | 101 | $val = $res['val']; |
102 | break; | 102 | break; |
103 | case 1: //date (timestamp) | 103 | case 1: //date (timestamp) |
104 | - if (!$res = unpack('Lval',fread($handle,4))) { | 104 | + if (!$res = unpack('dval',fread($handle,8))) { |
105 | break; | 105 | break; |
106 | } | 106 | } |
107 | $val = TimeUtils::stamp2iso($res['val']); | 107 | $val = TimeUtils::stamp2iso($res['val']); |
php/classes/RequestMgr.php
@@ -94,9 +94,10 @@ class RequestMgr extends AmdaObjectMgr | @@ -94,9 +94,10 @@ class RequestMgr extends AmdaObjectMgr | ||
94 | $time = strtotime($obj->startDate); | 94 | $time = strtotime($obj->startDate); |
95 | 95 | ||
96 | $interval = $obj->durationDay*86400 + | 96 | $interval = $obj->durationDay*86400 + |
97 | - $obj->durationHour*3600 + | ||
98 | - $obj->durationMin*60 + $obj->durationSec; | 97 | + $obj->durationHour*3600 + |
98 | + $obj->durationMin*60 + $obj->durationSec; | ||
99 | $stopTime = gmdate("Y-m-d\TH:i:s", $time+$interval); | 99 | $stopTime = gmdate("Y-m-d\TH:i:s", $time+$interval); |
100 | + $stopTime = $stopTime.'.'.$obj->durationMs; | ||
100 | $obj->stopDate = $stopTime; | 101 | $obj->stopDate = $stopTime; |
101 | 102 | ||
102 | return $obj; | 103 | return $obj; |
php/classes/TimeTableCacheIntervalObject.php
@@ -107,17 +107,27 @@ class TimeTableCacheIntervalObject | @@ -107,17 +107,27 @@ class TimeTableCacheIntervalObject | ||
107 | } | 107 | } |
108 | 108 | ||
109 | public function writeBin($handle) { | 109 | public function writeBin($handle) { |
110 | - fwrite($handle,pack('L6',$this->id,$this->index,$this->start,$this->stop,$this->isNew,$this->isModified)); | 110 | + |
111 | + fwrite($handle,pack('L2',$this->id,$this->index)); | ||
112 | + fwrite($handle,pack('d2', $this->start,$this->stop)); | ||
113 | + fwrite($handle, pack('L2', $this->isNew,$this->isModified)); | ||
111 | } | 114 | } |
112 | 115 | ||
113 | public function loadBin($handle) { | 116 | public function loadBin($handle) { |
114 | - $array = unpack('L6int',fread($handle,6*4)); | ||
115 | - $this->id = $array['int1']; | ||
116 | - $this->index = $array['int2']; | ||
117 | - $this->start = $array['int3']; | ||
118 | - $this->stop = $array['int4']; | ||
119 | - $this->isNew = $array['int5']; | ||
120 | - $this->isModified = $array['int6']; | 117 | + |
118 | + $res = unpack('L2int',fread($handle,4*2)); | ||
119 | + $this->id = $res['int1']; | ||
120 | + $this->index = $res['int2']; | ||
121 | + | ||
122 | + $res = unpack('d2d',fread($handle,8*2)); | ||
123 | + $this->start = $res['d1']; | ||
124 | + $this->stop = $res['d2']; | ||
125 | + | ||
126 | + | ||
127 | + $res = unpack('L2int',fread($handle,4*2)); | ||
128 | + $this->isNew = $res['int1']; | ||
129 | + $this->isModified = $res['int2']; | ||
130 | + | ||
121 | } | 131 | } |
122 | 132 | ||
123 | public function dump() { | 133 | public function dump() { |
php/classes/TimeTableCacheMgr.php
@@ -240,10 +240,10 @@ | @@ -240,10 +240,10 @@ | ||
240 | $index = 0; | 240 | $index = 0; |
241 | 241 | ||
242 | if (!isset($start)) | 242 | if (!isset($start)) |
243 | - $start = date('Y-m-d\TH:i:s'); | 243 | + $start = date('Y-m-d\TH:i:s.u'); |
244 | 244 | ||
245 | if (!isset($stop)) | 245 | if (!isset($stop)) |
246 | - $stop = date('Y-m-d\TH:i:s'); | 246 | + $stop = date('Y-m-d\TH:i:s.u'); |
247 | 247 | ||
248 | $this->cache->addInterval(array('start' => $start, 'stop' => $stop), true, $index); | 248 | $this->cache->addInterval(array('start' => $start, 'stop' => $stop), true, $index); |
249 | 249 |
php/classes/TimeTableMgr.php
@@ -200,7 +200,7 @@ class TimeTableMgr extends AmdaObjectMgr | @@ -200,7 +200,7 @@ class TimeTableMgr extends AmdaObjectMgr | ||
200 | } | 200 | } |
201 | 201 | ||
202 | $this->id = $this->setId(); | 202 | $this->id = $this->setId(); |
203 | - $this->created = date('Y-m-d\TH:i:s'); | 203 | + $this->created = date('Y-m-d\TH:i:s.u'); |
204 | if (!$this->id) { | 204 | if (!$this->id) { |
205 | return ['error' => ID_CREATION_ERROR]; | 205 | return ['error' => ID_CREATION_ERROR]; |
206 | } | 206 | } |
php/classes/TimeUtils.php
@@ -9,13 +9,18 @@ class TimeUtils | @@ -9,13 +9,18 @@ class TimeUtils | ||
9 | catch (Exception $e) { | 9 | catch (Exception $e) { |
10 | $time = new DateTime('1970-01-01T00:00:00Z'); | 10 | $time = new DateTime('1970-01-01T00:00:00Z'); |
11 | } | 11 | } |
12 | - $stamp = $time->format('U'); | 12 | + $stamp = $time->format('U.u'); |
13 | unset($time); | 13 | unset($time); |
14 | return $stamp; | 14 | return $stamp; |
15 | } | 15 | } |
16 | 16 | ||
17 | public static function stamp2iso($stamp) { | 17 | public static function stamp2iso($stamp) { |
18 | - return date('Y-m-d\TH:i:s',$stamp); | 18 | + $intStamp = floor($stamp); |
19 | + $intMilli = round(($stamp-$intStamp)*1000); | ||
20 | + // c'est moche mais setTime de php ne prends pas en compte les ms | ||
21 | + $strMilli = str_pad(strval($intMilli),3, '0', STR_PAD_LEFT); | ||
22 | + $dateIso = date("Y-m-d\TH:i:s",$intStamp).'.'.$strMilli; | ||
23 | + return $dateIso; | ||
19 | } | 24 | } |
20 | } | 25 | } |
21 | 26 |