Commit fdf1413b728ea7fa54e005976cfba24d497d3767
1 parent
501f5f6c
Exists in
master
and in
111 other branches
TT download
Showing
7 changed files
with
1236 additions
and
1291 deletions
Show diff stats
js/app/AmdaApp.js
... | ... | @@ -501,8 +501,7 @@ Ext.define('amdaApp.AmdaApp', { |
501 | 501 | msg += ('<b>Groups :</b> '+result['group']+'<br/>'); |
502 | 502 | msg += ('<b>Email :</b> '+result['email']+'<br/>'); |
503 | 503 | msg += ('<b>Registration date :</b> '+result['date']+'<br/>'); |
504 | - msg += ('<b>Receive Newsletter :</b> '+(result['news'] == "1"?"true":"false")+'<br/>'); | |
505 | - | |
504 | + | |
506 | 505 | this.infoMsg(msg); |
507 | 506 | } |
508 | 507 | else |
... | ... |
js/app/models/Download.js
... | ... | @@ -3,120 +3,117 @@ |
3 | 3 | * Name : Download.js |
4 | 4 | * Description : Download Request Business Object Definition |
5 | 5 | * @class amdaModel.Download |
6 | - * @extends amdaModel.AmdaObject | |
7 | - * | |
6 | + * @extends amdaModel.AmdaTimeObject | |
8 | 7 | * @author myriam |
9 | 8 | * @version $Id: Download.js 2068 2014-02-06 11:27:38Z elena $ |
10 | - ****************************************************************************** | |
11 | - * FT Id : Date : Name - Description | |
12 | - ****************************************************************************** | |
13 | - * : :15/12/2011: myriam โ creation | |
14 | 9 | */ |
15 | 10 | |
16 | 11 | |
17 | 12 | Ext.define('amdaModel.Download', { |
18 | - extend: 'amdaModel.AmdaTimeObject', | |
13 | + extend: 'amdaModel.AmdaTimeObject', | |
19 | 14 | |
20 | - fields : [ | |
21 | - {name: 'type', type: 'string', defaultValue: 'Download'}, | |
22 | - {name: 'downloadSrc', type: 'string'}, | |
23 | - {name: 'list', defaultValue: null }, // array of parameters | |
24 | - {name: 'timeformat', type: 'string'}, | |
25 | - {name: 'timeformatTT', type: 'string'}, | |
26 | - {name: 'structure', type: 'string'}, | |
27 | - {name: 'refparamSampling', type: 'boolean', defaultValue: false}, | |
28 | - {name: 'sampling', type: 'int', defaultValue: '600'}, | |
29 | - {name: 'fileprefix', type: 'string'}, | |
30 | - {name: 'fileformat', type: 'string'}, | |
31 | - {name: 'fileformatTT', type: 'string'}, | |
32 | - {name: 'compression', type: 'string'}, | |
33 | - {name: 'compressionTT', type: 'string'} | |
15 | + fields : [ | |
16 | + {name: 'type', type: 'string', defaultValue: 'Download'}, | |
17 | + {name: 'downloadSrc', type: 'string'}, | |
18 | + {name: 'list', defaultValue: null }, // array of parameters | |
19 | + {name: 'timeformat', type: 'string'}, | |
20 | + {name: 'timeformatTT', type: 'string'}, | |
21 | + {name: 'structure', type: 'string'}, | |
22 | + {name: 'refparamSampling', type: 'boolean', defaultValue: false}, | |
23 | + {name: 'sampling', type: 'int', defaultValue: '600'}, | |
24 | + {name: 'fileprefix', type: 'string'}, | |
25 | + {name: 'fileformat', type: 'string'}, | |
26 | + {name: 'fileformatTT', type: 'string'}, | |
27 | + {name: 'compression', type: 'string'}, | |
28 | + {name: 'compressionTT', type: 'string'} | |
34 | 29 | ], |
35 | - | |
30 | + | |
36 | 31 | propertiesToCopy : 'id,name,downloadSrc,refparamSampling,sampling,list,timeformat,timeformatTT,structure,fileprefix,fileformat,fileformatTT,compression,compressionTT', |
37 | 32 | |
38 | 33 | getJsonValues : function(){ |
39 | 34 | |
40 | - var myValues = new Object(); | |
41 | - myValues.nodeType = 'download';//amdaModel.DownloadNode.nodeType; | |
42 | - myValues.type = this.get('type'); | |
43 | - myValues.downloadSrc = this.get('downloadSrc'); | |
44 | -//Data download | |
45 | - if (myValues.downloadSrc === '0') { // Data download | |
46 | - myValues.structure = this.get('structure'); | |
47 | - myValues.refparamSampling = this.get('refparamSampling'); | |
48 | - myValues.sampling = this.get('sampling'); | |
49 | - myValues.fileprefix = this.get('fileprefix'); | |
50 | - | |
51 | - myValues.timesrc = this.get('timesrc'); | |
52 | - // if there's at least one timeTable in case of Download data | |
53 | - if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ | |
54 | - // get complete timeTables collection | |
55 | - var timeTables = this.get('timeTables'); | |
56 | - // init an empty array for timeTables | |
57 | - myValues.timeTables=[]; | |
58 | - // for each interval record | |
59 | - Ext.Array.each(timeTables, function(item, index, all){ | |
60 | - // get Json simplified value | |
61 | - if (!item.$className) { | |
62 | - myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id}; | |
63 | - } | |
64 | - // get Json simplified value | |
65 | - else { | |
66 | - myValues.timeTables[index] = item.getJsonValues(); | |
67 | - } | |
68 | - }); | |
69 | - } else { | |
70 | - myValues.startDate = this.get('startDate'); | |
71 | - myValues.stopDate = this.get('stopDate'); | |
72 | - myValues.durationDay = this.get('durationDay'); | |
73 | - myValues.durationHour = this.get('durationHour'); | |
74 | - myValues.durationMin = this.get('durationMin'); | |
75 | - myValues.durationSec = this.get('durationSec'); | |
76 | - } | |
77 | - | |
78 | - // if there's at least one parameter | |
79 | - if (this.get('list') && this.get('list').length) { | |
80 | - var list = this.get('list'); | |
81 | - myValues.list=[]; | |
82 | - | |
83 | - Ext.each(list, function(item, index){ | |
84 | - myValues.list[index] = item.getJsonValues(); | |
85 | - }); | |
86 | - } | |
87 | - myValues.fileformat = this.get('fileformat'); | |
88 | - myValues.timeformat = this.get('timeformat'); | |
89 | - myValues.compression = this.get('compression'); | |
90 | - } | |
91 | - else if (myValues.downloadSrc === '1'){ // TT download | |
92 | - // if there's at least one timeTable | |
93 | - if (this.get('timeTables') && this.get('timeTables').length) { | |
94 | - var list = this.get('timeTables'); | |
95 | - myValues.list=[]; | |
96 | - | |
97 | - Ext.each(list, function(item, index){ | |
98 | - myValues.list[index]=item.get('id'); | |
99 | - }); | |
100 | - } | |
101 | - myValues.fileformat = this.get('fileformatTT'); | |
102 | - myValues.timeformat = this.get('timeformatTT'); | |
103 | - myValues.compression = this.get('compressionTT'); | |
104 | - } | |
105 | - else { // fits images download | |
106 | - myValues.list=[]; | |
107 | - if (this.get('list') && this.get('list').length) | |
108 | - Ext.each(this.get('list'), function(item, index){ | |
109 | - var image = new Object(); | |
110 | - image.name = item['name']; | |
111 | - image.url = item['url']; | |
112 | - myValues.list[index] = image; | |
113 | - }); | |
114 | - myValues.compression = this.get('compression'); | |
115 | - } | |
116 | - | |
117 | - myValues.leaf = true; | |
118 | - // myValues.nodeType = amdaModel.PlotNode.nodeType; | |
119 | - return myValues; | |
120 | - } | |
121 | - | |
35 | + var myValues = new Object(); | |
36 | + myValues.nodeType = 'download';//amdaModel.DownloadNode.nodeType; | |
37 | + myValues.type = this.get('type'); | |
38 | + myValues.downloadSrc = this.get('downloadSrc'); | |
39 | + //Data download | |
40 | + if (myValues.downloadSrc === '0') { // Data download | |
41 | + myValues.structure = this.get('structure'); | |
42 | + myValues.refparamSampling = this.get('refparamSampling'); | |
43 | + myValues.sampling = this.get('sampling'); | |
44 | + myValues.fileprefix = this.get('fileprefix'); | |
45 | + | |
46 | + myValues.timesrc = this.get('timesrc'); | |
47 | + // if there's at least one timeTable in case of Download data | |
48 | + if (this.get('timesrc') == amdaModel.AmdaTimeObject.inputTimeSrc[0] && this.get('timeTables') && this.get('timeTables').length){ | |
49 | + // get complete timeTables collection | |
50 | + var timeTables = this.get('timeTables'); | |
51 | + // init an empty array for timeTables | |
52 | + myValues.timeTables=[]; | |
53 | + // for each interval record | |
54 | + Ext.Array.each(timeTables, function(item, index, all){ | |
55 | + // get Json simplified value | |
56 | + if (!item.$className) { | |
57 | + myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id}; | |
58 | + } | |
59 | + // get Json simplified value | |
60 | + else { | |
61 | + myValues.timeTables[index] = item.getJsonValues(); | |
62 | + } | |
63 | + }); | |
64 | + } else { | |
65 | + myValues.startDate = this.get('startDate'); | |
66 | + myValues.stopDate = this.get('stopDate'); | |
67 | + myValues.durationDay = this.get('durationDay'); | |
68 | + myValues.durationHour = this.get('durationHour'); | |
69 | + myValues.durationMin = this.get('durationMin'); | |
70 | + myValues.durationSec = this.get('durationSec'); | |
71 | + } | |
72 | + | |
73 | + // if there's at least one parameter | |
74 | + if (this.get('list') && this.get('list').length) { | |
75 | + var list = this.get('list'); | |
76 | + myValues.list=[]; | |
77 | + Ext.each(list, function(item, index){ | |
78 | + myValues.list[index] = item.getJsonValues(); | |
79 | + }); | |
80 | + } | |
81 | + myValues.fileformat = this.get('fileformat'); | |
82 | + myValues.timeformat = this.get('timeformat'); | |
83 | + myValues.compression = this.get('compression'); | |
84 | + } | |
85 | + // TT download | |
86 | + else if (myValues.downloadSrc === '1') { | |
87 | + // if there's at least one timeTable | |
88 | + if (this.get('timeTables') && this.get('timeTables').length) { | |
89 | + var list = this.get('timeTables'); | |
90 | + myValues.list=[]; | |
91 | + | |
92 | + Ext.each(list, function(item, index){ | |
93 | + var tt = new Object(); | |
94 | + tt.name = item.get('name'); | |
95 | + tt.id = item.get('id'); | |
96 | + myValues.list[index] = tt; | |
97 | + }); | |
98 | + } | |
99 | + myValues.fileformat = this.get('fileformatTT'); | |
100 | + myValues.timeformat = this.get('timeformatTT'); | |
101 | + myValues.compression = this.get('compressionTT'); | |
102 | + } | |
103 | + // fits images download | |
104 | + else { | |
105 | + myValues.list=[]; | |
106 | + if (this.get('list') && this.get('list').length) | |
107 | + Ext.each(this.get('list'), function(item, index){ | |
108 | + var image = new Object(); | |
109 | + image.name = item['name']; | |
110 | + image.url = item['url']; | |
111 | + myValues.list[index] = image; | |
112 | + }); | |
113 | + myValues.compression = this.get('compression'); | |
114 | + } | |
115 | + myValues.leaf = true; | |
116 | + // myValues.nodeType = amdaModel.PlotNode.nodeType; | |
117 | + return myValues; | |
118 | + } | |
122 | 119 | }); |
... | ... |
js/app/models/DownloadNode.js
... | ... | @@ -2,17 +2,16 @@ |
2 | 2 | * Project : AMDA-NG4 |
3 | 3 | * Name : DownloadNode.js |
4 | 4 | * @class amdaModel.DownloadNode |
5 | - * @extends amdaModel.ExecutableNode | |
5 | + * @extends Ext.data.Model | |
6 | 6 | * @brief Basic Model of Node corresponding to a download request |
7 | 7 | * @author Myriam |
8 | 8 | * @version $Id: DownloadNode.js 2949 2015-06-23 10:25:59Z elena $ |
9 | 9 | */ |
10 | -//TODO amdaModel.SingletonNode class ??? | |
10 | + | |
11 | 11 | Ext.define('amdaModel.DownloadNode', { |
12 | 12 | |
13 | - extend: 'Ext.data.Model', | |
14 | - | |
15 | - singleton: true, | |
13 | + extend: 'Ext.data.Model', | |
14 | + singleton: true, | |
16 | 15 | |
17 | 16 | fields:[{name : 'downloadType', type : 'string'}, |
18 | 17 | {name: 'object', type: 'object'}, |
... | ... | @@ -23,257 +22,206 @@ Ext.define('amdaModel.DownloadNode', { |
23 | 22 | {name: 'jobNode', type: 'string', defaultValue: 'amdaModel.BkgJobNode'} |
24 | 23 | ], |
25 | 24 | |
26 | - isExecutable: function(){ | |
27 | - return true; | |
28 | - }, | |
29 | - | |
30 | -//TODO MIXINS | |
25 | + isExecutable: function(){ | |
26 | + return true; | |
27 | + }, | |
31 | 28 | |
32 | - getObjectCallback : function(result,remoteEvent){ | |
33 | - var t = remoteEvent.getTransaction(); | |
34 | - if (result) { | |
35 | - var paramObj = Ext.create(this.get('objectDataModel'), result); | |
36 | - // set parameter into node | |
37 | - this.set('object', paramObj); | |
38 | - var downObject = amdaModel.DownloadNode.decodeObject(); | |
39 | - // Edition ; | |
40 | - amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject)); | |
41 | - amdaModel.DownloadNode.editInModule(); | |
42 | - } | |
43 | - else { | |
44 | - // EXCEPTION : parameter not found !? | |
45 | - alert(t.action + "." + t.method + " : No parameter '" | |
46 | - +this.get('name')+"' found!"); | |
47 | - //TODO: adding an error log | |
48 | - } | |
49 | - }, | |
29 | + getObjectCallback : function(result,remoteEvent){ | |
30 | + var t = remoteEvent.getTransaction(); | |
31 | + if (result) { | |
32 | + var paramObj = Ext.create(this.get('objectDataModel'), result); | |
33 | + // set parameter into node | |
34 | + this.set('object', paramObj); | |
35 | + var downObject = amdaModel.DownloadNode.decodeObject(); | |
36 | + // Edition ; | |
37 | + amdaModel.DownloadNode.set('object',Ext.create('amdaModel.Download',downObject)); | |
38 | + amdaModel.DownloadNode.editInModule(); | |
39 | + } | |
40 | + else { | |
41 | + myDesktopApp.errorMsg(t.action + "." + t.method + " : No parameter '" | |
42 | + +this.get('name')+"' found!"); | |
43 | + // EXCEPTION : parameter not found !? | |
44 | + } | |
45 | + }, | |
50 | 46 | |
51 | - editInModule : function () { | |
52 | - var me = this; | |
53 | - myDesktopApp.getLoadedModule(this.get('moduleId'), true, function (module) { | |
54 | - // If the node to edit is not already linked to this module | |
55 | - | |
56 | - if (module.getLinkedNode() != me) { | |
57 | - // set relative node into parameter Module | |
58 | - module.setLinkedNode(me); | |
59 | - } | |
60 | - else {// the node to edit is already edited | |
61 | - //TODO: TBD : message to user | |
62 | - //Sol1: msg alert: "warning this node is already edited! If you want to get the original, please press the 'reset' button"->'OK' | |
63 | - //Sol2: msg with user choice: "warning this node is already edited! Would you confirm this action and lost your modification?"->'Confirm','Cancel' | |
64 | - } | |
65 | - // Opening parameter window | |
66 | - module.createWindow(); | |
67 | - }); | |
68 | - }, | |
47 | + editInModule : function () { | |
48 | + var me = this; | |
49 | + myDesktopApp.getLoadedModule(this.get('moduleId'), true, function (module) { | |
50 | + // If the node to edit is not already linked to this module | |
51 | + if (module.getLinkedNode() != me) { | |
52 | + // set relative node into parameter Module | |
53 | + module.setLinkedNode(me); | |
54 | + } | |
55 | + else {// the node to edit is already edited | |
56 | + //TODO: TBD : message to user | |
57 | + //Sol1: msg alert: "warning this node is already edited! If you want to get the original, please press the 'reset' button"->'OK' | |
58 | + //Sol2: msg with user choice: "warning this node is already edited! Would you confirm this action and lost your modification?"->'Confirm','Cancel' | |
59 | + } | |
60 | + // Opening parameter window | |
61 | + module.createWindow(); | |
62 | + }); | |
63 | + }, | |
69 | 64 | |
70 | - decodeObject: function(obj) { | |
71 | - var myValues = new Object(); | |
72 | - myValues.list=[]; | |
73 | - | |
74 | - if (!obj) { | |
75 | - var fullObject = this.get('realLinkedNode').get('object'); | |
76 | - } | |
77 | - else { | |
78 | - var fullObject = obj; | |
79 | - } | |
80 | - | |
81 | - var i = 0; | |
82 | - fullObject.tabs().each(function (tab) { | |
83 | - tab.panels().each(function (panel) { | |
84 | - panel.params().each(function (param) { | |
85 | - myValues.list[i] = param.get('paramid'); | |
86 | - ++i; | |
87 | - }); | |
88 | - }); | |
89 | - | |
90 | - }); | |
91 | - | |
92 | - myValues.name = fullObject.get('name'); | |
93 | - myValues.timesrc = fullObject.get('timesrc'); | |
94 | - // if there's at least one timeTable name into 'timeTables' collection | |
95 | - if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0] | |
96 | - && fullObject.get('timeTables') | |
97 | - && fullObject.get('timeTables').length ){ | |
98 | - // get complete timeTables collection | |
99 | - var timeTables = fullObject.get('timeTables'); | |
100 | - // init an empty array for timeTables | |
101 | - myValues.timeTables=[]; | |
102 | - // for each interval record | |
103 | - Ext.Array.each(timeTables, function(item, index, all){ | |
104 | - if (!item.$className) { | |
105 | - myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id}; | |
65 | + decodeObject: function(obj) { | |
66 | + var myValues = new Object(); | |
67 | + myValues.list=[]; | |
68 | + | |
69 | + if (!obj) { | |
70 | + var fullObject = this.get('realLinkedNode').get('object'); | |
106 | 71 | } |
107 | - // get Json simplified value | |
108 | 72 | else { |
109 | - myValues.timeTables[index] = item.getJsonValues(); | |
73 | + var fullObject = obj; | |
110 | 74 | } |
111 | - }); | |
112 | - } else { | |
113 | - myValues.startDate = fullObject.get('startDate'); | |
114 | - myValues.stopDate = fullObject.get('stopDate'); | |
115 | - myValues.durationDay = fullObject.get('durationDay'); | |
116 | - myValues.durationHour = fullObject.get('durationHour'); | |
117 | - myValues.durationMin = fullObject.get('durationMin'); | |
118 | - myValues.durationSec = fullObject.get('durationSec'); | |
119 | - } | |
120 | - return myValues; | |
121 | - }, | |
122 | - | |
123 | - encodeObject: function() { | |
124 | - }, | |
125 | - | |
126 | -/* | |
127 | - * Method to parse special parameters cases with arguments (spectra && MODELS) | |
128 | - * TODO to rewrite with amda new kernel | |
129 | - */ | |
130 | - parseArgs: function(param) { | |
131 | - var name = param.name; | |
132 | - var args = param.downloadParamArgs; | |
133 | - if (args.energyMax){ | |
134 | - var nameToSent = name + '_' + args.energyMin + '_' + args.energyMax; | |
135 | - return nameToSent; | |
136 | - } | |
137 | - | |
138 | - if (args.PA && args.Energy){ | |
139 | - var nameToSent = name + '_' + args.PA + '_' + args.Energy; | |
140 | - return nameToSent; | |
141 | - } | |
142 | - | |
143 | - if (args.PA) { | |
144 | - var pa = args.PA - 1; | |
145 | - var nameToSent = name + '(' + pa + ')'; | |
146 | - return nameToSent; | |
147 | - } | |
148 | - | |
149 | - if (args.Energy) { | |
150 | - var en = args.Energy - 1; | |
151 | -//TODO temporary | |
152 | - if (name.substr(name.length-2, 2) == '_E') name = name.substr(0,name.length-2); | |
153 | - var nameToSent = name + '(' + en + ')'; | |
154 | - return nameToSent; | |
155 | - } | |
156 | - // T96; A2000 | |
157 | - if (args.SW_Monitor) { | |
158 | - var nameToSent = name + '_' + args.Spacecraft + '_' + args.SW_Monitor; | |
159 | - return nameToSent; | |
160 | - } | |
161 | - // Cain ; Morschhauser | |
162 | - if (args.Spacecraft && args.Sampling) { | |
163 | - var nameToSent = name + '_' + args.Spacecraft + '_' + args.Sampling; | |
164 | - return nameToSent; | |
165 | - } | |
166 | - // LATMOS | |
167 | - if (args.ClockAngle && args.Satellite) { | |
168 | - var nameToSent = name + '_' + args.Satellite + '_' + args.ClockAngle; | |
169 | - return nameToSent; | |
170 | - } | |
171 | - | |
172 | - // FMI HYBRID | |
173 | - if (args.Satellite && Ext.Object.getSize(args) === 1) { | |
174 | - var nameToSent = name + '_' + args.Satellite; | |
175 | - return nameToSent; | |
176 | - } | |
177 | - | |
178 | - }, | |
75 | + | |
76 | + var i = 0; | |
77 | + fullObject.tabs().each(function (tab) { | |
78 | + tab.panels().each(function (panel) { | |
79 | + panel.params().each(function (param) { | |
80 | + myValues.list[i] = param.get('paramid'); | |
81 | + ++i; | |
82 | + }); | |
83 | + }); | |
84 | + | |
85 | + }); | |
86 | + | |
87 | + myValues.name = fullObject.get('name'); | |
88 | + myValues.timesrc = fullObject.get('timesrc'); | |
89 | + // if there's at least one timeTable name into 'timeTables' collection | |
90 | + if (myValues.timesrc == amdaModel.AmdaTimeObject.inputTimeSrc[0] | |
91 | + && fullObject.get('timeTables') | |
92 | + && fullObject.get('timeTables').length ){ | |
93 | + // get complete timeTables collection | |
94 | + var timeTables = fullObject.get('timeTables'); | |
95 | + // init an empty array for timeTables | |
96 | + myValues.timeTables=[]; | |
97 | + // for each interval record | |
98 | + Ext.Array.each(timeTables, function(item, index, all){ | |
99 | + if (!item.$className) { | |
100 | + myValues.timeTables[index] = {timeTableName : item.timeTableName, id : item.id}; | |
101 | + } | |
102 | + // get Json simplified value | |
103 | + else { | |
104 | + myValues.timeTables[index] = item.getJsonValues(); | |
105 | + } | |
106 | + }); | |
107 | + } else { | |
108 | + myValues.startDate = fullObject.get('startDate'); | |
109 | + myValues.stopDate = fullObject.get('stopDate'); | |
110 | + myValues.durationDay = fullObject.get('durationDay'); | |
111 | + myValues.durationHour = fullObject.get('durationHour'); | |
112 | + myValues.durationMin = fullObject.get('durationMin'); | |
113 | + myValues.durationSec = fullObject.get('durationSec'); | |
114 | + } | |
115 | + return myValues; | |
116 | + }, | |
179 | 117 | |
118 | + encodeObject: function() { | |
119 | + }, | |
180 | 120 | |
181 | - loadJobTree : function() { | |
182 | - //ToDo - BRE - fix code duplication with ExecutableNode if possible | |
183 | - var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode(); | |
184 | - var me = this; | |
185 | - amdaModel.InteractiveNode.preloadNodes(rootNode, | |
186 | - function() | |
187 | - { | |
188 | - amdaModel.InteractiveNode.jobTreeLoaded = true; | |
189 | - me.realExecute(); | |
190 | - }); | |
191 | - }, | |
121 | + loadJobTree : function() { | |
122 | + //TBD - BRE - fix code duplication with ExecutableNode if possible | |
123 | + var rootNode = Ext.getCmp(amdaUI.ExplorerUI.JOB_TAB.TREE_ID).getRootNode(); | |
124 | + var me = this; | |
125 | + amdaModel.InteractiveNode.preloadNodes(rootNode, | |
126 | + function() | |
127 | + { | |
128 | + amdaModel.InteractiveNode.jobTreeLoaded = true; | |
129 | + me.realExecute(); | |
130 | + }); | |
131 | + }, | |
192 | 132 | |
193 | - execute : function() { | |
194 | - | |
195 | - if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree(); | |
196 | - else this.realExecute(); | |
197 | - | |
198 | - }, | |
199 | - | |
200 | - | |
201 | - /** | |
202 | - * Method to execute this node | |
203 | - */ | |
204 | - realExecute : function() { | |
205 | - | |
206 | - var jsonObject = this.get('object').getJsonValues(); | |
207 | - if (!jsonObject.list && !jsonObject.images) { | |
208 | - myDesktopApp.warningMsg('Please select at least one Parameter (Get Data) or one Time Table (Get Time Table)'); | |
209 | - return; | |
210 | - } | |
211 | - | |
212 | - loadMask.show(); | |
213 | - AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObject, function(res,e){ | |
133 | + execute : function() { | |
214 | 134 | |
215 | - loadMask.hide(); | |
135 | + if (!amdaModel.ExecutableNode.jobTreeLoaded) this.loadJobTree(); | |
136 | + else this.realExecute(); | |
137 | + }, | |
138 | + | |
139 | +/** | |
140 | +* Method to execute this node | |
141 | +*/ | |
142 | + realExecute : function() { | |
216 | 143 | |
217 | - //AKKA - Rework of the result treatment for the integration with the new kernel | |
218 | - if (!e.status) | |
219 | - { | |
220 | - myDesktopApp.errorMsg('Internal error during download request'); | |
221 | - return; | |
222 | - } | |
223 | - | |
224 | - if (!res.success) | |
225 | - { | |
226 | - myDesktopApp.errorMsg(res.message); | |
227 | - return; | |
228 | - } | |
229 | - | |
230 | - var newobj = this.createJobObject(res); | |
231 | - var newNode = Ext.create(this.get('jobNode'), | |
232 | - { | |
233 | - id : res.id, | |
234 | - info : res.info, | |
235 | - jobType : this.get('nodeType'), | |
236 | - processId : res.id, | |
237 | - text : res.name, | |
238 | - status : res.status, | |
239 | - stop : res.stop, | |
240 | - leaf : true, | |
241 | - object : newobj}); | |
242 | - | |
243 | - // new Tab | |
244 | - switch (res.status) | |
245 | - { | |
246 | - case amdaModel.BkgJobNode.STATUS_LIST.DONE : | |
247 | - // New tab, non-interactive session | |
248 | - var isInteractive = false; | |
249 | - var isNewTab = true; | |
250 | - newNode.createJobNode(true); | |
251 | - newNode.editNode(isNewTab, isInteractive); | |
252 | - break; | |
253 | - case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS : | |
254 | - newNode.createJobNode(false); | |
255 | - break; | |
256 | - default: | |
257 | - newNode.createJobNode(true); | |
258 | - } | |
259 | - }, this ); | |
144 | + var jsonObject = this.get('object').getJsonValues(); | |
145 | + if (!jsonObject.list && !jsonObject.images) { | |
146 | + myDesktopApp.warningMsg('Please select at least one Parameter (Get Data) or one Time Table (Get Time Table)'); | |
147 | + return; | |
148 | + } | |
149 | + | |
150 | + loadMask.show(); | |
151 | + AmdaAction.execute({nodeType : this.get('nodeType')}, jsonObject, function(res,e) | |
152 | + { | |
153 | + loadMask.hide(); | |
260 | 154 | |
261 | -}, | |
155 | + //AKKA - Rework of the result treatment for the integration with the new kernel | |
156 | + if (!e.status) | |
157 | + { | |
158 | + myDesktopApp.errorMsg('Internal error during download request'); | |
159 | + return; | |
160 | + } | |
161 | + | |
162 | + if (!res.success) | |
163 | + { | |
164 | + myDesktopApp.errorMsg(res.message); | |
165 | + return; | |
166 | + } | |
167 | + //TBD if such condition is OK ? | |
168 | + if (!res.id && res.download) { | |
169 | + if (res.compression) { | |
170 | + window.location.href = res.download; | |
171 | + } | |
172 | + else { | |
173 | + window.open(res.download, '_blank'); | |
174 | + } | |
175 | + return; | |
176 | + } | |
177 | + | |
178 | + var newobj = this.createJobObject(res); | |
179 | + var newNode = Ext.create(this.get('jobNode'), | |
180 | + { | |
181 | + id : res.id, | |
182 | + info : res.info, | |
183 | + jobType : this.get('nodeType'), | |
184 | + processId : res.id, | |
185 | + text : res.name, | |
186 | + status : res.status, | |
187 | + stop : res.stop, | |
188 | + leaf : true, | |
189 | + object : newobj | |
190 | + | |
191 | + }); | |
192 | + | |
193 | + // new Tab | |
194 | + switch (res.status) | |
195 | + { | |
196 | + case amdaModel.BkgJobNode.STATUS_LIST.DONE : | |
197 | + // New tab, non-interactive session | |
198 | + var isInteractive = false; | |
199 | + var isNewTab = true; | |
200 | + newNode.createJobNode(true); | |
201 | + newNode.editNode(isNewTab, isInteractive); | |
202 | + break; | |
203 | + case amdaModel.BkgJobNode.STATUS_LIST.IN_PROGRESS : | |
204 | + newNode.createJobNode(false); | |
205 | + break; | |
206 | + default: | |
207 | + newNode.createJobNode(true); | |
208 | + } | |
209 | + }, this ); | |
210 | + }, | |
262 | 211 | |
263 | - createJobObject: function(res) { | |
212 | + createJobObject: function(res) { | |
264 | 213 | |
265 | - var obj = this.get('object').getJsonValues(); | |
266 | -//TODO text, name, outputName - if all is needed | |
267 | - //new object to attach to new bkgJobNode | |
268 | - | |
269 | -//TODO Ext.clone() | |
214 | + var obj = this.get('object').getJsonValues(); | |
215 | + //TODO text, name, outputName - if all is needed | |
216 | + //new object to attach to new bkgJobNode | |
217 | + //TODO Ext.clone() | |
270 | 218 | |
271 | - var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy); | |
272 | - newobj.id = res.id; | |
273 | - newobj.resultId = res.result; | |
274 | - newobj.folderId = res.folder; | |
275 | - newobj = Ext.create(this.get('object').$className, newobj); | |
276 | - return newobj; | |
219 | + var newobj = Ext.copyTo({}, obj, this.get('object').propertiesToCopy); | |
220 | + newobj.id = res.id; | |
221 | + newobj.resultId = res.result; | |
222 | + newobj.folderId = res.folder; | |
223 | + newobj = Ext.create(this.get('object').$className, newobj); | |
224 | + | |
225 | + return newobj; | |
277 | 226 | } |
278 | - | |
279 | 227 | }); |
... | ... |
js/app/views/DownloadUI.js
... | ... | @@ -23,45 +23,47 @@ Ext.define('amdaUI.DownloadUI', { |
23 | 23 | //timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['Y m d H i s', 'YYYY MM DD hh mm ss'], ['d m Y H i s', 'DD MM YYYY hh mm ss'], ['Y z H i s', 'YYYY DDD hh mm ss']], |
24 | 24 | //New kernel time formats |
25 | 25 | timeformatData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss'], ['DD Time', 'DD Time'], ['Timestamp', 'Timestamp']], |
26 | + timeformatTTData : [['Y-m-dTH:i:s', 'YYYY-MM-DDThh:mm:ss']], | |
26 | 27 | fileformatData : [['ASCII', 'ASCII'],['vot', 'VOTable'],['cdf', 'CDF'],['json', 'JSON']], |
27 | 28 | fileformatTTData : [['text', 'plain text'], ['vot','VOTable']], |
28 | 29 | filecompressData : [['zip', 'zip'], ['tar+gzip', 'tar+gzip']], |
30 | + filecompressTT : [['zip', 'zip'], ['tar+gzip', 'tar+gzip'], ['none', 'none']], | |
29 | 31 | filestructureData : [['0','All In One File'], ['1','One File Per Time Interval'], ['2','One File Per Param/Interval']], |
30 | 32 | |
31 | 33 | constructor: function(config) { |
32 | 34 | this.init(config); |
33 | 35 | this.callParent(arguments); |
34 | - // load object into view | |
35 | - if (this.object) this.loadObject(); | |
36 | - // | |
37 | - var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
38 | - if (paramArgsPlug) | |
39 | - paramArgsPlug.onApply = this.onApplyParameterArgs; | |
36 | + // load object into view | |
37 | + if (this.object) this.loadObject(); | |
38 | + // | |
39 | + var paramArgsPlug = this.getPlugin('download-param-arguments-plugin'); | |
40 | + if (paramArgsPlug) | |
41 | + paramArgsPlug.onApply = this.onApplyParameterArgs; | |
40 | 42 | }, |
41 | 43 | |
42 | 44 | addTT : function(newTTName,newTTid) |
43 | - { | |
45 | + { | |
44 | 46 | var tabPanel = this.formPanel.down(); |
45 | 47 | var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); |
46 | 48 | |
47 | 49 | if (downloadSrc === 0) { |
48 | - this.timeSelector.addTT(newTTName,newTTid); | |
50 | + this.timeSelector.addTT(newTTName,newTTid); | |
49 | 51 | } |
50 | 52 | else { |
51 | - // search for an existing record in store with this unique name | |
52 | - var existingIndex = this.TTGrid.store.findExact( 'name', newTTName); | |
53 | - // if no corresponding TT found | |
54 | - if (existingIndex == -1){ | |
55 | - // adding the time table to the TTGrid of TT download | |
56 | - var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName }); | |
57 | - this.TTGrid.store.insert(this.TTGrid.store.getCount(),r); | |
58 | - } | |
53 | + // search for an existing record in store with this unique name | |
54 | + var existingIndex = this.TTGrid.store.findExact( 'name', newTTName); | |
55 | + // if no corresponding TT found | |
56 | + if (existingIndex == -1){ | |
57 | + // adding the time table to the TTGrid of TT download | |
58 | + var r = Ext.create('amdaModel.TTobject', { id: newTTid, name: newTTName }); | |
59 | + this.TTGrid.store.insert(this.TTGrid.store.getCount(),r); | |
60 | + } | |
59 | 61 | } |
60 | 62 | }, |
61 | 63 | |
62 | 64 | addTTs : function(TTarray) { |
63 | 65 | // set TTTab |
64 | - this.timeSelector.setTTTab(TTarray); | |
66 | + this.timeSelector.setTTTab(TTarray); | |
65 | 67 | }, |
66 | 68 | |
67 | 69 | // Add TT in download TT module |
... | ... | @@ -72,92 +74,91 @@ Ext.define('amdaUI.DownloadUI', { |
72 | 74 | |
73 | 75 | }, |
74 | 76 | |
75 | - /** | |
76 | - * Set Start-Stop from parameter info (Local & MyData) | |
77 | - */ | |
78 | - setTimeFromData : function(obj) { | |
79 | - | |
80 | - var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
81 | - var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
82 | - | |
83 | - this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop }); | |
84 | - this.timeSelector.intervalSel.updateDuration(); | |
85 | - }, | |
77 | + /** | |
78 | + * Set Start-Stop from parameter info (Local & MyData) | |
79 | + */ | |
80 | + setTimeFromData : function(obj) { | |
81 | + | |
82 | + var dateStart = new Date(obj.start.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
83 | + var dateStop = new Date(obj.stop.replace(/[T|Z]/g,' ').replace(/\-/g,'\/')); | |
84 | + | |
85 | + this.down('form').getForm().setValues({ startDate : dateStart, stopDate : dateStop }); | |
86 | + this.timeSelector.intervalSel.updateDuration(); | |
87 | + }, | |
86 | 88 | |
87 | - addParam : function(paramId, isLeaf, needArgs, components) | |
88 | - { | |
89 | - // adding the parameter to the paramGrid | |
90 | - | |
91 | - var paramObj = { | |
92 | - paramid: paramId, | |
93 | - type: 0, | |
94 | - 'dim1-is-range': false, | |
95 | - 'dim1-min-range': 0., | |
96 | - 'dim1-max-range': 0., | |
97 | - 'dim1-index': '*', | |
98 | - 'dim2-is-range': false, | |
99 | - 'dim2-min-range': 0., | |
100 | - 'dim2-max-range': 0., | |
101 | - 'dim2-index': '*', | |
102 | - template_args: {} | |
103 | - }; | |
89 | + addParam : function(paramId, isLeaf, needArgs, components) | |
90 | + { | |
91 | + // adding the parameter to the paramGrid | |
92 | + var paramObj = { | |
93 | + paramid: paramId, | |
94 | + type: 0, | |
95 | + 'dim1-is-range': false, | |
96 | + 'dim1-min-range': 0., | |
97 | + 'dim1-max-range': 0., | |
98 | + 'dim1-index': '*', | |
99 | + 'dim2-is-range': false, | |
100 | + 'dim2-min-range': 0., | |
101 | + 'dim2-max-range': 0., | |
102 | + 'dim2-index': '*', | |
103 | + template_args: {} | |
104 | + }; | |
104 | 105 | |
105 | - if (components) { | |
106 | - if (components['index1']) { | |
107 | - paramObj['dim1-index'] = components['index1']; | |
108 | - ++paramObj['type']; | |
109 | - } | |
110 | - | |
111 | - if (components['index2']) { | |
112 | - paramObj['dim2-index'] = components['index2']; | |
113 | - ++paramObj['type']; | |
114 | - } | |
115 | - } | |
106 | + if (components) { | |
107 | + if (components['index1']) { | |
108 | + paramObj['dim1-index'] = components['index1']; | |
109 | + ++paramObj['type']; | |
110 | + } | |
111 | + | |
112 | + if (components['index2']) { | |
113 | + paramObj['dim2-index'] = components['index2']; | |
114 | + ++paramObj['type']; | |
115 | + } | |
116 | + } | |
116 | 117 | |
117 | - var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
118 | - var pos = this.paramGrid.store.getCount(); | |
119 | - this.paramGrid.store.insert(pos,r); | |
120 | - this.paramGrid.getView().refresh(); | |
121 | - if (!isLeaf || needArgs) | |
122 | - this.editParameterArgs(r); | |
123 | - }, | |
118 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
119 | + var pos = this.paramGrid.store.getCount(); | |
120 | + this.paramGrid.store.insert(pos,r); | |
121 | + this.paramGrid.getView().refresh(); | |
122 | + if (!isLeaf || needArgs) | |
123 | + this.editParameterArgs(r); | |
124 | + }, | |
124 | 125 | |
125 | - addParams: function(arrayParams) | |
126 | - { | |
127 | - var arrayRec = new Array(); | |
128 | - var index = 1; | |
129 | - if (arrayParams) | |
130 | - { | |
131 | - index = 0; | |
132 | - Ext.Array.each(arrayParams,function(item){ | |
133 | - if (Ext.isObject(item)) { | |
134 | - // for Parameter Name in Download Module | |
135 | - var paramObj = { | |
136 | - paramid: paramId, | |
137 | - type: 0, | |
138 | - 'dim1-is-range': false, | |
139 | - 'dim1-min-range': 0., | |
140 | - 'dim1-max-range': 0., | |
141 | - 'dim1-index': item.get('dim1'), | |
142 | - 'dim2-is-range': false, | |
143 | - 'dim2-min-range': 0., | |
144 | - 'dim2-max-range': 0., | |
145 | - 'dim2-index': item.get('dim2'), | |
146 | - template_args: {} | |
147 | - }; | |
148 | - | |
149 | - var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
150 | - } | |
151 | - else { | |
152 | - // for Download By Request in Operations menu | |
153 | - //ToDo BRE - Components selection | |
154 | - var r = Ext.create('amdaModel.DownloadParam', { paramid: item }); | |
155 | - } | |
156 | - arrayRec.push(r); | |
157 | - }); | |
158 | - } | |
159 | - this.paramGrid.getStore().loadData(arrayRec); | |
160 | - }, | |
126 | + addParams: function(arrayParams) | |
127 | + { | |
128 | + var arrayRec = new Array(); | |
129 | + var index = 1; | |
130 | + if (arrayParams) | |
131 | + { | |
132 | + index = 0; | |
133 | + Ext.Array.each(arrayParams,function(item){ | |
134 | + if (Ext.isObject(item)) { | |
135 | + // for Parameter Name in Download Module | |
136 | + var paramObj = { | |
137 | + paramid: paramId, | |
138 | + type: 0, | |
139 | + 'dim1-is-range': false, | |
140 | + 'dim1-min-range': 0., | |
141 | + 'dim1-max-range': 0., | |
142 | + 'dim1-index': item.get('dim1'), | |
143 | + 'dim2-is-range': false, | |
144 | + 'dim2-min-range': 0., | |
145 | + 'dim2-max-range': 0., | |
146 | + 'dim2-index': item.get('dim2'), | |
147 | + template_args: {} | |
148 | + }; | |
149 | + | |
150 | + var r = Ext.create('amdaModel.DownloadParam', paramObj); | |
151 | + } | |
152 | + else { | |
153 | + // for Download By Request in Operations menu | |
154 | + //TODO BRE - Components selection | |
155 | + var r = Ext.create('amdaModel.DownloadParam', { paramid: item }); | |
156 | + } | |
157 | + arrayRec.push(r); | |
158 | + }); | |
159 | + } | |
160 | + this.paramGrid.getStore().loadData(arrayRec); | |
161 | + }, | |
161 | 162 | |
162 | 163 | // parameter name -> alias |
163 | 164 | updateConstruct : function(oldval,newval) { |
... | ... | @@ -165,7 +166,7 @@ Ext.define('amdaUI.DownloadUI', { |
165 | 166 | if (index != -1) { |
166 | 167 | this.paramGrid.getStore().getAt(index).set('name',newval); |
167 | 168 | this.paramGrid.getStore().getAt(index).set('text',newval); |
168 | - } | |
169 | + } | |
169 | 170 | }, |
170 | 171 | |
171 | 172 | setObject : function(obj) { |
... | ... | @@ -176,84 +177,89 @@ Ext.define('amdaUI.DownloadUI', { |
176 | 177 | /** |
177 | 178 | * update this.object from form |
178 | 179 | */ |
179 | - updateObject : function() | |
180 | - { | |
181 | - // get the basic form | |
182 | - var tabPanel = this.formPanel.down(); | |
183 | - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
184 | - var basicForm = this.formPanel.getForm(); | |
185 | - var updateStatus = true; | |
186 | - var values = basicForm.getValues(); | |
187 | - | |
188 | - // data download | |
189 | - if (downloadSrc === 0) | |
190 | - { | |
191 | - var timeformat = basicForm.findField('timeformat').getRawValue(); | |
192 | - var timeSource = this.timeSelector.getActiveTimeSource(); | |
193 | - var structure = values.filestructure; | |
194 | - var sampling = values.sampling ? values.sampling : 600; | |
195 | - var refparamSampling = values.refparamsampling == 'on'; | |
196 | - var fileprefix = values.fileprefix ? values.fileprefix : ''; | |
197 | - var fileformat = values.fileformat; | |
198 | - var compression = values.compression; | |
180 | + updateObject : function() | |
181 | + { | |
182 | + // get the basic form | |
183 | + var tabPanel = this.formPanel.down(); | |
184 | + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
185 | + var basicForm = this.formPanel.getForm(); | |
186 | + var updateStatus = true; | |
187 | + var values = basicForm.getValues(); | |
188 | + | |
189 | + // data download | |
190 | + if (downloadSrc === 0) | |
191 | + { | |
192 | + var timeformat = basicForm.findField('timeformat').getRawValue(); | |
193 | + var timeSource = this.timeSelector.getActiveTimeSource(); | |
194 | + var structure = values.filestructure; | |
195 | + var sampling = values.sampling ? values.sampling : 600; | |
196 | + var refparamSampling = values.refparamsampling == 'on'; | |
197 | + var fileprefix = values.fileprefix ? values.fileprefix : ''; | |
198 | + var fileformat = values.fileformat; | |
199 | + var compression = values.compression; | |
199 | 200 | |
200 | - var fieldsWithoutName = basicForm.getFields().items; | |
201 | - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | |
202 | - if (!item.isValid()) { | |
203 | - if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | |
204 | - ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | |
205 | - updateStatus = true; | |
206 | - } | |
207 | - else { | |
208 | - // set update isn't allowed | |
209 | - updateStatus = false; | |
210 | - return false; | |
211 | - } | |
212 | - } | |
213 | - }, this); | |
214 | - | |
215 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | |
216 | - && this.timeSelector.TTGrid.getStore().count() == 0) { | |
217 | - myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' | |
218 | - +'<br>You must add one or choose Time Selection `by Interval`'); | |
219 | - updateStatus = false; | |
220 | - } | |
201 | + var fieldsWithoutName = basicForm.getFields().items; | |
202 | + Ext.Array.each(fieldsWithoutName, function(item, index,allItems){ | |
203 | + if (!item.isValid()) { | |
204 | + if ((timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) && | |
205 | + ((item.name == 'startDate') || (item.name == 'stopDate') || (item.name == 'duration'))) { | |
206 | + updateStatus = true; | |
207 | + } | |
208 | + else { | |
209 | + // set update isn't allowed | |
210 | + updateStatus = false; | |
211 | + return false; | |
212 | + } | |
213 | + } | |
214 | + }, this); | |
215 | + | |
216 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0] // timeSource 'TimeTable' | |
217 | + && this.timeSelector.TTGrid.getStore().count() == 0) { | |
218 | + myDesktopApp.warningMsg('You\'ve chosen Time Selection `by TimeTable` but no timeTable was added!' | |
219 | + +'<br>You must add one or choose Time Selection `by Interval`'); | |
220 | + updateStatus = false; | |
221 | + } | |
221 | 222 | |
222 | - if (updateStatus) | |
223 | - { | |
224 | - /// real object update | |
225 | - // update TimeTable object with the content of form | |
226 | - basicForm.updateRecord(this.object); | |
227 | - this.object.set('timesrc', timeSource); | |
228 | - // set valid intervals into TimeTable object | |
229 | - if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) | |
230 | - this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); | |
231 | - // set parameters | |
232 | - this.object.set('list',this.paramGrid.getStore().data.items); | |
233 | - this.object.set('structure', structure); | |
234 | - this.object.set('refparamSampling', refparamSampling); | |
235 | - this.object.set('sampling', sampling); | |
236 | - this.object.set('fileprefix',fileprefix); | |
237 | - this.object.set('timeformat',timeformat); | |
238 | - this.object.set('fileformat',fileformat); | |
239 | - this.object.set('compression',compression); | |
240 | - } | |
241 | - } | |
242 | - //TT download | |
243 | - else | |
244 | - { | |
245 | - var timeformat = values.timeformatTT; | |
246 | - var compression = values.compressionTT; | |
247 | - var fileformat = values.fileformatTT; | |
248 | - this.object.set('timeTables',this.TTGrid.getStore().data.items); | |
249 | - this.object.set('timeformatTT',timeformat); | |
250 | - this.object.set('fileformatTT',fileformat); | |
251 | - this.object.set('compressionTT',compression); | |
252 | - } | |
223 | + if (updateStatus) | |
224 | + { | |
225 | + /// real object update | |
226 | + // update TimeTable object with the content of form | |
227 | + basicForm.updateRecord(this.object); | |
228 | + this.object.set('timesrc', timeSource); | |
229 | + // set valid intervals into TimeTable object | |
230 | + if (timeSource === amdaModel.AmdaTimeObject.inputTimeSrc[0]) | |
231 | + this.object.set('timeTables',this.timeSelector.TTGrid.getStore().data.items); | |
232 | + // set parameters | |
233 | + this.object.set('list',this.paramGrid.getStore().data.items); | |
234 | + this.object.set('structure', structure); | |
235 | + this.object.set('refparamSampling', refparamSampling); | |
236 | + this.object.set('sampling', sampling); | |
237 | + this.object.set('fileprefix',fileprefix); | |
238 | + this.object.set('timeformat',timeformat); | |
239 | + this.object.set('fileformat',fileformat); | |
240 | + this.object.set('compression',compression); | |
241 | + } | |
242 | + } | |
243 | + //TT download | |
244 | + else | |
245 | + { | |
246 | + var timeformat = values.timeformatTT; | |
247 | + var compression = values.compressionTT; | |
248 | + var fileformat = values.fileformatTT; | |
249 | + if (compression === 'none' | |
250 | + && this.TTGrid.getStore().count() > 1) { | |
251 | + myDesktopApp.warningMsg('You are going to download several time tables - select the Compression please'); | |
252 | + updateStatus = false; | |
253 | + } | |
254 | + this.object.set('timeTables',this.TTGrid.getStore().data.items); | |
255 | + this.object.set('timeformatTT',timeformat); | |
256 | + this.object.set('fileformatTT',fileformat); | |
257 | + this.object.set('compressionTT',compression); | |
258 | + } | |
253 | 259 | |
254 | - this.object.set('downloadSrc',downloadSrc); | |
255 | - // return the update status | |
256 | - return updateStatus; | |
260 | + this.object.set('downloadSrc',downloadSrc); | |
261 | + // return the update status | |
262 | + return updateStatus; | |
257 | 263 | }, |
258 | 264 | |
259 | 265 | /** |
... | ... | @@ -261,48 +267,48 @@ Ext.define('amdaUI.DownloadUI', { |
261 | 267 | */ |
262 | 268 | loadObject : function(){ |
263 | 269 | |
264 | - if (!this.object.get('timeformat')) | |
265 | - this.object.set('timeformat', this.timeformatData[0][0]); | |
266 | - | |
267 | - if (!this.object.get('timeformatTT')) | |
268 | - this.object.set('timeformatTT', this.timeformatData[0][0]); | |
269 | - | |
270 | - if (!this.object.get('fileformat')) | |
271 | - this.object.set('fileformat', this.fileformatData[0][0]); | |
272 | - | |
273 | - if (!this.object.get('fileformatTT')) | |
274 | - this.object.set('fileformatTT', this.fileformatTTData[0][0]); | |
275 | - | |
276 | - if (!this.object.get('compression')) | |
277 | - this.object.set('compression', this.filecompressData[1][0]); | |
270 | + if (!this.object.get('timeformat')) | |
271 | + this.object.set('timeformat', this.timeformatData[0][0]); | |
272 | + | |
273 | + if (!this.object.get('timeformatTT')) | |
274 | + this.object.set('timeformatTT', this.timeformatTTData[0][0]); | |
275 | + | |
276 | + if (!this.object.get('fileformat')) | |
277 | + this.object.set('fileformat', this.fileformatData[0][0]); | |
278 | + | |
279 | + if (!this.object.get('fileformatTT')) | |
280 | + this.object.set('fileformatTT', this.fileformatTTData[0][0]); | |
281 | + | |
282 | + if (!this.object.get('compression')) | |
283 | + this.object.set('compression', this.filecompressData[1][0]); | |
278 | 284 | |
279 | - if (!this.object.get('compressionTT')) | |
280 | - this.object.set('compressionTT', this.filecompressData[1][0]); | |
281 | - | |
282 | - // load object into form | |
283 | - this.formPanel.getForm().loadRecord(this.object); | |
284 | - // set object's TTs into the timeselector | |
285 | - this.addTTs(this.object.get('timeTables')); | |
286 | - // set parameters | |
287 | - this.addParams(this.object.get('list')); | |
285 | + if (!this.object.get('compressionTT')) | |
286 | + this.object.set('compressionTT', this.filecompressData[1][0]); | |
287 | + | |
288 | + // load object into form | |
289 | + this.formPanel.getForm().loadRecord(this.object); | |
290 | + // set object's TTs into the timeselector | |
291 | + this.addTTs(this.object.get('timeTables')); | |
292 | + // set parameters | |
293 | + this.addParams(this.object.get('list')); | |
288 | 294 | }, |
289 | 295 | |
290 | - /** | |
291 | - * download method called by 'Download' button to launch the download process | |
292 | - */ | |
296 | +/** | |
297 | +* download method called by 'Download' button to launch the download process | |
298 | +*/ | |
293 | 299 | doDownload : function(){ |
294 | 300 | var downloadModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); |
295 | 301 | if (downloadModule) |
296 | - downloadModule.linkedNode.execute(); | |
297 | - // fire execution | |
298 | - // this.object.fireEvent('execute',this.object.dirty); | |
302 | + downloadModule.linkedNode.execute(); | |
299 | 303 | }, |
300 | - | |
301 | - | |
304 | + | |
302 | 305 | actionItem: function(grid, cell, cellIndex, record, row, recordIndex, e){ |
303 | - if (cellIndex == 3) | |
306 | + | |
307 | + var isTimeTable = record instanceof amdaModel.TTobject; | |
308 | + | |
309 | + if ( cellIndex == 3 || ( cellIndex == 2 && isTimeTable )) | |
304 | 310 | grid.getStore().remove(record); |
305 | - else if (cellIndex == 2) { | |
311 | + else if ( cellIndex == 2 ) { | |
306 | 312 | this.paramGrid.getView().select(row); |
307 | 313 | this.editParameterArgs(record); |
308 | 314 | } |
... | ... | @@ -355,388 +361,382 @@ Ext.define('amdaUI.DownloadUI', { |
355 | 361 | this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector',flex: 1}); |
356 | 362 | |
357 | 363 | this.paramGrid = Ext.create('Ext.grid.Panel', { |
358 | - flex: 2, | |
359 | - store : Ext.create('Ext.data.Store', { model: 'amdaModel.DownloadParam'} ), | |
360 | - columns: [ | |
361 | - { xtype: 'rownumberer', width: 20 }, | |
362 | - { | |
363 | - header: "Parameter Name", | |
364 | - dataIndex: 'name', | |
365 | - flex:1, | |
366 | - sortable: false, | |
367 | - menuDisabled : true , | |
368 | - renderer: function (val, meta, rec) { | |
369 | - return rec.getParamFullName(); | |
370 | - } | |
371 | - }, | |
372 | - { | |
373 | - menuDisabled : true, width: 30, renderer: function(){ | |
374 | - return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; | |
375 | - } | |
376 | - }, | |
377 | - { | |
378 | - menuDisabled : true, width: 30, renderer: function(){ | |
379 | - return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
380 | - } | |
381 | - } | |
382 | - ], | |
364 | + flex: 2, | |
365 | + store : Ext.create('Ext.data.Store', { model: 'amdaModel.DownloadParam'} ), | |
366 | + columns: [ | |
367 | + { xtype: 'rownumberer', width: 20 }, | |
368 | + { | |
369 | + header: "Parameter Name", | |
370 | + dataIndex: 'name', | |
371 | + flex:1, | |
372 | + sortable: false, | |
373 | + menuDisabled : true , | |
374 | + renderer: function (val, meta, rec) { | |
375 | + return rec.getParamFullName(); | |
376 | + } | |
377 | + }, | |
378 | + { | |
379 | + menuDisabled : true, width: 30, renderer: function(){ | |
380 | + return'<div class="icon-parameters" style="width: 15px; height: 15px;"></div>'; | |
381 | + } | |
382 | + }, | |
383 | + { | |
384 | + menuDisabled : true, width: 30, renderer: function(){ | |
385 | + return'<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
386 | + } | |
387 | + } | |
388 | + ], | |
383 | 389 | //TODO - BRE - Wait the fix for drag&drop issue |
384 | - listeners : | |
390 | + listeners : | |
385 | 391 | { |
386 | - render : function(o,op) | |
387 | - { | |
388 | - var me = this; | |
389 | - var el = me.body.dom; | |
390 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
391 | - ddGroup: 'explorerTree', | |
392 | - notifyEnter : function(ddSource, e, data) | |
393 | - { }, | |
394 | - notifyOver : function(ddSource, e, data) | |
395 | - { | |
396 | - if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) { | |
397 | - this.valid = false; | |
398 | - return this.dropNotAllowed; | |
399 | - } | |
400 | - if (((data.records[0].data.nodeType == 'localParam') || | |
401 | - (data.records[0].data.nodeType == 'remoteParam') || | |
402 | - (data.records[0].data.nodeType == 'remoteSimuParam') || | |
403 | - (data.records[0].data.nodeType == 'derivedParam') || | |
404 | - (data.records[0].data.nodeType == 'myDataParam') || | |
405 | - (data.records[0].data.nodeType == 'alias'))&& | |
406 | - (data.records[0].isLeaf() || data.records[0].data.isParameter) && | |
407 | - !data.records[0].data.disable) | |
408 | - { | |
409 | - this.valid = true; | |
410 | - return this.dropAllowed; | |
411 | - } | |
412 | - | |
413 | - this.valid = false; | |
414 | - return this.dropNotAllowed; | |
415 | - }, | |
416 | - notifyDrop : function(ddSource, e, data) | |
417 | - { | |
418 | - if (!this.valid) | |
419 | - return false; | |
420 | - var idToSent; | |
421 | - var components = null; | |
422 | - switch (data.records[0].data.nodeType) | |
423 | - { | |
424 | - case 'localParam' : | |
425 | - case 'remoteParam': | |
426 | - case 'remoteSimuParam': | |
427 | - idToSent = data.records[0].get('id'); | |
428 | - if (data.records[0].get('alias')!= "" ) | |
429 | - idToSent = "#"+data.records[0].get('alias'); | |
430 | - var component_info = data.records[0].get('component_info'); | |
431 | - if (component_info && component_info.parentId) { | |
432 | - //It's a component | |
433 | - idToSent = component_info.parentId; | |
434 | - components = []; | |
435 | - if (component_info.index1) | |
436 | - components['index1'] = component_info.index1; | |
437 | - if (component_info.index2) | |
438 | - components['index2'] = component_info.index2; | |
439 | - } | |
440 | - break; | |
441 | - case 'alias' : | |
442 | - idToSent = "#"+data.records[0].get('text'); | |
443 | - break; | |
444 | - case 'derivedParam' : | |
445 | - idToSent = "ws_"+data.records[0].get('text'); | |
446 | - break; | |
447 | - case 'myDataParam' : | |
448 | - idToSent = "wsd_"+data.records[0].get('text'); | |
449 | - break; | |
450 | - default : | |
451 | - return false; | |
452 | - } | |
453 | - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
454 | - if (downModule) | |
455 | - downModule.addParam(idToSent,data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | |
456 | - return true; | |
457 | - } | |
458 | - }); | |
459 | - } | |
460 | - } | |
461 | - | |
392 | + render : function(o,op) | |
393 | + { | |
394 | + var me = this; | |
395 | + var el = me.body.dom; | |
396 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
397 | + ddGroup: 'explorerTree', | |
398 | + notifyEnter : function(ddSource, e, data) | |
399 | + { }, | |
400 | + notifyOver : function(ddSource, e, data) | |
401 | + { | |
402 | + if (data.records[0].data.nodeType == 'localParam' && data.records[0].get('notyet')) { | |
403 | + this.valid = false; | |
404 | + return this.dropNotAllowed; | |
405 | + } | |
406 | + if (((data.records[0].data.nodeType == 'localParam') || | |
407 | + (data.records[0].data.nodeType == 'remoteParam') || | |
408 | + (data.records[0].data.nodeType == 'remoteSimuParam') || | |
409 | + (data.records[0].data.nodeType == 'derivedParam') || | |
410 | + (data.records[0].data.nodeType == 'myDataParam') || | |
411 | + (data.records[0].data.nodeType == 'alias'))&& | |
412 | + (data.records[0].isLeaf() || data.records[0].data.isParameter) && | |
413 | + !data.records[0].data.disable) | |
414 | + { | |
415 | + this.valid = true; | |
416 | + return this.dropAllowed; | |
417 | + } | |
418 | + | |
419 | + this.valid = false; | |
420 | + return this.dropNotAllowed; | |
421 | + }, | |
422 | + notifyDrop : function(ddSource, e, data) | |
423 | + { | |
424 | + if (!this.valid) | |
425 | + return false; | |
426 | + var idToSent; | |
427 | + var components = null; | |
428 | + switch (data.records[0].data.nodeType) | |
429 | + { | |
430 | + case 'localParam' : | |
431 | + case 'remoteParam': | |
432 | + case 'remoteSimuParam': | |
433 | + idToSent = data.records[0].get('id'); | |
434 | + if (data.records[0].get('alias')!= "" ) | |
435 | + idToSent = "#"+data.records[0].get('alias'); | |
436 | + var component_info = data.records[0].get('component_info'); | |
437 | + if (component_info && component_info.parentId) { | |
438 | + //It's a component | |
439 | + idToSent = component_info.parentId; | |
440 | + components = []; | |
441 | + if (component_info.index1) | |
442 | + components['index1'] = component_info.index1; | |
443 | + if (component_info.index2) | |
444 | + components['index2'] = component_info.index2; | |
445 | + } | |
446 | + break; | |
447 | + case 'alias' : | |
448 | + idToSent = "#"+data.records[0].get('text'); | |
449 | + break; | |
450 | + case 'derivedParam' : | |
451 | + idToSent = "ws_"+data.records[0].get('text'); | |
452 | + break; | |
453 | + case 'myDataParam' : | |
454 | + idToSent = "wsd_"+data.records[0].get('text'); | |
455 | + break; | |
456 | + default : | |
457 | + return false; | |
458 | + } | |
459 | + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
460 | + if (downModule) | |
461 | + downModule.addParam(idToSent,data.records[0].get('leaf'), data.records[0].get('needsArgs'), components); | |
462 | + return true; | |
463 | + } | |
464 | + }); | |
465 | + } | |
466 | + } | |
462 | 467 | }); |
463 | 468 | |
464 | 469 | this.paramGrid.on('cellclick', this.actionItem, this); |
465 | 470 | |
466 | 471 | this.TTGrid = Ext.create('Ext.grid.Panel', { |
467 | - flex: 2, | |
468 | - store : Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}), | |
469 | - columns: [ | |
470 | - { xtype: 'rownumberer', width: 20 }, | |
471 | - { header: "Time Table Name", dataIndex: 'name', flex:1, sortable: false, menuDisabled: true}, | |
472 | - { | |
473 | - menuDisabled : true, width: 30, renderer: function(){ | |
474 | - return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
475 | - } | |
472 | + flex: 2, | |
473 | + store : Ext.create('Ext.data.Store', {model: 'amdaModel.TTobject'}), | |
474 | + columns: [ | |
475 | + { xtype: 'rownumberer', width: 20 }, | |
476 | + { header: "Time Table Name", dataIndex: 'name', flex:1, sortable: false, menuDisabled: true}, | |
477 | + { | |
478 | + menuDisabled : true, width: 30, renderer: function(){ | |
479 | + return '<div class="icon-remover" style="width: 15px; height: 15px;"></div>'; | |
480 | + } | |
481 | + } | |
482 | + ], | |
483 | + listeners : | |
484 | + { | |
485 | + render : function(o,op) | |
486 | + { | |
487 | + var me = this; | |
488 | + var el = me.body.dom; | |
489 | + var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
490 | + ddGroup: 'explorerTree', | |
491 | + notifyEnter : function(ddSource, e, data) | |
492 | + { | |
493 | + | |
494 | + }, | |
495 | + notifyOver : function(ddSource, e, data) | |
496 | + { | |
497 | + var nodeType = data.records[0].get('nodeType'); | |
498 | + | |
499 | + if ((nodeType == 'timeTable' || nodeType == 'sharedtimeTable') || | |
500 | + (nodeType == 'catalog' || nodeType == 'sharedCatalog') && | |
501 | + (data.records[0].get('leaf'))) | |
502 | + { | |
503 | + this.valid = true; | |
504 | + return this.dropAllowed; | |
505 | + } | |
506 | + this.valid = false; | |
507 | + return this.dropNotAllowed; | |
508 | + }, | |
509 | + notifyDrop : function(ddSource, e, data) | |
510 | + { | |
511 | + if (!this.valid) | |
512 | + return false; | |
513 | + var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
514 | + if (downModule) | |
515 | + downModule.getUiContent().addTTdownload(data.records[0].get('text'),data.records[0].get('id')); | |
516 | + return true; | |
517 | + } | |
518 | + }); | |
519 | + } | |
476 | 520 | } |
477 | - ], | |
478 | - listeners : | |
479 | - { | |
480 | - render : function(o,op) | |
481 | - { | |
482 | - var me = this; | |
483 | - var el = me.body.dom; | |
484 | - var dropTarget = Ext.create('Ext.dd.DropTarget', el, { | |
485 | - ddGroup: 'explorerTree', | |
486 | - notifyEnter : function(ddSource, e, data) | |
487 | - { | |
488 | - | |
489 | - }, | |
490 | - notifyOver : function(ddSource, e, data) | |
491 | - { | |
492 | - if ((data.records[0].get('nodeType') == 'timeTable' || data.records[0].get('nodeType') == 'sharedtimeTable') && (data.records[0].get('leaf'))) | |
493 | - { | |
494 | - this.valid = true; | |
495 | - return this.dropAllowed; | |
496 | - } | |
497 | - this.valid = false; | |
498 | - return this.dropNotAllowed; | |
499 | - }, | |
500 | - notifyDrop : function(ddSource, e, data) | |
501 | - { | |
502 | - if (!this.valid) | |
503 | - return false; | |
504 | - var downModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.download.id); | |
505 | - if (downModule) | |
506 | - downModule.getUiContent().addTTdownload(data.records[0].get('text'),data.records[0].get('id')); | |
507 | - return true; | |
508 | - } | |
509 | - }); | |
510 | - } | |
511 | - } | |
512 | 521 | }); |
522 | + | |
513 | 523 | this.TTGrid.on('cellclick', this.actionItem, this); |
514 | 524 | |
515 | 525 | this.paramPanel = { |
516 | - xtype: 'container', | |
517 | - title: 'Get Data', | |
518 | - layout: { | |
519 | - type: 'hbox', | |
520 | - align : 'stretch', | |
521 | - defaultMargins: {top: 10, left:10, bottom: 5, right:10} | |
522 | - }, | |
523 | - items: [ | |
524 | - { | |
525 | - xtype: 'container', | |
526 | - flex: 2, | |
527 | - layout: { | |
528 | - type: 'vbox', | |
529 | - align : 'stretch' | |
530 | - }, | |
531 | - items: [ | |
532 | - { | |
533 | - xtype: 'textfield', | |
534 | - fieldLabel: 'Request Name', | |
535 | - disabled: true, | |
536 | - name : 'name' | |
537 | - }, | |
538 | - { | |
539 | - xtype: 'splitter', | |
540 | - flex: 0.05 | |
541 | - }, | |
542 | - this.paramGrid | |
543 | - ] | |
544 | - }, | |
545 | - { | |
546 | - xtype: 'container', | |
547 | - flex: 2, | |
548 | - defaults : { | |
549 | - xtype : 'combo', | |
550 | - labelWidth: 90, | |
551 | - queryMode: 'local', | |
552 | - editable: false | |
553 | - }, | |
554 | - layout: { | |
555 | - type: 'vbox', | |
556 | - align: 'stretch' | |
557 | - }, | |
558 | - items: [ | |
559 | - { | |
560 | - fieldLabel: 'Time Format', | |
561 | - name: 'timeformat', | |
562 | - store: this.timeformatData, | |
563 | - value: this.timeformatData[0] | |
564 | - }, | |
565 | - { | |
566 | - fieldLabel: 'File Structure', | |
567 | - name: 'filestructure', | |
568 | - store: this.filestructureData, | |
569 | - value: this.filestructureData[2], | |
570 | - listeners : { | |
571 | - change : { fn : this.onFileStructureChange }, | |
572 | - scope: this | |
573 | - } | |
526 | + xtype: 'container', | |
527 | + title: 'Parameters', | |
528 | + layout: { | |
529 | + type: 'hbox', | |
530 | + align : 'stretch', | |
531 | + defaultMargins: {top: 10, left:10, bottom: 5, right:10} | |
532 | + }, | |
533 | + items: [ | |
534 | + { | |
535 | + xtype: 'container', | |
536 | + flex: 2, | |
537 | + layout: { | |
538 | + type: 'vbox', | |
539 | + align : 'stretch' | |
540 | + }, | |
541 | + items: [ | |
542 | + { | |
543 | + xtype: 'textfield', | |
544 | + fieldLabel: 'Request Name', | |
545 | + disabled: true, | |
546 | + name : 'name' | |
547 | + }, | |
548 | + { | |
549 | + xtype: 'splitter', | |
550 | + flex: 0.05 | |
551 | + }, | |
552 | + this.paramGrid | |
553 | + ] | |
554 | + }, | |
555 | + { | |
556 | + xtype: 'container', | |
557 | + flex: 2, | |
558 | + defaults : { | |
559 | + xtype : 'combo', | |
560 | + labelWidth: 90, | |
561 | + queryMode: 'local', | |
562 | + editable: false | |
574 | 563 | }, |
575 | - { | |
576 | - xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling', | |
577 | - boxLabelAlign: 'before', | |
578 | - name: 'refparamsampling', checked: false, disabled: true, | |
579 | - listeners : { | |
580 | - change : { fn : this.onRefParamSamplingChange }, | |
581 | - scope : this | |
582 | - } | |
583 | - }, | |
584 | - { | |
585 | - xtype: 'numberfield', name: 'sampling', | |
586 | - fieldLabel: 'Sampling Time', value: 600, | |
587 | - hideTrigger: true, editable: true, | |
588 | - disabled: true | |
564 | + layout: { | |
565 | + type: 'vbox', | |
566 | + align: 'stretch' | |
589 | 567 | }, |
590 | - { | |
591 | - xtype: 'textfield', name: 'fileprefix', | |
592 | - fieldLabel: 'File Prefix', | |
593 | - disabled: false, editable: true | |
568 | + items: [ | |
569 | + { | |
570 | + fieldLabel: 'Time Format', | |
571 | + name: 'timeformat', | |
572 | + store: this.timeformatData, | |
573 | + value: this.timeformatData[0] | |
574 | + }, | |
575 | + { | |
576 | + fieldLabel: 'File Structure', | |
577 | + name: 'filestructure', | |
578 | + store: this.filestructureData, | |
579 | + value: this.filestructureData[2], | |
580 | + listeners : { | |
581 | + change : { fn : this.onFileStructureChange }, | |
582 | + scope: this | |
583 | + } | |
584 | + }, | |
585 | + { | |
586 | + xtype: 'checkbox', boxLabel: 'Use first param. as reference for sampling', | |
587 | + boxLabelAlign: 'before', | |
588 | + name: 'refparamsampling', checked: false, disabled: true, | |
589 | + listeners : { | |
590 | + change : { fn : this.onRefParamSamplingChange }, | |
591 | + scope : this | |
592 | + } | |
593 | + }, | |
594 | + { | |
595 | + xtype: 'numberfield', name: 'sampling', | |
596 | + fieldLabel: 'Sampling Time', value: 600, | |
597 | + hideTrigger: true, editable: true, | |
598 | + disabled: true | |
599 | + }, | |
600 | + { | |
601 | + xtype: 'textfield', name: 'fileprefix', | |
602 | + fieldLabel: 'File Prefix', | |
603 | + disabled: false, editable: true | |
604 | + }, | |
605 | + { | |
606 | + fieldLabel: 'File Format', | |
607 | + name: 'fileformat', | |
608 | + store: this.fileformatData, | |
609 | + value: this.fileformatData[0] | |
610 | + }, | |
611 | + { | |
612 | + fieldLabel: 'Compression', | |
613 | + name: 'compression', | |
614 | + store: this.filecompressData, | |
615 | + value: this.filecompressData[0] | |
616 | + }, | |
617 | + this.timeSelector | |
618 | + ] | |
619 | + } | |
620 | + ]}; | |
621 | + | |
622 | + this.ttPanel = | |
623 | + { | |
624 | + xtype: 'container', | |
625 | + title: 'Time Tables / Catalogs', | |
626 | + layout: { | |
627 | + type: 'hbox', | |
628 | + align : 'stretch', | |
629 | + defaultMargins: { top: 10, left:10, bottom: 5, right:10 } | |
630 | + }, | |
631 | + items: [ | |
632 | + this.TTGrid, | |
633 | + { | |
634 | + xtype: 'container', | |
635 | + flex: 2, | |
636 | + defaults : { | |
637 | + xtype : 'combo', | |
638 | + labelWidth: 90, | |
639 | + queryMode: 'local', | |
640 | + editable: false | |
594 | 641 | }, |
595 | - { | |
596 | - fieldLabel: 'File Format', | |
597 | - name: 'fileformat', | |
598 | - store: this.fileformatData, | |
599 | - value: this.fileformatData[0] | |
600 | - }, | |
601 | - { | |
602 | - fieldLabel: 'Compression', | |
603 | - name: 'compression', | |
604 | - store: this.filecompressData, | |
605 | - value: this.filecompressData[0] | |
642 | + layout: { | |
643 | + type: 'vbox', | |
644 | + align : 'stretch' | |
606 | 645 | }, |
607 | - this.timeSelector | |
608 | - ] | |
609 | - } | |
610 | - ]}; | |
611 | - | |
612 | - this.ttPanel = | |
613 | - { | |
614 | - xtype: 'container', | |
615 | - title: 'Get Time Table', | |
616 | - layout: { | |
617 | - type: 'hbox', | |
618 | - align : 'stretch', | |
619 | - defaultMargins: {top: 10, left:10, bottom: 5, right:10} | |
620 | - }, | |
621 | - items: [ | |
622 | - this.TTGrid, | |
623 | - { | |
624 | - xtype: 'container', | |
625 | - flex: 2, | |
626 | - defaults : { | |
627 | - xtype : 'combo', | |
628 | - labelWidth: 90, | |
629 | - queryMode: 'local', | |
630 | - editable: false | |
631 | - }, | |
632 | - layout: { | |
633 | - type: 'vbox', | |
634 | - align : 'stretch' | |
635 | - }, | |
636 | - items: [ | |
637 | - { | |
638 | - fieldLabel:'Time Format', | |
639 | - name:'timeformatTT', | |
640 | - store: this.timeformatData, | |
641 | - value: this.timeformatData[0] | |
642 | - }, | |
643 | - { | |
644 | - fieldLabel: 'File Format ', | |
645 | - name: 'fileformatTT', | |
646 | - store: this.fileformatTTData, | |
647 | - value: this.fileformatTTData[0] | |
648 | - }, | |
649 | - { | |
650 | - fieldLabel: 'Compression ', | |
651 | - name: 'compressionTT', | |
652 | - store: this.filecompressData, | |
653 | - value: this.filecompressData[0] | |
654 | - } | |
655 | - ] | |
656 | - } | |
657 | - ] | |
658 | - } ; | |
646 | + items: [{ | |
647 | + fieldLabel:'Time Format', | |
648 | + name:'timeformatTT', | |
649 | + store: this.timeformatTTData, | |
650 | + value: this.timeformatTTData[0] | |
651 | + }, | |
652 | + { | |
653 | + fieldLabel: 'File Format ', | |
654 | + name: 'fileformatTT', | |
655 | + store: this.fileformatTTData, | |
656 | + value: this.fileformatTTData[0] | |
657 | + }, | |
658 | + { | |
659 | + fieldLabel: 'Compression ', | |
660 | + name: 'compressionTT', | |
661 | + store: this.filecompressTT, | |
662 | + value: this.filecompressTT[0] | |
663 | + } | |
664 | + ]} | |
665 | + ] | |
666 | + }; | |
659 | 667 | |
660 | 668 | this.formPanel = new Ext.form.Panel({ |
661 | - layout: 'fit', | |
662 | - region: 'center', | |
663 | - bodyStyle: { background : '#dfe8f6' }, | |
664 | - buttonAlign: 'left', | |
665 | - trackResetOnLoad: true, //reset to the last loaded record | |
666 | - defaults: { | |
669 | + layout: 'fit', | |
670 | + region: 'center', | |
671 | + bodyStyle: { background : '#dfe8f6' }, | |
672 | + buttonAlign: 'left', | |
673 | + trackResetOnLoad: true, //reset to the last loaded record | |
674 | + defaults: { | |
667 | 675 | border: false |
668 | - }, | |
669 | - items: [ | |
670 | - { | |
671 | - xtype: 'tabpanel', | |
672 | - activeTab : 0, | |
673 | - bodyStyle: { background : '#dfe8f6' }, | |
674 | - items: [ | |
675 | - this.paramPanel, | |
676 | - this.ttPanel | |
677 | - ] | |
678 | - } | |
679 | - ], | |
680 | - fbar: [ | |
681 | - { | |
682 | - text: 'Download', | |
683 | - scope : this, | |
684 | - handler: function(button){ | |
685 | - // if the return is true (object had been updated) | |
686 | - if(this.updateObject()){ | |
687 | - // launch the search process | |
688 | - this.doDownload(); | |
689 | - } | |
690 | - } | |
691 | - }, | |
692 | - { | |
693 | - text: 'Reset', | |
694 | - scope : this, | |
695 | - handler: function(){ | |
696 | - this.formPanel.getForm().reset(); | |
697 | - | |
698 | - var tabPanel = this.formPanel.down(); | |
699 | - var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
700 | - if (downloadSrc === 0) { | |
701 | - // reset parameters and Time Tables in Get Data | |
702 | - this.paramGrid.store.removeAll(); | |
703 | - this.timeSelector.TTGrid.store.removeAll(); | |
704 | - } | |
705 | - else { | |
706 | - // reset Time Tables in Get time Table | |
707 | - this.TTGrid.store.removeAll(); | |
708 | - } | |
709 | - } | |
710 | - } | |
711 | - ] | |
712 | - }); | |
713 | - | |
676 | + }, | |
677 | + items: [{ | |
678 | + xtype: 'tabpanel', | |
679 | + activeTab : 0, | |
680 | + bodyStyle: { background : '#dfe8f6' }, | |
681 | + items: [ | |
682 | + this.paramPanel, | |
683 | + this.ttPanel | |
684 | + ] | |
685 | + }], | |
686 | + fbar: [ | |
687 | + { | |
688 | + text: 'Download', | |
689 | + scope : this, | |
690 | + handler: function(button){ | |
691 | + // if the return is true (object had been updated) | |
692 | + if(this.updateObject()){ | |
693 | + // launch the download process | |
694 | + this.doDownload(); | |
695 | + } | |
696 | + } | |
697 | + }, | |
698 | + { | |
699 | + text: 'Reset', | |
700 | + scope : this, | |
701 | + handler: function(){ | |
702 | + this.formPanel.getForm().reset(); | |
703 | + var tabPanel = this.formPanel.down(); | |
704 | + var downloadSrc = tabPanel.items.indexOf(tabPanel.getActiveTab()); | |
705 | + if (downloadSrc === 0) { | |
706 | + // reset parameters and Time Tables in Get Data | |
707 | + this.paramGrid.store.removeAll(); | |
708 | + this.timeSelector.TTGrid.store.removeAll(); | |
709 | + } | |
710 | + else { | |
711 | + // reset Time Tables in Get time Table | |
712 | + this.TTGrid.store.removeAll(); | |
713 | + } | |
714 | + } | |
715 | + }] | |
716 | + }); | |
714 | 717 | |
715 | - var myConf = { | |
716 | - layout: 'border', | |
717 | - items: [ | |
718 | - this.formPanel, | |
719 | - { | |
720 | - xtype: 'panel', | |
721 | - region: 'south', | |
722 | - title: 'Information', | |
723 | - collapsible: true, | |
724 | - height: 100, | |
725 | - autoHide: false, | |
726 | - bodyStyle: 'padding:5px', | |
727 | - iconCls: 'icon-information', | |
728 | - loader: { | |
729 | - autoLoad: true, | |
730 | - url: helpDir+'downloadHOWTO' | |
731 | - } | |
732 | - | |
733 | - | |
734 | - } | |
735 | - ], | |
736 | - plugins: [ {ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}] | |
737 | - }; | |
738 | - | |
739 | - Ext.apply (this, Ext.apply(arguments, myConf)); | |
740 | - } | |
741 | - | |
718 | + var myConf = { | |
719 | + layout: 'border', | |
720 | + items: [ | |
721 | + this.formPanel, | |
722 | + { | |
723 | + xtype: 'panel', | |
724 | + region: 'south', | |
725 | + title: 'Information', | |
726 | + collapsible: true, | |
727 | + height: 100, | |
728 | + autoHide: false, | |
729 | + bodyStyle: 'padding:5px', | |
730 | + iconCls: 'icon-information', | |
731 | + loader: { | |
732 | + autoLoad: true, | |
733 | + url: helpDir + 'downloadHOWTO' | |
734 | + } | |
735 | + } | |
736 | + ], | |
737 | + plugins: [ {ptype: 'paramArgumentsPlugin', pluginId: 'download-param-arguments-plugin'}] | |
738 | + }; | |
739 | + | |
740 | + Ext.apply (this, Ext.apply(arguments, myConf)); | |
741 | + } | |
742 | 742 | }); |
... | ... |
php/classes/AmdaAction.php
... | ... | @@ -596,38 +596,37 @@ class AmdaAction { |
596 | 596 | } |
597 | 597 | |
598 | 598 | |
599 | - public function getObject($id, $nodeType) { | |
600 | - | |
601 | - switch ($nodeType) { | |
602 | - case 'myDataParam': | |
603 | - case 'derivedParam' : | |
604 | - $objectMgr = new DerivedParamMgr($nodeType); | |
605 | - break; | |
606 | - case 'timeTable' : | |
607 | - case 'sharedtimeTable' : | |
608 | - $objectMgr = new TimeTableMgr(); | |
609 | - break; | |
610 | - case 'catalog' : | |
611 | - case 'sharedcatalog' : | |
612 | - $objectMgr = new CatalogMgr(); | |
613 | - break; | |
614 | - case 'condition' : | |
615 | - case 'request' : | |
616 | - $objectMgr = new RequestMgr($nodeType); | |
617 | - break; | |
618 | - case 'bkgWorks' : | |
599 | + public function getObject($id, $nodeType) { | |
600 | + | |
601 | + switch ($nodeType) { | |
602 | + case 'myDataParam': | |
603 | + case 'derivedParam' : | |
604 | + $objectMgr = new DerivedParamMgr($nodeType); | |
605 | + break; | |
606 | + case 'timeTable' : | |
607 | + case 'sharedtimeTable' : | |
608 | + $objectMgr = new TimeTableMgr(); | |
609 | + break; | |
610 | + case 'catalog' : | |
611 | + case 'sharedcatalog' : | |
612 | + $objectMgr = new CatalogMgr(); | |
613 | + break; | |
614 | + case 'condition' : | |
615 | + case 'request' : | |
616 | + $objectMgr = new RequestMgr($nodeType); | |
617 | + break; | |
618 | + case 'bkgWorks' : | |
619 | 619 | require_once(INTEGRATION_SRC_DIR."RequestManager.php"); |
620 | 620 | return $this->executeRequest($id, FunctionTypeEnumClass::PROCESSGETINFO); |
621 | - break; | |
622 | - case 'myData' : | |
623 | - $objectMgr = new FilesMgr(); | |
624 | - break; | |
625 | - default: | |
626 | - return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); | |
627 | - } | |
628 | - | |
629 | - return $objectMgr -> getObject($id, $nodeType); | |
630 | - } | |
621 | + break; | |
622 | + case 'myData' : | |
623 | + $objectMgr = new FilesMgr(); | |
624 | + break; | |
625 | + default: | |
626 | + return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); | |
627 | + } | |
628 | + return $objectMgr -> getObject($id, $nodeType); | |
629 | + } | |
631 | 630 | /* |
632 | 631 | * $obj = { id: node.id, leaf: node.leaf, nodeType: node.nodeType } |
633 | 632 | */ |
... | ... | @@ -846,13 +845,13 @@ class AmdaAction { |
846 | 845 | return array('success' => true, 'userHost' => $dd -> getIPclient()); |
847 | 846 | } |
848 | 847 | |
849 | - private function executeRequest($obj, $function) | |
850 | - { | |
848 | + private function executeRequest($obj, $function){ | |
849 | + | |
851 | 850 | $res = $this->checkUser($obj); |
852 | 851 | |
853 | 852 | if (!$res['success']) |
854 | 853 | return $res; |
855 | - | |
854 | + | |
856 | 855 | $requestManager = new RequestManagerClass(); |
857 | 856 | |
858 | 857 | try { |
... | ... | @@ -867,14 +866,18 @@ class AmdaAction { |
867 | 866 | /* |
868 | 867 | * Main EXECUTE PROCEDURE |
869 | 868 | */ |
870 | - public function execute($node, $obj) | |
871 | - { | |
869 | + public function execute($node, $obj){ | |
870 | + | |
872 | 871 | require_once(INTEGRATION_SRC_DIR."RequestManager.php"); |
873 | - if (isset($obj->action)) | |
872 | + | |
873 | + // just convert TT / Catalog | |
874 | + if ($obj->nodeType == "download" && $obj->downloadSrc == "1") | |
875 | + return $this->executeRequest($obj, FunctionTypeEnumClass::TTCONVERT); | |
876 | + else if (isset($obj->action)) | |
874 | 877 | return $this->executeRequest($obj, FunctionTypeEnumClass::ACTION); |
875 | 878 | else |
876 | 879 | return $this->executeRequest($obj, FunctionTypeEnumClass::PARAMS); |
877 | - } | |
880 | + } | |
878 | 881 | |
879 | 882 | /* |
880 | 883 | * Generate derived parameter compilation |
... | ... | @@ -888,8 +891,8 @@ class AmdaAction { |
888 | 891 | /* |
889 | 892 | * Delete derived parameter compilation |
890 | 893 | */ |
891 | - public function compilParamDelete($obj) | |
892 | - { | |
894 | + public function compilParamDelete($obj){ | |
895 | + | |
893 | 896 | require_once(INTEGRATION_SRC_DIR."RequestManager.php"); |
894 | 897 | $res = $this->checkUser($obj); |
895 | 898 | |
... | ... | @@ -1177,108 +1180,125 @@ class AmdaAction { |
1177 | 1180 | return $res; |
1178 | 1181 | } |
1179 | 1182 | |
1180 | - public function getCrtFilterResult() | |
1181 | - { | |
1182 | - $filtersMgr = new FiltersMgr(); | |
1183 | - return $filtersMgr->getCrtResult(); | |
1184 | - } | |
1183 | + public function getCrtFilterResult() | |
1184 | + { | |
1185 | + $filtersMgr = new FiltersMgr(); | |
1186 | + return $filtersMgr->getCrtResult(); | |
1187 | + } | |
1185 | 1188 | |
1186 | - public function setCrtFilterId($o) | |
1187 | - { | |
1188 | - $filtersMgr = new FiltersMgr(); | |
1189 | - return $filtersMgr->setCrtId($o->id); | |
1190 | - } | |
1189 | + public function setCrtFilterId($o) | |
1190 | + { | |
1191 | + $filtersMgr = new FiltersMgr(); | |
1192 | + return $filtersMgr->setCrtId($o->id); | |
1193 | + } | |
1191 | 1194 | |
1192 | - public function resetFilter() | |
1193 | - { | |
1194 | - $filtersMgr = new FiltersMgr(); | |
1195 | - $res = $filtersMgr->reset(); | |
1196 | - return $res; | |
1197 | - } | |
1195 | + public function resetFilter() | |
1196 | + { | |
1197 | + $filtersMgr = new FiltersMgr(); | |
1198 | + $res = $filtersMgr->reset(); | |
1199 | + return $res; | |
1200 | + } | |
1198 | 1201 | |
1199 | 1202 | public function logout($isGuest) |
1200 | 1203 | { |
1201 | - if ($isGuest) { | |
1202 | - $guestMgr = new Guest($this->user); | |
1203 | - $guestMgr->deleteGuest(); | |
1204 | - } | |
1205 | - else { | |
1206 | - $myBaseMgr = new BaseManager(); | |
1207 | - $myBaseMgr->delSimuFiles('mysimudata'); | |
1208 | - $myBaseMgr->delSimuFiles('mywsrdata'); | |
1209 | - | |
1210 | - $this->cleanUserWS(); | |
1211 | - } | |
1204 | + if ($isGuest) { | |
1205 | + $guestMgr = new Guest($this->user); | |
1206 | + $guestMgr->deleteGuest(); | |
1207 | + } | |
1208 | + else { | |
1209 | + $myBaseMgr = new BaseManager(); | |
1210 | + $myBaseMgr->delSimuFiles('mysimudata'); | |
1211 | + $myBaseMgr->delSimuFiles('mywsrdata'); | |
1212 | + | |
1213 | + $this->cleanUserWS(); | |
1214 | + } | |
1212 | 1215 | return; |
1213 | 1216 | } |
1214 | 1217 | |
1215 | - public function getInfo($obj) | |
1216 | - { | |
1217 | - if (file_exists(HELPPATH.$obj->name)) | |
1218 | - { | |
1219 | - $content = file_get_contents(HELPPATH.$obj->name); | |
1220 | - return array('success' => true, 'result' => $content); | |
1221 | - } | |
1222 | - return array('success' => false); | |
1223 | - | |
1224 | - } | |
1218 | + public function getInfo($obj) | |
1219 | + { | |
1220 | + if (file_exists(HELPPATH.$obj->name)) | |
1221 | + { | |
1222 | + $content = file_get_contents(HELPPATH.$obj->name); | |
1223 | + return array('success' => true, 'result' => $content); | |
1224 | + } | |
1225 | + return array('success' => false); | |
1226 | + } | |
1225 | 1227 | |
1226 | - public function getUserInfo() | |
1227 | - { | |
1228 | - $dd = new UserMgr(); | |
1229 | - return $dd->getUserInfo(); | |
1230 | - } | |
1231 | - | |
1232 | - public function convertWS() | |
1233 | - { | |
1234 | - $dd = new UserMgr(); | |
1235 | - return $dd->convertWS(); | |
1236 | - } | |
1228 | + public function getUserInfo() | |
1229 | + { | |
1230 | + $dd = new UserMgr(); | |
1231 | + return $dd->getUserInfo(); | |
1232 | + } | |
1237 | 1233 | |
1238 | -// $obj ={"Object":"Earth","RunCount":"2", | |
1239 | -// "SW_Density_value":"10","SW_Density_weight":"1","SW_Density_scale":"7","SW_Temperature_value":"100", ....} | |
1240 | - public function getRun($obj) | |
1241 | - { | |
1234 | + public function convertWS() | |
1235 | + { | |
1236 | + $dd = new UserMgr(); | |
1237 | + return $dd->convertWS(); | |
1238 | + } | |
1242 | 1239 | |
1243 | - $myBestRunsMgr = new BestRunsMgr(); | |
1244 | - $res = $myBestRunsMgr->getRun($obj); | |
1245 | - | |
1246 | - return $res; | |
1247 | - } | |
1240 | + // $obj ={"Object":"Earth","RunCount":"2", | |
1241 | + // "SW_Density_value":"10","SW_Density_weight":"1","SW_Density_scale":"7","SW_Temperature_value":"100", ....} | |
1242 | + public function getRun($obj) | |
1243 | + { | |
1244 | + $myBestRunsMgr = new BestRunsMgr(); | |
1245 | + $res = $myBestRunsMgr->getRun($obj); | |
1246 | + | |
1247 | + return $res; | |
1248 | + } | |
1248 | 1249 | |
1249 | - //$obj = array of IDs | |
1250 | - public function addRun($obj) | |
1251 | - { | |
1252 | - $myBestRunsMgr = new BestRunsMgr(); | |
1253 | - $myBestRunsMgr->init(); | |
1254 | - $myBestRunsMgr->addRuns($obj); | |
1255 | - | |
1256 | - $res = array('success' => true,'addedRuns' => $obj); | |
1257 | - return $res; | |
1258 | - } | |
1259 | - //AKKA - New action to clean user WS | |
1260 | - public function cleanUserWS() | |
1261 | - { | |
1262 | - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1263 | - return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN); | |
1264 | - } | |
1250 | + //$obj = array of IDs | |
1251 | + public function addRun($obj) | |
1252 | + { | |
1253 | + $myBestRunsMgr = new BestRunsMgr(); | |
1254 | + $myBestRunsMgr->init(); | |
1255 | + $myBestRunsMgr->addRuns($obj); | |
1265 | 1256 | |
1266 | - public function deleteSpecialInfo($name) | |
1267 | - { | |
1268 | - if (file_exists(USERDIR.$name)) | |
1269 | - unlink(USERDIR.$name); | |
1270 | - return array('success' => true); | |
1271 | - } | |
1257 | + $res = array('success' => true,'addedRuns' => $obj); | |
1258 | + return $res; | |
1259 | + } | |
1260 | + | |
1261 | + //AKKA - New action to clean user WS | |
1262 | + public function cleanUserWS() | |
1263 | + { | |
1264 | + $this->rrmdir(USERDIR.'DOWNLOAD.TEMP'); | |
1265 | + | |
1266 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1267 | + return $this->executeRequest($obj, FunctionTypeEnumClass::PROCESSCLEAN); | |
1268 | + } | |
1269 | + | |
1270 | + public function rrmdir($dir){ | |
1271 | + if (is_dir($dir)) { | |
1272 | + $objects = scandir($dir); | |
1273 | + foreach ($objects as $object) { // Recursively delete a directory that is not empty and directorys in directory | |
1274 | + if ($object != "." && $object != "..") { // If object isn't a directory recall recursively this function | |
1275 | + if (filetype($dir."/".$object) == "dir") | |
1276 | + $this->rrmdir($dir."/".$object); | |
1277 | + else | |
1278 | + unlink($dir."/".$object); | |
1279 | + } | |
1280 | + } | |
1281 | + reset($objects); | |
1282 | + rmdir($dir); | |
1283 | + } | |
1284 | + } | |
1285 | + | |
1286 | + public function deleteSpecialInfo($name) | |
1287 | + { | |
1288 | + if (file_exists(USERDIR.$name)) | |
1289 | + unlink(USERDIR.$name); | |
1290 | + return array('success' => true); | |
1291 | + } | |
1272 | 1292 | |
1273 | - public function interactivePlot($obj, $multiPlotState) | |
1274 | - { | |
1275 | - require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1276 | - $inputobj = (Object)array( | |
1277 | - 'action' => $obj, | |
1278 | - 'multiPlotState' => $multiPlotState | |
1279 | - ); | |
1280 | - return $this->executeRequest($inputobj, FunctionTypeEnumClass::ACTION); | |
1281 | - } | |
1293 | + public function interactivePlot($obj, $multiPlotState) | |
1294 | + { | |
1295 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1296 | + $inputobj = (Object)array( | |
1297 | + 'action' => $obj, | |
1298 | + 'multiPlotState' => $multiPlotState | |
1299 | + ); | |
1300 | + return $this->executeRequest($inputobj, FunctionTypeEnumClass::ACTION); | |
1301 | + } | |
1282 | 1302 | |
1283 | 1303 | public function getParamPlotInit($obj) |
1284 | 1304 | { |
... | ... |
php/classes/AmdaObjectMgr.php
... | ... | @@ -5,187 +5,208 @@ |
5 | 5 | * |
6 | 6 | */ |
7 | 7 | |
8 | - class AmdaObjectMgr { | |
9 | - | |
10 | - protected $xmlName, $xp; | |
11 | - protected $attributes, $optionalAttributes; | |
12 | - protected $contentRootId, $objTagName; | |
13 | - protected $descFileName, $resFileName; | |
14 | - protected $id_prefix; | |
15 | - protected $contentRootTag; | |
16 | - protected $obj, $id; | |
17 | - protected $types; | |
18 | - | |
19 | - public $contentDom; | |
20 | - public $objectDom; | |
21 | - | |
22 | - protected function __construct($xmlFile) { | |
23 | -// content XML | |
8 | +class AmdaObjectMgr { | |
9 | + | |
10 | + protected $xmlName, $xp; | |
11 | + protected $attributes, $optionalAttributes; | |
12 | + protected $contentRootId, $objTagName; | |
13 | + protected $descFileName, $resFileName; | |
14 | + protected $id_prefix; | |
15 | + protected $contentRootTag; | |
16 | + protected $obj, $id; | |
17 | + protected $types; | |
18 | + | |
19 | + public $contentDom; | |
20 | + public $objectDom; | |
21 | + | |
22 | + protected function __construct($xmlFile) { | |
23 | + // content XML | |
24 | 24 | $this->xmlName = USERWSDIR."/".$xmlFile; |
25 | 25 | $this->contentDom = new DomDocument("1.0"); |
26 | 26 | $this->contentDom->preserveWhiteSpace = false; |
27 | 27 | $this->contentDom->formatOutput = true; |
28 | 28 | |
29 | 29 | if (file_exists($this->xmlName)) { |
30 | - $this->contentDom -> load($this->xmlName); | |
31 | - $this->xp = new domxpath($this->contentDom); | |
30 | + $this->contentDom -> load($this->xmlName); | |
31 | + $this->xp = new domxpath($this->contentDom); | |
32 | 32 | } |
33 | -// object desc XML | |
34 | -//TODO not used in RequestMgr | |
33 | + // object desc XML | |
34 | + //TODO not used in RequestMgr | |
35 | 35 | $this->objectDom = new DomDocument("1.0"); |
36 | 36 | $this->objectDom->preserveWhiteSpace = false; |
37 | 37 | $this->objectDom->formatOutput = true; |
38 | 38 | } |
39 | 39 | |
40 | - private function getNewId() { | |
41 | - // Get all ID attributes | |
42 | - $elements = $this->xp->query("//".$this->objTagName."/@xml:id"); | |
40 | + private function getNewId() { | |
41 | + // Get all ID attributes | |
42 | + $elements = $this->xp->query("//".$this->objTagName."/@xml:id"); | |
43 | 43 | |
44 | - // Now find New Valid ID | |
44 | + // Now find New Valid ID | |
45 | 45 | if ($elements->length > 0) { |
46 | - if($elements->length > 0) for ($i = 0; $i < $elements->length; $i++) { | |
47 | - $id = explode('_',$elements->item($i)->nodeValue); | |
48 | - $idList[] = $id[1]; | |
46 | + if($elements->length > 0) for ($i = 0; $i < $elements->length; $i++) { | |
47 | + $id = explode('_',$elements->item($i)->nodeValue); | |
48 | + $idList[] = $id[1]; | |
49 | 49 | } |
50 | 50 | |
51 | 51 | sort($idList); |
52 | 52 | |
53 | 53 | for ($i = 0; $i < count($idList); $i++) { |
54 | - if ($idList[$i] > $i) { | |
55 | - $newID = $i; | |
56 | - break; | |
54 | + if ($idList[$i] > $i) { | |
55 | + $newID = $i; | |
56 | + break; | |
57 | 57 | } |
58 | - $newID = $i+1; | |
59 | - } | |
58 | + $newID = $i+1; | |
59 | + } | |
60 | 60 | } else |
61 | - $newID = 0; | |
62 | - return $newID; | |
63 | - } | |
61 | + $newID = 0; | |
62 | + return $newID; | |
63 | + } | |
64 | 64 | |
65 | 65 | protected function setId() { |
66 | - $id_ = $this->getNewId(); | |
66 | + | |
67 | + $id_ = $this->getNewId(); | |
67 | 68 | if ($id_ === false) return false; |
68 | 69 | $this->id = $this->id_prefix.$id_; |
70 | + | |
69 | 71 | return $this->id; |
70 | 72 | } |
71 | 73 | |
72 | 74 | protected function objectExistsByName($name){ |
73 | - $this->obj = $this->xp->query("//".$this->objTagName."[@name='".$name."']"); | |
75 | + | |
76 | + $this->obj = $this->xp->query("//".$this->objTagName."[@name='".$name."']"); | |
74 | 77 | if ($this->obj->length != 0) return true; |
78 | + | |
75 | 79 | return false; |
76 | 80 | } |
77 | 81 | |
78 | 82 | protected function getObjectIdByName($name) { |
83 | + | |
79 | 84 | $this->obj = $this->xp->query("//".$this->objTagName."[@name='".$name."']"); |
80 | - if ($this->obj->length == 0) return false; | |
81 | - $id = $this->obj->item(0)->getAttribute('xml:id'); | |
82 | - if ($id) return $id; | |
85 | + if ($this->obj->length == 0) return false; | |
86 | + $id = $this->obj->item(0)->getAttribute('xml:id'); | |
87 | + if ($id) return $id; | |
88 | + | |
83 | 89 | return false; |
84 | 90 | } |
85 | 91 | |
86 | 92 | protected function folderExistsByName($name){ |
87 | - $this->obj = $this->xp->query("//".$this->contentRootTag."/folder[@name='".$name."']"); | |
93 | + | |
94 | + $this->obj = $this->xp->query("//".$this->contentRootTag."/folder[@name='".$name."']"); | |
88 | 95 | if ($this->obj->length != 0) return true; |
96 | + | |
89 | 97 | return false; |
90 | 98 | } |
91 | 99 | |
92 | - protected function objectExistsById($id){ | |
100 | + protected function objectExistsById($id){ | |
101 | + | |
93 | 102 | $this->obj = $this->contentDom->getElementById($id); |
94 | 103 | if ($this->obj != null) return $this->obj; |
104 | + | |
95 | 105 | return false; |
96 | - } | |
106 | + } | |
97 | 107 | |
98 | - protected function createObjectResource(){} | |
99 | - protected function renameInResource(){} | |
108 | + protected function createObjectResource(){} | |
109 | + protected function renameInResource(){} | |
100 | 110 | |
101 | 111 | /* |
102 | 112 | * Write Object into desc file |
103 | 113 | */ |
104 | 114 | protected function createObjectDescription($obj){ |
105 | - $root = $this->objectDom->createElement($this->objTagName); | |
106 | - $root->setAttribute('xml:id',$this->id); | |
115 | + | |
116 | + $root = $this->objectDom->createElement($this->objTagName); | |
117 | + $root->setAttribute('xml:id',$this->id); | |
107 | 118 | |
108 | 119 | foreach($obj as $key => $value) { |
109 | - if ($key != 'id' && $key != 'leaf' && $key != 'nodeType') { | |
110 | - $node = $this->objectDom->createElement($key,htmlspecialchars($value)); | |
111 | - $root -> appendChild($node); | |
112 | - } | |
120 | + if ($key != 'id' && $key != 'leaf' && $key != 'nodeType') { | |
121 | + $node = $this->objectDom->createElement($key,htmlspecialchars($value)); | |
122 | + $root -> appendChild($node); | |
123 | + } | |
113 | 124 | } |
114 | -// add Optional Attributes if they are undefined | |
115 | - foreach ($this->optionalAttributes as $key => $value) | |
116 | - if ($root->getElementsByTagName($key)->length == 0) { | |
117 | - $node = $this->objectDom->createElement($key,htmlspecialchars($value)); | |
118 | - $root -> appendChild($node); | |
119 | - } | |
125 | + // add Optional Attributes if they are undefined | |
126 | + foreach ($this->optionalAttributes as $key => $value) | |
127 | + if ($root->getElementsByTagName($key)->length == 0) { | |
128 | + $node = $this->objectDom->createElement($key,htmlspecialchars($value)); | |
129 | + $root -> appendChild($node); | |
130 | + } | |
120 | 131 | |
121 | - $this->objectDom->appendChild($root); | |
122 | - $this->objectDom->save($this->descFileName); | |
123 | - } | |
132 | + $this->objectDom->appendChild($root); | |
133 | + $this->objectDom->save($this->descFileName); | |
134 | + } | |
135 | + | |
124 | 136 | /* |
125 | 137 | * Just Save Content XML |
126 | 138 | */ |
127 | - protected function saveContent() { | |
128 | - $this->contentDom->save($this->xmlName); | |
129 | - } | |
139 | + protected function saveContent() { | |
140 | + | |
141 | + $this->contentDom->save($this->xmlName); | |
142 | + } | |
130 | 143 | |
131 | 144 | /* |
132 | 145 | * Add Object to Content XML |
133 | 146 | */ |
134 | - protected function addToContent($obj, $folder) { | |
147 | + protected function addToContent($obj, $folder) { | |
135 | 148 | |
136 | - $folderToAdd = null; | |
149 | + $folderToAdd = null; | |
137 | 150 | |
138 | 151 | $objList = $this->contentDom->getElementById($this->contentRootId); |
139 | - $newObj = $this->contentDom->createElement($this->objTagName); | |
140 | - $newObj->setAttribute('xml:id',$this->id); | |
141 | -// object to mapped array | |
142 | - $obj_arr = (array)$obj; | |
143 | - foreach ($this->attributes as $key => $value) { | |
144 | - $newObj->setAttribute($key, $obj_arr[$key]); | |
145 | - } | |
146 | - if ($folder != null) | |
147 | - $folderToAdd = $this->contentDom->getElementById($folder); | |
148 | - | |
149 | - if ($folderToAdd) $folderToAdd -> appendChild($newObj); | |
150 | - else $objList -> appendChild($newObj); | |
151 | - | |
152 | + $newObj = $this->contentDom->createElement($this->objTagName); | |
153 | + $newObj->setAttribute('xml:id',$this->id); | |
154 | + // object to mapped array | |
155 | + $obj_arr = (array)$obj; | |
156 | + foreach ($this->attributes as $key => $value) { | |
157 | + $newObj->setAttribute($key, $obj_arr[$key]); | |
158 | + } | |
159 | + if ($folder != null) | |
160 | + $folderToAdd = $this->contentDom->getElementById($folder); | |
161 | + | |
162 | + if ($folderToAdd) | |
163 | + $folderToAdd -> appendChild($newObj); | |
164 | + else | |
165 | + $objList -> appendChild($newObj); | |
152 | 166 | |
153 | 167 | $this->saveContent(); |
154 | - } | |
168 | + } | |
155 | 169 | |
156 | 170 | /* |
157 | -* Delete Object From Content XML | |
171 | +* Delete Object From Content XML | |
158 | 172 | */ |
159 | - protected function deleteFromContent($obj) { | |
160 | - $objList = $obj -> parentNode;// $this->contentDom->getElementById($this->contentRootId); | |
161 | - $objList -> removeChild($obj); | |
173 | + protected function deleteFromContent($obj) { | |
174 | + | |
175 | + $objList = $obj -> parentNode; // $this->contentDom->getElementById($this->contentRootId); | |
176 | + $objList -> removeChild($obj); | |
162 | 177 | $this->saveContent(); |
163 | - } | |
178 | + } | |
164 | 179 | |
165 | 180 | /* |
166 | -* Create Folder | |
181 | +* Create Folder | |
167 | 182 | */ |
168 | - protected function createFolder($obj){ | |
169 | - if ($this -> folderExistsByName($obj->name)) return array('error' => NAME_EXISTS); | |
170 | - $newFolder = $this->contentDom->createElement('folder'); | |
171 | - $id = $obj->name."_".$this->objTagName; | |
172 | - $newFolder -> setAttribute('xml:id',$id); | |
173 | - $newFolder -> setAttribute('name',$obj->name); | |
174 | - $objList = $this->contentDom->getElementById($obj->parent); | |
175 | - $objList -> appendChild($newFolder); | |
176 | - $this -> saveContent(); | |
183 | + protected function createFolder($obj){ | |
184 | + | |
185 | + if ($this -> folderExistsByName($obj->name)) | |
186 | + return array('error' => NAME_EXISTS); | |
187 | + $newFolder = $this->contentDom->createElement('folder'); | |
188 | + $id = $obj->name."_".$this->objTagName; | |
189 | + $newFolder -> setAttribute('xml:id',$id); | |
190 | + $newFolder -> setAttribute('name',$obj->name); | |
191 | + $objList = $this->contentDom->getElementById($obj->parent); | |
192 | + $objList -> appendChild($newFolder); | |
193 | + $this -> saveContent(); | |
194 | + | |
177 | 195 | return array('id' => $id); |
178 | - } | |
196 | + } | |
197 | + | |
179 | 198 | /* |
180 | 199 | * Get Folder of the object |
181 | 200 | */ |
182 | - protected function getObjectFolder($id) { | |
201 | + protected function getObjectFolder($id) { | |
183 | 202 | |
184 | - if (!($obj = $this->objectExistsById($id))) return "NO_SUCH_ID"; | |
185 | - if ($obj->parentNode->tagName == 'folder') return $obj->parentNode->getAttribute('xml:id'); | |
203 | + if (!($obj = $this->objectExistsById($id))) | |
204 | + return "NO_SUCH_ID"; | |
205 | + if ($obj->parentNode->tagName == 'folder') | |
206 | + return $obj->parentNode->getAttribute('xml:id'); | |
207 | + | |
186 | 208 | return null; |
187 | - | |
188 | - } | |
209 | + } | |
189 | 210 | |
190 | 211 | protected function setAlias($chain) { |
191 | 212 | |
... | ... | @@ -195,9 +216,8 @@ |
195 | 216 | foreach($listeAlias as $alias) { |
196 | 217 | $chain = $aliasMgr->substrParamAlias($chain, $alias->getAttribute("xml:id"),$alias->getAttribute("name")); |
197 | 218 | } |
198 | - | |
199 | 219 | return $chain; |
200 | - } | |
220 | + } | |
201 | 221 | |
202 | 222 | protected function resetAlias($chain) { |
203 | 223 | |
... | ... | @@ -207,23 +227,23 @@ |
207 | 227 | foreach($listeAlias as $alias) { |
208 | 228 | $chain = $aliasMgr->substrAliasParam($chain, $alias->getAttribute("xml:id"),$alias->getAttribute("name")); |
209 | 229 | } |
210 | - | |
211 | 230 | return $chain; |
212 | 231 | } |
213 | 232 | |
214 | 233 | protected function createDom() { |
215 | 234 | |
216 | 235 | $rootElement = $this->contentDom->createElement('ws'); |
217 | - foreach ($this->types as $type) { | |
218 | - $contentId = $type.'-treeRootNode'; | |
219 | - $contentTag = $type.'List'; | |
220 | - $typeElement = $this->contentDom->createElement($contentTag); | |
221 | - $typeElement->setAttribute('xml:id', $contentId); | |
222 | - $rootElement->appendChild($typeElement); | |
236 | + foreach ($this->types as $type) { | |
237 | + $contentId = $type.'-treeRootNode'; | |
238 | + $contentTag = $type.'List'; | |
239 | + $typeElement = $this->contentDom->createElement($contentTag); | |
240 | + $typeElement->setAttribute('xml:id', $contentId); | |
241 | + $rootElement->appendChild($typeElement); | |
223 | 242 | } |
224 | - $this->contentDom->appendChild($rootElement); | |
243 | + | |
244 | + $this->contentDom->appendChild($rootElement); | |
225 | 245 | $this->contentDom->save($this->xmlName); |
226 | - } | |
246 | + } | |
227 | 247 | |
228 | 248 | |
229 | 249 | /***************************************************************** |
... | ... | @@ -234,104 +254,121 @@ |
234 | 254 | * Create Parameter[TT...]/Folder |
235 | 255 | * create object itself, add it to content DOM |
236 | 256 | */ |
237 | - function createObject($p, $folder){ | |
257 | + function createObject($p, $folder){ | |
238 | 258 | |
239 | - if ($p -> leaf) return $this->createParameter($p, $folder); | |
240 | - // else return $this->createFolder($p); | |
241 | -//TODO check if this is possible? | |
242 | - else return array('error' => 'createFolder should be called from RENAME'); | |
259 | + if ($p -> leaf) | |
260 | + return $this->createParameter($p, $folder); | |
261 | + // else return $this->createFolder($p); | |
262 | + //TODO check if this is possible? | |
263 | + else | |
264 | + return array('error' => 'createFolder should be called from RENAME'); | |
243 | 265 | |
244 | - } | |
266 | + } | |
245 | 267 | |
246 | 268 | /* |
247 | 269 | * Rename Parameter[TT...]/Folder |
248 | 270 | */ |
249 | - function renameObject($p){ | |
271 | + function renameObject($p){ | |
250 | 272 | |
251 | 273 | if (!($objToRename = $this -> objectExistsById($p->id))) { |
252 | -// NO SUCH ID: leaf -> error; | |
253 | - if ($p->leaf) return array('error' => NO_SUCH_ID); | |
254 | -// NO SUCH ID: folder -> create | |
255 | - return $this -> createFolder($p); | |
256 | - } | |
257 | -// object was just DD in the tree : move tag in xml | |
274 | + // NO SUCH ID: leaf -> error; | |
275 | + if ($p->leaf) | |
276 | + return array('error' => NO_SUCH_ID); | |
277 | + // NO SUCH ID: folder -> create | |
278 | + return $this -> createFolder($p); | |
279 | + } | |
280 | + | |
281 | + // object was just DD in the tree : move tag in xml | |
258 | 282 | if ($p -> name == $p -> old_name) { |
259 | - if (!($parentNode = $this->contentDom->getElementById($p -> parent))) return array('error' => NO_SUCH_PARENT_ID); | |
260 | - $parentNode -> appendChild($objToRename); | |
261 | - $this->saveContent(); | |
262 | - return array('id' => $p->id); | |
263 | - } | |
264 | - | |
265 | -// if ($this -> objectExistsByName($p->name, $this->objTagName)) return array('error' => NAME_EXISTS); | |
266 | -//TODO CHECK: With some PHP versions setAttribute ADD attribute | |
267 | - if ($objToRename->hasAttribute('name')) $objToRename->removeAttribute('name'); | |
268 | - $objToRename->setAttribute('name',$p->name); | |
283 | + if (!($parentNode = $this->contentDom->getElementById($p -> parent))) | |
284 | + return array('error' => NO_SUCH_PARENT_ID); | |
285 | + $parentNode -> appendChild($objToRename); | |
286 | + $this->saveContent(); | |
287 | + | |
288 | + return array('id' => $p->id); | |
289 | + } | |
290 | + | |
291 | + //TODO CHECK: With some PHP versions setAttribute ADD attribute | |
292 | + if ($objToRename->hasAttribute('name')) | |
293 | + $objToRename->removeAttribute('name'); | |
294 | + | |
295 | + $objToRename->setAttribute('name',$p->name); | |
296 | + | |
269 | 297 | if (!$p->leaf) { |
270 | - $objToRename->removeAttribute('xml:id'); | |
271 | - $objToRename->setAttribute('xml:id', $p->name.'_'.$this->objTagName); | |
272 | - } | |
298 | + $objToRename->removeAttribute('xml:id'); | |
299 | + $objToRename->setAttribute('xml:id', $p->name.'_'.$this->objTagName); | |
300 | + } | |
273 | 301 | else |
274 | - $this -> renameInResource($p->name, $p->id); | |
302 | + $this -> renameInResource($p->name, $p->id); | |
275 | 303 | |
276 | 304 | $this->saveContent(); |
305 | + | |
277 | 306 | return array('id' => $p->id); |
278 | 307 | } |
279 | 308 | |
280 | 309 | /* |
281 | 310 | * Delete Parameter[TT...]/Folder |
282 | -* Delete object itself, delete from contentDOM, mark as undefined in depending objects | |
311 | +* Delete object itself, delete from contentDOM, mark as undefined in depending objects | |
283 | 312 | */ |
284 | - function deleteObject($p){ | |
285 | - | |
286 | - if ($p->leaf) { | |
287 | -// if Parameter[TT...] - delete resources first | |
288 | - $isDeleted = $this->deleteParameter($p->id); | |
289 | - if (!($objToDelete = $this -> objectExistsById($p->id))) return array('error' => NO_SUCH_ID); | |
290 | - } | |
291 | - else { | |
292 | - if (!($objToDelete = $this -> objectExistsById($p->id))) return array('error' => NO_SUCH_ID); | |
313 | + function deleteObject($p){ | |
314 | + | |
315 | + if ($p->leaf) { | |
316 | + // if Parameter[TT...] - delete resources first | |
317 | + $isDeleted = $this->deleteParameter($p->id); | |
318 | + if (!($objToDelete = $this -> objectExistsById($p->id))) | |
319 | + return array('error' => NO_SUCH_ID); | |
320 | + } | |
321 | + else { | |
322 | + if (!($objToDelete = $this -> objectExistsById($p->id))) | |
323 | + return array('error' => NO_SUCH_ID); | |
293 | 324 | $folderToDelete = $objToDelete->getElementsByTagName($this->objTagName); |
294 | -// delete all parameters[TT..] in folder(s) | |
325 | + // delete all parameters[TT..] in folder(s) | |
295 | 326 | foreach ($folderToDelete as $obj) { |
296 | - $id = $obj->getAttribute('xml:id'); | |
297 | - $this->deleteParameter($id); | |
298 | - } | |
299 | - } | |
300 | - $this -> deleteFromContent($objToDelete); | |
301 | - | |
302 | - if ($isDeleted) return array('id' => $p->id, 'maskDeleted' => true); | |
303 | - else return array('id' => $p->id); | |
304 | - } | |
327 | + $id = $obj->getAttribute('xml:id'); | |
328 | + $this->deleteParameter($id); | |
329 | + } | |
330 | + } | |
331 | + | |
332 | + $this -> deleteFromContent($objToDelete); | |
333 | + | |
334 | + if ($isDeleted) | |
335 | + return array('id' => $p->id, 'maskDeleted' => true); | |
336 | + else | |
337 | + return array('id' => $p->id); | |
338 | + } | |
305 | 339 | |
306 | 340 | /* |
307 | 341 | * Modify Parameter[TT...]/Folder |
308 | -*/ | |
309 | - | |
310 | - function modifyObject($p){ | |
311 | - if ($this->renameOnly($p)) { | |
342 | +*/ | |
343 | + function modifyObject($p){ | |
344 | + | |
345 | + if ($this->renameOnly($p)) { | |
312 | 346 | $p->leaf = 1; |
313 | - return $this->renameObject($p); | |
314 | - } | |
315 | - $folder = $this->getObjectFolder($p->id); | |
316 | - $this->deleteObject($p); | |
317 | - return | |
318 | - $this->createObject($p, $folder); | |
319 | - } | |
347 | + return $this->renameObject($p); | |
348 | + } | |
349 | + | |
350 | + $folder = $this->getObjectFolder($p->id); | |
351 | + $this->deleteObject($p); | |
352 | + | |
353 | + return $this->createObject($p, $folder); | |
354 | + } | |
320 | 355 | |
321 | 356 | |
322 | - function validNameObject($p){ | |
323 | - if (!isset($p->name) || ($p->name == "")) | |
324 | - return array('valid' => false, 'error' => 'Name is required'); | |
325 | - if ($p->leaf) | |
326 | - $alreadyExist = $this -> objectExistsByName($p->name, $this->objTagName); | |
327 | - else | |
328 | - $alreadyExist = $this -> folderExistsByName($p->name); | |
329 | - if ($alreadyExist) | |
330 | - return array('valid' => false, 'error' => 'This name already exists in this subtree!'); | |
331 | - return array('valid' => true); | |
332 | - } | |
357 | + function validNameObject($p){ | |
358 | + | |
359 | + if (!isset($p->name) || ($p->name == "")) | |
360 | + return array('valid' => false, 'error' => 'Name is required'); | |
361 | + if ($p->leaf) | |
362 | + $alreadyExist = $this -> objectExistsByName($p->name, $this->objTagName); | |
363 | + else | |
364 | + $alreadyExist = $this -> folderExistsByName($p->name); | |
365 | + if ($alreadyExist) | |
366 | + return array('valid' => false, 'error' => 'This name already exists in this subtree!'); | |
367 | + | |
368 | + return array('valid' => true); | |
369 | + } | |
333 | 370 | |
334 | - function getObject($id){} | |
371 | + function getObject($id){} | |
335 | 372 | |
336 | 373 | } |
337 | 374 | ?> |
... | ... |
php/classes/TimeTableMgr.php
... | ... | @@ -54,9 +54,9 @@ class TimeTableMgr extends AmdaObjectMgr |
54 | 54 | $this->contentDom->save($this->xmlName); |
55 | 55 | } |
56 | 56 | |
57 | - /* | |
58 | - * rename Time Table in id.xml | |
59 | - */ | |
57 | +/* | |
58 | +* rename Time Table in id.xml | |
59 | +*/ | |
60 | 60 | protected function renameInResource($name, $id) |
61 | 61 | { |
62 | 62 | if (!file_exists(USERTTDIR.$id.'.xml')) return false; |
... | ... | @@ -150,65 +150,9 @@ class TimeTableMgr extends AmdaObjectMgr |
150 | 150 | return $inter; |
151 | 151 | } |
152 | 152 | |
153 | - /* | |
154 | - * For TT download : file format in text | |
155 | - */ | |
156 | - protected function xsl2text($file,$format) | |
157 | - { | |
158 | - define("format", $format); | |
159 | - $xslt = new XSLTProcessor(); | |
160 | - | |
161 | - // add PHP functions to XSLT functions | |
162 | - $xslt -> registerPHPFunctions(); | |
163 | - | |
164 | - // Load Time table | |
165 | - $xml = new domDocument("1.0"); | |
166 | - $xml->load($file); | |
167 | - | |
168 | - // Load XSL file | |
169 | - $xsl = new domDocument("1.0"); | |
170 | - if ($format == "Y-m-dTH:i:s") $xslName = "xml2iso.xsl"; | |
171 | - else $xslName = "xml2all.xsl"; | |
172 | - $xsl->load(XMLPATH.$xslName); | |
173 | - | |
174 | - // Import XSL and write output file in text format | |
175 | - $xslt -> importStylesheet($xsl); | |
176 | - $filename = $xml->getElementsByTagName('name')->item(0)->nodeValue.".txt"; | |
177 | - $output=fopen(USERWORKINGDIR.$filename, "w"); | |
178 | - fwrite($output, trim($xslt -> transformToDoc($xml)->firstChild->wholeText)); | |
179 | - fclose($output); | |
180 | - | |
181 | - return USERWORKINGDIR.$filename; | |
182 | - } | |
183 | - | |
184 | - /* | |
185 | - * For TT download : file format in vot | |
186 | - */ | |
187 | - public function xsl2vot($file,$format) | |
188 | - { | |
189 | - $xslt = new XSLTProcessor(); | |
190 | - | |
191 | - // Load Time table | |
192 | - $xml = new domDocument("1.0"); | |
193 | - $xml->load($file); | |
194 | - | |
195 | - // Load XSL file | |
196 | - $xsl = new domDocument("1.0"); | |
197 | - $xsl->load(XMLPATH.'xml2vot.xsl'); | |
198 | - | |
199 | - // Import XSL and write output file in vot format | |
200 | - $xslt -> importStylesheet($xsl); | |
201 | - $vot = new domDocument("1.0"); | |
202 | - $vot -> loadXML($xslt -> transformToXML($xml)); | |
203 | - $filename = $xml->getElementsByTagName('name')->item(0)->nodeValue.".xml"; | |
204 | - $vot -> save(USERWORKINGDIR.$filename); | |
205 | - | |
206 | - return USERWORKINGDIR.$filename; | |
207 | - } | |
208 | - | |
209 | - /* | |
210 | - * Uploaded text file => convert to array | |
211 | - */ | |
153 | +/* | |
154 | +* Uploaded text file => convert to array | |
155 | +*/ | |
212 | 156 | protected function text2amda($tmp_file, $onlyDescription = false) |
213 | 157 | { |
214 | 158 | $suffix = explode('.', basename($tmp_file)); |
... | ... | @@ -828,7 +772,7 @@ class TimeTableMgr extends AmdaObjectMgr |
828 | 772 | chmod($dst_file_path, 0775); |
829 | 773 | |
830 | 774 | return TRUE; |
831 | - } | |
775 | + } | |
832 | 776 | |
833 | 777 | } |
834 | 778 | ?> |
... | ... |