Commit 43aefb08bd62f2c54affadc50fb2c0dbb0ccf994

Authored by Benjamin Renard
2 parents 28660257 8077d2c5

Merge branch 'master' of https://gitlab.irap.omp.eu/CDPP/AMDA_IHM

desktop.php
... ... @@ -91,7 +91,8 @@
91 91  
92 92 var helpDir = 'help/';
93 93 var isGuest = sessionID.match('guest');
94   -
  94 +
  95 + var max_uploaded_file_size = '<?php echo MAX_UPLOADED_FILESIZE; ?>';
95 96 var guestSessionDuration = '<?php echo GuestSessionDuration*60; ?>'; // in secs
96 97 var maxGuestTimeInterval = '<?php echo MaxGuestTimeInterval; ?>'; // in days
97 98  
... ...
help/dataMiningHOWTO
1   -
2   - To construct a condition for data mining <b><i>drag</i></b> one of the AMDA parameters
3   - from the parameter tree and <b><i>drop</i></b> onto the panel.<br/>
4   - Use <b>&</b> symbol as logical <b><i>AND</i></b> and <b>|</b> symbol as logical <b><i>OR</i></b>.<br/>
5   - <b><i>Attention !</i></b> Use <b><i>FLOAT</i></b> numbers in math expressions.<br/>
6 1 \ No newline at end of file
  2 +To construct a condition for data mining <i>drag</i> one of the AMDA parameters
  3 +from the parameter tree and <i>drop</i> onto the panel.
  4 +<li>1. Use <b><i>FLOAT numbers<i></b> in math expressions
  5 +<li>2. <b>Enclose</b> your expression in<b>brackets</b> - <i>(1./2.*imf(0)) > 0</i>
  6 +<li>3. Use <b>&</b> as <i>AND</i> and <b>|</b> as <i>OR</i> and <b>enclose</b> every logical block in <b>brackets</b> - <i>(imf(0) > 0) & ((5.*imf(1)) < -5)
  7 +
... ...
help/myParameterHOWTO
1   - <li>1. To construct a new parameter <i>drag</i> one of the AMDA parameters from the Parameters tree
  1 + To construct a new parameter <i>drag</i> one of the AMDA parameters from the Parameters tree
2 2 and <i>drop</i> it onto the Construct Parameter text area.
3 3  
4 4  
5 5 \ No newline at end of file
... ...
install-scripts.sh
... ... @@ -5,10 +5,6 @@
5 5 # AMDA_IHM installation root
6 6 export IHM_DIR=/home/budnik/AMDA/AMDA_IHM
7 7  
8   -export CDF_DIR=/usr/local/cdf
9   -export CEF_DIR=/usr/local/cef
10   -export DD_LIB=/usr/local/DDClient/lib
11   -export DD_INCLUDE=/usr/local/DDClient/include/DDClientLibC
12 8  
13 9 cd $IHM_DIR/php/src && make clean && make && make install && make clean
14 10 cd $IHM_DIR
... ...
js/app/AmdaApp.js
... ... @@ -8,94 +8,94 @@
8 8 */
9 9  
10 10 Ext.define('amdaApp.AmdaApp', {
11   - extend: 'Ext.ux.desktop.App',
12   -
13   - requires: [
14   - 'Ext.window.MessageBox',
15   - 'Ext.ux.desktop.ShortcutModel',
16   - 'amdaUI.SampToolBarUI',
17   - 'amdaDesktop.DynamicModule',
18   - 'MyDesktop.Settings'
19   - ],
20   -
21   - dynamicModules: {
22   - visu : {
23   - id : 'visu-win',
24   - icon : 'icon-visu_catalog',
25   - title : 'Visualization',
26   - source : 'amdaDesktop.VisuModule',
27   - useLauncher : true
28   - },
29   - statistics : {
30   - id : 'statistics-win',
31   - icon : 'icon-statistics',
32   - title : 'Statistics',
33   - source : 'amdaDesktop.StatisticsModule',
34   - useLauncher : true
35   - },
36   - catalog : {
37   - id : 'catalog-win',
38   - icon : 'icon-catalog',
39   - title : 'Manage catalogs',
40   - source : 'amdaDesktop.CatalogModule',
41   - useLauncher : true
42   - },
43   - param : {
44   - id : 'param-win',
45   - icon : 'icon-parameters',
46   - title : 'Create/modify parameters',
47   - source : 'amdaDesktop.ParameterModule',
48   - useLauncher : true
49   - },
50   - tt : {
51   - id : 'timetab-win',
52   - icon : 'icon-manage-tt',
53   - title : 'Manage Time Tables',
54   - source : 'amdaDesktop.TimeTableModule',
55   - useLauncher : true
56   - },
57   - tt_op : {
58   - id : 'ttsOpe-win',
59   - icon : 'icon-tts',
60   - title : 'Operations on Time Tables',
61   - source : 'amdaDesktop.TimeTableOperationModule',
62   - useLauncher : true
63   - },
64   - plot : {
65   - id : 'plot-win',
66   - icon : 'icon-plot',
67   - title : 'Plot Manager',
68   - source : 'amdaDesktop.PlotModule',
69   - useLauncher : true
70   - },
71   - search : {
72   - id : 'search-win',
73   - icon : 'icon-search',
74   - title : 'Data Mining',
75   - source : 'amdaDesktop.SearchModule',
76   - useLauncher : true
77   - },
78   - download : {
79   - id : 'down-win',
80   - icon : 'icon-download',
81   - title : 'Download data',
82   - source : 'amdaDesktop.DownloadModule',
83   - useLauncher : true
84   - },
85   - upload : {
86   - id : 'up-win',
87   - icon : 'icon-mydata',
88   - title : 'Upload data',
89   - source : 'amdaDesktop.UploadModule',
90   - useLauncher : true
91   - },
92   - interop : {
93   - id : 'interop-win',
94   - icon : 'icon-interop',
95   - title : 'Interoperability',
96   - source : 'amdaDesktop.InteropModule',
97   - useLauncher : true
98   - },
  11 + extend: 'Ext.ux.desktop.App',
  12 +
  13 + requires: [
  14 + 'Ext.window.MessageBox',
  15 + 'Ext.ux.desktop.ShortcutModel',
  16 + 'amdaUI.SampToolBarUI',
  17 + 'amdaDesktop.DynamicModule',
  18 + 'MyDesktop.Settings'
  19 + ],
  20 +
  21 + dynamicModules: {
  22 + visu : {
  23 + id : 'visu-win',
  24 + icon : 'icon-visu_catalog',
  25 + title : 'Visualization',
  26 + source : 'amdaDesktop.VisuModule',
  27 + useLauncher : true
  28 + },
  29 + statistics : {
  30 + id : 'statistics-win',
  31 + icon : 'icon-statistics',
  32 + title : 'Statistics',
  33 + source : 'amdaDesktop.StatisticsModule',
  34 + useLauncher : true
  35 + },
  36 + catalog : {
  37 + id : 'catalog-win',
  38 + icon : 'icon-catalog',
  39 + title : 'Manage catalogs',
  40 + source : 'amdaDesktop.CatalogModule',
  41 + useLauncher : true
  42 + },
  43 + param : {
  44 + id : 'param-win',
  45 + icon : 'icon-parameters',
  46 + title : 'Create/modify parameters',
  47 + source : 'amdaDesktop.ParameterModule',
  48 + useLauncher : true
  49 + },
  50 + tt : {
  51 + id : 'timetab-win',
  52 + icon : 'icon-manage-tt',
  53 + title : 'Manage Time Tables',
  54 + source : 'amdaDesktop.TimeTableModule',
  55 + useLauncher : true
  56 + },
  57 + tt_op : {
  58 + id : 'ttsOpe-win',
  59 + icon : 'icon-tts',
  60 + title : 'Operations on Time Tables',
  61 + source : 'amdaDesktop.TimeTableOperationModule',
  62 + useLauncher : true
  63 + },
  64 + plot : {
  65 + id : 'plot-win',
  66 + icon : 'icon-plot',
  67 + title : 'Plot Manager',
  68 + source : 'amdaDesktop.PlotModule',
  69 + useLauncher : true
  70 + },
  71 + search : {
  72 + id : 'search-win',
  73 + icon : 'icon-search',
  74 + title : 'Data Mining',
  75 + source : 'amdaDesktop.SearchModule',
  76 + useLauncher : true
  77 + },
  78 + download : {
  79 + id : 'down-win',
  80 + icon : 'icon-download',
  81 + title : 'Download data',
  82 + source : 'amdaDesktop.DownloadModule',
  83 + useLauncher : true
  84 + },
  85 + upload : {
  86 + id : 'up-win',
  87 + icon : 'icon-mydata',
  88 + title : 'Upload data',
  89 + source : 'amdaDesktop.UploadModule',
  90 + useLauncher : true
  91 + },
  92 + interop : {
  93 + id : 'interop-win',
  94 + icon : 'icon-interop',
  95 + title : 'Interoperability',
  96 + source : 'amdaDesktop.InteropModule',
  97 + useLauncher : true
  98 + },
99 99 epntap : {
100 100 id : 'epntap-win',
101 101 icon : 'icon-interop',
... ... @@ -103,399 +103,372 @@ Ext.define(&#39;amdaApp.AmdaApp&#39;, {
103 103 source : 'amdaDesktop.EpnTapModule',
104 104 useLauncher : false
105 105 },
106   - info : {
107   - id : 'info-win',
108   - icon : 'icon-information',
109   - title : 'About AMDA',
110   - source : 'amdaDesktop.AboutModule',
111   - useLauncher : false
112   - },
113   - explorer : {
114   - id : 'explorer-win',
115   - icon : 'icon-elements',
116   - title : 'Workspace Explorer',
117   - source : 'amdaDesktop.ExplorerModule',
118   - useLauncher : false
119   - },
120   - my_data : {
121   - id : 'mydata-win',
122   - icon : 'icon-mydata',
123   - title : 'Define parameter',
124   - source : 'amdaDesktop.MyDataModule',
125   - useLauncher : false
126   - },
127   - help : {
128   - id : 'help-win',
129   - icon : 'icon-help',
130   - title : 'Help',
131   - source : 'amdaDesktop.HelpModule',
132   - useLauncher : false
133   - },
134   - feedback : {
135   - id : 'feed-win',
136   - icon : 'icon-feedback',
137   - title : 'Feedback',
138   - source : 'amdaDesktop.FeedbackModule',
139   - useLauncher : false
140   - },
141   - filters : {
142   - id : 'filters-win',
143   - icon : 'icon-filter',
144   - title : 'Filters',
145   - source : 'amdaDesktop.FiltersModule',
146   - useLauncher : false
147   - },
148   - result : {
149   - id : 'result-win',
150   - contentId : 'resultUI',
151   - icon : 'icon-results',
152   - title : 'Results',
153   - source : 'amdaDesktop.ResultModule',
154   - useLauncher : false
155   - },
156   - astro : {
157   - id : 'astroimages-win',
158   - icon : 'icon-interop',
159   - title : 'Astronomical Images',
160   - source : 'amdaDesktop.AstroImagesModule',
161   - useLauncher : false
162   - }
163   - },
164   -
165   -// IDs of Modules working with parameters; used in Alias Node
166   - paramModulesID : ['plot-win', 'param-win', 'search-win', 'down-win'],
167   -
168   -// Important system constants
169   - MAX_UPLOADED_FILE_SIZE : 30000000, // 30MB
170   -
171   - listeners : {
  106 + info : {
  107 + id : 'info-win',
  108 + icon : 'icon-information',
  109 + title : 'About AMDA',
  110 + source : 'amdaDesktop.AboutModule',
  111 + useLauncher : false
  112 + },
  113 + explorer : {
  114 + id : 'explorer-win',
  115 + icon : 'icon-elements',
  116 + title : 'Workspace Explorer',
  117 + source : 'amdaDesktop.ExplorerModule',
  118 + useLauncher : false
  119 + },
  120 + my_data : {
  121 + id : 'mydata-win',
  122 + icon : 'icon-mydata',
  123 + title : 'Define parameter',
  124 + source : 'amdaDesktop.MyDataModule',
  125 + useLauncher : false
  126 + },
  127 + help : {
  128 + id : 'help-win',
  129 + icon : 'icon-help',
  130 + title : 'Help',
  131 + source : 'amdaDesktop.HelpModule',
  132 + useLauncher : false
  133 + },
  134 + feedback : {
  135 + id : 'feed-win',
  136 + icon : 'icon-feedback',
  137 + title : 'Feedback',
  138 + source : 'amdaDesktop.FeedbackModule',
  139 + useLauncher : false
  140 + },
  141 + filters : {
  142 + id : 'filters-win',
  143 + icon : 'icon-filter',
  144 + title : 'Filters',
  145 + source : 'amdaDesktop.FiltersModule',
  146 + useLauncher : false
  147 + },
  148 + result : {
  149 + id : 'result-win',
  150 + contentId : 'resultUI',
  151 + icon : 'icon-results',
  152 + title : 'Results',
  153 + source : 'amdaDesktop.ResultModule',
  154 + useLauncher : false
  155 + },
  156 + astro : {
  157 + id : 'astroimages-win',
  158 + icon : 'icon-interop',
  159 + title : 'Astronomical Images',
  160 + source : 'amdaDesktop.AstroImagesModule',
  161 + useLauncher : false
  162 + }
  163 + },
  164 +
  165 + // IDs of Modules working with parameters; used in Alias Node
  166 + //TODO stats-win
  167 + paramModulesID : ['plot-win', 'param-win', 'search-win', 'down-win'],
  168 +
  169 + // Important system constants
  170 + MAX_UPLOADED_FILE_SIZE : max_uploaded_file_size, // in B, from my_config.php
  171 +
  172 + listeners : {
172 173 scope : this,
173 174 beforeunload : function ()
174 175 {
175   -
176 176 var interopModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id);
177 177 if (interopModule)
178 178 interopModule.forceSampDisconnect();
179 179 return true;
180 180 },
181 181 ready : function ()
182   - {
183   - //AKKA - Clean user WS
184   - AmdaAction.cleanUserWS(function(res,e){},this);
  182 + {
  183 + //AKKA - Clean user WS
  184 + AmdaAction.cleanUserWS(function(res,e){},this);
185 185 }
186   - },
187   -
188   - init: function() {
189   - // custom logic before getXYZ methods get called...
190   -
191   - this.callParent();
192   -
193   - // now ready...
194   - //override createWindow method of desktop
195   - Ext.override(Ext.ux.desktop.Desktop, {
196   - createWindow: function (config, cls) {
197   - var me = this;
198   - var win = this.callParent([config,cls]);
199   - win.on({
200   - boxready: function (w) {
201   - w.dd.xTickSize = me.xTickSize;
202   - w.dd.yTickSize = me.yTickSize;
203   -
204   - if (w.resizer) {
205   - w.resizer.widthIncrement = me.xTickSize;
206   - w.resizer.heightIncrement = me.yTickSize;
207   - }
208   -
209   - if (w.y < 0)
210   - w.el.setY(0);
211   -
212   - if (w.x + w.width > me.el.getWidth())
213   - w.el.setX(me.el.getWidth()-w.width);
214   -
215   - if (w.y + w.height > me.el.getHeight())
216   - w.el.setY((me.el.getHeight()-w.height > 0) ? me.el.getHeight()-w.height : 0);
217   -
218   - },
219   - single: true
220   - });
221   - return win;
222   - }
223   - });
224   -
225   - },
226   -//create InfoBox
227   - infoMsg : function(msg) {
228   - Ext.Msg.show({
229   - title: 'AMDA Info',
230   - cls: 'infoMsg',
231   - msg: msg,
232   - modal: false,
233   - autoScroll: true,
234   - resizable: true,
235   - icon: Ext.Msg.INFO,
236   - buttons: Ext.Msg.OK
237   - });
238 186 },
239 187  
240   -//create WarningBox
241   - warningMsg : function(msg) {
242   - Ext.Msg.show({
243   - title: 'Attention',
244   - msg: msg,
245   - icon: Ext.Msg.WARNING,
246   - buttons: Ext.Msg.OK
247   - });
  188 + init: function()
  189 + {
  190 + // custom logic before getXYZ methods get called...
  191 + this.callParent();
  192 +
  193 + // now ready...
  194 + //override createWindow method of desktop
  195 + Ext.override(Ext.ux.desktop.Desktop, {
  196 + createWindow: function (config, cls) {
  197 + var me = this;
  198 + var win = this.callParent([config,cls]);
  199 + win.on({
  200 + boxready: function (w) {
  201 + w.dd.xTickSize = me.xTickSize;
  202 + w.dd.yTickSize = me.yTickSize;
  203 +
  204 + if (w.resizer) {
  205 + w.resizer.widthIncrement = me.xTickSize;
  206 + w.resizer.heightIncrement = me.yTickSize;
  207 + }
  208 +
  209 + if (w.y < 0)
  210 + w.el.setY(0);
  211 +
  212 + if (w.x + w.width > me.el.getWidth())
  213 + w.el.setX(me.el.getWidth()-w.width);
  214 +
  215 + if (w.y + w.height > me.el.getHeight())
  216 + w.el.setY((me.el.getHeight()-w.height > 0) ? me.el.getHeight()-w.height : 0);
  217 +
  218 + },
  219 + single: true
  220 + });
  221 + return win;
  222 + }
  223 + });
  224 + },
  225 +
  226 + //create InfoBox
  227 + infoMsg : function(msg) {
  228 + Ext.Msg.show({
  229 + title: 'AMDA Info',
  230 + cls: 'infoMsg',
  231 + msg: msg,
  232 + modal: false,
  233 + autoScroll: true,
  234 + resizable: true,
  235 + icon: Ext.Msg.INFO,
  236 + buttons: Ext.Msg.OK
  237 + });
  238 + },
  239 +
  240 + //create WarningBox
  241 + warningMsg : function(msg) {
  242 + Ext.Msg.show({
  243 + title: 'Attention',
  244 + msg: msg,
  245 + icon: Ext.Msg.WARNING,
  246 + buttons: Ext.Msg.OK
  247 + });
  248 + },
  249 +
  250 + //create ErrorBox
  251 + errorMsg : function(msg) {
  252 + Ext.Msg.show({
  253 + title: 'Failure',
  254 + msg: msg,
  255 + icon: Ext.Msg.ERROR,
  256 + buttons: Ext.Msg.OK
  257 + });
  258 + },
  259 +
  260 + getModules : function(){
  261 + var allModules = [];
  262 +
  263 + //Add dynamic modules
  264 + Ext.Object.each(this.dynamicModules, function(key, def) {
  265 + allModules.push(new amdaDesktop.DynamicModule(def.id, def.icon, def.title, def.source, def.useLauncher));
  266 + });
  267 +
  268 + return allModules;
248 269 },
249 270  
250   -//create ErrorBox
251   - errorMsg : function(msg) {
252   - Ext.Msg.show({
253   - title: 'Failure',
254   - msg: msg,
255   - icon: Ext.Msg.ERROR,
256   - buttons: Ext.Msg.OK
257   - });
  271 + getDesktopConfig: function ()
  272 + {
  273 + var me = this, ret = me.callParent();
  274 +
  275 + var desktopId = 'AmdaDesktop';
  276 + var wallpaper = Ext.state.Manager.getProvider().get(desktopId+'_wallpaper');
  277 + if (!wallpaper)
  278 + wallpaper = 'js/resources/images/desktop/wallpapers/Cdpp2.jpg';
  279 + return Ext.apply(ret, {
  280 + id : desktopId,
  281 + contextMenuItems: [
  282 + { text: 'Change Settings', handler: me.onSettings, scope: me }
  283 + ],
  284 + shortcuts: Ext.create('Ext.data.Store', {
  285 + model: 'Ext.ux.desktop.ShortcutModel',
  286 + data: [
  287 + { name: 'Help', iconCls: 'help', module: 'help-win' },
  288 + { name: 'Create/Modify parameter', iconCls: 'edit', module: 'param-win' },
  289 + { name: 'Plot data', iconCls: 'plot', module: 'plot-win'},
  290 + { name: 'Data mining', iconCls: 'search', module: 'search-win'},
  291 + { name: 'Statistics', iconCls: 'statistics', module: 'statistics-win'},
  292 + { name: 'Download data', iconCls: 'download_manager', module: 'down-win'},
  293 + { name: 'Upload data', iconCls: 'mydata', module: 'up-win'},
  294 + { name: 'Manage TimeTables', iconCls: 'timeTable', module: 'timetab-win' },
  295 + { name: 'TimeTables operations', iconCls: 'operations', module: 'ttsOpe-win' },
  296 + { name: 'Manage catalogs', iconCls: 'catalog', module: 'catalog-win'},
  297 + { name: 'Visualize catalogs', iconCls: 'visu_catalog', module: 'visu-win'},
  298 + { name: 'Interoperability', iconCls: 'interop', module: 'interop-win' }
  299 + ]
  300 + }),
  301 +
  302 + wallpaper: wallpaper,
  303 + wallpaperStretch: false
  304 + });
258 305 },
259 306  
260   - getModules : function(){
261   - var allModules = [];
262   -
263   - //Add dynamic modules
264   - Ext.Object.each(this.dynamicModules, function(key, def) {
265   - allModules.push(new amdaDesktop.DynamicModule(def.id, def.icon, def.title, def.source, def.useLauncher));
266   - });
267   -
268   - return allModules;
269   - },
270   -
271   - getDesktopConfig: function () {
272   - var me = this, ret = me.callParent();
273   -
274   - var desktopId = 'AmdaDesktop';
275   - var wallpaper = Ext.state.Manager.getProvider().get(desktopId+'_wallpaper');
276   - if (!wallpaper)
277   - wallpaper = 'js/resources/images/desktop/wallpapers/Cdpp2.jpg';
278   - return Ext.apply(ret, {
279   - id : desktopId,
280   - contextMenuItems: [
281   - { text: 'Change Settings', handler: me.onSettings, scope: me }
282   - ],
283   -
284   - shortcuts: Ext.create('Ext.data.Store', {
285   - model: 'Ext.ux.desktop.ShortcutModel',
286   - data: [
287   - { name: 'Help', iconCls: 'help', module: 'help-win' },
288   - { name: 'Create/Modify parameter', iconCls: 'edit', module: 'param-win' },
289   - { name: 'Plot data', iconCls: 'plot', module: 'plot-win'},
290   - { name: 'Data mining', iconCls: 'search', module: 'search-win'},
291   - { name: 'Statistics', iconCls: 'statistics', module: 'statistics-win'},
292   - { name: 'Download data', iconCls: 'download_manager', module: 'down-win'},
293   - { name: 'Upload data', iconCls: 'mydata', module: 'up-win'},
294   - { name: 'Manage TimeTables', iconCls: 'timeTable', module: 'timetab-win' },
295   - { name: 'TimeTables operations', iconCls: 'operations', module: 'ttsOpe-win' },
296   - { name: 'Manage catalogs', iconCls: 'catalog', module: 'catalog-win'},
297   - { name: 'Visualize catalogs', iconCls: 'visu_catalog', module: 'visu-win'},
298   - { name: 'Interoperability', iconCls: 'interop', module: 'interop-win' }
299   - ]
300   - }),
301   -
302   - wallpaper: wallpaper,
303   - wallpaperStretch: false
304   - });
305   - },
306   -
307   - // config for the start menu
308   - getStartConfig : function() {
309   - var me = this, ret = me.callParent();
310   - return Ext.apply(ret, {
311   - title: sessionID,
312   - iconCls: 'icon-user',
313   - height: 270,
314   - toolConfig: {
315   - width: 130,
316   - items: [
317   - {
318   - text:'Settings',
319   - iconCls:'settings',
320   - handler: me.onSettings,
321   - scope: me
322   - },
323   - '-',
324   - /* {
325   - text : 'Manage Workspaces',
326   - iconCls : 'icon-manage-ws',
327   - id : 'mngws-win-tool',
328   - scope : this,
329   - disabled: true,
330   - handler : function(obj, e) {
331   - e.stopEvent();
332   - var moduleId = obj.el.id;
333   - var module = this.getModule(moduleId.replace('-tool', ''));
334   - if (module) {
335   - module.createWindow();
336   - }
337   - }
338   - }, {
339   - text : 'Manage Resources',
340   - iconCls : 'icon-manage-resrc',
341   - id : 'resrc-win-tool',
342   - disabled : true,
343   - handler : function(obj, e) {
344   - e.stopEvent();
345   - var moduleId = obj.el.id;
346   - var module = this.getModule(moduleId.replace('-tool', ''));
347   - if (module) {
348   - module.createWindow();
349   - }
350   - },
351   - scope : this
352   - },
353   - */
354   - {
355   - text : 'Profile',
356   - iconCls : 'icon-user',
357   - id : 'profile-win-tool',
358   - handler : function(obj, e) {
359   - e.stopEvent();
360   - AmdaAction.getUserInfo(this.onGetUserInfo,this);
361   - },
362   - scope : this
363   - },{
364   - text : 'Feedback',
365   - iconCls : 'icon-feedback',
366   - id : 'feed-win-tool',
367   - handler : function(obj, e) {
368   - e.stopEvent();
369   - var moduleId = obj.el.id;
370   - this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
371   - module.createWindow();
372   - });
373   -
374   - },
375   - scope : this
376   - }, {
377   - text : 'Help',
378   - iconCls : 'icon-help',
379   - id : 'help-win-tool',
380   - scope : this,
381   - handler : function(obj, e) {
382   - e.stopEvent();
383   - var moduleId = obj.el.id;
384   - this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
385   - module.createWindow();
386   - });
387   - }
388   - }, {
389   - text : 'About AMDA',
390   - iconCls : 'icon-information',
391   - id : 'info-win-tool',
392   - scope : this,
393   - handler : function(obj, e) {
394   - e.stopEvent();
395   - var moduleId = obj.el.id;
396   - this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
397   - module.createWindow();
398   - });
399   - }
400   - }, '-', {
401   - text : 'Workspaces',
402   - iconCls : 'icon-ws',
403   - disabled: true,
404   - scope : this
405   - }, '-', {
406   - text : 'Logout',
407   - iconCls : 'logout',
408   - scope : this,
409   - handler : me.onLogout
410   - }
411   - ]
412   - }
413   - });
414   - },
415   -
416   - getModuleDefinition: function(id) {
417   - return this.getModule(id);
418   - },
419   -
420   - getLoadedModule: function(id, forceLoad, onReady) {
421   - var moduleDef = this.getModuleDefinition(id);
422   - if (!moduleDef)
423   - return null;
424   - if (!moduleDef.isReady())
425   - {
426   - if (forceLoad)
427   - {
428   - //loadMask.show();
429   - moduleDef.get(function (module) {
430   - //loadMask.hide();
431   - if (onReady)
432   - onReady(module);
433   - });
434   - }
435   - return null;
436   - }
437   - if (onReady)
  307 + // config for the start menu
  308 + getStartConfig : function()
  309 + {
  310 + var me = this, ret = me.callParent();
  311 + return Ext.apply(ret, {
  312 + title: sessionID,
  313 + iconCls: 'icon-user',
  314 + height: 270,
  315 + toolConfig: {
  316 + width: 130,
  317 + items: [
  318 + {
  319 + text:'Settings',
  320 + iconCls:'settings',
  321 + handler: me.onSettings,
  322 + scope: me
  323 + }, '-',
  324 + {
  325 + text : 'Profile',
  326 + iconCls : 'icon-user',
  327 + id : 'profile-win-tool',
  328 + handler : function(obj, e) {
  329 + e.stopEvent();
  330 + AmdaAction.getUserInfo(this.onGetUserInfo,this);
  331 + },
  332 + scope : this
  333 + },
  334 + {
  335 + text : 'Feedback',
  336 + iconCls : 'icon-feedback',
  337 + id : 'feed-win-tool',
  338 + handler : function(obj, e) {
  339 + e.stopEvent();
  340 + var moduleId = obj.el.id;
  341 + this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
  342 + module.createWindow();
  343 + });
  344 + },
  345 + scope : this
  346 + },
  347 + {
  348 + text : 'Help',
  349 + iconCls : 'icon-help',
  350 + id : 'help-win-tool',
  351 + scope : this,
  352 + handler : function(obj, e) {
  353 + e.stopEvent();
  354 + var moduleId = obj.el.id;
  355 + this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
  356 + module.createWindow();
  357 + });
  358 + }
  359 + },
  360 + {
  361 + text : 'About AMDA',
  362 + iconCls : 'icon-information',
  363 + id : 'info-win-tool',
  364 + scope : this,
  365 + handler : function(obj, e) {
  366 + e.stopEvent();
  367 + var moduleId = obj.el.id;
  368 + this.getLoadedModule(moduleId.replace('-tool', ''), true, function(module) {
  369 + module.createWindow();
  370 + });
  371 + }
  372 + }, '-',
  373 + {
  374 + text : 'Workspaces',
  375 + iconCls : 'icon-ws',
  376 + disabled: true,
  377 + scope : this
  378 + }, '-',
  379 + {
  380 + text : 'Logout',
  381 + iconCls : 'logout',
  382 + scope : this,
  383 + handler : me.onLogout
  384 + }
  385 + ]
  386 + }
  387 + });
  388 + },
  389 +
  390 + getModuleDefinition: function(id) {
  391 + return this.getModule(id);
  392 + },
  393 +
  394 + getLoadedModule: function(id, forceLoad, onReady) {
  395 + var moduleDef = this.getModuleDefinition(id);
  396 + if (!moduleDef)
  397 + return null;
  398 + if (!moduleDef.isReady())
  399 + {
  400 + if (forceLoad)
  401 + {
  402 + //loadMask.show();
  403 + moduleDef.get(function (module) {
  404 + //loadMask.hide();
  405 + if (onReady)
  406 + onReady(module);
  407 + });
  408 + }
  409 + return null;
  410 + }
  411 + if (onReady)
438 412 onReady(moduleDef.get());
439   - return moduleDef.get();
440   - },
441   -
442   - getTaskbarConfig: function () {
443   - var ret = this.callParent();
444   - return Ext.apply(ret, {
445   - quickStart: [],
446   - trayItems: [
447   - {
448   - name: this.dynamicModules.feedback.title, iconCls: 'icon-feedback',
449   - tooltip: { text: this.dynamicModules.feedback.title, align: 'bl-tl' },
450   - overflowText: this.dynamicModules.feedback.title,
451   - iconCls: this.dynamicModules.feedback.icon,
452   - scope: this,
453   - handler : function(obj, e) {
454   - e.stopEvent();
455   - this.getLoadedModule(this.dynamicModules.feedback.id, true, function(module) {
456   - module.createWindow();
457   - });
458   - }
459   - },
460   - {
461   - name: this.dynamicModules.info.title, iconCls: 'icon-information',
462   - tooltip: { text: this.dynamicModules.info.title, align: 'bl-tl' },
463   - overflowText: this.dynamicModules.info.title,
464   - iconCls: this.dynamicModules.info.icon,
465   - scope: this,
466   - handler : function(obj, e) {
467   - e.stopEvent();
468   - this.getLoadedModule(this.dynamicModules.info.id, true, function(module) {
469   - module.createWindow();
470   - });
471   - }
472   - },
473   - {
474   - name: 'Logout', iconCls : 'logout',
475   - tooltip: { text: 'Logout', align: 'bl-tl' },
476   - overflowText: 'Logout',
477   - scope : this,
478   - handler : this.onLogout
479   - },
480   - '-',
481   - { xtype: 'trayclock', flex: 1 }
482   - ]
483   - });
484   - },
485   -
486   - onLogout: function (obj,e) {
487   - e.stopEvent();
488   - // var interopModule = this.getModule(amdaDesktop.InteropModule.id);
489   - if (isGuest) {
490   - this.guestLogout();
491   - }
492   - else {
493   - this.saveSessionState();
494   - }
495   - },
496   -
497   - onGetUserInfo : function (result, e){
498   - var t = e.getTransaction();
  413 + return moduleDef.get();
  414 + },
  415 +
  416 + getTaskbarConfig: function ()
  417 + {
  418 + var ret = this.callParent();
  419 + return Ext.apply(ret, {
  420 + quickStart: [],
  421 + trayItems: [
  422 + {
  423 + name: this.dynamicModules.feedback.title, iconCls: 'icon-feedback',
  424 + tooltip: { text: this.dynamicModules.feedback.title, align: 'bl-tl' },
  425 + overflowText: this.dynamicModules.feedback.title,
  426 + iconCls: this.dynamicModules.feedback.icon,
  427 + scope: this,
  428 + handler : function(obj, e) {
  429 + e.stopEvent();
  430 + this.getLoadedModule(this.dynamicModules.feedback.id, true, function(module) {
  431 + module.createWindow();
  432 + });
  433 + }
  434 + },
  435 + {
  436 + name: this.dynamicModules.info.title, iconCls: 'icon-information',
  437 + tooltip: { text: this.dynamicModules.info.title, align: 'bl-tl' },
  438 + overflowText: this.dynamicModules.info.title,
  439 + iconCls: this.dynamicModules.info.icon,
  440 + scope: this,
  441 + handler : function(obj, e) {
  442 + e.stopEvent();
  443 + this.getLoadedModule(this.dynamicModules.info.id, true, function(module) {
  444 + module.createWindow();
  445 + });
  446 + }
  447 + },
  448 + {
  449 + name: 'Logout', iconCls : 'logout',
  450 + tooltip: { text: 'Logout', align: 'bl-tl' },
  451 + overflowText: 'Logout',
  452 + scope : this,
  453 + handler : this.onLogout
  454 + }, '-',
  455 + { xtype: 'trayclock', flex: 1 }
  456 + ]
  457 + });
  458 + },
  459 +
  460 + onLogout: function (obj,e) {
  461 + e.stopEvent();
  462 + if (isGuest) {
  463 + this.guestLogout();
  464 + }
  465 + else {
  466 + this.saveSessionState();
  467 + }
  468 + },
  469 +
  470 + onGetUserInfo : function (result, e){
  471 + var t = e.getTransaction();
499 472 if (e.status)
500 473 {
501 474 if (result && result.success)
... ... @@ -523,149 +496,137 @@ Ext.define(&#39;amdaApp.AmdaApp&#39;, {
523 496 }
524 497 },
525 498  
  499 + guestLogout: function() {
  500 + Ext.Msg.show({
  501 + title : 'Logout',
  502 + msg :'Your guest workspace is to be deleted. Continue logout ?',
  503 + buttons : Ext.Msg.YESNO,
  504 + iconCls : 'logout',
  505 + fn : function(btn) {
  506 + if (btn == 'yes'){
  507 + AmdaAction.logout(true, function(){
  508 + sessionID = '';
  509 + window.location.href ='index.html';
  510 + });
  511 + }
  512 + }
  513 + });
  514 + },
526 515  
527   - guestLogout: function()
528   - {
529   - Ext.Msg.show({
530   - title : 'Logout',
531   - msg :'Your guest workspace is to be deleted. Continue logout ?',
532   - buttons : Ext.Msg.YESNO,
533   - iconCls : 'logout',
534   - fn : function(btn) {
535   - if (btn == 'yes')
536   - {
537   - AmdaAction.logout(true, function(){
538   - sessionID = '';
539   - window.location.href ='index.html';
540   - });
541   - }
542   - }
543   - });
544   - },
545   -
546   - forceLogout: function()
547   - {
548   - // myDesktopApp.warningMsg('Your guest session is finished');
549   - AmdaAction.logout(true, function(){
550   - sessionID = '';
551   - window.location.href ='index.html';
552   - });
553   - },
554   -
555   - saveSessionState : function()
556   - {
557   - var me = this;
558   - Ext.Msg.show({
559   - title : 'Logout',
560   - msg :'Do you want to keep current windows sizes and locations<br/> for the next sessions?',
561   - buttons : Ext.Msg.YESNOCANCEL,
562   - iconCls : 'logout',
563   - fn : function(btn) {
564   - if (btn == 'yes')
565   - {
566   - //set wallpaper
567   - Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
568   - //
569   - Ext.state.Manager.getProvider().on({
570   - scope : this,
571   - aftersave : function(provider)
572   - {
573   - sessionID = '';
574   - window.location.href ='index.html';
575   - }
576   - });
577   - Ext.state.Manager.getProvider().saveState();
578   - AmdaAction.logout();
579   - }
580   - else if (btn == 'no')
581   - {
582   - Ext.state.Manager.getProvider().on({
583   - scope : this,
584   - aftersave : function(provider)
585   - {
586   - sessionID = '';
587   - window.location.href ='index.html';
588   - }
589   - });
590   - Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
591   - Ext.state.Manager.getProvider().saveLastTime();
592   - AmdaAction.logout();
593   - }
594   - }
595   - });
596   - },
597   -
598   - onSettings: function () {
599   - var dlg = new MyDesktop.Settings({
600   - desktop: this.desktop
601   - });
602   - dlg.show();
603   - },
604   -
605   - /**
606   - * initialization at the start of AMDA-NG webApplication
607   - */
608   - initProject : function() {
609   - moduleIds = new Ext.util.MixedCollection();
610   - // Adding Workspace Explorer Id
611   - moduleIds.add(this.dynamicModules.explorer.id);
612   -
613   - moduleIds.each(function(item) {
614   - this.getLoadedModule(item, true, function (module) {
615   - module.createWindow();
616   - });
617   - }, this);
618   -
619   - if (freeSpace < diskQuota / 20) {
620   - myDesktopApp.warningMsg('Think of cleaning up your work space.<br/>Only ' +
621   - Math.round(freeSpace/1024/1024)+ 'MB of '+Math.round(diskQuota/1024/1024) +
622   - 'MB rests');
623   - }
624   -
625   - if (isFirstVisit && !isGuest) {
626   - if (isSpecialInfo) {
627   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
628   - module.createWindow(isSpecialInfo, 'Welcome to AMDA', true);
  516 + forceLogout: function(){
  517 + // myDesktopApp.warningMsg('Your guest session is finished');
  518 + AmdaAction.logout(true, function(){
  519 + sessionID = '';
  520 + window.location.href ='index.html';
629 521 });
630   - } else {
  522 + },
631 523  
632   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.help.id, true, function(module) {
633   - module.createWindow();
  524 + saveSessionState : function()
  525 + {
  526 + var me = this;
  527 + Ext.Msg.show({
  528 + title : 'Logout',
  529 + msg :'Do you want to keep current windows sizes and locations<br/> for the next sessions?',
  530 + buttons : Ext.Msg.YESNOCANCEL,
  531 + iconCls : 'logout',
  532 + fn : function(btn) {
  533 + if (btn == 'yes'){
  534 + //set wallpaper
  535 + Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
  536 + Ext.state.Manager.getProvider().on({
  537 + scope : this,
  538 + aftersave : function(provider) {
  539 + sessionID = '';
  540 + window.location.href ='index.html';
  541 + }
  542 + });
  543 + Ext.state.Manager.getProvider().saveState();
  544 + AmdaAction.logout();
  545 + }
  546 + else if (btn == 'no')
  547 + {
  548 + Ext.state.Manager.getProvider().on({
  549 + scope : this,
  550 + aftersave : function(provider) {
  551 + sessionID = '';
  552 + window.location.href ='index.html';
  553 + }
  554 + });
  555 + Ext.state.Manager.getProvider().set(me.desktop.id+'_wallpaper',me.desktop.getWallpaper());
  556 + Ext.state.Manager.getProvider().saveLastTime();
  557 + AmdaAction.logout();
  558 + }
  559 + }
634 560 });
635   - }
636   - }
637   - else {
638   - if (isSpecialInfo && !isNewInfo) {
639   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
640   - module.createWindow(isSpecialInfo, 'Welcome to AMDA', true);
641   - });
642   - }
643   - }
644   -
645   - if (isNewInfo) {
646   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
647   - // module.createWindow('releaseNotes.' + AMDAVERSION, 'New Release V'+ AMDAVERSION);
648   - module.createWindow(news, 'Amda Latest News');
649   - });
650   - }
651   -
652   - if (isGuest) {
653   - myDesktopApp.warningMsg("Welcome to Guest Session<br/>Guest session lasts for "+
654   - guestSessionDuration/3600+" h maximum<br/>"+
655   - "For extended use time and functionalities (saved sessions)<br/> please register at amda@irap.omp.eu");
656   - Ext.Function.defer(myDesktopApp.warningMsg,(guestSessionDuration-300)*1000, this, ["Your session will be closed in 5 min!"]);
657   - Ext.Function.defer(myDesktopApp.forceLogout, guestSessionDuration*1000);
658   - }
659   -
660   -
661   -
662   - this.desktop.taskbar.tray.width = 130;
663   - this.desktop.taskbar.insert(4,new amdaUI.SampToolBarUI({id : 'samptb', onSwitchConnect : function ()
664   - {
665   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function(module) {
666   - module.switchSampConnect();
667   - });
668   -
669   - }}));
670   - }
  561 + },
  562 +
  563 + onSettings: function () {
  564 + var dlg = new MyDesktop.Settings({
  565 + desktop: this.desktop
  566 + });
  567 + dlg.show();
  568 + },
  569 +
  570 + /**
  571 + * initialization at the start of AMDA-NG webApplication
  572 + */
  573 + initProject : function()
  574 + {
  575 + moduleIds = new Ext.util.MixedCollection();
  576 + // Adding Workspace Explorer Id
  577 + moduleIds.add(this.dynamicModules.explorer.id);
  578 +
  579 + moduleIds.each(function(item) {
  580 + this.getLoadedModule(item, true, function (module) {
  581 + module.createWindow();
  582 + });
  583 + }, this);
  584 +
  585 + if (freeSpace < diskQuota / 20) {
  586 + myDesktopApp.warningMsg('Think of cleaning up your work space.<br/>Only ' +
  587 + Math.round(freeSpace/1024/1024)+ 'MB of '+Math.round(diskQuota/1024/1024) +
  588 + 'MB rests');
  589 + }
  590 +
  591 + if (isFirstVisit && !isGuest) {
  592 + if (isSpecialInfo) {
  593 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
  594 + module.createWindow(isSpecialInfo, 'Welcome to AMDA', true);
  595 + });
  596 + } else {
  597 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.help.id, true, function(module) {
  598 + module.createWindow();
  599 + });
  600 + }
  601 + }
  602 + else {
  603 + if (isSpecialInfo && !isNewInfo) {
  604 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
  605 + module.createWindow(isSpecialInfo, 'Welcome to AMDA', true);
  606 + });
  607 + }
  608 + }
  609 +
  610 + if (isNewInfo) {
  611 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
  612 + // module.createWindow('releaseNotes.' + AMDAVERSION, 'New Release V'+ AMDAVERSION);
  613 + module.createWindow(news, 'Amda Latest News');
  614 + });
  615 + }
  616 +
  617 + if (isGuest) {
  618 + myDesktopApp.warningMsg("Welcome to Guest Session<br/>Guest session lasts for "+
  619 + guestSessionDuration/3600+" h maximum<br/>"+
  620 + "For extended use time and functionalities (saved sessions)<br/> please register at amda@irap.omp.eu");
  621 + Ext.Function.defer(myDesktopApp.warningMsg,(guestSessionDuration-300)*1000, this, ["Your session will be closed in 5 min!"]);
  622 + Ext.Function.defer(myDesktopApp.forceLogout, guestSessionDuration*1000);
  623 + }
  624 +
  625 + this.desktop.taskbar.tray.width = 130;
  626 + this.desktop.taskbar.insert(4,new amdaUI.SampToolBarUI({id : 'samptb', onSwitchConnect : function () {
  627 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function(module) {
  628 + module.switchSampConnect();
  629 + });
  630 + }}));
  631 + }
671 632 });
... ...
js/app/controllers/AmdaModule.js
... ... @@ -6,36 +6,33 @@
6 6 * @brief Generic Module controller definition for AMDA project
7 7 * @author CDA
8 8 * @version $Id: AmdaModule.js 1761 2013-09-13 13:18:03Z myriam $
9   - * @todo define createWindow method for simple applications here ?
10   - *******************************************************************************
11   - * FT Id : Date : Name - Description
12   - *******************************************************************************
13   - * : :08/06/2011: CDA - Migration extjs4
14   - * : :09/06/2011: elena - Init method for Applications without launchers now is defined here
15 9 */
16 10  
17 11 Ext.define('amdaDesktop.AmdaModule', {
18 12 extend: 'Ext.ux.desktop.Module',
19 13  
20   - /**
21   - * @cfg {String} id
22   - * @required
23   - */
  14 + /**
  15 + * @cfg {String} id
  16 + * @required
  17 + */
24 18 id : '',
25   - /**
26   - * @cfg {String} icon
27   - * @required
28   - */
  19 +
  20 + /**
  21 + * @cfg {String} icon
  22 + * @required
  23 + */
29 24 icon : '',
30   - /**
31   - * @cfg {String} title
32   - * @required
33   - */
  25 +
  26 + /**
  27 + * @cfg {String} title
  28 + * @required
  29 + */
34 30 title : '',
35   - /**
36   - * @cfg {String} contentId
37   - * @required
38   - */
  31 +
  32 + /**
  33 + * @cfg {String} contentId
  34 + * @required
  35 + */
39 36 contentId : '',
40 37  
41 38 constructor : function(config){
... ... @@ -45,24 +42,22 @@ Ext.define(&#39;amdaDesktop.AmdaModule&#39;, {
45 42 /**
46 43 * Module without launcher in Start Menu
47 44 */
48   - init: function(){
49   - this.launcher = null;
50   - },
  45 + init: function(){
  46 + this.launcher = null;
  47 + },
51 48  
52 49 /**
53   - * Function which return the UI content of this module
54   - * @return {Object} The Ui content class of this module
55   - */
  50 + * Function which return the UI content of this module
  51 + * @return {Object} The Ui content class of this module
  52 + */
56 53 getUiContent : function (){
57   - return Ext.getCmp(this.contentId);
  54 + return Ext.getCmp(this.contentId);
58 55 },
59   -
60 56  
61 57 /**
62   - * Window Creation method of the Module
63   - */
64   - createWindow : function (onshowfn) {
65   -
  58 + * Window Creation method of the Module
  59 + */
  60 + createWindow : function (onshowfn) {
66 61 var desktop = this.app.getDesktop();
67 62 var win = desktop.getWindow(this.id);
68 63  
... ... @@ -71,7 +66,7 @@ Ext.define(&#39;amdaDesktop.AmdaModule&#39;, {
71 66 id : this.id,
72 67 title : this.title,
73 68 width : this.width,
74   - minWidth : this.width,
  69 + minWidth : this.width,
75 70 height : this.height,
76 71 minHeight: this.height,
77 72 iconCls : this.icon,
... ... @@ -81,35 +76,30 @@ Ext.define(&#39;amdaDesktop.AmdaModule&#39;, {
81 76 stateful : true,
82 77 stateId : this.id,
83 78 stateEvents: ['move','show','resize'],
84   - tools: [
85   - {
86   - type:'help',
87   - qtip: this.helpTitle,
88   - scope:this,
89   - handler: function(event, toolEl, panel){
90   - var me = this;
91   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
92   - module.createWindow(me.helpFile, me.helpTitle);
93   - });
94   - }
95   - }
96   - ],
97   - items : [
98   - {
99   - xtype : this.uiType,
100   - id : this.contentId
101   - }
102   - ]
  79 + tools: [{
  80 + type:'help',
  81 + qtip: this.helpTitle,
  82 + scope:this,
  83 + handler: function(event, toolEl, panel){
  84 + var me = this;
  85 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) {
  86 + module.createWindow(me.helpFile, me.helpTitle);
  87 + });
  88 + }
  89 + }],
  90 + items : [{
  91 + xtype : this.uiType,
  92 + id : this.contentId
  93 + }]
103 94 });
104   - }
  95 + }
105 96  
106   - if (onshowfn)
  97 + if (onshowfn) {
107 98 win.on({
108   - show : onshowfn,
109   - scope : this
110   - });
111   -
  99 + show : onshowfn,
  100 + scope : this
  101 + });
  102 + }
112 103 win.show();
113 104 }
114   -
115   -});
116 105 \ No newline at end of file
  106 +});
... ...
js/app/controllers/UploadModule.js
... ... @@ -4,56 +4,49 @@
4 4 * @class amdaDesktop.UploadModule
5 5 * @extends amdaDesktop.AmdaModule
6 6 * @brief Upload Module controller definition
7   - * @author Elena
8   - * @version $Id: UploadModule.js 2124 2014-02-21 14:06:14Z elena $
  7 + * @author Elena
9 8 */
10 9  
11 10 Ext.define('amdaDesktop.UploadModule', {
12 11 extend: 'amdaDesktop.AmdaModule',
13 12  
14 13 requires: [
15   - 'amdaUI.UploadUI'
16   - ],
17   -
  14 + 'amdaUI.UploadUI'
  15 + ],
  16 +
18 17 contentId : 'uploadUI',
19   -
20 18  
21   - /**
22   - * @cfg {String} window definitions
23   - * @required
24   - */
25   -
  19 + /**
  20 + * @cfg {String} window definitions
  21 + * @required
  22 + */
26 23 width: 320,
27 24 height: 510,
28   - uiType : 'panelTabUpload',
  25 + uiType : 'panelTabUpload',
29 26 helpTitle : 'Help on Upload Module',
30 27 helpFile : 'uploadHelp',
31 28  
32 29 init : function() {
33   - this.launcher = {
34   - text : this.title,
35   - iconCls : this.icon,
36   - handler : this.createWindow,
37   - scope : this
  30 + this.launcher = {
  31 + text : this.title,
  32 + iconCls : this.icon,
  33 + handler : this.createWindow,
  34 + scope : this
38 35 };
39   - },
40   -
41   - uploadNotification : function(url,format)
42   - {
43   - var me = this;
44   - loadMask.show();
45   - this.createWindow(function (o)
46   - {
47   - var desktop = myDesktopApp.getDesktop();
48   - var win = desktop.getWindow(me.id);
49   - if (win)
50   - {
51   - win.items.items[0].forceUpload(url,format);
52   - win.close();
53   - }
54   - loadMask.hide();
55   - });
56   -
57   - }
  36 + },
58 37  
  38 + uploadNotification : function(url,format){
  39 + var me = this;
  40 + loadMask.show();
  41 + this.createWindow(function (o)
  42 + {
  43 + var desktop = myDesktopApp.getDesktop();
  44 + var win = desktop.getWindow(me.id);
  45 + if (win){
  46 + win.items.items[0].forceUpload(url,format);
  47 + win.close();
  48 + }
  49 + loadMask.hide();
  50 + });
  51 + }
59 52 });
60 53 \ No newline at end of file
... ...
js/app/views/CatalogUI.js
... ... @@ -17,17 +17,14 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
17 17  
18 18 isCatalog : true,
19 19  
20   -
21   - constructor: function(config)
22   - {
  20 + constructor: function(config) {
23 21 this.init(config);
24 22 this.callParent(arguments);
25 23 this.toReconfigure = true;
26 24 if (this.object) this.loadObject();
27 25 },
28 26  
29   - setObject : function (object, toReconfigure)
30   - {
  27 + setObject : function (object, toReconfigure) {
31 28 if (toReconfigure)
32 29 this.toReconfigure = true;
33 30 // set object
... ... @@ -39,8 +36,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
39 36 /**
40 37 * set params description into this.object
41 38 */
42   - setParamInfo : function(parameters)
43   - {
  39 + setParamInfo : function(parameters) {
44 40 var params = [];
45 41 Ext.Array.each(parameters, function(item, index) {
46 42 params[index] = item;
... ... @@ -51,54 +47,56 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
51 47  
52 48 /**
53 49 * update this.object from form
54   - */
55   - updateObject : function()
56   - {
  50 + */
  51 + updateObject : function(){
57 52 // get the basic form
58   - var basicForm = this.formPanel.getForm();
59   - var updateStatus = true;
  53 + var basicForm = this.formPanel.getForm();
  54 + var updateStatus = true;
60 55  
61   - var fieldsWithoutName = basicForm.getFields().items;
62   - Ext.Array.each(fieldsWithoutName, function(item, index,allItems){
63   - if(item !== this.fieldName) {
64   - if (!item.isValid()) {
65   - // set update isn't allowed
66   - updateStatus = false;
67   - }
68   - }
69   - }, this);
70   - // if the update is allowed
71   - if (updateStatus) {
72   - /// real object update
73   - // update TimeTable object with the content of form
74   - basicForm.updateRecord(this.object);
75   - }
76   - // return the update status
77   - return updateStatus;
  56 + var fieldsWithoutName = basicForm.getFields().items;
  57 + Ext.Array.each(fieldsWithoutName, function(item, index,allItems){
  58 + if(item !== this.fieldName) {
  59 + if (!item.isValid()) {
  60 + // set update isn't allowed
  61 + updateStatus = false;
  62 + }
  63 + }
  64 + }, this);
  65 + // if the update is allowed
  66 + if (updateStatus) {
  67 + /// real object update
  68 + // update TimeTable object with the content of form
  69 + basicForm.updateRecord(this.object);
  70 + }
  71 + // return the update status
  72 + return updateStatus;
78 73 },
79 74  
80   -
81   - updateCount : function()
82   - {
  75 + updateCount : function() {
83 76 this.object.set('nbIntervals',this.TTGrid.getStore().getTotalCount());
84 77 this.formPanel.getForm().findField('nbIntervals').setValue(this.object.get('nbIntervals'));
85   - },
  78 + },
86 79  
87   -
88   -
89   - onAfterInit: function(result, e) {
90   -
  80 + onAfterInit: function(result, e)
  81 + {
91 82 var me = this;
92   -
93   - if (!result || !result.success)
  83 + if (!result) {
  84 + myDesktopApp.errorMsg(e.message);
  85 + Ext.defer(function(){Ext.Msg.toFront()},10);
  86 +
  87 + return;
  88 + }
  89 + else if (!result.success)
94 90 {
95 91 if (result.message)
96 92 myDesktopApp.errorMsg(result.message);
97 93 else
98 94 myDesktopApp.errorMsg('Unknown error during catalog cache initialisation');
  95 +
  96 + Ext.defer(function(){Ext.Msg.toFront()},10);
99 97 return;
100 98 }
101   -
  99 +
102 100 if (me.toReconfigure)
103 101 {
104 102 var fields = [], columns = [], i = 3, width, index;
... ... @@ -110,21 +108,31 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
110 108  
111 109 for (var j = 0; j < 5; j++) fields[j] = Ext.create('Ext.data.Field', fieldsConfig[j]);
112 110  
113   - columns[0] = Ext.create('Ext.grid.column.RowNumberer');
  111 + columns[0] = Ext.create('Ext.grid.column.RowNumberer', { width: 50,
  112 + renderer: function(value, metaData, record){
  113 + var msg = record.index;
  114 + if (record.get('isNew') || record.get('isModified')) {
  115 + msg += ' *';
  116 + metaData.style = 'font-weight: bold'
  117 + }
  118 + return msg;
  119 + }
  120 + });
114 121  
115   - columns[1] = Ext.create('Ext.grid.column.Column', { text: 'Start Time', sortable : false, dataIndex: 'start',
116   - width : 120, menuDisabled: true, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}});
117   - columns[2] = Ext.create('Ext.grid.column.Column', { text: 'Stop Time', sortable : false, dataIndex: 'stop',
  122 + columns[1] = Ext.create('Ext.grid.column.Column', { text: 'Start Time', sortable : true, dataIndex: 'start',
  123 + width : 120, menuDisabled: true, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}});
  124 + columns[2] = Ext.create('Ext.grid.column.Column', { text: 'Stop Time', sortable : true, dataIndex: 'stop',
118 125 width : 120, menuDisabled: true, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}});
119 126  
120 127 Ext.Array.each(result.parameters, function(obj)
121 128 {
122 129 index = 'param'+(i-1).toString();
  130 +
123 131 fields[i+2] = Ext.create('Ext.data.Field',{ name : index });
124   -
  132 +
125 133 if (obj.type == 1) // dateTime
126 134 {
127   - columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : false, dataIndex: index,
  135 + columns[i] = Ext.create('Ext.grid.column.Column', { text: obj.name, sortable : true, dataIndex: index,
128 136 width : 120, menuDisabled: true, editor : { xtype:'datefield', allowBlank:false, hideTrigger: true, format : 'Y-m-d\\TH:i:s'}});
129 137 }
130 138 else
... ... @@ -135,9 +143,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
135 143 }
136 144 i++;
137 145 });
138   -
139   -
140   -
  146 +
141 147 var store = Ext.create('Ext.data.Store', {
142 148 fields: fields,
143 149 autoDestroy: false,
... ... @@ -147,10 +153,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
147 153 remoteSort: true,
148 154 proxy: {
149 155 type: 'direct',
150   - api :
151   - {
152   - read : AmdaAction.readTTCacheIntervals
153   - },
  156 + api : { read : AmdaAction.readTTCacheIntervals },
154 157 // remplir automatiquement tt, sharedtt , catalog, shared catalog
155 158 extraParams : {'typeTT' : 'catalog'},
156 159 reader:
... ... @@ -164,9 +167,9 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
164 167 scope : me,
165 168 load: function(store,records) {
166 169 // myDesktopApp.EventManager.fireEvent('refresh');
167   - me.TTGrid.getView().refresh();
168   - me.TTGrid.getSelectionModel().refresh();
169   - me.updateCount();
  170 + me.TTGrid.getView().refresh();
  171 + me.TTGrid.getSelectionModel().refresh();
  172 + me.updateCount();
170 173 //Statistical plugin
171 174 // this.fireEvent("refresh");
172 175 }
... ... @@ -184,10 +187,9 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
184 187 // me.TTGrid.getStore().sorters.clear();
185 188 // //me.TTGrid.getStore().sorters = new Ext.util.MixedCollection();
186 189  
187   - //set cache token to the Catalog object
  190 + //set cache token to the Catalog object
188 191 me.object.set('cacheToken', result.token);
189   - me.setParamInfo(result.parameters);
190   -
  192 + me.setParamInfo(result.parameters);
191 193 me.TTGrid.getStore().load();
192 194  
193 195 me.status = result.status;
... ... @@ -196,35 +198,28 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
196 198 /**
197 199 * load object catalog into this view
198 200 */
199   - loadObject : function()
200   - {
  201 + loadObject : function(){
201 202 // load object into form
202 203 this.formPanel.getForm().loadRecord(this.object);
203 204  
204 205 this.status = null;
205 206  
206   - if (this.object.get('fromPlugin'))
207   - {
208   - if (this.object.get('objFormat') && this.object.get('objFormat') != '')
209   - {
  207 + if (this.object.get('fromPlugin')){
  208 + if (this.object.get('objFormat') && this.object.get('objFormat') != ''){
210 209 //From uploaded file
211 210 AmdaAction.initTTCacheFromUploadedFile(this.object.get('objName'), this.object.get('objFormat'), this.isCatalog, this.onAfterInit, this);
212 211 }
213   - else
214   - {
  212 + else {
215 213 //From tmp object (ie Statistics result)
216 214 AmdaAction.initTTCacheFromTmpObject(this.object.get('folderId'), this.object.get('objName'), this.isCatalog, this.onAfterInit, this);
217 215 }
218 216 }
219   - else
220   - {
  217 + else {
221 218 var typeTT = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id).linkedNode.data.nodeType;
222   - if (this.object.get('id') == '')
223   - {
224   -
  219 + if (this.object.get('id') == '') {
  220 + //TODO ?
225 221 }
226   - else
227   - {
  222 + else {
228 223 //From existing TT file
229 224 AmdaAction.initTTCacheFromTT(this.object.get('id'), typeTT, this.onAfterInit, this);
230 225 }
... ... @@ -244,8 +239,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
244 239 // store / columns are the same - not needed to reconfigure grid
245 240 this.toReconfigure = false;
246 241 // if the name has been modified this is a creation
247   - if (this.fclose())
248   - {
  242 + if (this.fclose()) {
249 243 if (this.object.isModified('name') || this.object.get('fromPlugin')) {
250 244 // if object already has an id : it's a 'rename' of an existing
251 245 if (this.object.get('id')){
... ... @@ -267,16 +261,14 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
267 261 } else {
268 262 //update
269 263 module.linkedNode.update();
270   - }
271   -
  264 + }
272 265 }
273 266 },
274 267  
275 268 /**
276 269 * overwrite metod called by Save button
277 270 */
278   - overwriteProcess : function(btn)
279   - {
  271 + overwriteProcess : function(btn) {
280 272 if (btn == 'cancel') return;
281 273  
282 274 this.fieldName.clearInvalid();
... ... @@ -288,13 +280,12 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
288 280 * Check if changes were made before closing window
289 281 * @return true if changes
290 282 */
291   - fclose : function()
292   - {
  283 + fclose : function() {
293 284 if (this.status == null)
294 285 return false;
295 286  
296 287 var isDirty = this.formPanel.getForm().isDirty() || (this.status.isModified) || (this.status.nbModified > 0) || (this.status.nbNew > 0);
297   - return isDirty;
  288 + return isDirty;
298 289 },
299 290  
300 291 init : function (config)
... ... @@ -310,9 +301,9 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
310 301 validateOnChange: false,
311 302 validateOnBlur: false,
312 303 validFlag: false,
313   - validator : function() {
314   - return this.validFlag;
315   - }
  304 + validator : function() {
  305 + return this.validFlag;
  306 + }
316 307 });
317 308  
318 309 var cellEditing = Ext.create('Ext.grid.plugin.CellEditing',{
... ... @@ -348,8 +339,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
348 339 //Interval is modified on the server side
349 340 me.editing = true;
350 341  
351   - AmdaAction.modifyTTCacheInterval(obj, function (result, e) {
352   -
  342 + AmdaAction.modifyTTCacheInterval(obj, function (result, e) {
353 343 var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
354 344 if (module)
355 345 module.getUiContent().status = result.status;
... ... @@ -365,7 +355,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
365 355 }, this);
366 356 }
367 357 else
368   - me.editing = false;
  358 + me.editing = false;
369 359 }
370 360 }
371 361 });
... ... @@ -375,85 +365,81 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
375 365 columns: [ ],
376 366 frame: true,
377 367 columnLines: true,
378   - // selType: 'cellmodel',
  368 + // selType: 'cellmodel',
379 369 plugins: [ cellEditing, { ptype : 'bufferedrenderer'} ],
380 370 dockedItems: [{
381 371 xtype: 'toolbar',
382 372 items: [{
383   - iconCls: 'icon-add',
384   - scope: this,
385   - handler: function(){
386   -
387   - cellEditing.cancelEdit();
388   - var store = this.TTGrid.getStore();
389   -
390   - var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0];
391   - var row = 0;
392   - if (selection)
393   - row = store.indexOf(selection) + 1;
394   - this.TTGrid.getSelectionModel().deselectAll();
395   -
396   - var me = this;
397   - AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) {
398   - this.status = result.status;
399   - this.TTGrid.getStore().reload({
400   - callback : function(records, options, success) {
401   - me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() {
402   - me.TTGrid.getView().select(row);
403   - cellEditing.startEditByPosition({row: row, column: 1});
404   - }, me);
405   - }
406   - });
407   - }, this);
408   - }
409   - },{
410   - iconCls: 'icon-delete',
411   - disabled: true,
412   - itemId: 'delete',
413   - scope: this,
414   - handler: function(){
415   - var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0];
416   - if (selection)
417   - {
418   - var rowId = selection.get('cacheId');
  373 + iconCls: 'icon-add',
  374 + scope: this,
  375 + handler: function(){
  376 + cellEditing.cancelEdit();
  377 + var store = this.TTGrid.getStore();
  378 +
  379 + var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0];
  380 + var row = 0;
  381 + if (selection)
  382 + row = store.indexOf(selection) + 1;
419 383 this.TTGrid.getSelectionModel().deselectAll();
420   - AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) {
  384 +
  385 + var me = this;
  386 + AmdaAction.addTTCacheInterval({'index' : row, 'isCatalog' : true}, function (result, e) {
421 387 this.status = result.status;
422   - this.TTGrid.getStore().reload();
  388 + this.TTGrid.getStore().reload({
  389 + callback : function(records, options, success) {
  390 + me.TTGrid.getView().bufferedRenderer.scrollTo(row, false, function() {
  391 + me.TTGrid.getView().select(row);
  392 + cellEditing.startEditByPosition({row: row, column: 1});
  393 + }, me);
  394 + }
  395 + });
423 396 }, this);
424 397 }
425   - }
  398 + },{
  399 + iconCls: 'icon-delete',
  400 + disabled: true,
  401 + itemId: 'delete',
  402 + scope: this,
  403 + handler: function(){
  404 + var selection = this.TTGrid.getView().getSelectionModel().getSelection()[0];
  405 + if (selection)
  406 + {
  407 + var rowId = selection.get('cacheId');
  408 + this.TTGrid.getSelectionModel().deselectAll();
  409 + AmdaAction.removeTTCacheIntervalFromId(rowId, this.isCatalog, function (result, e) {
  410 + this.status = result.status;
  411 + this.TTGrid.getStore().reload();
  412 + }, this);
  413 + }
  414 + }
426 415 }]
427 416 }]
428 417 });
429 418  
430   - this.formPanel = Ext.create('Ext.form.Panel',
431   - {
  419 + this.formPanel = Ext.create('Ext.form.Panel', {
432 420 region : 'center',
433 421 layout: 'hbox',
434 422 bodyStyle: {background : '#dfe8f6'},
435 423 defaults: { border : false, align: 'stretch', bodyStyle: {background : '#dfe8f6'}, padding: '3'},
436 424 fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
437   - items: [
438   - {
  425 + items: [{
439 426 xtype: 'form',
440 427 flex: 1,
441 428 buttonAlign: 'left',
442   - // title : 'Information',
  429 + // title : 'Information',
443 430 layout: {type: 'vbox', pack: 'start', align: 'stretch'},
444 431 items : [
445 432 this.fieldName,
446 433 {
447 434 xtype: 'fieldcontainer',
448 435 layout: 'hbox',
449   - items: [
450   - {
  436 + items: [{
451 437 xtype:'datefield', fieldLabel:'Creation date',
452 438 name: 'created', disabled: true,
453 439 hideTrigger: true, format: 'Y/m/d H:i:s'
454 440 },
455 441 { xtype: 'splitter' },
456   - { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true}
  442 + { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', disabled: true }
457 443 ]
458 444 },
459 445 {
... ... @@ -466,13 +452,11 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
466 452 xtype: 'component',
467 453 height: 180
468 454 }],
469   - dockedItems:[
470   - {
  455 + dockedItems:[{
471 456 xtype: 'toolbar',
472 457 dock: 'bottom',
473 458 ui: 'footer',
474   - items: [
475   - {
  459 + items: [{
476 460 type: 'button',
477 461 text: 'Create New Catalog',
478 462 scope : this,
... ... @@ -484,7 +468,8 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
484 468 var obj = module.linkedNode.get('object');
485 469  
486 470 if (obj && obj.get('id') == '' && !obj.get('fromPlugin')) {
487   - var me = this
  471 + var me = this;
  472 +
488 473 Ext.Msg.prompt('Define Parameters', 'Please enter parameters number:', function(btn, text){
489 474 if (btn == 'ok'){
490 475 AmdaAction.initTTCache(me.isCatalog, text, me.onAfterInit, me);
... ... @@ -515,28 +500,23 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
515 500 basicForm.updateRecord(this.object);
516 501  
517 502 var me = this;
518   - this.checkIntervalsStatusForSave(function ()
519   - {
  503 + this.checkIntervalsStatusForSave(function () {
520 504 //Name validation
521 505 var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
522 506  
523 507 if (!module) return;
524 508 module.linkedNode.isValidName(me.fieldName.getValue(), function (res)
525 509 {
526   - if (!res)
527   - {
  510 + if (!res) {
528 511 me.fieldName.validFlag = 'Error during object validation';
529 512 myDesktopApp.errorMsg(me.fieldName.validFlag);
530 513 me.fieldName.validate();
531 514 return;
532 515 }
533 516  
534   - if (!res.valid)
535   - {
536   - if (res.error)
537   - {
538   - if (res.error.search('subtree') != -1)
539   - {
  517 + if (!res.valid) {
  518 + if (res.error) {
  519 + if (res.error.search('subtree') != -1) {
540 520 Ext.MessageBox.show({title:'Warning',
541 521 msg: res.error+'<br/>Do you want to overwrite it?',
542 522 width: 300,
... ... @@ -550,8 +530,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
550 530 else
551 531 me.fieldName.validFlag = res.error;
552 532 }
553   - else
554   - {
  533 + else {
555 534 me.fieldName.validFlag = 'Invalid object name';
556 535 myDesktopApp.errorMsg(me.fieldName.validFlag);
557 536 }
... ... @@ -565,20 +544,17 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
565 544 });
566 545 });
567 546 }
568   - else
569   - {
  547 + else {
570 548 Ext.Msg.alert('No intervals', 'Your time table is invalid, <br>you must have at least one interval');
571 549 }
572 550 }
573 551 }
574   - },
575   - {
  552 + },{
576 553 type: 'button',
577 554 text: 'Reset',
578 555 scope : this,
579 556 disabled: true,
580   - handler: function()
581   - {
  557 + handler: function() {
582 558 // var module = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.catalog.id);
583 559 // module.createLinkedNode();
584 560 // module.createObject();
... ... @@ -594,24 +570,19 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
594 570 type: 'button',
595 571 text: 'Visualize',
596 572 scope: this,
597   - handler: function()
598   - {
  573 + handler: function() {
599 574 var me = this;
600 575  
601   - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module)
602   - {
  576 + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) {
603 577 //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute'
604   - var temporaryNode = Ext.create('amdaModel.CatalogNode', {
605   - leaf : true
606   - });
607   -
  578 + var temporaryNode = Ext.create('amdaModel.CatalogNode', { leaf : true });
608 579 if (temporaryNode) temporaryNode.set('object',me.object);
609 580 module.setLinkedNode(temporaryNode);
610 581  
611   - module.createWindow();
  582 + module.createWindow();
612 583 });
613 584 }
614   - }]
  585 + }]
615 586 }]
616 587 },
617 588 {
... ... @@ -619,19 +590,15 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
619 590 bodyStyle: {background : '#dfe8f6'},
620 591 //padding: '3',
621 592 flex: 2,
622   - items : [
623   - this.TTGrid
624   - ]
  593 + items : [ this.TTGrid ]
625 594 }]
626 595 });
627 596  
628   - this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections)
629   - {
  597 + this.TTGrid.getSelectionModel().on('selectionchange', function(selModel,selections) {
630 598 this.TTGrid.down('#delete').setDisabled(selections.length === 0);
631 599 }, this);
632 600  
633   - var myConf =
634   - {
  601 + var myConf = {
635 602 layout: 'border',
636 603 items: [
637 604 this.formPanel,
... ... @@ -651,9 +618,7 @@ Ext.define(&#39;amdaUI.CatalogUI&#39;, {
651 618 }
652 619 }
653 620 ]
654   - };
655   -
  621 + };
656 622 Ext.apply (this, Ext.apply(arguments, myConf));
657   - }
658   -
  623 + }
659 624 });
... ...
js/app/views/IntervalUI.js
... ... @@ -7,9 +7,6 @@
7 7 * @author Benjamin
8 8 * @version $Id: IntervalUI.js 2077 2014-02-11 11:33:36Z elena $
9 9 * @todo Validations
10   - *****************************************************************************
11   - * FT Id : Date : Name - Description
12   - ******************************************************************************
13 10 */
14 11  
15 12 /**
... ... @@ -17,10 +14,10 @@ config:
17 14 - durationLimit: The maximum value of the duration days field (9999 by default).
18 15 */
19 16 Ext.define('amdaUI.IntervalUI', {
20   - extend: 'Ext.container.Container',
  17 + extend: 'Ext.container.Container',
21 18  
22   - alias: 'widget.intervalSelector',
23   - activeField : null,
  19 + alias: 'widget.intervalSelector',
  20 + activeField : null,
24 21  
25 22 constructor: function(config) {
26 23 this.init(config);
... ... @@ -28,31 +25,31 @@ Ext.define(&#39;amdaUI.IntervalUI&#39;, {
28 25 },
29 26  
30 27 /**
31   - Set the start and stop date, and update the duration field.
32   - - startDate: A Extjs Date object representing the new start time.
33   - - stopDate: A Extjs Date object representing the new stop time.
34   - - return: None.
  28 + Set the start and stop date, and update the duration field.
  29 + - startDate: A Extjs Date object representing the new start time.
  30 + - stopDate: A Extjs Date object representing the new stop time.
  31 + - return: None.
35 32 */
36 33 setInterval : function(startDate,stopDate)
37 34 {
38 35 // get the search form
39   - var form = this.findParentByType('form').getForm();
40   - // get start field
41   - var startField = form.findField('startDate');
42   - // get stop field
43   - var stopField = form.findField('stopDate');
  36 + var form = this.findParentByType('form').getForm();
  37 + // get start field
  38 + var startField = form.findField('startDate');
  39 + // get stop field
  40 + var stopField = form.findField('stopDate');
44 41  
45   - if (startField != null)
46   - startField.setValue(startDate);
  42 + if (startField != null)
  43 + startField.setValue(startDate);
47 44  
48   - if (stopField != null)
49   - stopField.setValue(stopDate);
  45 + if (stopField != null)
  46 + stopField.setValue(stopDate);
50 47  
51   - this.updateDuration();
  48 + this.updateDuration();
52 49 },
53 50  
54   - /**
55   - Set the limits values of both startField and stopField date fields.
  51 + /**
  52 + Set the limits values of both startField and stopField date fields.
56 53 */
57 54 setLimits: function(minValue, maxValue) {
58 55 var form = this.findParentByType('form').getForm();
... ... @@ -71,31 +68,33 @@ Ext.define(&#39;amdaUI.IntervalUI&#39;, {
71 68  
72 69 this.updateDuration();
73 70 },
74   - setStartTime: function(startTime) {
75   - var form = this.findParentByType('form').getForm();
76   - var startField = form.findField('startDate');
77   - startField.setValue(startTime);
78   - this.updateDuration();
79   - },
80   - setStopTime: function(stopTime) {
81   - var form = this.findParentByType('form').getForm();
82   - var stopField = form.findField('stopDate');
83   - stopField.setValue(stopTime);
84   - this.updateDuration();
85   - },
  71 +
  72 + setStartTime: function(startTime) {
  73 + var form = this.findParentByType('form').getForm();
  74 + var startField = form.findField('startDate');
  75 + startField.setValue(startTime);
  76 + this.updateDuration();
  77 + },
  78 +
  79 + setStopTime: function(stopTime) {
  80 + var form = this.findParentByType('form').getForm();
  81 + var stopField = form.findField('stopDate');
  82 + stopField.setValue(stopTime);
  83 + this.updateDuration();
  84 + },
86 85  
87   - /**
  86 + /**
88 87 Get the start time field value.
89 88 - return: A Extjs Date object representing the start time (null if the date is not valid).
90 89 */
91 90 getStartTime : function()
92 91 {
93 92 // get the search form
94   - var form = this.findParentByType('form').getForm();
95   - // get start field
96   - var startField = form.findField('startDate');
  93 + var form = this.findParentByType('form').getForm();
  94 + // get start field
  95 + var startField = form.findField('startDate');
97 96  
98   - return startField.getValue();
  97 + return startField.getValue();
99 98 },
100 99  
101 100 /**
... ... @@ -105,123 +104,128 @@ Ext.define(&#39;amdaUI.IntervalUI&#39;, {
105 104 getStopTime : function()
106 105 {
107 106 // get the search form
108   - var form = this.findParentByType('form').getForm();
109   - // get stop field
110   - var stopField = form.findField('stopDate');
  107 + var form = this.findParentByType('form').getForm();
  108 + // get stop field
  109 + var stopField = form.findField('stopDate');
111 110  
112   - return stopField.getValue();
  111 + return stopField.getValue();
113 112 },
114 113  
115 114 /*
116 115 #### Private methods from here ####
117 116 */
  117 + updateDuration: function() {
  118 + // get the search form
  119 + var form = this.findParentByType('form').getForm();
  120 + // get start value
  121 + var start = this.getStartTime();
  122 + // get stop value
  123 + var stop = this.getStopTime();
  124 + // if duration computable
  125 + if (stop != null && start != null) {
  126 + // compute offset
  127 + var zoneOffset = stop.getTimezoneOffset() - start.getTimezoneOffset();
  128 + // compute duration
  129 + var diff = stop - start - zoneOffset*60000;
  130 +
  131 + var durationDays = Math.floor(diff/86400000);
  132 + // set all duration values
  133 + form.findField('durationDay').setValue(durationDays);
  134 + form.findField('durationHour').setValue(Math.floor(diff/3600000 % 24));
  135 + form.findField('durationMin').setValue(Math.floor(diff/60000 % 60));
  136 + form.findField('durationSec').setValue(Math.floor(diff/1000 % 60));
  137 +
  138 + if (durationDays > this.durationLimit) {
  139 + form.findField('durationDay').markInvalid('Maximum interval is ' + this.durationLimit + ' days!');
  140 + }
  141 + } else {
  142 + form.findField('durationDay').setValue('');
  143 + form.findField('durationHour').setValue('');
  144 + form.findField('durationMin').setValue('');
  145 + form.findField('durationSec').setValue('');
  146 + }
  147 + },
118 148  
119   - updateDuration: function() {
120   - // get the search form
121   - var form = this.findParentByType('form').getForm();
122   - // get start value
123   - var start = this.getStartTime();
124   - // get stop value
125   - var stop = this.getStopTime();
126   - // if duration computable
127   - if (stop != null && start != null) {
128   - // compute offset
129   - var zoneOffset = stop.getTimezoneOffset() - start.getTimezoneOffset();
130   - // compute duration
131   - var diff = stop - start - zoneOffset*60000;
132   -
133   - var durationDays = Math.floor(diff/86400000);
134   - // set all duration values
135   - form.findField('durationDay').setValue(durationDays);
136   - form.findField('durationHour').setValue(Math.floor(diff/3600000 % 24));
137   - form.findField('durationMin').setValue(Math.floor(diff/60000 % 60));
138   - form.findField('durationSec').setValue(Math.floor(diff/1000 % 60));
139   -
140   - if (durationDays > this.durationLimit) {
141   - form.findField('durationDay').markInvalid('Maximum interval is ' + this.durationLimit + ' days!');
142   - }
143   - } else {
144   - form.findField('durationDay').setValue('');
145   - form.findField('durationHour').setValue('');
146   - form.findField('durationMin').setValue('');
147   - form.findField('durationSec').setValue('');
148   - }
149   - },
150   -
151   - isValidDuration: function(){
152   - var form = this.findParentByType('form').getForm();
153   - return (
154   - form.findField('durationDay').isValid() &&
155   - form.findField('durationHour').isValid() &&
156   - form.findField('durationMin').isValid() &&
157   - form.findField('durationSec').isValid()
158   - );
159   - },
160   -
161   - updateStop: function() {
162   - var form = this.findParentByType('form').getForm();
163   - var start = form.findField('startDate').getValue();
164   -
165   - var d = form.findField('durationDay').getValue();
166   - var h = form.findField('durationHour').getValue();
167   - var m = form.findField('durationMin').getValue();
168   - var s = form.findField('durationSec').getValue();
169   - var duration = (d?d:0)*86400 + (h?h:0)*3600 + (m?m:0)*60 + (s?s:0)
  149 + isValidDuration: function(){
  150 + var form = this.findParentByType('form').getForm();
  151 + return (
  152 + form.findField('durationDay').isValid() &&
  153 + form.findField('durationHour').isValid() &&
  154 + form.findField('durationMin').isValid() &&
  155 + form.findField('durationSec').isValid()
  156 + );
  157 + },
170 158  
171   - form.findField('stopDate').setValue(Ext.Date.add(start, Ext.Date.SECOND, duration));
172   - },
  159 + updateStop: function() {
  160 + var form = this.findParentByType('form').getForm();
  161 + var start = form.findField('startDate').getValue();
  162 +
  163 + var d = form.findField('durationDay').getValue();
  164 + var h = form.findField('durationHour').getValue();
  165 + var m = form.findField('durationMin').getValue();
  166 + var s = form.findField('durationSec').getValue();
  167 + var duration = (d?d:0)*86400 + (h?h:0)*3600 + (m?m:0)*60 + (s?s:0)
  168 + var stop = Ext.Date.add(start, Ext.Date.SECOND, duration);
  169 +
  170 + if (Ext.Date.isDST(stop) && !Ext.Date.isDST(start))
  171 + stop = Ext.Date.add(start, Ext.Date.SECOND, duration-3600);
  172 +
  173 + if (!Ext.Date.isDST(stop) && Ext.Date.isDST(start))
  174 + stop = Ext.Date.add(start, Ext.Date.SECOND, duration+3600);
  175 +
  176 + form.findField('stopDate').setValue(stop);
  177 + },
173 178  
174 179 onChangeStartField : function(field, newValue, oldValue)
175 180 {
176   - if (field.isValid()) {
177   - // get the search form
178   - var form = this.findParentByType('form').getForm();
179   - // set to the stop datefield the newValue as minValue
180   - form.findField('stopDate').setMinValue(newValue);
181   - // if it's a user modification
182   - if (this.activeField == 'start') {
183   - // launch the update of duration fields
184   - this.updateDuration();
185   - }
186   - }
  181 + if (field.isValid()) {
  182 + // get the search form
  183 + var form = this.findParentByType('form').getForm();
  184 + // set to the stop datefield the newValue as minValue
  185 + form.findField('stopDate').setMinValue(newValue);
  186 + // if it's a user modification
  187 + if (this.activeField == 'start') {
  188 + // launch the update of duration fields
  189 + this.updateDuration();
  190 + }
  191 + }
187 192 },
188 193  
189   - onChangeStopField: function(field, newValue, oldValue){
190   - if (field.isValid() && this.activeField == 'stop') {
191   - // launch the update of duration fields
192   - this.updateDuration();
193   - }
194   - },
  194 + onChangeStopField: function(field, newValue, oldValue)
  195 + {
  196 + if (field.isValid() && this.activeField == 'stop') {
  197 + // launch the update of duration fields
  198 + this.updateDuration();
  199 + }
  200 + },
195 201  
196 202 getDateField : function(fieldName,fieldText,fieldId,onChangeField)
197 203 {
198 204 return {
199 205 layout: {type: 'hbox', align: 'middle'},
200   - items: [
201   - {
202   - xtype: 'datefield',
203   - name: fieldName,
204   - emptyText: 'YYYY/MM/DD hh:mm:ss',
205   - tip: 'Date formated as YYYY/MM/DD hh:mm:ss',
206   - format: 'Y/m/d H:i:s',
207   - enforceMaxLength: true,
208   - maxLength: 19,
209   - fieldLabel: fieldText,
210   - labelAlign: 'left',
211   - labelWidth: 60,
212   - listeners: {
213   - change: onChangeField,
214   - focus: function(field) {
215   - this.activeField = fieldId;
216   - },
217   - render: function(c) {
218   - Ext.create('Ext.tip.ToolTip', { target: c.getEl(), html: c.tip });
219   - },
220   - scope : this
221   - }
222   - }
223   - ]
224   - };
  206 + items: [{
  207 + xtype: 'datefield',
  208 + name: fieldName,
  209 + emptyText: 'YYYY/MM/DD hh:mm:ss',
  210 + tip: 'Date formated as YYYY/MM/DD hh:mm:ss',
  211 + format: 'Y/m/d H:i:s',
  212 + enforceMaxLength: true,
  213 + maxLength: 19,
  214 + fieldLabel: fieldText,
  215 + labelAlign: 'left',
  216 + labelWidth: 60,
  217 + listeners: {
  218 + change: onChangeField,
  219 + focus: function(field) {
  220 + this.activeField = fieldId;
  221 + },
  222 + render: function(c) {
  223 + Ext.create('Ext.tip.ToolTip', { target: c.getEl(), html: c.tip });
  224 + },
  225 + scope : this
  226 + }
  227 + }]
  228 + };
225 229 },
226 230  
227 231 getStartField : function()
... ... @@ -231,71 +235,69 @@ Ext.define(&#39;amdaUI.IntervalUI&#39;, {
231 235  
232 236 getStopField : function()
233 237 {
234   - return this.getDateField('stopDate','Stop Time','stop',this.onChangeStopField);
  238 + return this.getDateField('stopDate','Stop Time','stop', this.onChangeStopField);
235 239 },
236 240  
237 241 getDurationField : function()
238 242 {
239   - return {
240   - layout: {type: 'hbox', align: 'middle'},
241   - margin: 0,
242   - defaults: {
243   - xtype: 'numberfield',
244   - minValue: 0,
245   - maxLength: 2,
246   - enforceMaxLength: true,
247   - decimalPrecision: 0,
248   - allowExponential: false,
249   - autoStripChars: true,
250   - hideTrigger: true,
251   - labelAlign: 'left',
252   - width: 32,
253   - margin: '0 5 0 0',
254   - listeners: {
255   - change: function(field, newValue, oldValue) {
256   - var form = this.findParentByType('form').getForm();
257   - var start = form.findField('startDate').getValue();
258   - if (this.isValidDuration() && start!=null && this.activeField == 'duration') {
259   - this.updateStop();
260   - }
261   - },
262   - focus: function(field) {
263   - this.activeField = 'duration';
264   - },
265   - render: function(c) {
266   - Ext.create('Ext.tip.ToolTip', { target: c.getEl(), html: c.tip });
267   - },
268   - scope : this
269   - }
270   - },
271   - items:[
272   - { name: 'durationDay', emptyText: 'Days', tip: 'Days', maxValue: 36500, maxLength: 5, fieldLabel: 'Duration', labelWidth: 60, width: 110, },
273   - { name: 'durationHour', emptyText: 'Hrs', tip: 'Hours', maxValue: 23},
274   - { name: 'durationMin', emptyText: 'Mins', tip: 'Minutes', maxValue: 59},
275   - { name: 'durationSec', emptyText: 'Secs', tip: 'Seconds', maxValue: 59}
276   - ]
277   - };
  243 + return {
  244 + layout: {type: 'hbox', align: 'middle'},
  245 + margin: 0,
  246 + defaults: {
  247 + xtype: 'numberfield',
  248 + minValue: 0,
  249 + maxLength: 2,
  250 + enforceMaxLength: true,
  251 + decimalPrecision: 0,
  252 + allowExponential: false,
  253 + autoStripChars: true,
  254 + hideTrigger: true,
  255 + labelAlign: 'left',
  256 + width: 32,
  257 + margin: '0 5 0 0',
  258 + listeners: {
  259 + change: function(field, newValue, oldValue) {
  260 + var form = this.findParentByType('form').getForm();
  261 + var start = form.findField('startDate').getValue();
  262 + if (this.isValidDuration() && start!=null && this.activeField == 'duration') {
  263 + this.updateStop();
  264 + }
  265 + },
  266 + focus: function(field) {
  267 + this.activeField = 'duration';
  268 + },
  269 + render: function(c) {
  270 + Ext.create('Ext.tip.ToolTip', { target: c.getEl(), html: c.tip });
  271 + },
  272 + scope : this
  273 + }
  274 + },
  275 + items:[
  276 + { name: 'durationDay', emptyText: 'Days', tip: 'Days', maxValue: 73000, maxLength: 5, fieldLabel: 'Duration', labelWidth: 60, width: 110},
  277 + { name: 'durationHour', emptyText: 'Hrs', tip: 'Hours', maxValue: 23},
  278 + { name: 'durationMin', emptyText: 'Mins', tip: 'Minutes', maxValue: 59},
  279 + { name: 'durationSec', emptyText: 'Secs', tip: 'Seconds', maxValue: 59}
  280 + ]
  281 + };
278 282 },
279 283  
280   - init : function(config) {
281   - this.durationLimit = config.durationLimit == null ? 36500 : config.durationLimit; // Set duration limit to 100 years by default
282   -
283   - var me = this;
284   -
285   - var myConf = {
286   - border: false,
287   - plain: true,
288   - flex: 1,
289   - layout: 'anchor',
290   - defaults: { margin: '0 0 5 0', xtype : 'container'},
291   -
292   - items: [
293   - me.getStartField(),
294   - me.getStopField(),
295   - me.getDurationField()
296   - ]
297   - };
298   -
299   - Ext.apply (this , Ext.apply (arguments, myConf));
  284 + init : function(config)
  285 + {
  286 + this.durationLimit = config.durationLimit == null ? 73000 : config.durationLimit; // Set duration limit to 200 years by default
  287 +
  288 + var me = this;
  289 + var myConf = {
  290 + border: false,
  291 + plain: true,
  292 + flex: 1,
  293 + layout: 'anchor',
  294 + defaults: { margin: '0 0 5 0', xtype : 'container'},
  295 + items: [
  296 + me.getStartField(),
  297 + me.getStopField(),
  298 + me.getDurationField()
  299 + ]
  300 + };
  301 + Ext.apply (this, Ext.apply(arguments, myConf));
300 302 }
301 303 });
... ...
js/app/views/VisuUI.js
... ... @@ -11,30 +11,30 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
11 11 extend: 'Ext.container.Container',
12 12 alias: 'widget.panelVisu',
13 13  
14   - constructor: function(config)
15   - {
  14 + constructor: function(config) {
16 15 this.init(config);
17 16 this.callParent(arguments);
18 17 if (this.object) this.reformObject();
19 18 },
20 19  
21   - setObject : function (obj) {
22   -
  20 + setObject : function (obj) {
23 21 this.object = obj;
24 22 this.reformObject();
25 23 },
26 24  
27   - updateObject : function () {
28   -
  25 + updateObject : function () {
29 26 return true;
30 27 },
31 28  
32   - reformObject : function ()
33   - {
  29 + reformObject : function () {
34 30 this.fromPlugin = this.object.get('fromPlugin');
35 31  
36 32 if (this.fromPlugin) {
37   - this.object.set('id',this.object.get('folderId'));
  33 + if (this.object.get('folderId') == '')
  34 + this.object.set('id','cacheCat');
  35 + else
  36 + this.object.set('id',this.object.get('folderId'));
  37 +
38 38 this.object.set('objName',this.object.get('objName'));
39 39 }
40 40 else {
... ... @@ -42,12 +42,11 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
42 42 this.object.set('name',this.object.get('name'));
43 43 }
44 44 // load object into view
45   - if (this.object.get('id') != '')
  45 + if (this.object.get('id') != '')
46 46 this.loadObject();
47 47 },
48 48  
49 49 reset : function() {
50   -
51 50 //reset all fieldsets except the first one (name, intervals)
52 51 var form = this.items.items[0].items.items[0];
53 52 for (var i = 1; i < 4; i++) {
... ... @@ -56,62 +55,88 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
56 55 field.reset();
57 56 });
58 57 }
59   - this.resetChart();
60   -
  58 + this.resetChart();
61 59 },
  60 +
62 61 /**
63 62 * load object catalog into this view
64 63 */
65 64 loadObject : function()
66   - {
67   -
  65 + {
68 66 var me = this;
69 67  
70 68 var onAfterInit = function(result, e)
71   - {
72   - if (!result || !result.success)
  69 + {
  70 + if (!result) {
  71 + myDesktopApp.errorMsg(e.message);
  72 + Ext.defer(function(){Ext.Msg.toFront()},10);
  73 +
  74 + return;
  75 + }
  76 + else if (!result.success)
73 77 {
74 78 if (result.message)
75 79 myDesktopApp.errorMsg(result.message);
76 80 else
77 81 myDesktopApp.errorMsg('Unknown error during catalog cache initialisation');
  82 +
  83 + Ext.defer(function(){Ext.Msg.toFront()},10);
  84 +
78 85 return;
79 86 }
80   -
81   - me.object.set('name', result.name);
82   - me.object.set('nbIntervals', result.totalCount);
83   -
  87 +
84 88 var fields = [], i = 0, index;
85   -
86   - Ext.Array.each(result.parameters, function(obj)
87   - {
  89 +
  90 + if (!result.cache) {
  91 + me.object.set('name', result.name);
  92 + me.object.set('nbIntervals', result.totalCount);
88 93  
89   - index = 'param'+i.toString();
90   - fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name,
91   - convert: function(value, record) {
92   - return parseFloat(value);
93   - }
  94 + var params = [];
  95 + Ext.Array.each(result.parameters, function(item, index) {
  96 + params[index] = item;
  97 + }, this);
  98 +
  99 + me.object.set('parameters', params);
  100 + }
  101 + else {
  102 + fields[0] = Ext.create('Ext.data.Field', { name : 'start', id: 'start', text : 'start: date' });
  103 + fields[1] = Ext.create('Ext.data.Field', { name : 'stop', id: 'stop', text : 'stop: date' });
  104 + i = 2;
  105 + }
  106 +
  107 + Ext.Array.each(me.object.get('parameters'), function(obj) {
  108 + index = 'param'+i.toString();
  109 + if (obj.type == 0) {
  110 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name,
  111 + convert: function(value, record) {
  112 + return parseFloat(value);
  113 + }
  114 + });
  115 + }
  116 + else if (obj.type == 1){
  117 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': date' });
  118 + }
  119 + else {
  120 + fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name + ': string' });
94 121 }
95   - );
96   -
97 122 i++;
98 123 });
99   -
  124 +
100 125 if (me.chartStore) {
101 126 me.parList.removeAll();
102 127 me.reset();
103 128 me.chartStore = null;
104 129 }
105 130  
106   - me.parList.add(fields);
  131 + me.parList.add(fields);
107 132  
108 133 me.chartStore = Ext.create('Ext.data.Store', {
109 134 fields : fields,
110 135 // autoDestroy: false,
111   - // pageSize : 200,
112   - // buffered : true,
113   - // purgePageCount: 0,
114   - // remoteSort: true,
  136 + // pageSize : 200,
  137 + // buffered : true,
  138 + // purgePageCount: 0,
  139 + // remoteSort: true,
115 140 autoload: false,
116 141 proxy: {
117 142 type: 'direct',
... ... @@ -144,9 +169,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
144 169  
145 170 me.chartStore.load();
146 171 }
147   -
148   - AmdaAction.initForChart(this.object.get('id'), this.object.get('objName'), this.fromPlugin, 'catalog', onAfterInit);
149   -
  172 +
  173 + AmdaAction.initForChart(this.object.get('id'), this.object.get('objName'), this.fromPlugin, 'catalog', onAfterInit);
150 174 },
151 175  
152 176  
... ... @@ -155,9 +179,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
155 179 * @return true if changes
156 180 */
157 181 fclose : function()
158   - {
159   -
160   - return false;
  182 + {
  183 + return false;
161 184 },
162 185  
163 186 resetChart : function () {
... ... @@ -168,7 +191,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
168 191 fields: [],
169 192 title: 'X axis',
170 193 grid : true
171   - }, {
  194 + }, {
172 195 type: 'Numeric',
173 196 position: 'left',
174 197 fields: [],
... ... @@ -224,13 +247,10 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
224 247  
225 248 var chart = Ext.create('Ext.chart.Chart', this.chartConfig);
226 249  
227   - this.replaceChart(chart);
228   -
  250 + this.replaceChart(chart);
229 251 },
230   -
231   -
232   - replaceChart: function(chart) {
233   -
  252 +
  253 + replaceChart: function(chart) {
234 254 var chartPanel = this.items.items[0].items.items[1];
235 255 var oldChart = chartPanel.down('chart');
236 256 oldIndex = chartPanel.items.indexOf(oldChart);
... ... @@ -250,7 +270,6 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
250 270 autoload : false
251 271 });
252 272  
253   -
254 273 this.chartConfig = {
255 274 width: 500,
256 275 height: 500,
... ... @@ -266,7 +285,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
266 285 fields: [],
267 286 title: 'X axis',
268 287 grid : true
269   - }, {
  288 + }, {
270 289 type: 'Numeric',
271 290 position: 'left',
272 291 fields: [],
... ... @@ -290,7 +309,7 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
290 309 // // return storeItem.param3;
291 310 // // }
292 311 // },
293   - tips: {
  312 + tips: {
294 313 // trackMouse: true,
295 314 width: 10,
296 315 height: 20,
... ... @@ -299,9 +318,8 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
299 318 renderer: function(storeItem, item) {
300 319 this.setTitle(storeItem.index + 1);
301 320 }
302   - }
303   - }
304   - ]
  321 + }
  322 + }]
305 323 }
306 324  
307 325 this.parList = Ext.create('Ext.data.Store', {
... ... @@ -414,16 +432,13 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
414 432 bodyStyle: {background : '#dfe8f6'},
415 433 defaults: { border : false, align: 'stretch', padding: '3'},
416 434 fieldDefaults: { labelWidth: 80, labelAlign : 'top' },
417   - items: [
418   - {
  435 + items: [ {
419 436 xtype: 'form',
420 437 flex : 1,
421 438 bodyStyle: {background : '#dfe8f6'},
422   - items: [
423   - {
  439 + items: [{
424 440 xtype : 'fieldset',
425   - items : [
426   - {
  441 + items : [{
427 442 xtype: 'fieldcontainer',
428 443 layout: 'hbox',
429 444 items: [
... ... @@ -431,15 +446,13 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
431 446 { xtype: 'splitter' },
432 447 { xtype:'textfield', fieldLabel: 'Intervals', name: 'nbIntervals', readOnly: true}
433 448 ]
434   - }
435   - ]
436   - },
437   - {
  449 + }]
  450 + },{
438 451 xtype : 'fieldset',
439 452 title : 'X axis',
440 453 items : [
441   - this.parCombo,
442   - {
  454 + this.parCombo,
  455 + {
443 456 xtype : 'fieldcontainer',
444 457 layout: 'hbox',
445 458 items: [{
... ... @@ -450,58 +463,57 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
450 463 items: [
451 464 this.comboXrange,
452 465 {
453   - xtype: 'splitter'
  466 + xtype: 'splitter'
454 467 }, {
455   - xtype: 'numberfield',
456   - hideTrigger: true,
457   - width: 50,
458   - disabled: true
  468 + xtype: 'numberfield',
  469 + hideTrigger: true,
  470 + width: 50,
  471 + disabled: true
459 472 },{
460   - xtype: 'splitter'
  473 + xtype: 'splitter'
461 474 },{
462   - xtype: 'numberfield',
463   - hideTrigger: true,
464   - width: 50,
465   - disabled: true
  475 + xtype: 'numberfield',
  476 + hideTrigger: true,
  477 + width: 50,
  478 + disabled: true
466 479 }]
467 480 }]
468 481 },
469 482 // { xtype : 'checkbox', boxLabel: 'Logarithmic'},
470 483 { xtype: 'textfield', fieldLabel: 'X title', name: 'xtitle'}
471 484 ]
472   - },
473   - {
474   - xtype : 'fieldset',
  485 + },{
  486 + xtype : 'fieldset',
475 487 title : 'Y axis',
476 488 items : [
477 489 this.parCombo1,
478 490 {
479   - xtype : 'fieldcontainer',
480   - layout: 'hbox',
481   - items: [{
482   - xtype:'fieldset',
483   - title: 'Y Range',
484   - border: false,
  491 + xtype : 'fieldcontainer',
485 492 layout: 'hbox',
486   - items: [
487   - this.comboYrange,
488   - {
489   - xtype: 'splitter'
490   - }, {
491   - xtype: 'numberfield',
492   - hideTrigger: true,
493   - width: 50,
494   - disabled: true
495   - },{
496   - xtype: 'splitter'
497   - },{
498   - xtype: 'numberfield',
499   - hideTrigger: true,
500   - width: 50,
501   - disabled: true
  493 + items: [{
  494 + xtype:'fieldset',
  495 + title: 'Y Range',
  496 + border: false,
  497 + layout: 'hbox',
  498 + items: [
  499 + this.comboYrange,
  500 + {
  501 + xtype: 'splitter'
  502 + }, {
  503 + xtype: 'numberfield',
  504 + hideTrigger: true,
  505 + width: 50,
  506 + disabled: true
  507 + },{
  508 + xtype: 'splitter'
  509 + },{
  510 + xtype: 'numberfield',
  511 + hideTrigger: true,
  512 + width: 50,
  513 + disabled: true
502 514 }]
503 515 }]
504   - },
  516 + },
505 517 // { xtype : 'checkbox', boxLabel: 'Logarithmic',
506 518 // listeners: {
507 519 // scope: this,
... ... @@ -510,84 +522,75 @@ Ext.define(&#39;amdaUI.VisuUI&#39;, {
510 522 // }
511 523 // }
512 524 // },
513   - { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
514   -
  525 + { xtype: 'textfield', fieldLabel: 'Y title', name: 'ytitle'}
515 526 ]
516 527 },
517   - {
518   - xtype : 'fieldset',
519   - title : 'Plotting Options',
520   - items : [
521   - plotTypeCombo,
522   - plotThemeCombo
523   - ]
524   - }
525   - ],
526   - fbar:[
527   - {
528   - type: 'button',
529   - text: 'Plot',
530   - scope : this,
531   - handler: this.plotChart
  528 + {
  529 + xtype : 'fieldset',
  530 + title : 'Plotting Options',
  531 + items : [
  532 + plotTypeCombo,
  533 + plotThemeCombo
  534 + ]
  535 + }
  536 + ],
  537 + fbar:[{
  538 + type: 'button',
  539 + text: 'Plot',
  540 + scope : this,
  541 + handler: this.plotChart
  542 +
  543 + },{
  544 + type: 'button',
  545 + text: 'Reset',
  546 + scope : this,
  547 + handler: this.reset
532 548  
533   - },{
534   - type: 'button',
535   - text: 'Reset',
536   - scope : this,
537   - handler: this.reset
538   -
539   - }
540   - ]
  549 + }]
541 550 }, {
542   - xtype: 'form',
543   - // padding: '3',
544   - flex: 2,
545   - items : [
546   - chart
547   - ],
548   - fbar:[
  551 + xtype: 'form',
  552 + // padding: '3',
  553 + flex: 2,
  554 + items : [ chart ],
  555 + fbar:[
549 556 {
550   - type: 'button',
551   - text: 'Save Chart',
552   - scope: this,
553   - handler: function() {
554   - var chartPanel = this.items.items[0].items.items[1];
555   - var chart = chartPanel.down('chart');
556   - chart.save({
557   - type: 'image/png',
558   - defaultUrl : window.location //'http://apus.irap.omp.eu/NEWAMDA/'
559   - });
560   - }
561   -
562   - }
563   - ]
564   - }
565   - ]
  557 + type: 'button',
  558 + text: 'Save Chart',
  559 + scope: this,
  560 + handler: function() {
  561 + var chartPanel = this.items.items[0].items.items[1];
  562 + var chart = chartPanel.down('chart');
  563 + chart.save({
  564 + type: 'image/png',
  565 + defaultUrl : window.location //'http://apus.irap.omp.eu/NEWAMDA/'
  566 + });
  567 + }
  568 + }]
  569 + }
  570 + ]
566 571 });
567   -
568 572  
569 573 var myConf = {
570 574 layout: 'border',
571 575 items: [
572 576 formPanel,
573 577 {
574   - xtype: 'panel',
575   - region: 'south',
576   - title: 'Information',
577   - collapsible: true,
578   - height: 100,
579   - autoHide: false,
580   - bodyStyle: 'padding:5px',
581   - iconCls: 'icon-information',
582   - loader: {
583   - autoLoad: true,
584   - url: helpDir+'visuHOWTO'
585   - }
  578 + xtype: 'panel',
  579 + region: 'south',
  580 + title: 'Information',
  581 + collapsible: true,
  582 + height: 100,
  583 + autoHide: false,
  584 + bodyStyle: 'padding:5px',
  585 + iconCls: 'icon-information',
  586 + loader: {
  587 + autoLoad: true,
  588 + url: helpDir+'visuHOWTO'
  589 + }
586 590 }
587 591 ]
588 592 };
589 593  
590 594 Ext.apply (this, Ext.apply(arguments, myConf));
591   - }
592   -
  595 + }
593 596 });
... ...
php/RemoteDataCenter/RemoteParamManager.php
... ... @@ -120,6 +120,7 @@ class RemoteParamManager
120 120 }
121 121  
122 122 $fillValue = $this->center->getParamFillValue();
  123 +
123 124 if (!$fillValue)
124 125 $fillValue = null;
125 126  
... ... @@ -130,8 +131,8 @@ class RemoteParamManager
130 131 $infoNode->appendChild($xml->createElement("si_conversion"));
131 132 $infoNode->appendChild($xml->createElement("fill_value", $fillValue));
132 133 $infoNode->appendChild($xml->createElement("ucd"));
133   - $infoNode->appendChild($xml->createElement("dataset_id"));
134   - $infoNode->appendChild($xml->createElement("instrument_id"));
  134 + $infoNode->appendChild($xml->createElement("dataset_id",strtolower($this->center->ViId)));
  135 + $infoNode->appendChild($xml->createElement("instrument_id",strtolower($this->center->baseID." ".$this->center->ViId)));
135 136  
136 137 $getNode = $xml->createElement("get");
137 138 $viNode = $xml->createElement("vi");
... ...
php/api.php
1 1 <?php
2 2  
3   - require('config.php');
4   - header('Content-Type: text/javascript');
  3 + require('config.php');
  4 + header('Content-Type: text/javascript');
5 5  
6   - $actions = array();
7   - foreach($API as $aname => &$a){
8   - $methods = array();
9   - foreach($a['methods'] as $mname => &$m){
10   - $md = array(
11   - 'name'=>$mname,
12   - 'len'=>$m['len']
13   - );
14   - if(isset($m['formHandler']) && $m['formHandler']){
15   - $md['formHandler'] = true;
16   - }
17   - $methods[] = $md;
  6 + $actions = array();
  7 + foreach($API as $aname => &$a){
  8 + $methods = array();
  9 + foreach($a['methods'] as $mname => &$m){
  10 + $md = array(
  11 + 'name'=>$mname,
  12 + 'len'=>$m['len']
  13 + );
  14 + if(isset($m['formHandler']) && $m['formHandler']){
  15 + $md['formHandler'] = true;
  16 + }
  17 + $methods[] = $md;
  18 + }
  19 + $actions[$aname] = $methods;
18 20 }
19   - $actions[$aname] = $methods;
20   - }
21 21  
22   - $cfg = array(
23   - 'url'=>'php/router.php',
24   - 'type'=>'remoting',
25   - 'id' => 'amda-provider',
26   - 'maxRetries' => 0,
27   - 'actions'=>$actions
28   - );
  22 + $cfg = array(
  23 + 'url'=>'php/router.php',
  24 + 'type'=>'remoting',
  25 + 'id' => 'amda-provider',
  26 + 'maxRetries' => 0,
  27 + 'actions'=>$actions
  28 + );
29 29  
30   - echo 'Ext.app.REMOTING_API = ';
31   -
32   - echo json_encode($cfg);
33   - echo ';';
  30 + echo 'Ext.app.REMOTING_API = ';
34 31  
  32 + echo json_encode($cfg);
  33 + echo ';';
35 34 ?>
36 35  
... ...
php/classes/AmdaAction.php
... ... @@ -870,12 +870,14 @@ class AmdaAction
870 870  
871 871 if (isset($obj->username) && isset($obj->password) && isset($obj->sessionID))
872 872 {
873   - //$dd = new WSUserMgr();
  873 + //$dd = new WSUserMgr();
874 874 //$dd->init($obj->username,$obj->password,$obj->sessionID);
875 875 return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support not implemented");
876 876 }
877   - else
  877 + else {
878 878 $dd = new UserMgr();
  879 + $dd->setSpecialSettings();
  880 + }
879 881  
880 882 //TODO error handling
881 883 if (($res = $dd -> ddCheckUser()) != 0)
... ... @@ -887,14 +889,12 @@ class AmdaAction
887 889 }
888 890  
889 891 if ($dd->user == 'impex')
890   - {
891   - //if ($dd->getWsSize() > DISK_QUOTA * 100)
892   - // error_log('Natacha! It is time to CLEAN UP IMPEX WS!',1,'nbourrel@irap.omp.eu');
  892 + {
893 893 return array('success' => false, "message" => "AKKA-KERNEL-INT - WS support for IMPEx not implemented");
894 894 }
895 895 else
896 896 {
897   - // check disk space
  897 + // check disk space
898 898 if ($dd->getWsSize() > DISK_QUOTA)
899 899 return array('success' => false, 'message' => 'Please clean up your workspace.<br/>No more space is available');
900 900 }
... ... @@ -1028,6 +1028,9 @@ class AmdaAction
1028 1028  
1029 1029 public function initForChart($id, $name, $isTmpObject, $type)
1030 1030 {
  1031 + if ($isTmpObject && $type == 'catalog' && $id == 'cacheCat')
  1032 + return array('success' => true, 'cache' => $id);
  1033 +
1031 1034 if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
1032 1035  
1033 1036 return $objMgr->initForChart($id, $name, $isTmpObject, $type);
... ... @@ -1059,7 +1062,16 @@ class AmdaAction
1059 1062  
1060 1063 public function readIntervalsForChart($o)
1061 1064 {
1062   - if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr();
  1065 + if ($o->typeTT == 'catalog' || $type == 'sharedcatalog') {
  1066 +
  1067 + if ($o->fromPlugin && $o->id == 'cacheCat') {
  1068 + $objMgr = new CatalogCacheMgr();
  1069 +
  1070 + return $objMgr->getIntervals();
  1071 + }
  1072 +
  1073 + $objMgr = new CatalogMgr();
  1074 + }
1063 1075  
1064 1076 return $objMgr->getIntervalsForChart($o->id, $o->name, $o->fromPlugin, $o->typeTT);
1065 1077 }
... ...
php/classes/CatalogCacheMgr.php
... ... @@ -47,14 +47,22 @@ class CatIntervalCacheObject extends IntervalCacheObject
47 47 {
48 48 fwrite($handle,pack('L6',$this->id,$this->index,$this->start,$this->stop,$this->isNew,$this->isModified));
49 49 for ($i = 0; $i < $paramsNumber; $i++)
50   - {
51   - if ($paramsTypes[$i] == '1')
52   - $paramString = CacheTools::iso2stamp($this->params[$i]);
53   - else
54   - $paramString = $this->params[$i];
55   -
56   - $paramArray = explode(',',$paramString);
57   - for ($j = 0; $j < $paramsSizes[$i]; $j++) fwrite($handle,pack('d', $paramArray[$j]));
  50 + {
  51 + if ($paramsTypes[$i] == '2') // string
  52 + {
  53 + fwrite($handle,pack('d', strlen($this->params[$i])));
  54 + fwrite($handle, $this->params[$i],strlen($this->params[$i]));
  55 + }
  56 + else
  57 + {
  58 + if ($paramsTypes[$i] == '1')
  59 + $paramString = CacheTools::iso2stamp($this->params[$i]);
  60 + else
  61 + $paramString = $this->params[$i];
  62 +
  63 + $paramArray = explode(',',$paramString);
  64 + for ($j = 0; $j < $paramsSizes[$i]; $j++) fwrite($handle,pack('d', $paramArray[$j]));
  65 + }
58 66 }
59 67 }
60 68  
... ... @@ -70,16 +78,24 @@ class CatIntervalCacheObject extends IntervalCacheObject
70 78  
71 79 for ($i = 0; $i < $paramsNumber; $i++) {
72 80 $this->params[$i] = null;
  81 +
73 82 for ($j = 0; $j < $paramsSizes[$i]; $j++)
74 83 {
75 84 $val = unpack('dval',fread($handle,8));
76 85  
77   - if ($paramsTypes[$i] == '1')
78   - $this->params[$i] .= CacheTools::stamp2iso($val['val']);
79   - else
80   - $this->params[$i] .= $val['val'];
81   -
82   - if ($j != $paramsSizes[$i] - 1) $this->params[$i] .= ',';
  86 + if ($paramsTypes[$i] == '2') // string
  87 + {
  88 + $this->params[$i] = fread($handle,$val['val']);
  89 + }
  90 + else
  91 + {
  92 + if ($paramsTypes[$i] == '1')
  93 + $this->params[$i] .= CacheTools::stamp2iso($val['val']);
  94 + else
  95 + $this->params[$i] .= $val['val'];
  96 +
  97 + if ($j != $paramsSizes[$i] - 1) $this->params[$i] .= ',';
  98 + }
83 99 }
84 100 }
85 101  
... ...
php/classes/CatalogMgr.php
... ... @@ -479,18 +479,34 @@ class CatalogMgr extends TimeTableMgr
479 479 else
480 480 {
481 481 $oneParam['size'] = 1;
482   - }
  482 + }
  483 +
483 484 foreach ($paramNode->attributes as $attr)
484 485 {
485 486 if ($attr->nodeName == 'datatype')
486 487 {
487   - if ($paramNode->hasAttribute('xtype') && ($paramNode->getAttribute('xtype') == 'dateTime'))
  488 + $datatype = $attr->nodeValue;
  489 +
  490 + if ($paramNode->hasAttribute('xtype') && (($paramNode->getAttribute('xtype') == 'dateTime') || ($paramNode->getAttribute('xtype') == 'iso8601')))
  491 + {
488 492 $oneParam['type'] = 1;
489   - else
  493 + $paramNode->setAttribute('xtype','dateTime');
  494 + $paramNode->setAttribute('size',1);
  495 + }
  496 + else if ($datatype == 'char')
  497 + {
  498 + $oneParam['type'] = 2;// string
  499 + $paramNode->setAttribute('size', 1);
  500 + }
  501 + else
  502 + {
490 503 $oneParam['type'] = 0;//'Double';
  504 + }
491 505 }
492 506 else if ($attr->nodeName != 'arraysize')
493   - $oneParam[$attr->nodeName] = $attr->nodeValue;
  507 + {
  508 + $oneParam[$attr->nodeName] = $attr->nodeValue;
  509 + }
494 510 }
495 511 $paramsArray[] = $oneParam;
496 512 }
... ...
php/classes/TimeTableCacheMgr.php
... ... @@ -3,7 +3,12 @@
3 3 class CacheTools
4 4 {
5 5 public static function iso2stamp($iso) {
6   - $time = new DateTime($iso);
  6 + try {
  7 + $time = new DateTime($iso);
  8 + }
  9 + catch (Exception $e) {
  10 + $time = new DateTime('1970-01-01T00:00:00Z');
  11 + }
7 12 $stamp = $time->format('U');
8 13 unset($time);
9 14 return $stamp;
... ...
php/classes/TimeTableMgr.php
... ... @@ -38,25 +38,26 @@ class TimeTableMgr extends AmdaObjectMgr
38 38 }
39 39 }
40 40  
41   - protected function createDom() {
42   -
  41 + protected function createDom()
  42 + {
43 43 $types = array('timetab' => 'timeTable', 'catalog' => 'catalog');
44 44  
45 45 $rootElement = $this->contentDom->createElement('ws');
46   - foreach ($types as $key => $value) {
47   - $contentId = $value.'-treeRootNode';
48   - $contentTag = $key.'List';
49   - $typeElement = $this->contentDom->createElement($contentTag);
50   - $typeElement->setAttribute('xml:id', $contentId);
51   - $rootElement->appendChild($typeElement);
  46 +
  47 + foreach ($types as $key => $value) {
  48 + $contentId = $value.'-treeRootNode';
  49 + $contentTag = $key.'List';
  50 + $typeElement = $this->contentDom->createElement($contentTag);
  51 + $typeElement->setAttribute('xml:id', $contentId);
  52 + $rootElement->appendChild($typeElement);
52 53 }
53 54 $this->contentDom->appendChild($rootElement);
54 55 $this->contentDom->save($this->xmlName);
55   - }
  56 + }
56 57  
57   -/*
58   -* rename Time Table in id.xml
59   -*/
  58 + /*
  59 + * rename Time Table in id.xml
  60 + */
60 61 protected function renameInResource($name, $id)
61 62 {
62 63 if (!file_exists(USERTTDIR.$id.'.xml')) return false;
... ... @@ -97,6 +98,7 @@ class TimeTableMgr extends AmdaObjectMgr
97 98 $p -> id = $this -> getObjectIdByName($p->name);
98 99 $this -> deleteObject($p);
99 100 }
  101 +
100 102 $this->id = $this->setId();
101 103 $this->created = date('Y-m-d\TH:i:s');
102 104 if (!$this->id) return array('error' => ID_CREATION_ERROR);
... ... @@ -107,30 +109,30 @@ class TimeTableMgr extends AmdaObjectMgr
107 109 $rootElement->setAttribute('xml:id',$this->id);
108 110  
109 111 foreach ($p as $key => $value)
110   - if ($key != 'id' && $key != 'leaf' && $key != 'nodeType' &&
111   - $key != 'objName' && $key != 'objFormat' && $key != 'folderId' && $key != 'cacheToken') {
112   - if ($key == 'created') {
113   - $rootElement->appendChild($this->objectDom->createElement($key, $this->created));
114   - }
115   - /*else if ($key == 'intervals') {
116   - $n_int = 0;
117   - foreach ($value as $item) {
118   - $newInterval = $this->objectDom->createElement('intervals');
119   - $newInterval->appendChild($this->objectDom->createElement('start', $item->start));
120   - $newInterval->appendChild($this->objectDom->createElement('stop', $item->stop));
121   - $rootElement->appendChild($newInterval);
122   - $n_int++;
123   - }
124   - }*/
125   - // it is catalog
126   - else if ($key == 'parameters') {
127   - $paramsElement = $this->setParamDescription($value);
128   - if ($paramsElement) $rootElement->appendChild($paramsElement);
129   -
  112 + if ($key != 'id' && $key != 'leaf' && $key != 'nodeType' &&
  113 + $key != 'objName' && $key != 'objFormat' && $key != 'folderId' && $key != 'cacheToken') {
  114 + if ($key == 'created') {
  115 + $rootElement->appendChild($this->objectDom->createElement($key, $this->created));
  116 + }
  117 + /*else if ($key == 'intervals') {
  118 + $n_int = 0;
  119 + foreach ($value as $item) {
  120 + $newInterval = $this->objectDom->createElement('intervals');
  121 + $newInterval->appendChild($this->objectDom->createElement('start', $item->start));
  122 + $newInterval->appendChild($this->objectDom->createElement('stop', $item->stop));
  123 + $rootElement->appendChild($newInterval);
  124 + $n_int++;
  125 + }
  126 + }*/
  127 + // it is catalog
  128 + else if ($key == 'parameters') {
  129 + $paramsElement = $this->setParamDescription($value);
  130 + if ($paramsElement) $rootElement->appendChild($paramsElement);
  131 +
  132 + }
  133 + else if ($key != 'intervals')
  134 + $rootElement->appendChild($this->objectDom->createElement($key, htmlspecialchars($value)));
130 135 }
131   - else if ($key != 'intervals')
132   - $rootElement->appendChild($this->objectDom->createElement($key, htmlspecialchars($value)));
133   - }
134 136  
135 137 $this->objectDom->appendChild($rootElement);
136 138 $this->objectDom->save($this->resFileName);
... ... @@ -150,9 +152,9 @@ class TimeTableMgr extends AmdaObjectMgr
150 152 return $inter;
151 153 }
152 154  
153   -/*
154   -* Uploaded text file => convert to array
155   -*/
  155 + /*
  156 + * Uploaded text file => convert to array
  157 + */
156 158 protected function text2amda($tmp_file, $onlyDescription = false)
157 159 {
158 160 $suffix = explode('.', basename($tmp_file));
... ... @@ -167,33 +169,33 @@ class TimeTableMgr extends AmdaObjectMgr
167 169 $description=$description."\n".$line;
168 170 continue;
169 171 }
170   - // check if it is ISO format
171   - if (!isset($isIso)) $isIso = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/', trim($date[0]));
172   - if (!$isIso) {
173   - $tempT = strtotime(trim($date[0]));
174   - $startDate = date('Y-m-d',$tempT)."T".date('H:i:s',$tempT);
175   - $tempT = strtotime(trim($date[1]));
176   - $stopDate = date('Y-m-d',$tempT)."T".date('H:i:s',$tempT);
177   - //TODO convert time into non standard formats
178   - // $startDate = DateTime::createFromFormat($timeFormat, trim($date[0]);
179   - // $start = $startDate->format('Y-m-d')."T".$startDate->format('H:i:s');
180   - // $stopDate = DateTime::createFromFormat($timeFormat, trim($date[1]);
181   - // $stop = $stopDate->format('Y-m-d')."T".$stopDate->format('H:i:s');
182   - if (!$onlyDescription)
183   - $attributesToReturn['intervals'][] = array('start' => $startDate, 'stop' => $stopDate);
  172 + // check if it is ISO format
  173 + if (!isset($isIso)) $isIso = preg_match('/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})$/', trim($date[0]));
  174 + if (!$isIso) {
  175 + $tempT = strtotime(trim($date[0]));
  176 + $startDate = date('Y-m-d',$tempT)."T".date('H:i:s',$tempT);
  177 + $tempT = strtotime(trim($date[1]));
  178 + $stopDate = date('Y-m-d',$tempT)."T".date('H:i:s',$tempT);
  179 + //TODO convert time into non standard formats
  180 + // $startDate = DateTime::createFromFormat($timeFormat, trim($date[0]);
  181 + // $start = $startDate->format('Y-m-d')."T".$startDate->format('H:i:s');
  182 + // $stopDate = DateTime::createFromFormat($timeFormat, trim($date[1]);
  183 + // $stop = $stopDate->format('Y-m-d')."T".$stopDate->format('H:i:s');
  184 + if (!$onlyDescription)
  185 + $attributesToReturn['intervals'][] = array('start' => $startDate, 'stop' => $stopDate);
  186 + }
  187 + else {
  188 + if (!$onlyDescription)
  189 + $attributesToReturn['intervals'][] = array('start' => trim($date[0]), 'stop' => trim($date[1]));
  190 + }
184 191 }
185   - else {
186   - if (!$onlyDescription)
187   - $attributesToReturn['intervals'][] = array('start' => trim($date[0]), 'stop' => trim($date[1]));
188   - }
189   - }
190   - }
  192 + }
191 193  
192 194 $attributesToReturn['description'] = $description;
193 195 $attributesToReturn['name'] = basename($tmp_file, '.'.$suffix[1]);
194 196 $attributesToReturn['created'] = date('Y-m-d')."T".date('H:i:s');
195 197  
196   - return $attributesToReturn;
  198 + return $attributesToReturn;
197 199 }
198 200  
199 201  
... ... @@ -201,35 +203,32 @@ class TimeTableMgr extends AmdaObjectMgr
201 203 * Uploaded vot TT => convert to array
202 204 */
203 205 protected function vot2amda($tmp_file, $onlyDescription = false) {
204   - // Load Time table
205   - $this->objectDom -> load($tmp_file);
206   - $objToGet = $this->objectDom->getElementsByTagName('TABLEDATA')->item(0);
207   - $attributesToReturn['name'] = $tmp_file;
208   - $attributes = $objToGet -> childNodes;
209   - foreach($attributes as $attribute)
210   - if ($attribute->tagName == 'TR') {
211   - $start = $attribute -> getElementsByTagName('TD')->item(0) -> nodeValue;
212   - $stop = $attribute -> getElementsByTagName('TD')->item(1) -> nodeValue;
213   - if (!$onlyDescription)
214   - $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
215   - }
216   - $suffix = explode('.', basename($tmp_file));
217   - $attributesToReturn['name'] = basename($tmp_file, '.'.$suffix[1]);
218   - $attributesToReturn['created'] = date('Y-m-d')."T".date('H:i:s');
219   - $attributesToReturn['description'] = htmlspecialchars($this->objectDom->getElementsByTagName('DESCRIPTION')->item(0) -> nodeValue);
220   - return($attributesToReturn);
  206 + // Load Time table
  207 + $this->objectDom -> load($tmp_file);
  208 + $objToGet = $this->objectDom->getElementsByTagName('TABLEDATA')->item(0);
  209 + $attributesToReturn['name'] = $tmp_file;
  210 + $attributes = $objToGet -> childNodes;
  211 + foreach($attributes as $attribute)
  212 + if ($attribute->tagName == 'TR') {
  213 + $start = $attribute -> getElementsByTagName('TD')->item(0) -> nodeValue;
  214 + $stop = $attribute -> getElementsByTagName('TD')->item(1) -> nodeValue;
  215 + if (!$onlyDescription)
  216 + $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
  217 + }
  218 + $suffix = explode('.', basename($tmp_file));
  219 + $attributesToReturn['name'] = basename($tmp_file, '.'.$suffix[1]);
  220 + $attributesToReturn['created'] = date('Y-m-d')."T".date('H:i:s');
  221 + $attributesToReturn['description'] = htmlspecialchars($this->objectDom->getElementsByTagName('DESCRIPTION')->item(0) -> nodeValue);
  222 + return($attributesToReturn);
221 223 }
222 224  
223   -
224 225 /*****************************************************************
225 226 * PUBLIC FUNCTIONS
226 227 *****************************************************************/
227   -
228   -
  228 +
229 229 /*
230 230 * Get Object into Edit
231 231 */
232   -
233 232 function getObject($id, $nodeType) {
234 233 if (substr($nodeType,0,6) == 'shared') {
235 234 //Shared object
... ... @@ -268,10 +267,9 @@ class TimeTableMgr extends AmdaObjectMgr
268 267 return $attributesToReturn;
269 268 }
270 269  
271   - public function createObject($p, $folder){
272   -
273   - if ($p -> leaf)
274   - {
  270 + public function createObject($p, $folder)
  271 + {
  272 + if ($p -> leaf){
275 273 $result = $this->createParameter($p, $folder);
276 274 if ($result['error'])
277 275 return $result;
... ... @@ -291,8 +289,7 @@ class TimeTableMgr extends AmdaObjectMgr
291 289 }
292 290 // else return $this->createFolder($p);
293 291 //TODO check if this is possible?
294   - else return array('error' => 'createFolder should be called from RENAME');
295   -
  292 + else return array('error' => 'createFolder should be called from RENAME');
296 293 }
297 294  
298 295  
... ... @@ -328,186 +325,179 @@ class TimeTableMgr extends AmdaObjectMgr
328 325 }
329 326 }
330 327  
331   - public function loadIntervalsFromTT($id,$typeTT,$start = NULL, $limit = NULL)
332   - {
333   -
334   - if ($typeTT == 'sharedtimeTable') {
335   - //Shared object
336   - $sharedObjMgr = new SharedObjectsMgr();
337   - $path = $sharedObjMgr->getDataFilePath('timeTable', $id);
338   - }
339   - else {
340   - $path = USERTTDIR.$id.'.xml';
341   - }
  328 + public function loadIntervalsFromTT($id,$typeTT,$start = NULL, $limit = NULL)
  329 + {
  330 + if ($typeTT == 'sharedtimeTable') {
  331 + //Shared object
  332 + $sharedObjMgr = new SharedObjectsMgr();
  333 + $path = $sharedObjMgr->getDataFilePath('timeTable', $id);
  334 + }
  335 + else {
  336 + $path = USERTTDIR.$id.'.xml';
  337 + }
342 338  
343 339 //load intervals from TT id
344   - if (!file_exists($path))
345   - return array('success' => false, 'message' => "Cannot find TT file ".$id);
346   - $this->objectDom -> load($path);
347   - if (!($objToGet = $this->objectDom->getElementById($id)))
348   - return array('success' => false, 'message' => NO_SUCH_ID." ".$id);
349   -
350   - $xpath = new DOMXPath($this->objectDom);
351   - $intervals = $xpath->query('//intervals');
  340 + if (!file_exists($path))
  341 + return array('success' => false, 'message' => "Cannot find TT file ".$id);
  342 +
  343 + $this->objectDom -> load($path);
  344 + if (!($objToGet = $this->objectDom->getElementById($id)))
  345 + return array('success' => false, 'message' => NO_SUCH_ID." ".$id);
352 346  
353   - $result = array();
  347 + $xpath = new DOMXPath($this->objectDom);
  348 + $intervals = $xpath->query('//intervals');
  349 +
  350 + $result = array();
354 351  
355   - if (!isset($start) || !isset($limit))
356   - {
357   - foreach ($intervals as $interval)
358   - {
359   - $startTime = $interval->getElementsByTagName('start')->item(0)->nodeValue;
360   - $stopTime = $interval->getElementsByTagName('stop')->item(0)->nodeValue;
361   - array_push($result, array('start' => $startTime, 'stop' => $stopTime));
  352 + if (!isset($start) || !isset($limit)) {
  353 + foreach ($intervals as $interval) {
  354 + $startTime = $interval->getElementsByTagName('start')->item(0)->nodeValue;
  355 + $stopTime = $interval->getElementsByTagName('stop')->item(0)->nodeValue;
  356 + array_push($result, array('start' => $startTime, 'stop' => $stopTime));
  357 + }
  358 + }
  359 + else {
  360 + for ($i = 0; $i < $limit; ++$i) {
  361 + if ($start+$i >= $intervals->length)
  362 + break;
  363 + $startTime = $intervals->item($start+$i)->getElementsByTagName('start')->item(0)->nodeValue;
  364 + $stopTime = $intervals->item($start+$i)->getElementsByTagName('stop')->item(0)->nodeValue;
  365 + array_push($result, array('start' => $startTime, 'stop' => $stopTime));
  366 + }
362 367 }
363   - }
364   - else
365   - {
366   - for ($i = 0; $i < $limit; ++$i)
367   - {
368   - if ($start+$i >= $intervals->length)
369   - break;
370   - $startTime = $intervals->item($start+$i)->getElementsByTagName('start')->item(0)->nodeValue;
371   - $stopTime = $intervals->item($start+$i)->getElementsByTagName('stop')->item(0)->nodeValue;
372   - array_push($result, array('start' => $startTime, 'stop' => $stopTime));
373   - }
374   - }
375 368  
376   - return array(
  369 + return array(
377 370 'totalCount' => $intervals->length,
378 371 'intervals' => $result,
379 372 'start' => isset($start) ? $start : 0,
380 373 'limit' => isset($limit) ? $limit : 0,
381 374 'success' => true
382   - );
383   -
384   - }
385   -
386   - protected function createIntervalElement($interval) {
  375 + );
  376 + }
387 377  
388   - $newInterval = $this->objectDom->createElement('intervals');
389   - $newInterval->appendChild($this->objectDom->createElement('start',$interval->start));
390   - $newInterval->appendChild($this->objectDom->createElement('stop',$interval->stop));
391   - return $newInterval;
392   - }
393   -
394   - public function saveIntervals($id,$intervals,$action)
395   - {
396   - if (substr($id,0,6) == 'shared') {
397   - return array('success' => false, 'message' => "Cannot save shared TimeTable");
  378 + protected function createIntervalElement($interval)
  379 + {
  380 + $newInterval = $this->objectDom->createElement('intervals');
  381 + $newInterval->appendChild($this->objectDom->createElement('start',$interval->start));
  382 + $newInterval->appendChild($this->objectDom->createElement('stop',$interval->stop));
  383 + return $newInterval;
398 384 }
399   - else {
400   - $path = USERTTDIR.$id.'.xml';
401   - }
402   - if (!file_exists($path))
403   - return array('success' => false, 'message' => "Cannot find TT file ".$id);
404   - $this->objectDom -> load($path);
  385 +
  386 + public function saveIntervals($id,$intervals,$action)
  387 + {
  388 + if (substr($id,0,6) == 'shared') {
  389 + return array('success' => false, 'message' => "Cannot save shared TimeTable");
  390 + }
  391 + else {
  392 + $path = USERTTDIR.$id.'.xml';
  393 + }
  394 + if (!file_exists($path))
  395 + return array('success' => false, 'message' => "Cannot find TT file ".$id);
  396 + $this->objectDom -> load($path);
405 397  
406   - if (!($objToGet = $this->objectDom->getElementById($id)))
407   - return array('success' => false, 'message' => NO_SUCH_ID." ".$id);
  398 + if (!($objToGet = $this->objectDom->getElementById($id)))
  399 + return array('success' => false, 'message' => NO_SUCH_ID." ".$id);
408 400  
409   - //remove old intervals
410   - $crtNode = $objToGet->firstChild;
  401 + //remove old intervals
  402 + $crtNode = $objToGet->firstChild;
411 403  
412   - while ($crtNode)
413   - {
414   - if (($crtNode->nodeType != XML_ELEMENT_NODE) || ($crtNode->tagName != 'intervals'))
415   - {
416   - $crtNode = $crtNode->nextSibling;
417   - continue;
418   - }
419   - $toRemove = $crtNode;
420   - $crtNode = $crtNode->nextSibling;
421   - $objToGet->removeChild($toRemove);
422   - unset($toRemove);
423   - }
  404 + while ($crtNode) {
  405 + if (($crtNode->nodeType != XML_ELEMENT_NODE) || ($crtNode->tagName != 'intervals')) {
  406 + $crtNode = $crtNode->nextSibling;
  407 + continue;
  408 + }
  409 + $toRemove = $crtNode;
  410 + $crtNode = $crtNode->nextSibling;
  411 + $objToGet->removeChild($toRemove);
  412 + unset($toRemove);
  413 + }
424 414  
425   - //add new intervals
426   - foreach ($intervals as $interval)
427   - {
428   - $newInterval = $this-> createIntervalElement($interval);
429   - $this->objectDom->documentElement->appendChild($newInterval);
430   - }
  415 + //add new intervals
  416 + foreach ($intervals as $interval) {
  417 + $newInterval = $this-> createIntervalElement($interval);
  418 + $this->objectDom->documentElement->appendChild($newInterval);
  419 + }
431 420  
432   - //save modifications
433   - $this->id = $id;
434   - $this->resFileName = USERTTDIR.$this->id.'.xml';
435   - $this->objectDom->save($this->resFileName);
  421 + //save modifications
  422 + $this->id = $id;
  423 + $this->resFileName = USERTTDIR.$this->id.'.xml';
  424 + $this->objectDom->save($this->resFileName);
436 425  
437   - unset($this->objectDom);
  426 + unset($this->objectDom);
438 427  
439   - return array('success' => true,'action' => $action, 'nbIntervals' => count($intervals));
440   - }
  428 + return array('success' => true,'action' => $action, 'nbIntervals' => count($intervals));
  429 + }
441 430  
442 431  
443   - public function getUploadedObject($name, $format, $onlyDescription = false) {
444   -
445   - if (strpos($name,'.txt') !== false || strpos($name,'.asc') !== false ) {
446   - $attributesToReturn = $this->text2amda(USERTEMPDIR.$name, $onlyDescription);
447   - $attributesToReturn['objName'] = $name;
448   - $attributesToReturn['objFormat'] = $format;
449   - return $attributesToReturn;
  432 + public function getUploadedObject($name, $format, $onlyDescription = false)
  433 + {
  434 + if (strpos($name,'.txt') !== false || strpos($name,'.asc') !== false || strpos($name,'.') == false) {
  435 + $attributesToReturn = $this->text2amda(USERTEMPDIR.$name, $onlyDescription);
  436 + $attributesToReturn['objName'] = $name;
  437 + $attributesToReturn['objFormat'] = $format;
  438 +
  439 + return $attributesToReturn;
450 440 }
451 441  
452 442 if ($format == 'VOT') {
453 443 $attributesToReturn = $this->vot2amda(USERTEMPDIR.$name, $onlyDescription);
454 444 $attributesToReturn['objName'] = $name;
455 445 $attributesToReturn['objFormat'] = $format;
  446 +
456 447 return $attributesToReturn;
457 448 }
458 449  
459   - if (strpos($name,'.xml') !== false) {
460   - $temp = explode('.xml', $name);
461   - $name = $temp[0];
  450 + if (strpos($name,'.xml') !== false) {
  451 + $temp = explode('.xml', $name);
  452 + $name = $temp[0];
462 453 }
463   -
464   -
465   - if (!file_exists(USERTEMPDIR.$name.'.xml'))
466   - return array('error' => 'no such name');
467   - $this->objectDom -> load(USERTEMPDIR.$name.'.xml');
  454 +
  455 + if (!file_exists(USERTEMPDIR.$name.'.xml'))
  456 + return array('error' => 'no such name');
  457 +
  458 + $this->objectDom->load(USERTEMPDIR.$name.'.xml');
468 459 if (!($objToGet = $this->objectDom->getElementsByTagName('timetable')->item(0)) &&
469   - !($objToGet = $this->objectDom->getElementsByTagName('TimeTable')->item(0)))
470   - return array('error' => 'no time table');
  460 + !($objToGet = $this->objectDom->getElementsByTagName('TimeTable')->item(0)))
  461 + return array('error' => 'no time table');
471 462  
472 463 $attributes = $objToGet -> childNodes;
473 464 $attributesToReturn['name'] = $name;
474 465 $attributesToReturn['objName'] = $name;
475 466 $attributesToReturn['objFormat'] = $format;
476 467  
477   - foreach($attributes as $attribute)
478   - if($attribute->nodeType == XML_ELEMENT_NODE){
479   - if ($attribute->tagName == 'intervals') {
480   - $start = $attribute -> getElementsByTagName('start')->item(0) -> nodeValue;
481   - $stop = $attribute -> getElementsByTagName('stop')->item(0) -> nodeValue;
482   - if (!$onlyDescription)
483   - $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
484   - }
485   - else if ($attribute->tagName == 'Interval') {
486   - $start = $attribute -> getElementsByTagName('Start')->item(0) -> nodeValue;
487   - $stop = $attribute -> getElementsByTagName('Stop')->item(0) -> nodeValue;
488   - if (!$onlyDescription)
489   - $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
490   - }
491   - else {
492   - switch (strtolower($attribute->tagName)) {
493   - case 'created' :
494   - $attributesToReturn['created'] = $attribute->nodeValue;
495   - break;
496   - case 'chain' :
497   - case 'source' :
498   - $attributesToReturn['description'] = $attribute->nodeValue;
499   - break;
500   - default: break;
501   - }
  468 + foreach($attributes as $attribute) {
  469 + if($attribute->nodeType == XML_ELEMENT_NODE){
  470 + if ($attribute->tagName == 'intervals') {
  471 + $start = $attribute -> getElementsByTagName('start')->item(0) -> nodeValue;
  472 + $stop = $attribute -> getElementsByTagName('stop')->item(0) -> nodeValue;
  473 + if (!$onlyDescription)
  474 + $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
  475 + }
  476 + else if ($attribute->tagName == 'Interval') {
  477 + $start = $attribute -> getElementsByTagName('Start')->item(0) -> nodeValue;
  478 + $stop = $attribute -> getElementsByTagName('Stop')->item(0) -> nodeValue;
  479 + if (!$onlyDescription)
  480 + $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
  481 + }
  482 + else {
  483 + switch (strtolower($attribute->tagName)) {
  484 + case 'created' :
  485 + $attributesToReturn['created'] = $attribute->nodeValue;
  486 + break;
  487 + case 'chain' :
  488 + case 'source' :
  489 + $attributesToReturn['description'] = $attribute->nodeValue;
  490 + break;
  491 + default: break;
  492 + }
  493 + }
502 494 }
503   - }
  495 + }
504 496 return $attributesToReturn;
505 497 }
506 498  
507   -
508   -
509   -//TODO getObject only!!!! => change DD_Search output
510   - public function getTmpObject($folderId, $name, $onlyDescription = false) {
  499 + //TODO getObject only!!!! => change DD_Search output
  500 + public function getTmpObject($folderId, $name, $onlyDescription = false) {
511 501 $filePath = USERWORKINGDIR.$folderId.'/'.$name.'.xml';
512 502 if (!file_exists($filePath))
513 503 return array('error' => 'Cannot find result file');
... ... @@ -552,26 +542,26 @@ class TimeTableMgr extends AmdaObjectMgr
552 542 return $attributesToReturn;
553 543 }
554 544  
555   -/*
556   - * merge time tables
557   - */
558   - public function merge($obj) {
559   - /**
560   - * Array of intervals, used like :
561   - * [{start:'2010-01-01T23:00:00',stop:'2011-01-01T20:00:00'},{start:'2009-01-01T23:00:00',stop:'2010-01-01T20:00:00'}]
562   - * $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
563   - */
564   -
565   - $intervals = 0;
  545 + /*
  546 + * merge time tables
  547 + */
  548 + public function merge($obj) {
  549 + /**
  550 + * Array of intervals, used like :
  551 + * [{start:'2010-01-01T23:00:00',stop:'2011-01-01T20:00:00'},{start:'2009-01-01T23:00:00',stop:'2010-01-01T20:00:00'}]
  552 + * $attributesToReturn['intervals'][] = array('start' => $start, 'stop' => $stop);
  553 + */
  554 +
  555 + $intervals = 0;
566 556  
567   - for ( $i = 0; $i < count($obj->ids); $i++ ) {
568   - $table[$i] = $this->loadIntervalsFromTT($obj->ids[$i]);
569   - for ($j=0; $j < count($table[$i]['intervals']); $j++) {
570   - $interval[$i][$j][0] = $table[$i]['intervals'][$j]['start'];
571   - $interval[$i][$j][1] = $table[$i]['intervals'][$j]['stop'];
572   - }
573   - $intervals += count($interval[$i]);
574   - }
  557 + for ( $i = 0; $i < count($obj->ids); $i++ ) {
  558 + $table[$i] = $this->loadIntervalsFromTT($obj->ids[$i]);
  559 + for ($j=0; $j < count($table[$i]['intervals']); $j++) {
  560 + $interval[$i][$j][0] = $table[$i]['intervals'][$j]['start'];
  561 + $interval[$i][$j][1] = $table[$i]['intervals'][$j]['stop'];
  562 + }
  563 + $intervals += count($interval[$i]);
  564 + }
575 565 if ( $intervals > 10000) set_time_limit(1800);
576 566  
577 567 $final = array();
... ... @@ -717,7 +707,8 @@ class TimeTableMgr extends AmdaObjectMgr
717 707 return array('valid' => false, 'error' => 'Space character is not allowed');
718 708 }
719 709  
720   - public function copyTT($src_path, $dst_path, $newId, $newName, $newDescription = NULL) {
  710 + public function copyTT($src_path, $dst_path, $newId, $newName, $newDescription = NULL)
  711 + {
721 712 if (!file_exists($src_path))
722 713 return FALSE;
723 714  
... ... @@ -771,7 +762,6 @@ class TimeTableMgr extends AmdaObjectMgr
771 762 chmod($dst_file_path, 0775);
772 763  
773 764 return TRUE;
774   - }
775   -
  765 + }
776 766 }
777 767 ?>
... ...
php/classes/UserMgr.php
... ... @@ -163,7 +163,40 @@ class UserMgr
163 163  
164 164 return $specialGrpNode;
165 165 }
166   -
  166 +
  167 + public function setSpecialSettings()
  168 + {
  169 + $userSettings = new DomDocument("1.0");
  170 +
  171 + if (!$userSettings->load(specialSettingsXml)) {
  172 + define("DISK_QUOTA", DISK_QUOTA_standard);
  173 + return;
  174 + }
  175 +
  176 + $theUser = $userSettings->getElementById($this->user);
  177 + if (!$theUser) {
  178 + define("DISK_QUOTA", DISK_QUOTA_standard);
  179 + return;
  180 + }
  181 + $settings = $theUser->getElementsByTagName("setting");
  182 + if ($settings->length == 0) {
  183 + define("DISK_QUOTA", DISK_QUOTA_standard);
  184 + return;
  185 + }
  186 +
  187 + foreach ($settings as $setting) {
  188 + $key = $setting->getAttribute("name");
  189 + $value = $setting->getAttribute("value");
  190 + $isSetting = $setting->hasAttribute("isSetting");
  191 + if ($isSetting) {
  192 + ini_set("$key",$value);
  193 + }
  194 + else {
  195 + // Attention !!! CONSTANT cannot be redefined
  196 + define("$key",$value);
  197 + }
  198 + }
  199 + }
167 200 /*
168 201 * Totally replace IMPEX staff in user remote tree
169 202 */
... ... @@ -567,7 +600,12 @@ unlink(USERWSDIR.&#39;RemoteParams.xml&#39;);
567 600  
568 601 //TODO sessionID = user + WSname
569 602 $sessionID = $this->user;
570   -
  603 +
  604 + /*
  605 + * Special settings are defined in the generic_data/SpecialSettings/Settings.xml
  606 + */
  607 + $this->setSpecialSettings();
  608 +
571 609 /*
572 610 * Special groups are defined in the generic_data/SpecialSettings/Groups.xml
573 611 */
... ...
php/classes/WSUserMgr.php
... ... @@ -48,7 +48,7 @@ class WSUserMgr extends UserMgr
48 48  
49 49 // $this->userWS = USERPATH . "/" . $this->user . "/WS/";
50 50 // chmod($this->userWS, 0775);
51   - $this->userMissions = $this->getAvailableMissionsByUser();
  51 + // $this->userMissions = $this->getAvailableMissionsByUser();
52 52  
53 53 $this->setPath();
54 54  
... ... @@ -57,7 +57,11 @@ class WSUserMgr extends UserMgr
57 57  
58 58 public function makeUserWS()
59 59 {
60   - $this->makeLocalTree();
  60 + if (file_exists(USERWSDIR.'LocalParams.xml'))
  61 + unlink(USERWSDIR.'LocalParams.xml');
  62 + // if (!file_exists(USERWSDIR.'LocalParams.xml'))
  63 + symlink(DATAPATH.'/LocalData/LocalParams.xml', USERWSDIR.'LocalParams.xml');
  64 + // $this->makeLocalTree();
61 65 $this->makeRemoteTree();
62 66  
63 67 return $this->user;
... ...
php/config.php
... ... @@ -47,7 +47,7 @@ define(&quot;MaxGuestTimeInterval&quot;, 10); // days
47 47 /*-----------------------END GUESTS LOGIN section --------*/
48 48  
49 49 // user WS size limit
50   -define('DISK_QUOTA', 1024*1024*200); // 200MB
  50 +define('DISK_QUOTA_standard', 1024*1024*200); // 200MB
51 51 // max lines of uploaded ascii file to show
52 52 define('MAX_FILE_INDEX_TO_SHOW', 100);
53 53 // private key used to be considerate as a trust client for some functions of DD web service
... ... @@ -76,6 +76,7 @@ ini_set(&#39;user_agent&#39;, &#39;Mozilla/5.0 (X11; U; Linux i686; en-US; rv:7.0) Gecko/201
76 76 // SHOULD BE DEFINED IN MASTER /etc/php.ini !!!
77 77 // ini_set('upload_max_filesize',100000000);
78 78 // ini_set('post_max_size',1050000000);
  79 +
79 80 /*-----------------------END PHP run-time settings --------*/
80 81  
81 82 // General Info dirs
... ...
php/my_config.php
... ... @@ -20,7 +20,7 @@ define(&#39;SYS_BIN&#39;, &#39;/bin:/usr/bin/:/usr/local/bin/&#39;);
20 20 define('BASE_PATH', IHM_SRC_DIR);
21 21  
22 22 //DD WebServices
23   -define('INFOSITE', 'http://cdpp.irap.omp.eu/BASE/');
  23 +define('INFOSITE', 'http://amda-dev.irap.omp.eu/BASE/');
24 24 //log for AmdaUpdate/AmdaInstall
25 25 define('log', IHM_SRC_DIR.'LOG');
26 26 // User apache
... ... @@ -38,6 +38,9 @@ define(&#39;DDLIB&#39;,&#39;/opt/local/lib/&#39;);
38 38 define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl');
39 39 define('TITLE', 'AMDANEW-Test');
40 40  
  41 +// real upload_max_filesize is defined in /etc/php.ini : ini_get('upload_max_filesize')
  42 +// here for additional flexibility
  43 +define('MAX_UPLOADED_FILESIZE',30000000); // in bytes !!!
41 44  
42 45 $is64 = true;
43 46  
... ...
php/old_amda/param_info.pro deleted
... ... @@ -1,255 +0,0 @@
1   -; $Id: param_info.pro,v 1.4 2009/03/30 15:45:33 budnik Exp $
2   -;
3   -;+
4   -; NAME:
5   -; PARAM_INFO
6   -;
7   -; PURPOSE:
8   -; gets CDAWEB parameter Info
9   -; to create AMDA parameter automatically
10   -;
11   -;
12   -; CALLING SEQUENCE:
13   -;
14   -; PARAM_INFO, CDF_name, ParID
15   -;
16   -; INPUTS:
17   -; CDF_name: CDF file name (master CDF or data CDF)
18   -; ParID : variable name in CDF notation
19   -;
20   -; KEYWORD PARAMETERS:
21   -;
22   -;
23   -; OUTPUTS:
24   -; string "paramID%....."
25   -;
26   -; MODIFICATION HISTORY:
27   -; Written by: Elena Budnik
28   -; September, 2007
29   -;-
30   -
31   - pro Param_Info, CDF_name, ParID
32   -
33   - NODATA = "%-9999"
34   -
35   -;------------------- List of Param Attributes used for AMDA ----------------
36   -
37   - AttributesGlobal = ["Source_name", "Descriptor", "Data_type", "Instrument_type"]
38   - AttributesCommon = ["FIELDNAM", "DISPLAY_TYPE", "UNITS", "FILLVAL", "Frame", "VALIDMIN","VALIDMAX", "SI_conversion"]
39   -
40   -; ALSO EXIST "DICT_KEY", "CATDESC", "AVG_TYPE"
41   - AttributeScalar = ["LABLAXIS"]
42   - AttributeVector = ["LABL_PTR_1"]
43   -
44   - if (file_test(CDF_name) eq 0) then begin
45   - print, NODATA
46   - return
47   - endif
48   -
49   - Output = "paramID%" + strjoin(strsplit(ParID,"%&.><",/EXTRACT),"_");
50   - cdfID = cdf_open(CDF_name)
51   -
52   -;---------------- Get Global Attributes ----------------------
53   - On_IoError, NoGlobalAttr
54   - for i = 0, n_elements(AttributesGlobal) - 1 do begin
55   - if (cdf_attexists(cdfid, AttributesGlobal[i])) then cdf_attget, cdfid, AttributesGlobal[i], 0, attvalue $
56   - else cdf_attget, cdfid, strupcase(AttributesGlobal[i]), 0, attvalue
57   - Output += "&&"+strupcase(AttributesGlobal[i])+"%" + strcompress(string(attvalue))
58   - continue;
59   - NoGlobalAttr: Output += "&&"+strupcase(AttributesGlobal[i]) + NODATA
60   - endfor
61   -
62   - On_IoError, NULL
63   -;--------------- Get parameter Number -----------------------
64   -
65   - par_num = cdf_varnum(cdfid, ParID, IsZVar);
66   -
67   -;----------- Attributes & Dims for R-vars -----------------------------
68   - if (IsZVar eq 0) then begin ; r-variable
69   - glob = cdf_inquire(cdfid)
70   - info = cdf_varinq(cdfid, par_num)
71   - outDim = ""
72   -
73   - if (glob.ndims eq 0) then dim = 1 else begin
74   - numDim = where(info.dimvar eq 1, ndim)
75   - if (ndim GT 0) then dim = glob.dim[numDim] else dim = 1
76   - endelse
77   - if (n_elements(dim) eq 1) then outDim = string(dim,format='(i3.3)') else $
78   - for j = 0, n_elements(dim)-1 do outDim +=string(dim[j],format='(i3.3)')+","
79   -
80   -;---------- CDF data types to DD
81   -
82   - case info.datatype of
83   - "CDF_CHAR": datatype = 0; DD_CHAR
84   -
85   - "CDF_BYTE": datatype = 5;
86   - "CDF_INT1": datatype = 5;
87   -
88   - "CDF_INT2": datatype = 4; DD_SHORT
89   - "CDF_UCHAR": datatype = 4;
90   - "CDF_UINT1": datatype = 4;
91   -
92   - "CDF_INT4": datatype = 1; DD_INT
93   - "CDF_UINT2": datatype = 1;
94   -
95   - "CDF_FLOAT": datatype = 2; DD_FLOAT
96   - "CDF_REAL4": datatype = 2;
97   -
98   - "CDF_DOUBLE": datatype = 3; DD_DOUBLE
99   - "CDF_REAL8": datatype = 3;
100   - "CDF_UINT4": datatype = 3;
101   - end
102   -
103   - Output += "&&DATATYPE%" + strcompress(string(datatype)) + "&&DIMENSION%" + outDim
104   - On_IoError, NoAttr
105   -
106   - for i = 0, N_elements(AttributesCommon)-1 do begin
107   - if (cdf_attexists(cdfid, AttributesCommon[i])) then begin
108   - cdf_attget, cdfid, AttributesCommon[i], par_num, attvalue
109   - Output += "&&"+strupcase(AttributesCommon[i])+"%" + strcompress(string(attvalue))
110   - endif else Output += "&&"+strupcase(AttributesCommon[i])+NODATA
111   - continue
112   - NoAttr : Output += "&&"+strupcase(AttributesCommon[i])+NODATA
113   - endfor
114   -
115   - if (n_elements(dim) eq 1 AND dim[0] eq 1) then begin
116   - On_IoError, NoAttr1
117   - cdf_attget, cdfid, AttributeScalar[0], par_num, attvalue
118   - Output += "&&"+AttributeScalar[0]+"%" + strcompress(string(attvalue))
119   - GOTO, CONT
120   - NoAttr1: Output += "&&"+AttributeScalar[0]+NODATA
121   - endif else begin
122   - On_IoError, NoAttr2
123   - cdf_attget, cdfid, "LABL_PTR_1", par_num, attvalue
124   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
125   - temp=strarr(dim)
126   - if (IsZVar) then cdf_varget, cdfid, var_num, temp, /STRING, /ZVariable $
127   - else cdf_varget, cdfid, var_num, temp, /STRING
128   - labelOutput = ""
129   -; Crazy stuff - don't understand how to treat
130   - t_sort = temp(sort(reform(temp,N_elements(temp))))
131   - t_temp = t_sort(uniq(t_sort))
132   - for j = 0, N_elements(t_temp) - 1 do labelOutput += string(t_temp[j])+"$"
133   - Output += "&&LABLAXIS%" + strcompress(labelOutput)
134   - GOTO, CONT
135   - NoAttr2: On_IoError, NoAttr3
136   - cdf_attget, cdfid, "DEPEND_1", par_num, attvalue
137   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
138   - cdf_attget, cdfid, "LABL_PTR_1", var_num, attvalue
139   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
140   - temp=strarr(dim)
141   - if (IsZVar) then cdf_varget,cdfid, var_num, temp, /STRING, /ZVARIABLE $
142   - else cdf_varget,cdfid, var_num, temp, /STRING
143   - labelOutput = ""
144   - t_temp = temp(uniq(temp))
145   - for j = 0, N_elements(t_temp)-1 do labelOutput += string(t_temp[j])+"$"
146   - Output += "&&LABLAXIS%" + strcompress(labelOutput)
147   - GOTO, CONT
148   -
149   - NoAttr3: Output += "&&LABLAXIS"+NODATA
150   - endelse
151   - CONT: On_IoError, NoAttr4
152   - if (cdf_attexists(cdfid, "VIRTUAL")) then begin
153   - cdf_attget, cdfid, "VIRTUAL", par_num, attvalue
154   - if (attvalue eq "TRUE") then begin
155   - cdf_attget, cdfid, "COMPONENT_0", par_num, attvalue
156   - Output += "&&VIRTUAL%" + attvalue
157   - endif
158   - endif
159   - NoAttr4: On_IoError, NULL
160   -
161   - endif else begin ; z-Variable
162   -
163   -;----------- Attributes & Dims for Z-vars -----------------------------
164   -
165   - info = cdf_varinq(cdfid, par_num, /Z)
166   - if (n_elements(info.dimvar) GT 1) then begin
167   - print, NODATA
168   - return
169   - endif
170   -
171   - if (info.dimvar eq 0) then dim = 1 else dim = info.dim
172   -;---------- CDF data types to DD
173   -
174   - case info.datatype of
175   - "CDF_CHAR": datatype = 0; DD_CHAR
176   -
177   - "CDF_BYTE": datatype = 5;
178   - "CDF_INT1": datatype = 5;
179   -
180   - "CDF_INT2": datatype = 4; DD_SHORT
181   - "CDF_UCHAR": datatype = 4;
182   - "CDF_UINT1": datatype = 4;
183   -
184   - "CDF_INT4": datatype = 1; DD_INT
185   - "CDF_UINT2": datatype = 1;
186   -
187   - "CDF_FLOAT": datatype = 2; DD_FLOAT
188   - "CDF_REAL4": datatype = 2;
189   -
190   - "CDF_DOUBLE": datatype = 3; DD_DOUBLE
191   - "CDF_REAL8": datatype = 3;
192   - "CDF_UINT4": datatype = 3;
193   - end
194   - Output += "&&DATATYPE%" + strcompress(string(datatype))+"&&DIMENSION%"+string(dim,format='(i3.3)')
195   - On_IoError, NoAttrZ
196   -
197   - for i = 0, N_elements(AttributesCommon)-1 do begin
198   - if (cdf_attexists(cdfid, AttributesCommon[i])) then begin
199   - cdf_attget, cdfid, AttributesCommon[i], par_num, attvalue, /ZVARIABLE
200   - Output += "&&"+strupcase(AttributesCommon[i])+"%" + strcompress(string(attvalue))
201   - endif else Output += "&&"+strupcase(AttributesCommon[i])+NODATA
202   - continue
203   - NoAttrZ: Output += "&&"+strupcase(AttributesCommon[i])+NODATA
204   - endfor
205   -
206   - if (dim eq 1) then begin
207   - On_IoError, NoAttrZ1
208   - cdf_attget, cdfid, AttributeScalar[0], par_num, attvalue, /ZVARIABLE
209   - Output += "&&"+AttributeScalar[0]+"%" + strcompress(string(attvalue))
210   - GOTO, CONT1
211   - NoAttrZ1: Output += "&&"+AttributeScalar[0]+NODATA
212   - endif else begin
213   - On_IoError, NoAttrZ2
214   - cdf_attget, cdfid, "LABL_PTR_1", par_num, attvalue, /ZVARIABLE
215   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
216   - temp=strarr(dim)
217   - if (IsZVar) then cdf_varget,cdfid, var_num, temp, /STRING, /ZVARIABLE $
218   - else cdf_varget,cdfid, var_num, temp, /STRING
219   - labelOutput = ""
220   - t_temp = temp(uniq(temp))
221   - for j = 0, N_elements(t_temp)-1 do labelOutput += string(t_temp[j])+"$"
222   - Output += "&&LABLAXIS%" + strcompress(labelOutput)
223   - GOTO, CONT1
224   - NoAttrZ2:
225   - On_IoError, NoAttrZ3
226   - cdf_attget, cdfid, "DEPEND_1", par_num, attvalue, /ZVARIABLE
227   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
228   - cdf_attget, cdfid, "LABL_PTR_1", var_num, attvalue, /ZVARIABLE
229   - var_num = cdf_varnum(cdfid, attvalue, IsZvar)
230   - temp=strarr(dim)
231   - if (IsZVar) then cdf_varget,cdfid, var_num, temp, /STRING, /ZVARIABLE $
232   - else cdf_varget,cdfid, var_num, temp, /STRING
233   - labelOutput = ""
234   - t_temp = temp(uniq(temp))
235   - for j = 0, N_elements(t_temp)-1 do labelOutput += string(t_temp[j])+"$"
236   - Output += "&&LABLAXIS%" + strcompress(labelOutput)
237   - GOTO, CONT1
238   -
239   - NoAttrZ3: Output += "&&LABLAXIS"+NODATA
240   - endelse
241   - CONT1: On_IoError, NoAttrZ4
242   - if (cdf_attexists(cdfid, "VIRTUAL",/ZVARIABLE)) then begin
243   - cdf_attget, cdfid, "VIRTUAL", par_num, attvalue, /ZVARIABLE
244   - if (attvalue eq "TRUE") then begin
245   - cdf_attget, cdfid, "COMPONENT_0", par_num, attvalue, /ZVARIABLE
246   - Output += "&&VIRTUAL%" + attvalue
247   - endif
248   - endif
249   - NoAttrZ4: On_IoError, NULL
250   - endelse
251   - cdf_close,cdfID
252   - print, output
253   -
254   - return
255   - end
php/src/cdfinfo.c
... ... @@ -15,42 +15,42 @@
15 15 void cdf_status_handler (CDFstatus, char *);
16 16 char * cdf_str_datatype (long);
17 17  
18   -typedef struct cdfvar { /* CDF variable structure */
19   - char name[CDF_VAR_NAME_LEN+1];
20   - long datatype;
21   - long numElements; /* string length for CDF_CHAR, 1 otherwise */
22   - long dimensionality; /* variable dimensionality */
23   - long dimSizes[CDF_MAX_DIMS]; /* variable dimension sizes */
24   - long recVariance; /* record variance */
25   - long numRecs; /* # of records this variable contains */
  18 +typedef struct cdfvar { /* CDF variable structure */
  19 + char name[CDF_VAR_NAME_LEN+1];
  20 + long datatype;
  21 + long numElements; /* string length for CDF_CHAR, 1 otherwise */
  22 + long dimensionality; /* variable dimensionality */
  23 + long dimSizes[CDF_MAX_DIMS]; /* variable dimension sizes */
  24 + long recVariance; /* record variance */
  25 + long numRecs; /* # of records this variable contains */
26 26 } CDFvar;
27 27  
28 28 int main(int argc, char *argv[])
29 29 {
  30 +
  31 + CDFvar var;
  32 + CDFid id; /* CDF file ID */
  33 + CDFstatus status; /* CDF status code */
  34 +
  35 + long nZvars, nAttrs, attrId, attrScope, varId;
  36 + char attrName[CDF_ATTR_NAME_LEN+1];
  37 + char fileName[MAX_FILE_NAME_LEN];
  38 + char msg[100];
  39 + int dummy, i;
30 40  
31   - CDFvar var;
32   - CDFid id; /* CDF file ID */
33   - CDFstatus status; /* CDF status code */
34   -
35   - long nZvars, nAttrs, attrId, attrScope, varId;
36   - char attrName[CDF_ATTR_NAME_LEN+1];
37   - char fileName[MAX_FILE_NAME_LEN];
38   - char msg[100];
39   - int dummy, i;
40   -
41   - if (argc <= 1)
42   - exit(0); /* CDF input file name not specified */
43   - else
44   - strcpy(fileName, argv[argc-1]); /* Get the input file name */
  41 + if (argc <= 1)
  42 + exit(0); /* CDF input file name not specified */
  43 + else
  44 + strcpy(fileName, argv[argc-1]); /* Get the input file name */
45 45  
46 46  
47 47 status = CDFlib (OPEN_, CDF_, fileName, &id, NULL_);
48 48  
49   - if (status != CDF_OK) {
50   - strcpy(msg, "OPEN_, CDF_, ");
51   - strcat(msg, fileName);
52   - cdf_status_handler (status, msg);
53   - }
  49 + if (status != CDF_OK) {
  50 + strcpy(msg, "OPEN_, CDF_, ");
  51 + strcat(msg, fileName);
  52 + cdf_status_handler (status, msg);
  53 + }
54 54  
55 55 /*---------------------------------------------------------------------------
56 56 * This routine retrievs the following information:
... ... @@ -64,124 +64,119 @@ int main(int argc, char *argv[])
64 64 * more. Treat all CDF variables as zVariables.
65 65 *--------------------------------------------------------------------------*/
66 66  
67   - status = CDFlib (SELECT_, CDF_zMODE_, zMODEon2,
68   - GET_, CDF_NUMATTRS_, &nAttrs,
69   - CDF_NUMzVARS_, &nZvars,
70   - NULL_);
71   - if (status != CDF_OK) cdf_status_handler(status, "GET_, CDF_FILEINFO_");
  67 + status = CDFlib (SELECT_, CDF_zMODE_, zMODEon2,
  68 + GET_, CDF_NUMATTRS_, &nAttrs,
  69 + CDF_NUMzVARS_, &nZvars,
  70 + NULL_);
  71 + if (status != CDF_OK) cdf_status_handler(status, "GET_, CDF_FILEINFO_");
72 72  
73   - // printf(" nAttrs %d Zvars %d\n",nAttrs, nZvars);
  73 + // printf(" nAttrs %d Zvars %d\n",nAttrs, nZvars);
74 74  
75   -// printf ("Attributes:\n");
  75 + // printf ("Attributes:\n");
76 76  
77   - for (attrId = 0; attrId < nAttrs; attrId++) {
78   - status = CDFlib (SELECT_, ATTR_, attrId,
79   - GET_, ATTR_NAME_, attrName, ATTR_SCOPE_, &attrScope,
80   - NULL_);
81   - if (status != CDF_OK) cdf_status_handler (status, "SELECT_, ATTR_");
82   -
83   -
  77 + for (attrId = 0; attrId < nAttrs; attrId++) {
  78 + status = CDFlib (SELECT_, ATTR_, attrId,
  79 + GET_, ATTR_NAME_, attrName, ATTR_SCOPE_, &attrScope,
  80 + NULL_);
  81 + if (status != CDF_OK) cdf_status_handler (status, "SELECT_, ATTR_");
84 82 // printf("Attr %d %s %d\n", attrId, attrName, attrScope);
85   - }
  83 + }
86 84  
87   - // printf ("Variables:\n");
88   - for (varId=0; varId < nZvars; varId++) {
89   - status = CDFlib (SELECT_,zVAR_, varId,
90   - GET_, zVAR_NAME_, var.name,
91   - zVAR_DATATYPE_, &var.datatype,
92   - zVAR_NUMELEMS_, &var.numElements,
93   - zVAR_NUMDIMS_, &var.dimensionality,
94   - zVAR_DIMSIZES_, var.dimSizes,
95   - zVAR_NUMRECS_, &var.numRecs,
96   - zVAR_RECVARY_, &var.recVariance,
97   - NULL_);
98   - if (status != CDF_OK) cdf_status_handler (status, "GET_, zVARS_");
99   -
100   - // printf("Varr %d %s %s %d\n", varId, var.name, cdf_str_datatype(var.datatype), var.numRecs);
101   - if (var.recVariance != 0 && var.numRecs > 1 && var.datatype != CDF_EPOCH && var.datatype != CDF_EPOCH16) printf("%s \n", var.name);
102   - }
103   -
104   - /* Close the CDF file */
105   - status = CDFlib (CLOSE_, CDF_, NULL_);
  85 + // printf ("Variables:\n");
  86 + for (varId=0; varId < nZvars; varId++) {
  87 + status = CDFlib (SELECT_,zVAR_, varId,
  88 + GET_, zVAR_NAME_, var.name,
  89 + zVAR_DATATYPE_, &var.datatype,
  90 + zVAR_NUMELEMS_, &var.numElements,
  91 + zVAR_NUMDIMS_, &var.dimensionality,
  92 + zVAR_DIMSIZES_, var.dimSizes,
  93 + zVAR_NUMRECS_, &var.numRecs,
  94 + zVAR_RECVARY_, &var.recVariance,
  95 + NULL_);
  96 + if (status != CDF_OK) cdf_status_handler (status, "GET_, zVARS_");
  97 + // printf("Varr %d %s %s %d\n", varId, var.name, cdf_str_datatype(var.datatype), var.numRecs);
  98 + if (var.recVariance != 0 && var.numRecs > 1 && var.datatype != CDF_EPOCH && var.datatype != CDF_EPOCH16 && var.datatype != CDF_TIME_TT2000) printf("%s \n", var.name);
  99 + }
106 100  
  101 + /* Close the CDF file */
  102 + status = CDFlib (CLOSE_, CDF_, NULL_);
107 103 }
108 104  
109   -
110   -
111   -
112 105 void cdf_status_handler (CDFstatus status, char *source)
113 106 {
114   - char message[CDF_STATUSTEXT_LEN+1];
115   -
116   - CDFerror (status, message); /* Get the appropriate message */
117   -
118   - if (status < CDF_WARN) {
119   - printf ("An error has occurred, halting...\n");
120   - printf ("%s\n", message);
121   - printf ("** Error source: %s\n", source);
122   - exit (status);
123   - }
124   - else if (status < CDF_OK) {
125   - printf ("Warning, function may not have compeleted as expected...\n");
126   - printf ("%s\n", message);
127   - }
128   - else if (status > CDF_OK) {
129   - printf ("Function compeleted successfully, but be advised that...\n");
130   - printf ("%s\n", message);
131   - }
132   -
133   -
  107 + char message[CDF_STATUSTEXT_LEN+1];
  108 +
  109 + CDFerror (status, message); /* Get the appropriate message */
  110 +
  111 + if (status < CDF_WARN) {
  112 + printf ("An error has occurred, halting...\n");
  113 + printf ("%s\n", message);
  114 + printf ("** Error source: %s\n", source);
  115 + exit (status);
  116 + }
  117 + else if (status < CDF_OK) {
  118 + printf ("Warning, function may not have compeleted as expected...\n");
  119 + printf ("%s\n", message);
  120 + }
  121 + else if (status > CDF_OK) {
  122 + printf ("Function compeleted successfully, but be advised that...\n");
  123 + printf ("%s\n", message);
  124 + }
134 125 }
  126 +
135 127 /*--------------------------------------------------------------------------
136 128 * This routine returns the string representation of the given CDF
137 129 * datatype.
138 130 *--------------------------------------------------------------------------*/
139 131 char * cdf_str_datatype (long type)
140 132 {
141   - switch (type) {
142   - case CDF_BYTE:
143   - return "CDF_BYTE";
  133 + switch (type) {
  134 + case CDF_BYTE:
  135 + return "CDF_BYTE";
144 136  
145   - case CDF_INT1:
146   - return "CDF_INT1";
  137 + case CDF_INT1:
  138 + return "CDF_INT1";
147 139  
148   - case CDF_CHAR:
149   - return "CDF_CHAR";
  140 + case CDF_CHAR:
  141 + return "CDF_CHAR";
150 142  
151   - case CDF_INT2:
152   - return "CDF_INT2";
  143 + case CDF_INT2:
  144 + return "CDF_INT2";
153 145  
154   - case CDF_UCHAR:
155   - return "CDF_UCHAR";
  146 + case CDF_UCHAR:
  147 + return "CDF_UCHAR";
156 148  
157   - case CDF_UINT1:
158   - return "CDF_UINT1";
  149 + case CDF_UINT1:
  150 + return "CDF_UINT1";
159 151  
160   - case CDF_INT4:
161   - return "CDF_INT4";
  152 + case CDF_INT4:
  153 + return "CDF_INT4";
162 154  
163   - case CDF_UINT2:
164   - return "CDF_UINT2";
  155 + case CDF_UINT2:
  156 + return "CDF_UINT2";
165 157  
166   - case CDF_FLOAT:
167   - return "CDF_FLOAT";
  158 + case CDF_FLOAT:
  159 + return "CDF_FLOAT";
168 160  
169   - case CDF_REAL4:
170   - return "CDF_REAL4";
  161 + case CDF_REAL4:
  162 + return "CDF_REAL4";
171 163  
172   - case CDF_DOUBLE:
173   - return "CDF_DOUBLE";
  164 + case CDF_DOUBLE:
  165 + return "CDF_DOUBLE";
174 166  
175   - case CDF_REAL8:
176   - return "CDF_REAL8";
  167 + case CDF_REAL8:
  168 + return "CDF_REAL8";
177 169  
178   - case CDF_UINT4:
179   - return "CDF_UINT4";
  170 + case CDF_UINT4:
  171 + return "CDF_UINT4";
180 172  
181   - case CDF_EPOCH:
182   - return "CDF_EPOCH";
  173 + case CDF_EPOCH:
  174 + return "CDF_EPOCH";
183 175  
184   - case CDF_EPOCH16:
185   - return "CDF_EPOCH16";
186   - }
  176 + case CDF_EPOCH16:
  177 + return "CDF_EPOCH16";
  178 +
  179 + case CDF_TIME_TT2000:
  180 + return "CDF_TIME_TT2000";
  181 + }
187 182 }
... ...
php/src/cdfsamplingfromdata.c
... ... @@ -16,153 +16,177 @@
16 16 /*************************************
17 17 Global variables and structures
18 18 **************************************/
19   -long CDFDims, // Number of dimensions in a CDF file
20   - CDFVars, // Number of variables in a CDF file
21   - CDFDimSizes[CDF_MAX_DIMS], // Dimension Sizes in a CDF file
22   - CDFencoding, // Data encoding
23   - CDFmajority, // Variable majority
24   - CDFmaxRec, // max Record number
25   - CDFAttrs; // number of CDF Attributes
26   - // CDFdatatype;
  19 +long CDFDims, // Number of dimensions in a CDF file
  20 + CDFVars, // Number of variables in a CDF file
  21 + CDFDimSizes[CDF_MAX_DIMS], // Dimension Sizes in a CDF file
  22 + CDFencoding, // Data encoding
  23 + CDFmajority, // Variable majority
  24 + CDFmaxRec, // max Record number
  25 + CDFAttrs; // number of CDF Attributes
  26 +// CDFdatatype;
27 27  
28 28 struct cdfvar { // CDF variable structure
29   - char name[CDF_VAR_NAME_LEN+1];
30   - long num; //variable number
31   - long datatype;
32   - long numElem; // variable dimensionality
33   - long recVariance; // variable rec Variance
34   - long dimVariances[CDF_MAX_DIMS]; // # of data values in dimSizes
  29 + char name[CDF_VAR_NAME_LEN+1];
  30 + long num; //variable number
  31 + long datatype;
  32 + long numElem; // variable dimensionality
  33 + long recVariance; // variable rec Variance
  34 + long dimVariances[CDF_MAX_DIMS]; // # of data values in dimSizes
35 35 } cdfVar;
36 36  
37   -
38   -
39 37 /*--------------------------------------------------------------------------
40 38 * Handles a CDF error.
41 39 *--------------------------------------------------------------------------*/
42 40 void cdf_handle_error(CDFstatus status)
43 41 {
  42 + char message[CDF_STATUSTEXT_LEN+1];
44 43  
45   - char message[CDF_STATUSTEXT_LEN+1];
46   -
47   - CDFerror (status, message); /* Get the appropriate message */
48   - fprintf (stderr, "%s\n", message);
49   - exit(1);
  44 + CDFerror (status, message); /* Get the appropriate message */
  45 + fprintf (stderr, "%s\n", message);
  46 + exit(1);
50 47 }
51 48  
52 49 void find_min(int* delta, int nRecs, int minFalse, int* minVal)
53 50 {
54   - int i, n, min;
55   -
56   - n = 1;
57   - i = 0;
58   - while (abs(delta[i]) <= minFalse) i++;
59   - if (i < nRecs) {
60   - min = abs(delta[i]);
61   - // printf(" first MIN %d \n", min);
62   - for (i = 1; i < nRecs; i++) {
63   -// printf(" delta %d \n", delta[i]);
64   - if (delta[i] == min) n++;
65   - if (delta[i] < min && delta[i] > minFalse) {
66   - min = delta[i];
67   - n = 1;
68   - }
69   - }
70   - } else { min = -10;
71   - n = nRecs;
72   - }
73   - minVal[0] = min;
74   - minVal[1] = n;
75   - printf(" MIN %d %d\n", min, n);
  51 + int i, n, min;
  52 +
  53 + n = 1;
  54 + i = 0;
  55 + while (abs(delta[i]) <= minFalse) i++;
  56 + if (i < nRecs) {
  57 + min = abs(delta[i]);
  58 + // printf(" first MIN %d \n", min);
  59 + for (i = 1; i < nRecs; i++) {
  60 + // printf(" delta %d \n", delta[i]);
  61 + if (delta[i] == min) n++;
  62 + if (delta[i] < min && delta[i] > minFalse) {
  63 + min = delta[i];
  64 + n = 1;
  65 + }
  66 + }
  67 + } else {
  68 + min = -10;
  69 + n = nRecs;
  70 + }
  71 +
  72 + minVal[0] = min;
  73 + minVal[1] = n;
  74 + printf(" MIN %d %d\n", min, n);
76 75 }
77 76  
78 77 int main(int argc, char *argv[])
79 78 {
80   -
81   - long RecStart = 0, RecCount, RecInt = 1;
82   - long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1};
83   - long varN = -1;
84   - long datatype = 0, attrN, maxEntry;
85   - CDFstatus cstatus; // CDF status code
86   - CDFid id;
87   - double *value;
88   - int *delta;
89   - int i, minFalse = 0, numEnough;
90   - int min[2] = {0, 0};
91   - char attrValue[300];
92   - float Sampling;
93   - double epoch16[2];
94   - long year, month, day, hour, minute, sec, msec, mksec, nsec, psec;
  79 + long RecStart = 0, RecCount, RecInt = 1;
  80 + long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1};
  81 + long varN = -1;
  82 + long datatype = 0, attrN, maxEntry;
  83 + CDFstatus cstatus; // CDF status code
  84 + CDFid id;
  85 + double *value;
  86 + int *delta;
  87 + int i, minFalse = 0, numEnough;
  88 + int min[2] = {0, 0};
  89 + char attrValue[300];
  90 + float Sampling;
  91 + double epoch16[2], dbl_value, dbl_value_;
  92 + long year, month, day, hour, minute, sec, msec, mksec, nsec, psec;
  93 + long long *int_value;
95 94  
96 95 /*********************** Open CDF file *****************************/
97   - if ((cstatus = CDFopen(fileName, &id)) != CDF_OK)
98   - cdf_handle_error(cstatus);
  96 + if ((cstatus = CDFopen(fileName, &id)) != CDF_OK)
  97 + cdf_handle_error(cstatus);
99 98  
100 99 /*********** treat all vars as zVars with eliminated false dimensionality and get Nrecs **********/
101 100  
102   - if ((cstatus = CDFlib(SELECT_, CDF_zMODE_, zMODEon2, NULL_)) != CDF_OK)
103   - cdf_handle_error (cstatus);
104   - while (datatype != CDF_EPOCH && datatype != CDF_EPOCH16){
105   - varN++;
106   - if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
107   - GET_, zVAR_DATATYPE_, &datatype, NULL_)) != CDF_OK)
108   - cdf_handle_error (cstatus);
109   -
110   - // if (datatype == CDF_EPOCH16) break;
111   - }
112   - fprintf(stdout,"DATATYPE %d %d\n", varN, datatype);
113   - if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
114   - GET_, zVAR_MAXREC_, &CDFmaxRec, NULL_)) != CDF_OK)
115   - cdf_handle_error (cstatus);
  101 + if ((cstatus = CDFlib(SELECT_, CDF_zMODE_, zMODEon2, NULL_)) != CDF_OK)
  102 + cdf_handle_error (cstatus);
  103 +
  104 + while (datatype != CDF_EPOCH && datatype != CDF_EPOCH16 && datatype != CDF_TIME_TT2000){
  105 + varN++;
  106 + if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
  107 + GET_, zVAR_DATATYPE_, &datatype, NULL_)) != CDF_OK)
  108 + cdf_handle_error (cstatus);
  109 + // if (datatype == CDF_EPOCH16) break;
  110 + }
  111 + fprintf(stdout,"DATATYPE %d %d\n", varN, datatype);
  112 + if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
  113 + GET_, zVAR_MAXREC_, &CDFmaxRec, NULL_)) != CDF_OK)
  114 + cdf_handle_error (cstatus);
  115 +
  116 + fprintf(stdout,"Max Recs %d\n", CDFmaxRec+1);
  117 + if (CDFmaxRec < 10) {
  118 + fprintf(stdout," %d\n", badFile);
  119 + exit (0);
  120 + }
  121 +
  122 + if ( datatype == CDF_TIME_TT2000 ) {
  123 + int_value = (long long *) malloc (sizeof(long long) * (CDFmaxRec+1));
  124 + /******************* Get Epoch *************************/
  125 + if ((cstatus = CDFlib (SELECT_,
  126 + zVAR_, varN,
  127 + zVAR_RECNUMBER_, RecStart,
  128 + zVAR_RECCOUNT_, CDFmaxRec+1,
  129 + zVAR_RECINTERVAL_, RecInt,
  130 + zVAR_DIMINDICES_, indices,
  131 + zVAR_DIMCOUNTS_, counts,
  132 + zVAR_DIMINTERVALS_, intervals,
  133 + GET_, zVAR_HYPERDATA_, int_value, NULL_)) != CDF_OK)
  134 + cdf_handle_error (cstatus);
  135 + }
  136 + else {
  137 + value = (double *)malloc(sizeof(double)* (CDFmaxRec+1)*((datatype == CDF_EPOCH16)+1));
  138 + /******************* Get Epoch *************************/
  139 + if ((cstatus = CDFlib (SELECT_,
  140 + zVAR_, varN,
  141 + zVAR_RECNUMBER_, RecStart,
  142 + zVAR_RECCOUNT_, CDFmaxRec+1,
  143 + zVAR_RECINTERVAL_, RecInt,
  144 + zVAR_DIMINDICES_, indices,
  145 + zVAR_DIMCOUNTS_, counts,
  146 + zVAR_DIMINTERVALS_, intervals,
  147 + GET_, zVAR_HYPERDATA_, value, NULL_)) != CDF_OK)
  148 + cdf_handle_error (cstatus);
  149 + }
  150 +
116 151  
117   - fprintf(stdout,"Max Recs %d\n", CDFmaxRec+1);
118   - if (CDFmaxRec < 10) {
119   - fprintf(stdout," %d\n", badFile);
120   - exit (0);
121   - }
122   - value = (double *)malloc(sizeof(double)* (CDFmaxRec+1)*((datatype == CDF_EPOCH16)+1));
123   -
124   -/******************* Get Epoch *************************/
125   - if ((cstatus = CDFlib (SELECT_,
126   - zVAR_, varN,
127   - zVAR_RECNUMBER_, RecStart,
128   - zVAR_RECCOUNT_, CDFmaxRec+1,
129   - zVAR_RECINTERVAL_, RecInt,
130   - zVAR_DIMINDICES_, indices,
131   - zVAR_DIMCOUNTS_, counts,
132   - zVAR_DIMINTERVALS_, intervals,
133   - GET_, zVAR_HYPERDATA_, value, NULL_)) != CDF_OK)
134   - cdf_handle_error (cstatus);
135 152  
136   - delta = (int *)malloc(sizeof(int)* CDFmaxRec);
137   - for (i = 1; i < CDFmaxRec+1; i++)
138   - {
139   - if (datatype == CDF_EPOCH16) {
140   - epoch16[0] = value[2*(i-1)];
141   - epoch16[1] = value[2*(i-1)+1];
142   - EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &minute, &sec, &msec, &mksec, &nsec, &psec);
143   - value[i-1] = computeEPOCH(year, month, day, hour, minute, sec, msec);
144   - epoch16[0] = value[2*i];
145   - epoch16[1] = value[2*i+1];
146   - EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &minute, &sec, &msec, &mksec, &nsec, &psec);
147   - value[i] = computeEPOCH(year, month, day, hour, minute, sec, msec);
148   - }
149   - delta[i-1] = (int)(value[i] - value[i-1] + 50)/100;
150   - }
151   - // fprintf(stdout,"value %f\n", value[11]-value[10]);
152   - free(value);
153   - // fprintf(stdout,"delta %d\n", delta[0]);
154   - numEnough = CDFmaxRec/10;
155   - while (min[1] < numEnough) {
156   - fprintf(stdout,"minFalse %d\n", minFalse);
157   - find_min(delta, CDFmaxRec, minFalse, min);
158   - minFalse = min[0];
159   - }
  153 + delta = (int *)malloc(sizeof(int)* CDFmaxRec);
  154 + for (i = 1; i < CDFmaxRec+1; i++)
  155 + {
  156 + if (datatype == CDF_TIME_TT2000) {
  157 + dbl_value_ = CDF_TT2000_to_UTC_EPOCH(int_value[i-1]);
  158 + dbl_value = CDF_TT2000_to_UTC_EPOCH(int_value[i]);
  159 + delta[i-1] = (int)(dbl_value - dbl_value_ + 50)/100;
  160 + }
  161 + else {
  162 + if (datatype == CDF_EPOCH16) {
  163 + epoch16[0] = value[2*(i-1)];
  164 + epoch16[1] = value[2*(i-1)+1];
  165 + EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &minute, &sec, &msec, &mksec, &nsec, &psec);
  166 + value[i-1] = computeEPOCH(year, month, day, hour, minute, sec, msec);
  167 + epoch16[0] = value[2*i];
  168 + epoch16[1] = value[2*i+1];
  169 + EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &minute, &sec, &msec, &mksec, &nsec, &psec);
  170 + value[i] = computeEPOCH(year, month, day, hour, minute, sec, msec);
  171 + }
  172 + delta[i-1] = (int)(value[i] - value[i-1] + 50)/100;
  173 + }
  174 + }
  175 + // fprintf(stdout,"value %f\n", value[11]-value[10]);
  176 + if (datatype == CDF_TIME_TT2000) free(int_value);
  177 + else free(value);
  178 + // fprintf(stdout,"delta %d\n", delta[0]);
  179 + numEnough = CDFmaxRec/10;
  180 + while (min[1] < numEnough) {
  181 + fprintf(stdout,"minFalse %d\n", minFalse);
  182 + find_min(delta, CDFmaxRec, minFalse, min);
  183 + minFalse = min[0];
  184 + }
160 185  
161   - free(delta);
162   - if ((cstatus = CDFlib(CLOSE_, CDF_, NULL_)) != CDF_OK)
163   - cdf_handle_error (cstatus);
  186 + free(delta);
  187 + if ((cstatus = CDFlib(CLOSE_, CDF_, NULL_)) != CDF_OK)
  188 + cdf_handle_error (cstatus);
164 189  
165   - // fprintf(stdout,"%d %f\n",min[1], (float)min[0]/100.0);
166   - fprintf(stdout,"%f\n",(float)min[0]/10.0);
167   -
  190 + // fprintf(stdout,"%d %f\n",min[1], (float)min[0]/100.0);
  191 + fprintf(stdout,"%f\n",(float)min[0]/10.0);
168 192 }
... ...
php/src/cdfstartstopfromdata.c
... ... @@ -16,21 +16,21 @@
16 16 Global variables and structures
17 17 **************************************/
18 18 long CDFDims, // Number of dimensions in a CDF file
19   - CDFVars, // Number of variables in a CDF file
20   - CDFDimSizes[CDF_MAX_DIMS], // Dimension Sizes in a CDF file
21   - CDFencoding, // Data encoding
22   - CDFmajority, // Variable majority
23   - CDFmaxRec, // max Record number
24   - CDFAttrs; // number of CDF Attributes
25   - // CDFdatatype;
  19 + CDFVars, // Number of variables in a CDF file
  20 + CDFDimSizes[CDF_MAX_DIMS], // Dimension Sizes in a CDF file
  21 + CDFencoding, // Data encoding
  22 + CDFmajority, // Variable majority
  23 + CDFmaxRec, // max Record number
  24 + CDFAttrs; // number of CDF Attributes
  25 +// CDFdatatype;
26 26  
27 27 struct cdfvar { // CDF variable structure
28   - char name[CDF_VAR_NAME_LEN+1];
29   - long num; //variable number
30   - long datatype;
31   - long numElem; // variable dimensionality
32   - long recVariance; // variable rec Variance
33   - long dimVariances[CDF_MAX_DIMS]; // # of data values in dimSizes
  28 + char name[CDF_VAR_NAME_LEN+1];
  29 + long num; //variable number
  30 + long datatype;
  31 + long numElem; // variable dimensionality
  32 + long recVariance; // variable rec Variance
  33 + long dimVariances[CDF_MAX_DIMS]; // # of data values in dimSizes
34 34 } cdfVar;
35 35  
36 36  
... ... @@ -40,88 +40,105 @@ struct cdfvar { // CDF variable structure
40 40 *--------------------------------------------------------------------------*/
41 41 void cdf_handle_error(CDFstatus status)
42 42 {
  43 + char message[CDF_STATUSTEXT_LEN+1];
43 44  
44   - char message[CDF_STATUSTEXT_LEN+1];
45   -
46   - CDFerror (status, message); /* Get the appropriate message */
47   - fprintf (stderr, "%s\n", message);
48   - exit(1);
  45 + CDFerror (status, message); /* Get the appropriate message */
  46 + fprintf (stderr, "%s\n", message);
  47 + exit(1);
49 48 }
50 49  
51   -
52   -
53 50 int main(int argc, char *argv[])
54 51 {
55   - char fileName[MAX_FILE_NAME_LEN];
56   - long RecStart = 0, RecCount, RecInt = 1;
57   - long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1};
58   - long varN = -1;
59   - long datatype = 0;
60   - CDFstatus cstatus; // CDF status code
61   - CDFid id;
62   - double *value;
63   - int i;
64   - double epoch16[2];
65   - long year, month, day, hour, min, sec, msec, mksec, nsec, psec;
66   -
67   - if (argc <= 1)
68   - exit(0); /* CDF input file name not specified */
69   - else
70   - strcpy(fileName, argv[argc-1]); /* Get the input file name */
  52 + char fileName[MAX_FILE_NAME_LEN];
  53 + long RecStart = 0, RecCount, RecInt = 1;
  54 + long indices[1] = {0}, intervals[1] = {1}, counts[1] = {1};
  55 + long varN = -1;
  56 + long datatype = 0;
  57 + CDFstatus cstatus; // CDF status code
  58 + CDFid id;
  59 + double *value;
  60 + int i;
  61 + double epoch16[2], dbl_value, dbl_value_;
  62 + long year, month, day, hour, min, sec, msec, mksec, nsec, psec;
  63 + long long *int_value;
  64 +
  65 + if (argc <= 1)
  66 + exit(0); /* CDF input file name not specified */
  67 + else
  68 + strcpy(fileName, argv[argc-1]); /* Get the input file name */
71 69  
72 70 /*********************** Open CDF file *****************************/
73   - if ((cstatus = CDFopen(fileName, &id)) != CDF_OK)
74   - cdf_handle_error(cstatus);
  71 + if ((cstatus = CDFopen(fileName, &id)) != CDF_OK)
  72 + cdf_handle_error(cstatus);
75 73  
76 74 /*********** treat all vars as zVars with eliminated false dimensionality and get Nrecs **********/
77 75  
78   - if ((cstatus = CDFlib(SELECT_, CDF_zMODE_, zMODEon2, NULL_)) != CDF_OK)
79   - cdf_handle_error (cstatus);
80   - while (datatype != CDF_EPOCH && datatype != CDF_EPOCH16){
81   - varN++;
82   - if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
83   - GET_, zVAR_DATATYPE_, &datatype, NULL_)) != CDF_OK)
84   - cdf_handle_error (cstatus);
85   -
86   - // if (datatype == CDF_EPOCH16) break;
87   - }
  76 + if ((cstatus = CDFlib(SELECT_, CDF_zMODE_, zMODEon2, NULL_)) != CDF_OK)
  77 + cdf_handle_error (cstatus);
  78 +
  79 + while (datatype != CDF_EPOCH && datatype != CDF_EPOCH16 && datatype != CDF_TIME_TT2000) {
  80 + varN++;
  81 + if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
  82 + GET_, zVAR_DATATYPE_, &datatype, NULL_)) != CDF_OK)
  83 + cdf_handle_error (cstatus);
  84 + }
88 85  
89   - if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
90   - GET_, zVAR_MAXREC_, &CDFmaxRec, NULL_)) != CDF_OK)
91   - cdf_handle_error (cstatus);
92   -
93   - // fprintf(stdout,"Max Recs %d\n", CDFmaxRec+1);
94   - if (CDFmaxRec < 1) exit (0);
95   -
96   - value = (double *)malloc(sizeof(double)* (CDFmaxRec+1)*((datatype == CDF_EPOCH16)+1));
  86 + if ((cstatus = CDFlib(SELECT_, zVAR_, varN,
  87 + GET_, zVAR_MAXREC_, &CDFmaxRec, NULL_)) != CDF_OK)
  88 + cdf_handle_error (cstatus);
97 89  
98   -/******************* Get Epoch *************************/
99   - if ((cstatus = CDFlib (SELECT_,
100   - zVAR_, varN,
101   - zVAR_RECNUMBER_, RecStart,
102   - zVAR_RECCOUNT_, CDFmaxRec+1,
103   - zVAR_RECINTERVAL_, RecInt,
104   - zVAR_DIMINDICES_, indices,
105   - zVAR_DIMCOUNTS_, counts,
106   - zVAR_DIMINTERVALS_, intervals,
107   - GET_, zVAR_HYPERDATA_, value, NULL_)) != CDF_OK)
108   - cdf_handle_error (cstatus);
109   -
110   - if (datatype == CDF_EPOCH16) {
111   - epoch16[0] = value[0];
112   - epoch16[1] = value[1];
113   - EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &min, &sec, &msec, &mksec, &nsec, &psec);
114   - value[0] = computeEPOCH(year, month, day, hour, min, sec, msec);
115   - epoch16[0] = value[CDFmaxRec*2];
116   - epoch16[1] = value[CDFmaxRec*2+1];
117   - EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &min, &sec, &msec, &mksec, &nsec, &psec);
118   - value[CDFmaxRec] = computeEPOCH(year, month, day, hour, min, sec, msec);
119   - }
120   - printf("%f %f\n", value[0]/1000.0-TIMESHIFT, value[CDFmaxRec]/1000.0-TIMESHIFT);
  90 + // fprintf(stdout,"Max Recs %d\n", CDFmaxRec+1);
  91 + if (CDFmaxRec < 1) exit (0);
  92 +
  93 + if ( datatype == CDF_TIME_TT2000 ) {
  94 + int_value = (long long *) malloc (sizeof(long long) * (CDFmaxRec+1));
  95 + /******************* Get Epoch *************************/
  96 + if ((cstatus = CDFlib (SELECT_,
  97 + zVAR_, varN,
  98 + zVAR_RECNUMBER_, RecStart,
  99 + zVAR_RECCOUNT_, CDFmaxRec+1,
  100 + zVAR_RECINTERVAL_, RecInt,
  101 + zVAR_DIMINDICES_, indices,
  102 + zVAR_DIMCOUNTS_, counts,
  103 + zVAR_DIMINTERVALS_, intervals,
  104 + GET_, zVAR_HYPERDATA_, int_value, NULL_)) != CDF_OK)
  105 + cdf_handle_error (cstatus);
  106 +
  107 + dbl_value_ = CDF_TT2000_to_UTC_EPOCH(int_value[0]);
  108 + dbl_value = CDF_TT2000_to_UTC_EPOCH(int_value[CDFmaxRec]);
  109 + printf("%f %f\n", dbl_value_/1000.0-TIMESHIFT,dbl_value/1000.0-TIMESHIFT);
  110 + free(int_value);
  111 + }
  112 + else {
  113 + value = (double *)malloc(sizeof(double)* (CDFmaxRec+1)*((datatype == CDF_EPOCH16)+1));
121 114  
  115 + /******************* Get Epoch *************************/
  116 + if ((cstatus = CDFlib (SELECT_,
  117 + zVAR_, varN,
  118 + zVAR_RECNUMBER_, RecStart,
  119 + zVAR_RECCOUNT_, CDFmaxRec+1,
  120 + zVAR_RECINTERVAL_, RecInt,
  121 + zVAR_DIMINDICES_, indices,
  122 + zVAR_DIMCOUNTS_, counts,
  123 + zVAR_DIMINTERVALS_, intervals,
  124 + GET_, zVAR_HYPERDATA_, value, NULL_)) != CDF_OK)
  125 + cdf_handle_error (cstatus);
  126 +
  127 + if (datatype == CDF_EPOCH16) {
  128 + epoch16[0] = value[0];
  129 + epoch16[1] = value[1];
  130 + EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &min, &sec, &msec, &mksec, &nsec, &psec);
  131 + value[0] = computeEPOCH(year, month, day, hour, min, sec, msec);
  132 + epoch16[0] = value[CDFmaxRec*2];
  133 + epoch16[1] = value[CDFmaxRec*2+1];
  134 + EPOCH16breakdown(epoch16, &year, &month, &day, &hour, &min, &sec, &msec, &mksec, &nsec, &psec);
  135 + value[CDFmaxRec] = computeEPOCH(year, month, day, hour, min, sec, msec);
  136 + }
  137 +
  138 + printf("%f %f\n", value[0]/1000.0-TIMESHIFT, value[CDFmaxRec]/1000.0-TIMESHIFT);
  139 + free(value);
  140 + }
122 141  
123   - if ((cstatus = CDFlib(CLOSE_, CDF_, NULL_)) != CDF_OK)
124   - cdf_handle_error (cstatus);
125   -
126   - free(value);
  142 + if ((cstatus = CDFlib(CLOSE_, CDF_, NULL_)) != CDF_OK)
  143 + cdf_handle_error (cstatus);
127 144 }
... ...
php/uploadFile.php
... ... @@ -49,7 +49,23 @@
49 49  
50 50 return $ContentLength;
51 51 }
  52 +
  53 + function return_bytes($val) {
  54 + $val = trim($val);
  55 + $last = strtolower($val[strlen($val)-1]);
  56 + switch($last) {
  57 + // Le modifieur 'G' est disponible depuis PHP 5.1.0
  58 + case 'g':
  59 + $val *= 1024;
  60 + case 'm':
  61 + $val *= 1024;
  62 + case 'k':
  63 + $val *= 1024;
  64 + }
52 65  
  66 + return $val;
  67 + }
  68 +
53 69 /**
54 70 * Main
55 71 */
... ... @@ -59,8 +75,7 @@
59 75  
60 76 // error_reporting(E_ERROR | E_WARNING | E_PARSE);
61 77  
62   - if (!isset($_POST['sessionID']))
63   - {
  78 + if (!isset($_POST['sessionID'])) {
64 79 $response = array( 'success' => false, 'error' => ': Check that uploaded file size is less than '.ini_get('upload_max_filesize'));
65 80 die(json_encode($response));
66 81 }
... ... @@ -70,8 +85,14 @@
70 85 define('USERWSDIR', USERPATH."/".$_POST['sessionID']."/WS/");
71 86 define('USERWORKINGDIR', USERPATH."/".$_POST['sessionID']."/RES/");
72 87 define('ATTACHMENTDIR', DATAPATH."/Feedback/Attach/");
73   - define('maxSize',$_POST['MAX_FILE_SIZE'] < ini_get('upload_max_filesize'));
74 88  
  89 + $upload_max_filesize = return_bytes(ini_get('upload_max_filesize'));
  90 +
  91 + if ($upload_max_filesize > $_POST['MAX_FILE_SIZE'])
  92 + define('maxSize',$_POST['MAX_FILE_SIZE']);
  93 + else
  94 + define('maxSize',$upload_max_filesize); // NEVER !
  95 +
75 96 if (!is_dir(USERTEMPDIR)) mkdir(USERTEMPDIR.'/', 0755, true);
76 97 if (!is_dir(ATTACHMENTDIR)) mkdir(ATTACHMENTDIR.'/', 0755, true);
77 98  
... ... @@ -94,10 +115,11 @@
94 115  
95 116 if ($_POST['filesrc'] == 'URL') $fromURL = true;
96 117 else $fromURL = false;
97   -
  118 +
98 119 // to check ws sizw
99 120 $wsMgr = new UserMgr();
100   -
  121 + $wsMgr->setSpecialSettings();
  122 +
101 123 if ($fromURL)
102 124 {
103 125 // url files check
... ... @@ -157,7 +179,8 @@
157 179  
158 180 if ($fileSize > maxSize)
159 181 {
160   - $response = array( 'success' => false, 'error' => 'The uploaded file exceeds '.maxSize);
  182 + $maxMB = maxSize/1000000;
  183 + $response = array( 'success' => false, 'error' => 'The uploaded file exceeds '.$maxMB.'MB');
161 184 die(json_encode($response));
162 185 }
163 186  
... ... @@ -223,7 +246,7 @@
223 246 {
224 247 $file['error'] = 5;
225 248 }
226   -
  249 +
227 250 if ($file['error'] !== 0)
228 251 {
229 252 $response = array( 'success'=>false, 'error'=>file_upload_error_message($file['error']));
... ... @@ -288,8 +311,8 @@
288 311 if ($isFile)
289 312 {
290 313 $fileMgr = new FilesMgr();
291   - $amdaStat = new AmdaStats($_POST['sessionID']);
292   - if ($amdaStat->success) $amdaStat->addTask('upload', $_POST['sessionID'], null);
  314 + // $amdaStat = new AmdaStats($_POST['sessionID']);
  315 + // if ($amdaStat->success) $amdaStat->addTask('upload', $_POST['sessionID'], null);
293 316 }
294 317 // Time Table or Catalog
295 318 else
... ...
update_amda/makeRemote
... ... @@ -19,4 +19,8 @@
19 19  
20 20 # make template args
21 21 php $AMDA_IHM/php/RemoteDataCenter/makeArgs.php
22   -
23 22 \ No newline at end of file
  23 +
  24 + # copy "DDBASE" Remote Params descriptions
  25 + if [ -d $AMDA_IHM/generic_data/RemoteData/PARAMS ]; then
  26 + cp $AMDA_IHM/generic_data/RemoteData/PARAMS/* $AMDA_IHM/generic_data/newKernelDDBase/
  27 + fi
... ...
update_amda/updateAmda
... ... @@ -70,9 +70,9 @@
70 70 $UPDATEDIR/cleanNewMetaLight
71 71 echo "clean in NEWMETA : done"
72 72  
73   - echo "cleaning in AMDA_IHM/generic_data AMDA_Kernel/config..."
  73 + echo "cleaning in AMDA_IHM/generic_data ..."
74 74 $UPDATEDIR/cleanExistingInstallation
75   - echo "clean in AMDA_IHM/generic_data AMDA_Kernel/config : done"
  75 + echo "clean in AMDA_IHM/generic_data : done"
76 76  
77 77 echo "making Amda From Spase..."
78 78 if [ $SYNCHRO ]
... ... @@ -94,6 +94,11 @@
94 94 echo "making Orbits..."
95 95 $UPDATEDIR/makeOrbits
96 96 echo "make Orbits : done"
  97 +
  98 + echo "copy DDBASE Remote Params descriptions"
  99 + if [ -d $AMDA_IHM/generic_data/RemoteData/PARAMS ]; then
  100 + cp $AMDA_IHM/generic_data/RemoteData/PARAMS/* $AMDA_IHM/generic_data/newKernelDDBase/
  101 + fi
97 102 fi
98 103 # Update StartStop only
99 104 if [ $UPDATE ]
... ...