Commit 95ebd7a5223e7f664239fe9b408f0302755608b3

Authored by Myriam Bouchemit
2 parents ca7b9385 d575ea1d

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

generic_data/rank.json
1   -{"Mercury": 1, "Venus": 2, "Heliosphere.NearEarth": 3, "Heliosphere.Remote1AU": 4,
2   -"Earth.Magnetosheath": 5, "Earth.Magnetosphere": 5, "Earth": 5, "Earth.Surface": 6,
3   -"Mars": 7, "Jupiter": 8, "Ganymede" : 8, "Saturn": 9, "Uranus" : 10, "Neptune" : 11, "Comet" : 93,
  1 +{"Sun" : 1, "Mercury": 2, "Venus": 3, "Heliosphere.NearEarth": 4, "Heliosphere.Remote1AU": 5,
  2 +"Earth.Magnetosheath": 6, "Earth.Magnetosphere": 6, "Earth": 6, "Earth.Surface": 7,
  3 +"Mars": 8, "Jupiter": 9, "Ganymede" : 9, "Saturn": 91, "Uranus" : 92, "Neptune" : 93, "Comet" : 94,
4 4 "Heliosphere" : 99 }
5 5 \ No newline at end of file
... ...
help/epic.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/epic.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
help/epic_amda.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/amda_epic.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
help/epic_table.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/epic_table.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
help/ics_e.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/ics_e.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
help/ics_i.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/ics_i.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
help/images/amda_epic.png 0 → 100644

200 KB

help/images/epic.png 0 → 100644

137 KB

help/images/epic_table.png 0 → 100644

85.6 KB

help/images/ics_e.png 0 → 100644

56.1 KB

help/images/ics_i.png 0 → 100644

94.4 KB

help/images/stics.png 0 → 100644

103 KB

help/stics.html 0 → 100644
... ... @@ -0,0 +1,3 @@
  1 +<body>
  2 + <img src="images/stics.png"/>
  3 +</body>
0 4 \ No newline at end of file
... ...
js/app/controllers/AmdaModule.js
... ... @@ -99,7 +99,12 @@ Ext.define(&#39;amdaDesktop.AmdaModule&#39;, {
99 99 show : onshowfn,
100 100 scope : this
101 101 });
102   - }
103   - win.show();
  102 + }
  103 + if (!win.isVisible()) {
  104 + win.show();
  105 + }
  106 + else if (onshowfn) {
  107 + onshowfn();
  108 + }
104 109 }
105 110 });
... ...
js/app/controllers/InteractiveModule.js
... ... @@ -144,7 +144,13 @@ Ext.define(&#39;amdaDesktop.InteractiveModule&#39;, {
144 144 // second arg 'true' is used in CatalogUI to mark if Grid Reconfiguration is needed
145 145 this.getUiContent().setObject(this.linkedNode.get('object'), true);
146 146 }
147   - win.show();
  147 +
  148 + if (!win.isVisible()) {
  149 + win.show();
  150 + }
  151 + else if (onShowEvent) {
  152 + onShowEvent();
  153 + }
148 154 },
149 155 /**
150 156 * Mechanism to attach a Module to the Workspace Explorer to enable interactions
... ... @@ -256,4 +262,4 @@ Ext.define(&#39;amdaDesktop.InteractiveModule&#39;, {
256 262 return null;
257 263 }
258 264  
259   -});
260 265 \ No newline at end of file
  266 +});
... ...
js/app/controllers/PlotModule.js
... ... @@ -208,5 +208,5 @@ Ext.define(&#39;amdaDesktop.PlotModule&#39;, {
208 208 getWindowResult: function(winResultId){
209 209 if (!this.plotResultWindowsManager.get(winResultId)) return null;
210 210 return this.plotResultWindowsManager.get(winResultId);
211   - }
  211 + }
212 212 });
... ...
js/app/models/AmdaNode.js
... ... @@ -128,7 +128,20 @@ Ext.define(&#39;amdaModel.AmdaNode&#39;, {
128 128 }
129 129 // if this node is a leaf and have no child
130 130 else if (this.isLeaf() || this.get('nodeType' ) == 'derivedParam' ) {
131   - itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
  131 + if (this.get('nodeType') == 'plottab') {
  132 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_PTAB;
  133 + }
  134 + else {
  135 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
  136 + }
  137 + }
  138 + else if (this.get('nodeType') == 'request') {
  139 + if (this.get('tabs') && (this.get('tabs').length > 0)) {
  140 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_LEAF;
  141 + }
  142 + else {
  143 + itemKind = amdaUI.ExplorerUI.ITEM_KIND_DIRE;
  144 + }
132 145 }
133 146 else if (this.get('isParameter') && this.get('nodeType' ) != 'derivedParam' ) {
134 147 itemKind = amdaUI.ExplorerUI.ITEM_KIND_PARA;
... ...
js/app/models/InteractiveNode.js
... ... @@ -52,7 +52,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
52 52 {
53 53 node.eachChild(function(n)
54 54 {
55   - if (!n.isLoaded() && !n.isLeaf())
  55 + if (!n.isLoaded() && !n.isRealLeaf())
56 56 {
57 57 nodesToLoad.push(n);
58 58 me.preloadTreeNode(n,nodesToLoad,onloaded);
... ... @@ -70,7 +70,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
70 70 {
71 71 records.forEach(function (record)
72 72 {
73   - if (!record.isLoaded() && !record.isLeaf())
  73 + if (!record.isLoaded() && !record.isRealLeaf())
74 74 {
75 75 nodesToLoad.push(record);
76 76 me.preloadTreeNode(record,nodesToLoad,onloaded);
... ... @@ -99,6 +99,11 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
99 99 }
100 100 }
101 101 },
  102 +
  103 + isRealLeaf: function()
  104 + {
  105 + return this.isLeaf();
  106 + },
102 107  
103 108 /**
104 109 * this method is overriden into ExecutableNode to return true
... ... @@ -146,7 +151,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
146 151 */
147 152 rename: function(value,callBackFn)
148 153 {
149   - var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')};
  154 + var dataToSend = {id : this.get('id'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isRealLeaf(), nodeType: this.get('nodeType')};
150 155 AmdaAction.renameObject(dataToSend, callBackFn);
151 156 },
152 157  
... ... @@ -155,7 +160,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
155 160 */
156 161 renameDD: function(parentId, callBackFn)
157 162 {
158   - var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')};
  163 + var dataToSend = {id : this.get('id'), old_name: this.get('name'), name: this.get('name'), parent : parentId, leaf: this.isRealLeaf(), nodeType: this.get('nodeType')};
159 164 AmdaAction.renameObject(dataToSend, callBackFn);
160 165 },
161 166  
... ... @@ -166,7 +171,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
166 171 */
167 172 isValidName : function(name, callBackFn)
168 173 {
169   - var dataToSend = {name: name, nodeType: this.get('nodeType'), leaf: this.isLeaf()};
  174 + var dataToSend = {name: name, nodeType: this.get('nodeType'), leaf: this.isRealLeaf()};
170 175 AmdaAction.validNameObject(dataToSend, callBackFn);
171 176 },
172 177  
... ... @@ -515,7 +520,7 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
515 520  
516 521 deleteNode: function() {
517 522 // if the target is a directory
518   - if (!this.isLeaf()) {
  523 + if (!this.isRealLeaf()) {
519 524 // determine if this directory is empty before launching the delete confirmation method
520 525 this.isNotEmptyDir(this.confirmDirectoryDeletion);
521 526 // else (the target is a leaf)
... ... @@ -568,14 +573,14 @@ Ext.define(&#39;amdaModel.InteractiveNode&#39;, {
568 573 */
569 574 realDelete : function()
570 575 {
571   - AmdaAction.deleteObject({id: this.get('id'), leaf: this.isLeaf(), nodeType: this.get('nodeType')}, function(res,e){
  576 + AmdaAction.deleteObject({id: this.get('id'), leaf: this.isRealLeaf(), nodeType: this.get('nodeType')}, function(res,e){
572 577 //TODO proper errors handling
573 578 // node deletion in tree
574 579 if (res) { // if success
575 580 if (res.id) {
576 581 //Ext.Msg.show({title:'Warning', msg: 'Requests with parameter '+node.data.text+' are deleted', icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK});
577 582 if (this.parentNode) {
578   - if (this.isLeaf()){
  583 + if (this.isRealLeaf()){
579 584 var moduleId = this.get('moduleId');
580 585 // if really interactive node
581 586 if (moduleId) {
... ...
js/app/models/LocalParamNode.js
... ... @@ -28,9 +28,9 @@ Ext.define(&#39;amdaModel.LocalParamNode&#39;,
28 28 {name: 'rank', type: 'integer', persist: false, defaultValue: null}
29 29 ],
30 30  
31   - icons : {'1' : 'icon-mercury','2' : 'icon-venus','3' : 'icon-sw','4' : 'icon-sw','5' : 'icon-earth','6' : 'icon-earth',
32   - '7' : 'icon-mars','8' : 'icon-jupiter','9' : 'icon-saturn','10' : 'icon-uranus','11' : 'icon-neptune',
33   - '93' :'icon-comet', '99' :'icon-solarsystem', '999' :'icon-solarsystem'
  31 + icons : {'1' : 'icon-sun', '2' : 'icon-mercury','3' : 'icon-venus','4' : 'icon-sw','5' : 'icon-sw','6' : 'icon-earth','7' : 'icon-earth',
  32 + '8' : 'icon-mars','9' : 'icon-jupiter','91' : 'icon-saturn','92' : 'icon-uranus','93' : 'icon-neptune',
  33 + '94' :'icon-comet', '99' :'icon-solarsystem', '999' :'icon-solarsystem'
34 34 },
35 35  
36 36 constructor : function(config)
... ...
js/app/models/PlotNode.js
... ... @@ -10,15 +10,47 @@
10 10 Ext.define('amdaModel.PlotNode', {
11 11 extend: 'amdaModel.ExecutableNode',
12 12  
  13 + fields : [
  14 + {name : 'tabs', type:'auto', defaultValue:false, persist: false}
  15 + ],
  16 +
13 17 statics: {
14 18 nodeType: 'request'
15 19 },
16 20  
  21 + requires:[
  22 + 'amdaModel.PlotTabNode'
  23 + ],
  24 +
17 25 constructor : function(config){
18 26 this.callParent(arguments);
19 27 this.set('moduleId',myDesktopApp.dynamicModules.plot.id);
20 28 this.set('objectDataModel','amdaPlotObj.PlotRequestObject');
21 29 this.set('nodeType',this.self.nodeType);
  30 + if (this.get('leaf')) {
  31 + this.updateTabs(this.get('tabs'));
  32 + }
  33 + },
  34 +
  35 + updateTabs : function(tabs) {
  36 + if (tabs) {
  37 + var oneTab = (tabs.length == 1);
  38 + this.set('leaf', oneTab);
  39 + this.set('iconCls', oneTab ? 'icon-plot-page' : 'icon-plot-pages');
  40 + this.removeAll();
  41 + if (tabs.length > 1) {
  42 + var me = this;
  43 + Ext.Array.each(tabs, function(tab) {
  44 + var tabNode = new amdaModel.PlotTabNode({text: tab.name, tabid: tab.id});
  45 + me.appendChild(tabNode);
  46 + });
  47 + }
  48 + this.set('tabs', tabs);
  49 + }
  50 + },
  51 +
  52 + specialUpdate : function(res) {
  53 + this.updateTabs(res.tabs);
22 54 },
23 55  
24 56 allMenuItems : function() {
... ... @@ -44,6 +76,10 @@ Ext.define(&#39;amdaModel.PlotNode&#39;, {
44 76 }, {
45 77 fnId : 'leaf-deleteNode',
46 78 text : 'Delete Request'
  79 + }, {
  80 + fnId : 'leaf-insertTabs',
  81 + text : 'Insert in current Plot Request'
  82 +
47 83 }];
48 84  
49 85 return menuItems;
... ... @@ -92,10 +128,35 @@ Ext.define(&#39;amdaModel.PlotNode&#39;, {
92 128 case 'deleteMulti':
93 129 this.deleteMulti();
94 130 break;
95   -
  131 + case 'insertTabs':
  132 + this.insertPlotTabsRequest();
96 133 default:
97 134 break;
98 135 }
  136 + },
  137 +
  138 + isRealLeaf: function()
  139 + {
  140 + var isFolder = (!this.isLeaf()) && (this.get('tabs') === false);
  141 + return !isFolder;
  142 + },
  143 +
  144 + insertPlotTabsRequest: function() {
  145 + var me = this;
  146 + AmdaAction.getObject(me.get('id'), me.get('nodeType'), function (result,remoteEvent) {
  147 + var paramObj = Ext.create(me.get('objectDataModel'), result);
  148 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  149 + module.createWindow(function () {
  150 + var uiContent = module.getUiContent();
  151 + if (uiContent != null) {
  152 + paramObj.tabs().each(function (tab) {
  153 + var tabData = tab.getJsonValues();
  154 + uiContent.insertPlotTab(tabData);
  155 + });
  156 + }
  157 + });
  158 + });
  159 + });
99 160 }
100 161  
101 162 });
... ...
js/app/models/PlotObjects/PlotLayoutAutoObject.js
... ... @@ -14,18 +14,41 @@
14 14  
15 15  
16 16 Ext.define('amdaPlotObj.PlotLayoutAutoObject', {
17   - extend: 'Ext.data.Model',
  17 + extend: 'Ext.data.Model',
18 18  
19   - requires: [
20   - 'amdaPlotObj.PlotObjectConfig'
21   - ],
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22  
23   - fields : [
24   - {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},
25   - {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},
26   - {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand},
27   - {name: 'layout-timeaxes-legend-lowerone', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend}
  23 + fields : [
  24 + {name: 'layout-panel-height', type: 'float'},
  25 + {name: 'layout-panel-spacing', type: 'float'},
  26 + {name: 'layout-expand', type: 'boolean'},
  27 + {name: 'layout-timeaxes-legend-lowerone', type: 'boolean'}
28 28 ],
  29 +
  30 + constructor: function()
  31 + {
  32 + var me = this;
  33 + me.callParent(arguments);
  34 + if ((arguments.length > 0) && arguments[0])
  35 + {
  36 + }
  37 + else
  38 + {
  39 + //new object, set default fields values
  40 + me.setDefaultValues();
  41 + }
  42 + this.dirty = false;
  43 + },
  44 +
  45 + setDefaultValues: function()
  46 + {
  47 + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
  48 + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
  49 + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
  50 + this.set('layout-timeaxes-legend-lowerone', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend);
  51 + },
29 52  
30 53 getJsonValues : function()
31 54 {
... ...
js/app/models/PlotObjects/PlotLayoutVerticalObject.js
... ... @@ -14,23 +14,45 @@
14 14  
15 15  
16 16 Ext.define('amdaPlotObj.PlotLayoutVerticalObject', {
17   - extend: 'Ext.data.Model',
  17 + extend: 'Ext.data.Model',
18 18  
19   - requires: [
20   - 'amdaPlotObj.PlotObjectConfig'
21   - ],
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22  
23   - fields : [
24   - {name: 'layout-panel-height', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight},
25   - {name: 'layout-panel-spacing', type: 'float', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing},
26   - {name: 'layout-expand', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand},
27   - {name: 'layout-timeaxes-legend-lowerone', type: 'boolean', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend},
28   - //{name: 'layout-timeplot-width', type: 'float', useNull:true},
29   - {name: 'layout-timeplot-height', type: 'float', useNull:true},
30   - {name: 'layout-xyplot-width', type: 'float', useNull:true},
31   - {name: 'layout-xyplot-height', type: 'float', useNull:true}
  23 + fields : [
  24 + {name: 'layout-panel-height', type: 'float'},
  25 + {name: 'layout-panel-spacing', type: 'float'},
  26 + {name: 'layout-expand', type: 'boolean'},
  27 + {name: 'layout-timeaxes-legend-lowerone', type: 'boolean'},
  28 + //{name: 'layout-timeplot-width', type: 'float', useNull:true},
  29 + {name: 'layout-timeplot-height', type: 'float', useNull:true},
  30 + {name: 'layout-xyplot-width', type: 'float', useNull:true},
  31 + {name: 'layout-xyplot-height', type: 'float', useNull:true}
32 32 ],
33   -
  33 +
  34 + constructor: function()
  35 + {
  36 + var me = this;
  37 + me.callParent(arguments);
  38 + if ((arguments.length > 0) && arguments[0])
  39 + {
  40 + }
  41 + else {
  42 + //new object, set default fields values
  43 + me.setDefaultValues();
  44 + }
  45 + this.dirty = false;
  46 + },
  47 +
  48 + setDefaultValues: function()
  49 + {
  50 + this.set('layout-panel-height', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelHeight);
  51 + this.set('layout-panel-spacing', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.panelSpacing);
  52 + this.set('layout-expand', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.expand);
  53 + this.set('layout-timeaxes-legend-lowerone', amdaPlotObj.PlotObjectConfig.defaultValues.page.layout.timeAxesLegend);
  54 + },
  55 +
34 56 getJsonValues : function()
35 57 {
36 58 var layoutValues = new Object();
... ...
js/app/models/PlotObjects/PlotLegendSeriesObject.js
... ... @@ -14,32 +14,46 @@
14 14  
15 15  
16 16 Ext.define('amdaPlotObj.PlotLegendSeriesObject', {
17   - extend: 'Ext.data.Model',
  17 + extend: 'Ext.data.Model',
18 18  
19   - requires: [
20   - 'amdaPlotObj.PlotObjectConfig'
21   - ],
  19 + requires: [
  20 + 'amdaPlotObj.PlotObjectConfig'
  21 + ],
22 22  
23   - fields : [
24   - {name: 'legend-series-activated', type: 'boolean', defaultValue: false},
25   - {name: 'legend-series-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type},
26   - {name: 'legend-series-position', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position},
27   - {name: 'legend-series-showparaminfo', type: 'boolean', defaultValue: true},
28   - {name: 'legend-series-defaulttextcolor', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.text.color},
29   - {name: 'legend-series-border-activated', type: 'boolean', defaultValue: false},
30   - {name: 'legend-series-border-color', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.border.color},
31   - {name: 'legend-series-intervalinfo-activated', type: 'boolean', defaultValue: false},
32   - {name: 'legend-series-intervalinfo-type', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.intervalinfo.type},
33   - {name: 'legend-series-font-activated', type: 'boolean', defaultValue: false},
34   - {name: 'legend-series-font-name', type: 'string', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name},
35   - {name: 'legend-series-font-size', type: 'int', defaultValue: amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size},
36   - {name: 'legend-series-font-bold', type: 'boolean', defaultValue: false},
37   - {name: 'legend-series-font-italic', type: 'boolean', defaultValue: false}
  23 + fields : [
  24 + {name: 'legend-series-activated', type: 'boolean'},
  25 + {name: 'legend-series-type', type: 'string'},
  26 + {name: 'legend-series-position', type: 'string'},
  27 + {name: 'legend-series-showparaminfo', type: 'boolean'},
  28 + {name: 'legend-series-defaulttextcolor', type: 'string'},
  29 + {name: 'legend-series-border-activated', type: 'boolean'},
  30 + {name: 'legend-series-border-color', type: 'string'},
  31 + {name: 'legend-series-intervalinfo-activated', type: 'boolean'},
  32 + {name: 'legend-series-intervalinfo-type', type: 'string'},
  33 + {name: 'legend-series-font-activated', type: 'boolean'},
  34 + {name: 'legend-series-font-name', type: 'string'},
  35 + {name: 'legend-series-font-size', type: 'int'},
  36 + {name: 'legend-series-font-bold', type: 'boolean'},
  37 + {name: 'legend-series-font-italic', type: 'boolean'}
38 38 ],
  39 +
  40 + constructor: function()
  41 + {
  42 + var me = this;
  43 + me.callParent(arguments);
  44 + if ((arguments.length > 0) && arguments[0])
  45 + {
  46 + }
  47 + else {
  48 + //new object, set default fields values
  49 + me.setDefaultValues();
  50 + }
  51 + this.dirty = false;
  52 + },
39 53  
40 54 setDefaultValues: function()
41 55 {
42   - /*this.set('legend-series-activated', false);
  56 + this.set('legend-series-activated', false);
43 57 this.set('legend-series-type', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.type);
44 58 this.set('legend-series-position', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.position);
45 59 this.set('legend-series-showparaminfo', true);
... ... @@ -52,7 +66,7 @@ Ext.define(&#39;amdaPlotObj.PlotLegendSeriesObject&#39;, {
52 66 this.set('legend-series-font-name', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.name);
53 67 this.set('legend-series-font-size', amdaPlotObj.PlotObjectConfig.defaultValues.legends.series.font.size);
54 68 this.set('legend-series-font-bold', false);
55   - this.set('legend-series-font-italic', false);*/
  69 + this.set('legend-series-font-italic', false);
56 70 },
57 71  
58 72 getShortInfo : function()
... ... @@ -86,4 +100,4 @@ Ext.define(&#39;amdaPlotObj.PlotLegendSeriesObject&#39;, {
86 100  
87 101 return legendValues;
88 102 }
89   -});
90 103 \ No newline at end of file
  104 +});
... ...
js/app/models/PlotObjects/PlotRequestObject.js
... ... @@ -30,8 +30,7 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
30 30 {name: 'one-file-per-interval', type: 'boolean'},
31 31 {name: 'last-plotted-tab', type: 'int', defaultValue: 0},
32 32 {name: 'last-tab-id', type: 'int', defaultValue: 0},
33   - {name: 'active-tab-id', type: 'int', defaultValue: 1},
34   - {name: 'all-in-one', type: 'boolean', defaultValue: false}
  33 + {name: 'active-tab-id', type: 'int', defaultValue: 1}
35 34 ],
36 35  
37 36 hasMany: {
... ... @@ -74,10 +73,19 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
74 73  
75 74 createNewTab: function() {
76 75 this.set('last-tab-id', this.get('last-tab-id') + 1);
77   - var recs = this.tabs().add({id : this.get('last-tab-id')});
78   - recs[0].setDefaultValues();
  76 + var data = {id: this.get('last-tab-id')};
  77 + var applyDefault = true;
  78 + if ((arguments.length > 0) && arguments[0]) {
  79 + data = arguments[0];
  80 + data['id'] = this.get('last-tab-id');
  81 + applyDefault = false;
  82 + }
  83 + var recs = this.tabs().add(data);
  84 + if (applyDefault) {
  85 + recs[0].setDefaultValues();
  86 + }
79 87 this.dirty = true;
80   - return recs[0];
  88 + return recs[0];
81 89 },
82 90  
83 91 removeTabById: function(tabId) {
... ... @@ -124,7 +132,6 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
124 132 requestValues['one-file-per-interval'] = this.get('one-file-per-interval');
125 133 requestValues['last-plotted-tab'] = this.get('last-plotted-tab');
126 134 requestValues['name'] = this.get('name');
127   - requestValues['all-in-one'] = this.get('all-in-one');
128 135  
129 136 requestValues['timesrc'] = this.get('timesrc');
130 137  
... ... @@ -153,26 +160,15 @@ Ext.define(&#39;amdaPlotObj.PlotRequestObject&#39;, {
153 160 requestValues['durationSec'] = this.get('durationSec');
154 161 }
155 162  
156   - requestValues['tabs'] = [];
  163 + requestValues['tabs'] = [];
157 164  
158   - if (this.get('all-in-one')) {
159   - this.tabs().each(function (tab, index) {
160   - requestValues['tabs'][index] = tab.getJsonValues();
161   - });
  165 + this.tabs().each(function (tab, index) {
  166 + requestValues['tabs'][index] = tab.getJsonValues();
  167 + });
162 168  
163   - requestValues['active-tab-id'] = this.get('active-tab-id');
164   - requestValues['last-tab-id'] = this.get('last-tab-id');
165   - }
166   - else {
167   - var tab = this.tabs().getAt(this.get('active-tab-id')-1);
168   - requestValues['tabs'][0] = tab.getJsonValues();
169   -
170   - requestValues['tabs'][0]['id'] = "1";
171   - requestValues['active-tab-id'] = "1";
172   - requestValues['last-tab-id'] = "1";
173   - requestValues['last-plotted-tab'] = "0";
174   - }
  169 + requestValues['active-tab-id'] = this.get('active-tab-id');
  170 + requestValues['last-tab-id'] = this.get('last-tab-id');
175 171  
176   - return requestValues;
  172 + return requestValues;
177 173 }
178   -});
179 174 \ No newline at end of file
  175 +});
... ...
js/app/models/PlotObjects/PlotTabObject.js
... ... @@ -27,6 +27,7 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
27 27  
28 28 fields : [
29 29 {name: 'id', type: 'int'},
  30 + {name: 'tab-name', type: 'string', defaultValue: ''},
30 31 {name: 'tree-full-view', type: 'boolean'},
31 32 {name: 'multi-plot-linked', type: 'boolean'},
32 33 {name: 'page-node-state', type: 'int', defaultValue: 2}, //0 : collapsed, 1 : expanded, 2 : not set
... ... @@ -223,6 +224,7 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
223 224 var tabValues = new Object();
224 225  
225 226 tabValues['id'] = this.get('id');
  227 + tabValues['tab-name'] = this.get('tab-name');
226 228 tabValues['tree-full-view'] = this.get('tree-full-view');
227 229 tabValues['multi-plot-linked'] = this.get('multi-plot-linked');
228 230 tabValues['page-node-state'] = this.get('page-node-state');
... ... @@ -289,4 +291,4 @@ Ext.define(&#39;amdaPlotObj.PlotTabObject&#39;, {
289 291  
290 292 return tabValues;
291 293 }
292   -});
293 294 \ No newline at end of file
  295 +});
... ...
js/app/models/PlotTabNode.js 0 → 100644
... ... @@ -0,0 +1,164 @@
  1 +/**
  2 + * Project : AMDA-NG4
  3 + * Name : PlotTabNode.js
  4 + * @class amdaModel.PlotTabNode
  5 + * @extends amdaModel.ExecutableNode
  6 + * @brief Basic Model of Node corresponding to a tab of a plot request
  7 + * @author Benjamin Renard
  8 + */
  9 +
  10 +Ext.define('amdaModel.PlotTabNode', {
  11 + extend: 'amdaModel.ExecutableNode',
  12 +
  13 + fields : [
  14 + {name : 'tabid', type:'string', defaultValue:'', persist: false}
  15 + ],
  16 +
  17 + statics: {
  18 + nodeType: 'plottab'
  19 + },
  20 +
  21 + constructor : function(config){
  22 + this.callParent(arguments);
  23 + this.set('moduleId',myDesktopApp.dynamicModules.plot.id);
  24 + //this.set('objectDataModel','amdaPlotObj.PlotRequestObject');
  25 + this.set('nodeType',this.self.nodeType);
  26 + this.set('leaf',true);
  27 + this.set('iconCls','icon-plot-page');
  28 + },
  29 +
  30 + allMenuItems : function() {
  31 + var menuItems =
  32 + [
  33 + {
  34 + fnId : 'ptab-openTab',
  35 + text : 'Open in new Plot Request'
  36 + }, {
  37 + fnId : 'ptab-insertTab',
  38 + text : 'Insert in current Plot Request'
  39 + }, {
  40 + fnId : 'ptab-renameTab',
  41 + text : 'Rename Plot Tab'
  42 + }];
  43 +
  44 + return menuItems;
  45 + },
  46 +
  47 + allMenuMultiItems : function() {
  48 + var menuMulti = [
  49 + ];
  50 + return menuMulti;
  51 + },
  52 +
  53 + getAllContextMenuItems: function(){
  54 + return this.allMenuItems();
  55 + },
  56 +
  57 + getMultiContextMenuItems: function(){
  58 + return this.allMenuMultiItems();
  59 + },
  60 +
  61 + onMenuItemClick : function(menu,item,event) {
  62 +
  63 + var fnId = Ext.util.Format.substr(item.fnId, 5, item.fnId.length);
  64 +
  65 + switch (fnId) {
  66 +
  67 + case 'openTab':
  68 + this.insertPlotTabRequest(true);
  69 + break;
  70 +
  71 + case 'insertTab':
  72 + this.insertPlotTabRequest(false);
  73 + break;
  74 +
  75 + case 'renameTab':
  76 + this.renameTab();
  77 + break;
  78 + default:
  79 + break;
  80 + }
  81 + },
  82 +
  83 + insertPlotTabRequest : function(inNewRequest) {
  84 + var me = this;
  85 + amdaModel.InteractiveNode.preloadNodes(this.parentNode.getRootNode(), function() {
  86 + AmdaAction.getObject(me.parentNode.get('id'), me.parentNode.get('nodeType'), function (result,remoteEvent) {
  87 + var paramObj = Ext.create(me.parentNode.get('objectDataModel'), result);
  88 + var tabData = null;
  89 + paramObj.tabs().each(function(tab) {
  90 + if (tab.get('id') == me.get('tabid')) {
  91 + tabData = tab.getJsonValues();
  92 + }
  93 + });
  94 + if (tabData != null) {
  95 + if (inNewRequest) {
  96 + tabData['id'] = 1;
  97 + paramObj.set('id','');
  98 + paramObj.set('name', '');
  99 + paramObj.set('folderId', '');
  100 + paramObj.set('active-tab-id', 1);
  101 + paramObj.set('last-tab-id', 1);
  102 + paramObj.set('last-plotted-tab', 1);
  103 + paramObj.loadTabs([tabData]);
  104 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  105 + module.setContextNode(me.parentNode.getRootNode());
  106 + module.createWindow(function () {
  107 + var uiContent = module.getUiContent();
  108 + if (uiContent != null) {
  109 + uiContent.resetProcess(paramObj.getJsonValues());
  110 + }
  111 + });
  112 + });
  113 + }
  114 + else {
  115 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  116 + module.createWindow(function () {
  117 + var uiContent = module.getUiContent();
  118 + if (uiContent != null) {
  119 + var tabObj = new amdaPlotObj.PlotTabObject(tabData);
  120 + uiContent.insertPlotTab(tabData);
  121 + }
  122 + });
  123 + });
  124 + }
  125 + }
  126 + }, me);
  127 + });
  128 + },
  129 +
  130 + editPlotTab : function() {
  131 + var me = this;
  132 + this.parentNode.editLeaf(function () {
  133 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  134 + var uiContent = module.getUiContent();
  135 + if (uiContent != null) {
  136 + uiContent.forceActiveTab(me.get('tabid'));
  137 + }
  138 + });
  139 + });
  140 + },
  141 +
  142 + renameTab: function() {
  143 + if (this.myGetOwnerTree()) {
  144 + var item = this.myGetOwnerTree().getSelectionModel().selected.items[0];
  145 + this.myGetOwnerTree().fireEvent('edition', this.myGetOwnerTree().view, item);
  146 + }
  147 + },
  148 +
  149 + rename: function(value,callBackFn) {
  150 + var me = this;
  151 + var dataToSend = {id : this.get('tabid'), old_name: this.modified.text, name: value, parent : this.data.parentId, leaf: this.isLeaf(), nodeType: this.get('nodeType')};
  152 + AmdaAction.renameObject(dataToSend, function (result) {
  153 + callBackFn(result);
  154 + myDesktopApp.getLoadedModule(me.get('moduleId'), true, function (module) {
  155 + var uiContent = module.getUiContent();
  156 + if (uiContent != null) {
  157 + if ((module.linkedNode != null) && (module.linkedNode.get('id') == dataToSend.parent)) {
  158 + uiContent.updatePlotTabName(dataToSend.id, dataToSend.name);
  159 + }
  160 + }
  161 + });
  162 + });
  163 + },
  164 +});
... ...
js/app/views/DownloadUI.js
... ... @@ -459,6 +459,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
459 459 }
460 460 break;
461 461 case 'alias' :
  462 + // console.log(data.records[0].data);
462 463 idToSent = "#" + data.records[0].get('text');
463 464 break;
464 465 case 'derivedParam' :
... ... @@ -481,7 +482,7 @@ Ext.define(&#39;amdaUI.DownloadUI&#39;, {
481 482 }
482 483 break;
483 484 case 'myDataParam' :
484   - idToSent = "ws_" + data.records[0].get('text');
  485 + idToSent = "wsd_" + data.records[0].get('text');
485 486 break;
486 487 default :
487 488 return false;
... ...
js/app/views/ExplorerUI.js
... ... @@ -102,6 +102,7 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
102 102 ITEM_KIND_LEAF : 'leaf',
103 103 ITEM_KIND_DIRE : 'dire',
104 104 ITEM_KIND_PARA : 'para',
  105 + ITEM_KIND_PTAB : 'ptab', //plot tab
105 106 ITEM_KIND_MISS : 'miss'
106 107 },
107 108  
... ... @@ -231,7 +232,7 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
231 232 toggleGroup: 'sorting',
232 233 handler: function(){
233 234 var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID);
234   - tree.getStore().sort([{ property : 'rank' }]);
  235 + tree.getStore().sort('rank');
235 236 this.updateFilter();
236 237 }
237 238 }]
... ... @@ -353,6 +354,7 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
353 354 case 'remoteParam' :
354 355 case 'remoteSimuParam' :
355 356 case 'myData' :
  357 + case 'plottab' :
356 358 return false;
357 359 default :
358 360 if (draggedRecord.data.id == targetNode.data.nodeType+'-treeRootNode')
... ... @@ -575,13 +577,13 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
575 577 });
576 578 }
577 579  
578   - if (record.isLeaf() || record.data.isParameter)
  580 + if (record.isLeaf() || record.data.isParameter || (record.data.tabs && (record.data.tabs.length > 0)))
579 581 switch (record.get('nodeType'))
580 582 {
581 583 case 'myData' :
582 584 case 'myDataParam' :
583 585 case 'derivedParam' :
584   - case 'timeTable' :
  586 + case 'timeTable' :
585 587 case 'sharedtimeTable' :
586 588 case 'sharedcatalog' :
587 589 case 'catalog' :
... ... @@ -589,6 +591,9 @@ Ext.define(&#39;amdaUI.ExplorerUI&#39;, {
589 591 case 'condition' :
590 592 record.editLeaf();
591 593 break;
  594 + case 'plottab' :
  595 + record.editPlotTab();
  596 + break;
592 597 case 'localParam' :
593 598 case 'remoteParam':
594 599 case 'remoteSimuParam':
... ... @@ -1024,7 +1029,7 @@ Ext.define( &#39;MyTreeEditor&#39;, {
1024 1029 event.record.commit();
1025 1030 var rec = event.record.data;
1026 1031 // in case of directory
1027   - if (!rec.leaf){
  1032 + if (!rec.leaf && (rec.nodeType != 'plottab')){
1028 1033 // set folder's ID returned by server
1029 1034 rec.id = result.id;
1030 1035 }
... ...
js/app/views/PlotComponents/PlotTabPanel.js
... ... @@ -31,16 +31,20 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
31 31  
32 32 setRequestObject: function(object)
33 33 {
  34 + var me = this;
34 35 this.removeAll();
35 36 this.object = object;
36   - var selectedTab = this.object.get('active-tab-id');
37 37  
  38 + var haveSelectedTab = false;
38 39 this.object.tabs().each(function (rec, index) {
39   - var isSelected = false;
40   - if (index+1 == selectedTab)
41   - isSelected = true;
  40 + if (rec.get('id') == me.object.get('active-tab-id')) {
  41 + haveSelectedTab = true;
  42 + }
  43 + });
42 44  
43   - this.addPlotTab(rec, isSelected);
  45 + this.object.tabs().each(function (rec, index) {
  46 + var isSelectedTab = haveSelectedTab ? (rec.get('id') == me.object.get('active-tab-id')) : (index == 0);
  47 + this.addPlotTab(rec, isSelectedTab);
44 48 }, this);
45 49 },
46 50  
... ... @@ -49,8 +53,9 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
49 53 var tabNumber = this.getTabBar().items.getCount();
50 54 var tabContent = new amdaPlotComp.PlotTabContent({plotElementPanel: this.plotElementPanel, plotTabPanel : this, tabId : tabObject.get('id')});
51 55 tabContent.setTabObject(tabObject);
  56 + var me = this;
52 57 var tabComp = this.add({
53   - title: 'Plot '+tabNumber,
  58 + title: (tabObject.get('tab-name') != '') ? tabObject.get('tab-name') : 'Plot '+tabNumber,
54 59 closable: true,
55 60 layout: 'fit',
56 61 bodyStyle: 'background: none',
... ... @@ -75,8 +80,34 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
75 80 this.object.removeTabById(tab.items.getAt(0).object.get('id'));
76 81 },
77 82 destroy: function(tab, eOpts) {
  83 +
78 84 this.updatePlotTabs();
79   - }
  85 + },
  86 + afterrender: function(tab, e0pts) {
  87 + if (!tab.tab.el) {
  88 + return;
  89 + }
  90 + tab.tab.el.on('contextmenu', function(e, t, eOpts) {
  91 + var menu = new Ext.menu.Menu({
  92 + items: [
  93 + {
  94 + text: 'Rename',
  95 + handler: function() {
  96 + Ext.Msg.prompt('Rename', 'Please enter new plot tab name:', function(btn, text){
  97 + if (btn == 'ok'){
  98 + tabObject.set('tab-name',text);
  99 + me.updatePlotTabs();
  100 + }
  101 + }, me);
  102 + }
  103 + }
  104 + ]
  105 + });
  106 + var position = e.getXY();
  107 + e.stopEvent();
  108 + menu.showAt(position);
  109 + },this);
  110 + }
80 111 }
81 112 });
82 113  
... ... @@ -88,12 +119,32 @@ Ext.define(&#39;amdaPlotComp.PlotTabPanel&#39;, {
88 119  
89 120 updatePlotTabs: function()
90 121 {
  122 + var me = this;
  123 + var haveSelectedTab = false;
  124 + this.object.tabs().each(function (rec, index) {
  125 + if (rec.get('id') == me.object.get('active-tab-id')) {
  126 + haveSelectedTab = true;
  127 + }
  128 + });
  129 +
91 130 var i = 0;
92 131 for (i = 0; i < this.items.getCount(); ++i)
93 132 {
  133 + var tabItem = this.items.getAt(i);
  134 + var tabContent = tabItem.items.getAt(0);
  135 + var tabObj = this.object.tabs().getById(tabContent.tabId);
  136 + if (!tabObj) {
  137 + continue;
  138 + }
  139 + if (!haveSelectedTab) {
  140 + //Set first tab as the selected one
  141 + this.setActiveTab(tabItem);
  142 + this.object.set('active-tab-id', tabObj.get('id'));
  143 + haveSelectedTab = true;
  144 + }
94 145 var tabNumber = i+1;
95   - this.items.getAt(i).setTitle('Plot '+tabNumber);
96   - this.items.getAt(i).items.getAt(0).setTabObject(this.object.tabs().getAt(i));
  146 + tabItem.setTitle((tabObj.get('tab-name') != '') ? tabObj.get('tab-name') : 'Plot '+tabNumber);
  147 + tabContent.setTabObject(tabObj);
97 148 }
98 149 },
99 150  
... ...
js/app/views/PlotUI.js
... ... @@ -32,8 +32,6 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
32 32  
33 33 plotElement : null,
34 34  
35   - allPlots : false,
36   -
37 35 constructor: function(config) {
38 36 this.init(config);
39 37 this.callParent(arguments);
... ... @@ -47,12 +45,6 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
47 45 this.plotTabs.setRequestObject(this.object);
48 46 this.timeSelector.intervalSel.setInterval(this.object.get('startDate'), this.object.get('stopDate'));
49 47 this.addTTs(this.object.get('timeTables'));
50   - this.updateRequestOption(this.object.get('all-in-one'));
51   - },
52   -
53   - updateRequestOption : function(allInOne) {
54   - var requestOptionCB = this.formPanel.getForm().findField('all-in-one');
55   - requestOptionCB.setValue(allInOne);
56 48 },
57 49  
58 50 /**
... ... @@ -92,7 +84,11 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
92 84 resetProcess : function(){
93 85 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
94 86 plotModule.createLinkedNode();
95   - plotModule.createObject();
  87 + var obj = null;
  88 + if ((arguments.length > 0) && (arguments[0] != null)) {
  89 + obj = arguments[0];
  90 + }
  91 + plotModule.createObject(obj);
96 92 this.setObject(plotModule.linkedNode.get('object'));
97 93 },
98 94  
... ... @@ -119,7 +115,6 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
119 115 doPlot : function(){
120 116  
121 117 this.updateObject();
122   - this.object.set('all-in-one', true);
123 118 this.object.set('last-plotted-tab', this.plotTabs.getSelectedTabId());
124 119 var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
125 120 if (plotModule)
... ... @@ -180,10 +175,154 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
180 175  
181 176 this.timeSelector.intervalSel.setInterval(dateStart, dateStop);
182 177 },
  178 +
  179 + forceActiveTab : function(tabId) {
  180 + for (var i = 0; i < this.plotTabs.items.getCount(); ++i) {
  181 + var plotTab = this.plotTabs.items.getAt(i).items.getAt(0);
  182 + if (plotTab.tabId == tabId) {
  183 + this.plotTabs.setActiveTab(i);
  184 + return;
  185 + }
  186 + }
  187 + },
  188 +
  189 + updatePlotTabName: function(tabId, name) {
  190 + var me = this;
  191 + this.object.tabs().each(function (tabObject) {
  192 + if (tabId == tabObject.getId()) {
  193 + tabObject.set('tab-name', name);
  194 + me.plotTabs.updatePlotTabs();
  195 + }
  196 + });
  197 + },
  198 +
  199 + insertPlotTab : function(tabData) {
  200 + var newTab = this.object.createNewTab(tabData);
  201 + this.plotTabs.addPlotTab(newTab,true);
  202 + },
183 203  
184 204 updateLinkedToMultiPlotMode : function(isLinkedToMultiPlotMode) {
185 205 this.timeSelector.setVisible(isLinkedToMultiPlotMode);
186 206 },
  207 +
  208 + keepOnlySelectedTabInObject: function(showWarning, onSuccess) {
  209 + if (this.object.tabs().count() == 1) {
  210 + if (onSuccess) {
  211 + onSuccess();
  212 + }
  213 + return;
  214 + }
  215 +
  216 + var me = this;
  217 + var removeFunc = function() {
  218 + var tabsToRemove = [];
  219 + var selectedTabFound = false;
  220 + me.object.tabs().each(function(tab) {
  221 + if (tab.get('id') != me.object.get('active-tab-id')) {
  222 + tabsToRemove.push(tab);
  223 + }
  224 + else {
  225 + selectedTabFound = true;
  226 + }
  227 + });
  228 + if (!selectedTabFound) {
  229 + myDesktopApp.errorMsg('Cannot retrieve selected tab');
  230 + return false;
  231 + }
  232 + if (tabsToRemove.length > 0) {
  233 + me.object.tabs().remove(tabsToRemove);
  234 + }
  235 + return true;
  236 + };
  237 +
  238 + if (!showWarning) {
  239 + if (removeFunc()) {
  240 + if (onSuccess) {
  241 + onSuccess();
  242 + }
  243 + }
  244 + return;
  245 + }
  246 +
  247 +
  248 + Ext.Msg.show( { title : 'Warning',
  249 + msg: 'Active plot will be saved, but other ones will be lost.<br/>Do you want to continue?',
  250 + width: 300,
  251 + buttons: Ext.Msg.OKCANCEL,
  252 + fn: function(btn) {
  253 + if (btn == 'cancel') return;
  254 +
  255 + if (removeFunc()) {
  256 + if (onSuccess) {
  257 + onSuccess();
  258 + }
  259 + }
  260 + return;
  261 + },
  262 + scope: me
  263 + });
  264 + },
  265 +
  266 + savePlotRequest : function(allTabs) {
  267 + var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
  268 + if (!plotModule)
  269 + return;
  270 + this.updateObject();
  271 + this.object.set('active-tab-id', this.plotTabs.getSelectedTabId());
  272 + var me = this;
  273 +
  274 + if ((this.object.get('id') != '') && (plotModule.linkedNode.get('text') == this.object.get('name'))) {
  275 + //update existing request
  276 + if (!allTabs) {
  277 + this.keepOnlySelectedTabInObject(true, function() {
  278 + plotModule.linkedNode.update();
  279 + });
  280 + }
  281 + else {
  282 + plotModule.linkedNode.update();
  283 + }
  284 + return;
  285 + }
  286 +
  287 + //save new request
  288 + var me = this;
  289 + plotModule.linkedNode.isValidName(this.object.get('name'), function (res) {
  290 + if (!res) {
  291 + myDesktopApp.errorMsg('Error during object validation');
  292 + return;
  293 + }
  294 + if (!res.valid) {
  295 + if (res.error) {
  296 + if (res.error.search('subtree') != -1) {
  297 + Ext.Msg.show( { title : 'Warning',
  298 + msg: res.error + '<br/>Do you want to overwrite it?',
  299 + width: 300,
  300 + buttons: Ext.Msg.OKCANCEL,
  301 + icon: Ext.Msg.WARNING,
  302 + fn : me.overwriteProcess,
  303 + scope : me
  304 + });
  305 + }
  306 + else {
  307 + myDesktopApp.errorMsg(res.error);
  308 + }
  309 + }
  310 + else {
  311 + myDesktopApp.errorMsg('Invalid object name');
  312 + }
  313 + return;
  314 + }
  315 + if (!allTabs) {
  316 + me.keepOnlySelectedTabInObject((me.object.get('id') == ''), function() {
  317 + me.saveProcess(false);
  318 + me.setObject(me.object);
  319 + });
  320 + }
  321 + else {
  322 + me.saveProcess(false);
  323 + }
  324 + });
  325 + },
187 326  
188 327 init : function(config) {
189 328 this.timeSelector = new amdaUI.TimeSelectorUI( { id: 'multiPlotTimeSelector' + config.id, title : 'MultiPlot Time Selection', border : false, collapsible : true, collapseDirection : 'bottom', visible : false, flex: 2 } );
... ... @@ -252,7 +391,8 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
252 391 ]
253 392 }
254 393 ],
255   - fbar: [{
  394 + fbar: [
  395 + {
256 396 xtype: 'button',
257 397 text: 'Plot',
258 398 scope: this,
... ... @@ -275,68 +415,24 @@ Ext.define(&#39;amdaUI.PlotUI&#39;, {
275 415 }
276 416 },
277 417 '->', '-', {
278   - xtype: 'button',
279   - text: 'Save Request',
  418 + xtype: 'splitbutton',
  419 + text: 'Save All Tabs',
  420 + menu: {
  421 + items: [
  422 + {
  423 + text: 'Save Current Tab',
  424 + scope: this,
  425 + handler: function() {
  426 + this.savePlotRequest(false);
  427 + }
  428 + },
  429 + ]
  430 + },
280 431 scope: this,
281 432 handler: function(button) {
282   - var plotModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.plot.id);
283   - if (!plotModule)
284   - return;
285   -
286   - this.updateObject();
287   - this.object.set('active-tab-id', this.plotTabs.getSelectedTabId());
288   - this.object.set('all-in-one', this.allPlots);
289   -
290   - //update existing request
291   - if ((this.object.get('id') != '') &&
292   - (plotModule.linkedNode.get('text') == this.object.get('name')))
293   - plotModule.linkedNode.update();
294   - else {
295   - var me = this;
296   - plotModule.linkedNode.isValidName(this.object.get('name'), function (res) {
297   - if (!res) {
298   - myDesktopApp.errorMsg('Error during object validation');
299   - return;
300   - }
301   - if (!res.valid) {
302   - if (res.error) {
303   - if (res.error.search('subtree') != -1) {
304   - Ext.Msg.show( { title : 'Warning',
305   - msg: res.error + '<br/>Do you want to overwrite it?',
306   - width: 300,
307   - buttons: Ext.Msg.OKCANCEL,
308   - icon: Ext.Msg.WARNING,
309   - fn : me.overwriteProcess,
310   - scope : me
311   - });
312   - }
313   - else {
314   - myDesktopApp.errorMsg(res.error);
315   - }
316   - }
317   - else {
318   - myDesktopApp.errorMsg('Invalid object name');
319   - }
320   -
321   - return;
322   - }
323   - me.saveProcess(false);
324   - })
325   - }
326   - }
327   - }, ' ',
328   - myDesktopApp.addAmdaInfo('plotSaveRequest'),
329   - ' ', {
330   - xtype: 'checkbox',
331   - boxLabel: 'All Plot Tabs',
332   - name : 'all-in-one',
333   - listeners : {
334   - scope: this,
335   - change: function (cb, nv, ov) {
336   - this.allPlots = nv;
337   - }
  433 + this.savePlotRequest(true);
338 434 }
339   - }
  435 + }
340 436 ]
341 437 });
342 438  
... ...
js/resources/css/amda.css
... ... @@ -354,6 +354,12 @@ background-image: url(../images/16x16/error.png) !important;
354 354 opacity:0.5 !important;
355 355 }
356 356  
  357 +.icon-sun {
  358 + background-image:url(../images/icons/sun.png) !important;
  359 + background-position: center;
  360 + background-repeat: no-repeat;
  361 +}
  362 +
357 363 .icon-mercury {
358 364 background-image:url(../images/icons/mercury.png) !important;
359 365 background-position: center;
... ... @@ -456,6 +462,10 @@ p + p {
456 462 background-image:url( ../images/16x16/plot_page.png ) !important;
457 463 }
458 464  
  465 +.icon-plot-pages {
  466 + background-image:url( ../images/16x16/plot_pages.png ) !important;
  467 +}
  468 +
459 469 .icon-plot-layout {
460 470 background-image:url( ../images/16x16/plot_layout.png ) !important;
461 471 }
... ...
js/resources/images/16x16/plot_pages.png 0 → 100644

150 Bytes

php/classes/AmdaAction.php
... ... @@ -151,6 +151,7 @@ class AmdaAction
151 151 $isParameter = false;
152 152 $isAddable = false;
153 153 $isSimulation = false;
  154 + $plotTabs = FALSE;
154 155 $rank = null;
155 156 $skip = FALSE;
156 157  
... ... @@ -178,18 +179,44 @@ class AmdaAction
178 179 case 'request':
179 180 $objectMgr = new RequestMgr();
180 181 $objplot = $objectMgr->getObject($id);
181   - for ($i=0; $i < count($objplot->children); $i++)
182   - {
183   - for ($j=0; $j < count($objplot->children[$i]->children); $j++) {
184   - $info = $info.' . '.$objplot->children[$i]->children[$j]->name;
  182 + if (isset($objplot->name)) {
  183 + $info = $objplot->name;
  184 + }
  185 + else {
  186 + $info = $id;
  187 + }
  188 +
  189 + $isLeaf = isset($objplot->tabs);
  190 + if ($isLeaf) {
  191 + $plotTabs = array();
  192 + foreach ($objplot->tabs as $index => $tab) {
  193 + $plotTabs[$index] = array(
  194 + "name" => (!empty($tab->{'tab-name'})) ? $tab->{'tab-name'} : "Plot ".($index+1),
  195 + "id" => $tab->id,
  196 + );
185 197 }
186 198 }
  199 + else
  200 + $plotTabs = FALSE;
187 201 break;
188 202  
189 203 case 'alias':
190 204 $info = $id;
191 205 $id = 'alias_'.$id;
  206 + $component_info = array();
  207 + if ($child->hasAttribute("index1"))
  208 + $component_info["index1"] = $child->getAttribute('index1');
  209 + if ($child->hasAttribute("index2"))
  210 + $component_info["index2"] = $child->getAttribute('index2');
  211 +
  212 + if ($child->hasAttribute("parentId"))
  213 + $component_info["parentId"] = $child->getAttribute("parentId");
  214 +
  215 + if ($child->hasAttribute("iconCls"))
  216 + $iconCls = $child->getAttribute("iconCls");
  217 +
192 218 if ($isLeaf) $isParameter = true;
  219 +
193 220 break;
194 221  
195 222 case 'timeTable':
... ... @@ -254,8 +281,16 @@ class AmdaAction
254 281 // }
255 282 }
256 283  
257   - if ($child->hasAttribute('units')) $info = $child->getAttribute('units');
258   -
  284 + if ($child->hasAttribute('units')) {
  285 +
  286 + $units = $child->getAttribute('units');
  287 +
  288 + if ($child->hasAttribute('description'))
  289 + $info = $child->getAttribute('description')."<br/>".$units;
  290 + else
  291 + $info = $units;
  292 + }
  293 +
259 294 if ($child->tagName == 'parameter') {
260 295 $isParameter = true;
261 296  
... ... @@ -313,6 +348,7 @@ class AmdaAction
313 348 }
314 349 }
315 350  
  351 +
316 352 if ($isParameter) {
317 353 $objectMgr = new AliasMgr();
318 354 $alias = $objectMgr->getAlias($id);
... ... @@ -561,7 +597,9 @@ class AmdaAction
561 597 }
562 598  
563 599 $childrenToReturn[] = array('text' => $name, 'id' => $id, 'nodeType' => $nodeType, 'info' => $info,
564   - 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2);
  600 + 'help' => $help, 'leaf' => $isLeaf, 'isParameter' => $isParameter, 'dim_1' => $dim_1, 'dim_2' => $dim_2, 'tabs' => $plotTabs,
  601 + 'component_info' => isset($component_info) ? $component_info : NULL,
  602 + 'iconCls' => isset($iconCls) ? $iconCls : NULL );
565 603 }
566 604 }
567 605 // if $childrenToReturn we have to return []
... ... @@ -757,6 +795,7 @@ class AmdaAction
757 795 break;
758 796 case 'condition' :
759 797 case 'request' :
  798 + case 'plottab' :
760 799 $objectMgr = new RequestMgr($obj->nodeType);
761 800 break;
762 801 case 'alias' :
... ... @@ -846,6 +885,7 @@ class AmdaAction
846 885 break;
847 886 case 'condition' :
848 887 case 'request' :
  888 + case 'plottab' :
849 889 $objectMgr = new RequestMgr($obj->nodeType);
850 890 break;
851 891 default:
... ... @@ -915,7 +955,8 @@ class AmdaAction
915 955 }
916 956  
917 957 private function executeRequest($obj, $function)
918   - {
  958 + {
  959 +
919 960 // Check user if access to DD Server and / or possible 'space consuming' action
920 961 if ( $function == FunctionTypeEnumClass::PARAMS ||
921 962 $function == FunctionTypeEnumClass::ACTION ||
... ...
php/classes/RequestMgr.php
... ... @@ -30,7 +30,7 @@ class RequestMgr extends AmdaObjectMgr
30 30 $this->attributes = array('name' => '');
31 31 $this->optionalAttributes = array();
32 32  
33   - if ($type == 'request')
  33 + if ($type == 'request' || $type == 'plottab')
34 34 {
35 35 $this->id_prefix = 'req_';
36 36 }
... ... @@ -70,6 +70,52 @@ class RequestMgr extends AmdaObjectMgr
70 70 {
71 71 return false;
72 72 }
  73 +
  74 + public function validNameObject($p)
  75 + {
  76 + if ($this->type == 'plottab') {
  77 + if (empty($p->name)) {
  78 + return array('valid' => false, 'error' => 'Name is required');
  79 + }
  80 + return array('valid' => true);
  81 + }
  82 + return parent::validNameObject($p);
  83 + }
  84 +
  85 + public function renameObject($p)
  86 + {
  87 + if ($this->type == 'plottab') {
  88 + //Rename a plot tab
  89 + if (!isset($p->parent) || empty($p->parent)) {
  90 + return array('error' => 'Missing parent definition');
  91 + }
  92 + $plotObj = $this->getObject($p->parent);
  93 + if (is_array($plotObj) && isset($plotObj['error'])) {
  94 + return array('error' => $plotObj['error']);
  95 + }
  96 + if (!isset($plotObj->tabs)) {
  97 + return array('error' => 'Cannot retrieve tab in plot request');
  98 + }
  99 + $renameOK = FALSE;
  100 + foreach ($plotObj->tabs as &$tab) {
  101 + if ($tab->id == $p->id) {
  102 + $tab->{'tab-name'} = $p->name;
  103 + $renameOK = TRUE;
  104 + break;
  105 + }
  106 + }
  107 + if (!$renameOK) {
  108 + return array('error' => 'Cannot retrieve tab in plot request 2');
  109 + }
  110 + //Save modification
  111 + $file = fopen(USERREQDIR.$p->parent, 'w');
  112 + fwrite($file, json_encode($plotObj));
  113 + fclose($file);
  114 +
  115 + return array('id' => $p->id);
  116 + }
  117 + return parent::renameObject($p);
  118 + }
73 119  
74 120 /* Stop Time from StartTime and Interval*/
75 121 public function convertTime($obj)
... ... @@ -144,7 +190,7 @@ class RequestMgr extends AmdaObjectMgr
144 190 * Make new request/condition resource file (JSON!!) and add it to content file
145 191 * ATTENTION : it is not DD parameter!!!
146 192 */
147   - protected function createParameter($p)
  193 + protected function createParameter($p, $folder)
148 194 {
149 195 if ($this -> objectExistsByName($p->name))
150 196 {
... ... @@ -177,6 +223,19 @@ class RequestMgr extends AmdaObjectMgr
177 223 }
178 224 }
179 225 }
  226 +
  227 + $additional = array();
  228 + if ($this->type == 'request') {
  229 + $additional['tabs'] = array();
  230 + if (isset($p->tabs)) {
  231 + foreach ($p->tabs as $index => $tab) {
  232 + $additional['tabs'][$index] = array(
  233 + "name" => (!empty($tab->{'tab-name'})) ? $tab->{'tab-name'} : "Plot ".($index+1),
  234 + "id" => $tab->id,
  235 + );
  236 + }
  237 + }
  238 + }
180 239  
181 240 $this->descFileName = USERREQDIR.$this->id;
182 241 $p->id = $this->id;
... ... @@ -184,10 +243,10 @@ class RequestMgr extends AmdaObjectMgr
184 243 $file = fopen($this->descFileName, 'w');
185 244 fwrite($file, json_encode($p));
186 245 fclose($file);
187   -
  246 +
188 247 $this -> addToContent($p, $folder);
189 248  
190   - return array('id' => $this->id, 'info' => $info);
  249 + return array('id' => $this->id, 'info' => $info) + $additional;
191 250 }
192 251  
193 252 public static function checkRequest($obj)
... ... @@ -225,7 +284,7 @@ class RequestMgr extends AmdaObjectMgr
225 284 {
226 285 $argsTab['param'] = array_unique($params);
227 286 $argsTab['startTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->startDate;
228   - $argsTab['stopTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->stopDate;
  287 + $argsTab['stopTime'] = $tab->{'multi-plot-linked'} ? $obj->stopDate : $tab->stopDate;
229 288 }
230 289 }
231 290 if (count($argsTab) > 0) $args[] = $argsTab;
... ... @@ -255,8 +314,8 @@ class RequestMgr extends AmdaObjectMgr
255 314 {
256 315 // tab is not defined, iterate over $obj->tabs?
257 316 $argsTab['param'] = array_unique($params);
258   - $argsTab['startTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->startDate;
259   - $argsTab['stopTime'] = $tab->{'multi-plot-linked'} ? $obj->startDate : $tab->stopDate;
  317 + $argsTab['startTime'] = $obj->startDate;
  318 + $argsTab['stopTime'] = $obj->stopDate;
260 319 }
261 320 if (count($argsTab) > 0) $args[] = $argsTab;
262 321  
... ...
php/classes/TimeTableMgr.php
... ... @@ -452,10 +452,11 @@ class TimeTableMgr extends AmdaObjectMgr
452 452 $attributesToReturn['folderId'] = $folderId;
453 453  
454 454 if (!$onlyDescription) {
455   - $intNodes = $dom->getElementsByTagName('intervals');
  455 + $xpath = new DOMXPath($dom);
456 456  
457   - /** @var DOMElement $intNode */
458   - foreach ($intNodes as $intNode) {
  457 + $intervals = $xpath->query('//intervals');
  458 +
  459 + foreach ($intervals as $intNode) {
459 460 $startNodes = $intNode->getElementsByTagName('start');
460 461 if ($startNodes->length <= 0) {
461 462 return ['error' => 'Error detected in result file'];
... ...
php/config.php
... ... @@ -63,7 +63,7 @@ define(&#39;EPNTAP_APIS&#39;, &#39;http://voparis-tap.obspm.fr/__system__/tap/run/tap/sync&#39;)
63 63 define('EPNTAP_AMDA', 'http://cdpp-epntap.irap.omp.eu/__system__/tap/run/tap/sync');
64 64  
65 65 // PHP run-time settings
66   -ini_set('memory_limit',128000000);
  66 +ini_set('memory_limit',256000000);
67 67 ini_set('max_execution_time',600); // max PHP execution
68 68  
69 69 ini_set('default_socket_timeout', 600); //TODO if this is needed ? IMPEX LONG DURATION WEBSERVICES
... ...