Commit 2c36794b28d43c2898a0346bb7a5cfb6570d279a
Exists in
master
and in
111 other branches
Merge branch 'remote_bases'
Showing
21 changed files
with
2637 additions
and
2616 deletions
Show diff stats
desktop.php
@@ -30,15 +30,13 @@ | @@ -30,15 +30,13 @@ | ||
30 | <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css" /> | 30 | <link rel="stylesheet" type="text/css" href="js/lib/ext/resources/css/ext-all.css" /> |
31 | <link rel="icon" href="favicon.ico" type="image/x-icon"> | 31 | <link rel="icon" href="favicon.ico" type="image/x-icon"> |
32 | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | 32 | <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> |
33 | - | ||
34 | -<!-- <script type="text/javascript" src="js/lib/ext/builds/ext-core.js"></script> --> | ||
35 | -<!-- <script type="text/javascript" src="js/lib/ext/bootstrap.js"></script> --> | ||
36 | -<!-- <script type="text/javascript" src="js/lib/ext/ext-all-debug-w-comments.js"></script> --> | ||
37 | - <script type="text/javascript" src="js/lib/ext/ext-all.js"></script> | ||
38 | - <!-- <script type="text/javascript" src="js/lib/ext/ext-all-dev.js"> --> | ||
39 | - <!-- <script type="text/javascript" src="js/lib/ext-override.js"></script> --> | ||
40 | - | ||
41 | 33 | ||
34 | +<!-- <script type="text/javascript" src="js/lib/ext/builds/ext-core.js"></script> --> | ||
35 | +<!-- <script type="text/javascript" src="js/lib/ext/bootstrap.js"></script> --> | ||
36 | + <script type="text/javascript" src="js/lib/ext/ext-all-debug-w-comments.js"></script>--> | ||
37 | +<!-- <script type="text/javascript" src="js/lib/ext/ext-all.js"></script> --> | ||
38 | +<!-- <script type="text/javascript" src="js/lib/ext/ext-all-dev.js"> --> | ||
39 | +<!-- <script type="text/javascript" src="js/lib/ext-override.js"></script> --> | ||
42 | 40 | ||
43 | <!-- Direct API --> | 41 | <!-- Direct API --> |
44 | <script type="text/javascript" src="php/api.php"></script> | 42 | <script type="text/javascript" src="php/api.php"></script> |
generic_data/Functions/functions.xml
@@ -105,6 +105,10 @@ | @@ -105,6 +105,10 @@ | ||
105 | <info_brief>Arc-tangent</info_brief> | 105 | <info_brief>Arc-tangent</info_brief> |
106 | <new_kernel>atan</new_kernel> | 106 | <new_kernel>atan</new_kernel> |
107 | </function> | 107 | </function> |
108 | + <function name="atan2(,)" kind="idl"> | ||
109 | + <info_brief>Arc-tangent</info_brief> | ||
110 | + <new_kernel>atan_2f</new_kernel> | ||
111 | + </function> | ||
108 | <function name="cos()" kind="idl"> | 112 | <function name="cos()" kind="idl"> |
109 | <info_brief>cosine</info_brief> | 113 | <info_brief>cosine</info_brief> |
110 | <new_kernel>cos</new_kernel> | 114 | <new_kernel>cos</new_kernel> |
@@ -113,11 +117,11 @@ | @@ -113,11 +117,11 @@ | ||
113 | <info_brief>Hyperbolic cosine</info_brief> | 117 | <info_brief>Hyperbolic cosine</info_brief> |
114 | <new_kernel>cosh</new_kernel> | 118 | <new_kernel>cosh</new_kernel> |
115 | </function> | 119 | </function> |
116 | - <function name="deriv_()" kind="idl"> | 120 | + <!--<function name="deriv_()" kind="idl"> |
117 | <prompt/> | 121 | <prompt/> |
118 | <info_brief>deriv() function with possibly unequal point spacing</info_brief> | 122 | <info_brief>deriv() function with possibly unequal point spacing</info_brief> |
119 | <new_kernel>#deriv</new_kernel> | 123 | <new_kernel>#deriv</new_kernel> |
120 | - </function> | 124 | + </function>--> |
121 | <function name="exp()" kind="idl"> | 125 | <function name="exp()" kind="idl"> |
122 | <info_brief>Natural exponential function</info_brief> | 126 | <info_brief>Natural exponential function</info_brief> |
123 | <new_kernel>exp</new_kernel> | 127 | <new_kernel>exp</new_kernel> |
generic_data/SpecialSettings/Groups.xml
1 | <?xml version="1.0"?> | 1 | <?xml version="1.0"?> |
2 | <groups> | 2 | <groups> |
3 | -<!-- <group xml:id="Rosetta"><folder name="WS"/><folder name="REQ"/></group>--> | 3 | + <!--<group xml:id="Rosetta"><folder name="WS"/><folder name="REQ"/></group>--> |
4 | + <group xml:id="CU"><folder name="WS"/><folder name="TT"/></group> | ||
4 | </groups> | 5 | </groups> |
index.html
1 | -<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Welcome on Amda</title> <link href="js/resources/css/AccueilAmda.css" rel="stylesheet" type="text/css"> <!-- Login --> <link rel="stylesheet" type="text/css" href="js/resources/css/login.css" /> <link rel="icon" href="favicon.ico" type="image/x-icon"> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> </head> <body> <div id="centrage"> <div id="trou"> <div id="couvercle"></div> <div id="TousLesBoutons"> <div id="Btn_FirstVisit" onclick="location.href='help.html';""></div> <div id="Btn_Rules" onclick="location.href='help/policy.html';"></div> <form method="POST" action="desktop.php"> <input type="text" name="username" placeholder="LOGIN" id="Btn_EnterLogin" class="PlaceHolder" /> <input type="password" name="password" placeholder="PASSWORD" id="Btn_EnterPassword" class="PlaceHolder"/> <div><input id="Btn_Login" type="submit" value=""/></div> </form> <a href="mailto:amda@irap.omp.eu?subject=AMDA registration" id="Btn_Register"></a> <a href="mailto:amda@irap.omp.eu?subject=AMDA contact" id="Btn_Contact"></a> <a href="http://cdpp.eu/" id="Logo_CDPP"></a> <div id="PaveGuest"> <div id="TitrePaveGuest">Try AMDA as a guest</div> <div id="TextePaveGuest">login: guest</div> <div id="TextePaveGuest">password : your e-mail address</div> </div> <div id="Logos_partenaires"></div> <div id="PaveAnnoucements"> <div id="TitrePaveAnnoucement">Announcements </div> <div id="DateAnnoucement">12/05/2016</div> <div id="TexteAnnoucement">New instance for CU tests </div> </div> </div><!--TousLesBoutons--> </div><!--trou--> </div><!--centrage--> </body> </html> | ||
2 | \ No newline at end of file | 1 | \ No newline at end of file |
2 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ||
3 | +<html> | ||
4 | +<head> | ||
5 | +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||
6 | +<title>AmdaNG Login</title> | ||
7 | + | ||
8 | +<!-- Login --> | ||
9 | +<link rel="stylesheet" type="text/css" href="js/resources/css/login.css" /> | ||
10 | +<link rel="icon" href="favicon.ico" type="image/x-icon"> | ||
11 | +<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> | ||
12 | +<!--<script type="text/javascript" src="client/misc/cookies.js"></script> --> | ||
13 | +<!--<script type="text/javascript" src="js/login/login.js"></script>--> | ||
14 | +</head> | ||
15 | + | ||
16 | +<body> | ||
17 | +<div id="qo-panel"> | ||
18 | + <!--<img alt="" src="js/resources/images/default/s.gif" class="qo-logo qo-abs-position" />--> | ||
19 | + <span class="qo-supported qo-abs-position"> | ||
20 | + <b>Supported Browsers</b><br /> | ||
21 | + <a href="http://www.mozilla.org/download.html" target="_blank">Firefox</a><br/> | ||
22 | + <!--<a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx" target="_blank">Internet Explorer 7+</a><br />--> | ||
23 | + <!--<a href="http://www.opera.com/download/" target="_blank">Opera 9+</a><br />--> | ||
24 | + <a href="http://www.apple.com/safari/download/" target="_blank">Safari</a><br/> | ||
25 | + <a href="http://www.google.com/chrome/" target="_blank">Google-Chrome</a> | ||
26 | + </span> | ||
27 | + | ||
28 | + <a href="http://www.extjs.com/" target="_blank"> | ||
29 | + <img alt="" src="js/resources/images/s.gif" class="qo-extjs-logo qo-abs-position" /></a> | ||
30 | + <span class="qo-library qo-abs-position"> | ||
31 | + built with the <a href="http://www.extjs.com/" target="_blank">Ext JS</a> library. | ||
32 | + </span> | ||
33 | + | ||
34 | + <span class="qo-signup-link qo-abs-position"> | ||
35 | + <a href="signup.html">I want to sign up</a> | ||
36 | + </span> | ||
37 | + | ||
38 | + <span class="qo-forgot-link qo-abs-position"> | ||
39 | + <a href="forgot-password.html">I forgot my password</a> | ||
40 | + </span> | ||
41 | + <form method="POST" action="desktop.php"> | ||
42 | + <label id="field1-label" class="qo-abs-position">Login</label> | ||
43 | + <input class="qo-abs-position" type="text" name="username" id="field1" /> | ||
44 | + | ||
45 | + <label id="field2-label" class="qo-abs-position">Password</label> | ||
46 | + <input class="qo-abs-position" type="password" name="password" id="field2" /> | ||
47 | + <input id="submitBtn" class="qo-submit qo-abs-position" type="submit" value=""/> | ||
48 | + </form> | ||
49 | + | ||
50 | + <!--<input id="resetBtn" class="qo-reset qo-abs-position" type="image" src="js/resources/images/s.gif" />--> | ||
51 | +</div> | ||
52 | + | ||
53 | +</body> | ||
54 | +</html> | ||
3 | \ No newline at end of file | 55 | \ No newline at end of file |
js/app/controllers/InteropModule.js
@@ -6,10 +6,6 @@ | @@ -6,10 +6,6 @@ | ||
6 | * @brief Interop Module controller definition | 6 | * @brief Interop Module controller definition |
7 | * @author Benjamin RENARD | 7 | * @author Benjamin RENARD |
8 | * $Id: InteropModule.js 1870 2013-11-22 13:43:34Z elena $ | 8 | * $Id: InteropModule.js 1870 2013-11-22 13:43:34Z elena $ |
9 | - ***************************************************************************** | ||
10 | - * FT Id : Date : Name - Description | ||
11 | - ******************************************************************************* | ||
12 | - * 23/04/2012: BRE - file creation | ||
13 | */ | 9 | */ |
14 | 10 | ||
15 | 11 | ||
@@ -17,17 +13,17 @@ Ext.define('amdaDesktop.InteropModule', { | @@ -17,17 +13,17 @@ Ext.define('amdaDesktop.InteropModule', { | ||
17 | extend: 'amdaDesktop.AmdaModule', | 13 | extend: 'amdaDesktop.AmdaModule', |
18 | 14 | ||
19 | requires: [ | 15 | requires: [ |
20 | - 'amdaUI.InteropUI', | ||
21 | - 'amdaDesktop.SampModule', | 16 | + 'amdaUI.InteropUI', |
17 | + 'amdaDesktop.SampModule', | ||
22 | 'amdaDesktop.EpnTapModule' | 18 | 'amdaDesktop.EpnTapModule' |
23 | - ], | 19 | + ], |
24 | 20 | ||
25 | contentId : 'interopUI', | 21 | contentId : 'interopUI', |
26 | 22 | ||
27 | - /** | ||
28 | - * @cfg {String} window definitions | ||
29 | - * @required | ||
30 | - */ | 23 | + /** |
24 | + * @cfg {String} window definitions | ||
25 | + * @required | ||
26 | + */ | ||
31 | // height: 650, | 27 | // height: 650, |
32 | // width: 1050, | 28 | // width: 1050, |
33 | uiType : 'panelInterop', | 29 | uiType : 'panelInterop', |
@@ -38,206 +34,201 @@ Ext.define('amdaDesktop.InteropModule', { | @@ -38,206 +34,201 @@ Ext.define('amdaDesktop.InteropModule', { | ||
38 | 34 | ||
39 | sampclientsStore : new Ext.data.SimpleStore({ | 35 | sampclientsStore : new Ext.data.SimpleStore({ |
40 | idProperty: 'id', | 36 | idProperty: 'id', |
41 | - fields: [ | ||
42 | - {name: 'id'}, | ||
43 | - {name: 'name'}, | ||
44 | - {name: 'descriptionText'}, | ||
45 | - {name: 'iconUrl'}, | ||
46 | - {name: 'acceptVOTable', type : 'boolean'}, | ||
47 | - {name: 'acceptFITS', type : 'boolean'} | ||
48 | - ] | ||
49 | - }), | 37 | + fields: [ |
38 | + {name: 'id'}, | ||
39 | + {name: 'name'}, | ||
40 | + {name: 'descriptionText'}, | ||
41 | + {name: 'iconUrl'}, | ||
42 | + {name: 'acceptVOTable', type : 'boolean'}, | ||
43 | + {name: 'acceptFITS', type : 'boolean'} | ||
44 | + ] | ||
45 | + }), | ||
50 | 46 | ||
51 | init : function() { | 47 | init : function() { |
52 | - this.launcher = { | ||
53 | - text : this.title, | ||
54 | - iconCls : this.icon, | ||
55 | - handler : this.createWindow, | ||
56 | - scope : this | 48 | + this.launcher = { |
49 | + text : this.title, | ||
50 | + iconCls : this.icon, | ||
51 | + handler : this.createWindow, | ||
52 | + scope : this | ||
57 | }; | 53 | }; |
58 | - }, | ||
59 | - | ||
60 | - initSampConnector : function(successfn) | ||
61 | - { | ||
62 | - var me = this; | ||
63 | - if (!this.samp) | ||
64 | - { | ||
65 | - this.samp = Ext.create('amdaDesktop.SampModule',{ | ||
66 | - listeners : { | ||
67 | - connected : function(o,success) | ||
68 | - { | ||
69 | - if (!success) | ||
70 | - Ext.Msg.show( { | ||
71 | - title : 'SAMP', | ||
72 | - msg : 'Cannot connect AMDA to a hub', | ||
73 | - modal : false, | ||
74 | - icon : Ext.Msg.ERROR, | ||
75 | - buttons : Ext.Msg.OK | ||
76 | - }); | ||
77 | - me.updateStatus(); | ||
78 | - me.updateClients(); | ||
79 | - }, | ||
80 | - disconnected : function(o,success) | ||
81 | - { | ||
82 | - me.updateStatus(); | ||
83 | - me.sampclientsStore.removeAll(); | ||
84 | - me.updateClients(); | ||
85 | - }, | ||
86 | - clientregister : function(o,id) | ||
87 | - { | ||
88 | - me.updateClients(); | ||
89 | - }, | ||
90 | - clientunregister : function(o,id) | ||
91 | - { | ||
92 | - var record = me.sampclientsStore.getById(id); | ||
93 | - if (record) | ||
94 | - { | ||
95 | - me.sampclientsStore.remove(record); | ||
96 | - me.updateClients(); | ||
97 | - } | ||
98 | - }, | ||
99 | - clientmetachange : function(o,id,data,subs) | ||
100 | - { | ||
101 | - var record = me.sampclientsStore.getById(id); | ||
102 | - | ||
103 | - if (!record) | ||
104 | - { | ||
105 | - me.sampclientsStore.add({id : id}); | ||
106 | - record = me.sampclientsStore.getById(id); | ||
107 | - } | ||
108 | - | ||
109 | - if (record) | ||
110 | - { | ||
111 | - record.set('descriptionText',data['samp.description.text']); | ||
112 | - record.set('iconUrl',data['samp.icon.url']); | ||
113 | - record.set('name',data['samp.name']); | ||
114 | - if (subs) | ||
115 | - { | ||
116 | - record.set('acceptVOTable', | ||
117 | - me.samp.isSubscribed(subs,"table.load.votable")); | ||
118 | - record.set('acceptFITS', | ||
119 | - me.samp.isSubscribed(subs,"image.load.fits")); | ||
120 | - } | ||
121 | - } | ||
122 | - | ||
123 | - me.updateClients(); | ||
124 | - }, | ||
125 | - clientsubs : function(o,id,data) | ||
126 | - { | ||
127 | - var record = me.sampclientsStore.getById(id); | ||
128 | - | ||
129 | - if (!record) | ||
130 | - return; | ||
131 | - | ||
132 | - if (record) | ||
133 | - { | ||
134 | - record.set('acceptVOTable', | ||
135 | - me.samp.isSubscribed(data,"table.load.votable")); | ||
136 | - record.set('acceptFITS', | ||
137 | - me.samp.isSubscribed(data,"image.load.fits")); | ||
138 | - } | ||
139 | - | ||
140 | - me.updateClients(); | ||
141 | - }, | ||
142 | - uploadfile : function(o,clientName,url,format) | ||
143 | - { | ||
144 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) { | ||
145 | - module.uploadNotification(url,format); | ||
146 | - }); | ||
147 | - } | ||
148 | - } | ||
149 | - }); | ||
150 | - this.samp.loadScript(function (s){ | ||
151 | - if (successfn) | ||
152 | - successfn.call(me.samp); | ||
153 | - }); | ||
154 | - } | ||
155 | - else | ||
156 | - this.samp.loadScript(function (s){ | ||
157 | - if (successfn) | ||
158 | - successfn.call(me.samp); | ||
159 | - }); | ||
160 | - }, | ||
161 | - | ||
162 | - updateStatus : function() | ||
163 | - { | ||
164 | - if (this.app && this.samp) | ||
165 | - { | ||
166 | - var desktop = this.app.getDesktop(); | ||
167 | - | ||
168 | - var isConnected = this.samp.isConnected(); | ||
169 | - | ||
170 | - if (desktop) | ||
171 | - { | ||
172 | - var win = desktop.getWindow(this.id); | ||
173 | - if (win && win.isVisible) | ||
174 | - win.items.items[0].updateStatus(isConnected); | ||
175 | - | ||
176 | - var taskbar = desktop.taskbar; | ||
177 | - | ||
178 | - if (taskbar) | ||
179 | - { | ||
180 | - var samptb = taskbar.getComponent('samptb'); | ||
181 | - if (samptb) | ||
182 | - samptb.updateStatus(isConnected); | ||
183 | - } | ||
184 | - } | ||
185 | - } | ||
186 | - }, | ||
187 | - | ||
188 | - updateClients : function() | ||
189 | - { | ||
190 | - if (this.app && this.samp) | ||
191 | - { | ||
192 | - var desktop = this.app.getDesktop(); | ||
193 | - | ||
194 | - var isConnected = this.samp.isConnected(); | ||
195 | - | ||
196 | - if (desktop) | ||
197 | - { | ||
198 | - var win = desktop.getWindow(this.id); | ||
199 | - | ||
200 | - var taskbar = desktop.taskbar; | ||
201 | - | ||
202 | - if (taskbar) | ||
203 | - { | ||
204 | - var samptb = taskbar.getComponent('samptb'); | ||
205 | - if (samptb) | ||
206 | - samptb.updateClients(this.sampclientsStore); | ||
207 | - } | ||
208 | - } | ||
209 | - } | ||
210 | - }, | ||
211 | - | ||
212 | - sampConnected : function() | ||
213 | - { | ||
214 | - if (!this.samp) | ||
215 | - return false; | ||
216 | - return this.samp.isConnected(); | ||
217 | - }, | ||
218 | - | ||
219 | - sendVOTable : function(file,clientId) | ||
220 | - { | ||
221 | - if (!this.samp) | ||
222 | - return false; | ||
223 | - var href = window.location.href; | ||
224 | - var baseurl = href.replace('desktop.php',''); | ||
225 | - this.samp.sendVOTable(baseurl+file,clientId); | ||
226 | - }, | ||
227 | - | ||
228 | - sendAladinScript : function(script) | ||
229 | - { | ||
230 | - if (!this.samp) | ||
231 | - return false; | ||
232 | - this.samp.sendAladinScript(script); | ||
233 | - }, | ||
234 | - | ||
235 | - sendFITS : function(url,name) | ||
236 | - { | ||
237 | - if (!this.samp) | ||
238 | - return false; | ||
239 | - this.samp.sendFITS(url,name); | ||
240 | - }, | 54 | + }, |
55 | + | ||
56 | + initSampConnector : function(successfn){ | ||
57 | + var me = this; | ||
58 | + | ||
59 | + if (!this.samp) | ||
60 | + { | ||
61 | + this.samp = Ext.create('amdaDesktop.SampModule',{ | ||
62 | + listeners : { | ||
63 | + connected : function(o,success) | ||
64 | + { | ||
65 | + if (!success) | ||
66 | + Ext.Msg.show( { | ||
67 | + title : 'SAMP', | ||
68 | + msg : 'Cannot connect AMDA to a hub', | ||
69 | + modal : false, | ||
70 | + icon : Ext.Msg.ERROR, | ||
71 | + buttons : Ext.Msg.OK | ||
72 | + }); | ||
73 | + me.updateStatus(); | ||
74 | + me.updateClients(); | ||
75 | + }, | ||
76 | + disconnected : function(o,success) | ||
77 | + { | ||
78 | + me.updateStatus(); | ||
79 | + me.sampclientsStore.removeAll(); | ||
80 | + me.updateClients(); | ||
81 | + }, | ||
82 | + clientregister : function(o,id) | ||
83 | + { | ||
84 | + me.updateClients(); | ||
85 | + }, | ||
86 | + clientunregister : function(o,id) | ||
87 | + { | ||
88 | + var record = me.sampclientsStore.getById(id); | ||
89 | + if (record) | ||
90 | + { | ||
91 | + me.sampclientsStore.remove(record); | ||
92 | + me.updateClients(); | ||
93 | + } | ||
94 | + }, | ||
95 | + clientmetachange : function(o,id,data,subs) | ||
96 | + { | ||
97 | + var record = me.sampclientsStore.getById(id); | ||
98 | + | ||
99 | + if (!record){ | ||
100 | + me.sampclientsStore.add({id : id}); | ||
101 | + record = me.sampclientsStore.getById(id); | ||
102 | + } | ||
103 | + | ||
104 | + if (record){ | ||
105 | + record.set('descriptionText',data['samp.description.text']); | ||
106 | + record.set('iconUrl',data['samp.icon.url']); | ||
107 | + record.set('name',data['samp.name']); | ||
108 | + | ||
109 | + if (subs){ | ||
110 | + record.set('acceptVOTable', | ||
111 | + me.samp.isSubscribed(subs,"table.load.votable")); | ||
112 | + record.set('acceptFITS', | ||
113 | + me.samp.isSubscribed(subs,"image.load.fits")); | ||
114 | + } | ||
115 | + } | ||
116 | + | ||
117 | + me.updateClients(); | ||
118 | + }, | ||
119 | + clientsubs : function(o,id,data) | ||
120 | + { | ||
121 | + var record = me.sampclientsStore.getById(id); | ||
122 | + | ||
123 | + if (!record) | ||
124 | + return; | ||
125 | + | ||
126 | + if (record){ | ||
127 | + record.set('acceptVOTable', | ||
128 | + me.samp.isSubscribed(data,"table.load.votable")); | ||
129 | + record.set('acceptFITS', | ||
130 | + me.samp.isSubscribed(data,"image.load.fits")); | ||
131 | + } | ||
132 | + | ||
133 | + me.updateClients(); | ||
134 | + }, | ||
135 | + uploadfile : function(o,clientName,url,format) | ||
136 | + { | ||
137 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.upload.id, true, function (module) { | ||
138 | + module.uploadNotification(url,format); | ||
139 | + }); | ||
140 | + } | ||
141 | + } | ||
142 | + }); | ||
143 | + this.samp.loadScript(function (s){ | ||
144 | + if (successfn) | ||
145 | + successfn.call(me.samp); | ||
146 | + }); | ||
147 | + } | ||
148 | + else | ||
149 | + this.samp.loadScript(function (s){ | ||
150 | + if (successfn) | ||
151 | + successfn.call(me.samp); | ||
152 | + }); | ||
153 | + }, | ||
154 | + | ||
155 | + updateStatus : function() | ||
156 | + { | ||
157 | + if (this.app && this.samp) | ||
158 | + { | ||
159 | + var desktop = this.app.getDesktop(); | ||
160 | + | ||
161 | + var isConnected = this.samp.isConnected(); | ||
162 | + | ||
163 | + if (desktop){ | ||
164 | + var win = desktop.getWindow(this.id); | ||
165 | + if (win && win.isVisible) | ||
166 | + win.items.items[0].updateStatus(isConnected); | ||
167 | + | ||
168 | + var taskbar = desktop.taskbar; | ||
169 | + | ||
170 | + if (taskbar){ | ||
171 | + var samptb = taskbar.getComponent('samptb'); | ||
172 | + if (samptb) | ||
173 | + samptb.updateStatus(isConnected); | ||
174 | + } | ||
175 | + } | ||
176 | + } | ||
177 | + }, | ||
178 | + | ||
179 | + updateClients : function() | ||
180 | + { | ||
181 | + if (this.app && this.samp) | ||
182 | + { | ||
183 | + var desktop = this.app.getDesktop(); | ||
184 | + | ||
185 | + var isConnected = this.samp.isConnected(); | ||
186 | + | ||
187 | + if (desktop) | ||
188 | + { | ||
189 | + var win = desktop.getWindow(this.id); | ||
190 | + | ||
191 | + var taskbar = desktop.taskbar; | ||
192 | + | ||
193 | + if (taskbar) | ||
194 | + { | ||
195 | + var samptb = taskbar.getComponent('samptb'); | ||
196 | + if (samptb) | ||
197 | + samptb.updateClients(this.sampclientsStore); | ||
198 | + } | ||
199 | + } | ||
200 | + } | ||
201 | + }, | ||
202 | + | ||
203 | + sampConnected : function() | ||
204 | + { | ||
205 | + if (!this.samp) | ||
206 | + return false; | ||
207 | + return this.samp.isConnected(); | ||
208 | + }, | ||
209 | + | ||
210 | + sendVOTable : function(file,clientId) | ||
211 | + { | ||
212 | + if (!this.samp) | ||
213 | + return false; | ||
214 | + var href = window.location.href; | ||
215 | + var baseurl = href.replace('desktop.php',''); | ||
216 | + this.samp.sendVOTable(baseurl+file,clientId); | ||
217 | + }, | ||
218 | + | ||
219 | + sendAladinScript : function(script) | ||
220 | + { | ||
221 | + if (!this.samp) | ||
222 | + return false; | ||
223 | + this.samp.sendAladinScript(script); | ||
224 | + }, | ||
225 | + | ||
226 | + sendFITS : function(url,name) | ||
227 | + { | ||
228 | + if (!this.samp) | ||
229 | + return false; | ||
230 | + this.samp.sendFITS(url,name); | ||
231 | + }, | ||
241 | 232 | ||
242 | loadEpnTap: function(filter) { | 233 | loadEpnTap: function(filter) { |
243 | if(!this.epntap) { | 234 | if(!this.epntap) { |
@@ -246,81 +237,9 @@ Ext.define('amdaDesktop.InteropModule', { | @@ -246,81 +237,9 @@ Ext.define('amdaDesktop.InteropModule', { | ||
246 | this.epntap.loadTarget(filter); | 237 | this.epntap.loadTarget(filter); |
247 | }, | 238 | }, |
248 | 239 | ||
249 | - generateAladinScript : function(urlList, scriptType) | ||
250 | - { | ||
251 | - /*var script="reset;"; //reset all views & all planes | ||
252 | - // first get files | ||
253 | - var scriptHead=''; | ||
254 | - //var script="#AJS;\n"; | ||
255 | - //scriptHead+="trace 3;"; // | ||
256 | - for( var i=0; i < urlList.length; i++) | ||
257 | - { | ||
258 | - var url = urlList[i].url; | ||
259 | - var name = urlList[i].name; | ||
260 | - scriptHead += 'get File(' + url +','+name+');'; | ||
261 | - scriptHead += 'sync;'; | ||
262 | - }*/ | ||
263 | - | ||
264 | - //scriptHead += 'sync;'; | ||
265 | - | ||
266 | - /*for( var i=0; i < urlList.length; i++) | ||
267 | - { | ||
268 | - //then modify some fits values | ||
269 | - var name = urlList[i].name; | ||
270 | - scriptHead += 'set '+name+' FITS:CRVAL1=0;'; | ||
271 | - scriptHead += 'set '+name+' FITS:CRVAL2=0;'; | ||
272 | - }*/ | ||
273 | - | ||
274 | - //scriptHead += 'sync;'; | ||
275 | - | ||
276 | - // add som method specific lines | ||
277 | - /*switch( scriptType ) | ||
278 | - { | ||
279 | - case( 'mosaic' ): | ||
280 | - // first insert the modeview | ||
281 | - script += "mview 16;"; | ||
282 | - // then download the files | ||
283 | - script += scriptHead; | ||
284 | - //for( var i=0; i < urlList.length; i++){ | ||
285 | - // // we also shall position each image in the grid | ||
286 | - // var gridCols = ["A", "B", "C", "D"]; | ||
287 | - // var colIndex = i%4; | ||
288 | - // var lineIndex = 1+Math.floor(i/4); | ||
289 | - // script += "cview "+i+" "+gridCols[colIndex]+lineIndex+";\n"; | ||
290 | - //} | ||
291 | - break; | ||
292 | - | ||
293 | - case( 'movie' ): | ||
294 | - // download first | ||
295 | - script += scriptHead; | ||
296 | - script += 'blink '; | ||
297 | - for( var i=1; i < urlList.length; i++){ | ||
298 | - script += urlList[i].name+" "; | ||
299 | - } | ||
300 | - script += ';'; | ||
301 | - break; | ||
302 | - | ||
303 | - case( 'diff' ): | ||
304 | - // download first | ||
305 | - script += scriptHead; | ||
306 | - for( var i=1; i < urlList.length; i++){ | ||
307 | - var diffName = 'diff' + i; | ||
308 | - var currRawName = urlList[i].name; | ||
309 | - var prevRawNum = i-1; | ||
310 | - var prevRawName = urlList[prevRawNum].name; | ||
311 | - script += diffName + ' = ' + currRawName + ' - ' + prevRawName + ';\n'; | ||
312 | - } | ||
313 | - script += 'sync;'; | ||
314 | - script += 'diff_movie = blink '; | ||
315 | - for( var i=1; i < urlList.length; i++){ | ||
316 | - script += 'diff'+i+' '; | ||
317 | - } | ||
318 | - script += ';'; | ||
319 | - break; | ||
320 | - } | ||
321 | - //script += 'sync;';*/ | ||
322 | - | ||
323 | - var script = 'reset;'; | 240 | + generateAladinScript : function(urlList, scriptType) |
241 | + { | ||
242 | + var script = 'reset;'; | ||
324 | 243 | ||
325 | for( var i=0; i < urlList.length; i++) { | 244 | for( var i=0; i < urlList.length; i++) { |
326 | var url = urlList[i].url; | 245 | var url = urlList[i].url; |
@@ -328,162 +247,149 @@ Ext.define('amdaDesktop.InteropModule', { | @@ -328,162 +247,149 @@ Ext.define('amdaDesktop.InteropModule', { | ||
328 | script += 'get File(' + url +','+name+');'; | 247 | script += 'get File(' + url +','+name+');'; |
329 | } | 248 | } |
330 | 249 | ||
331 | - script += 'sync;'; | ||
332 | - | ||
333 | - /*for( var i=0; i < urlList.length; i++) | ||
334 | - { | ||
335 | - //then modify some fits values | ||
336 | - var name = urlList[i].name; | ||
337 | - script += 'set '+name+' FITS:CRPIX1=100;'; | ||
338 | - script += 'set '+name+' FITS:CRPIX2=0;'; | ||
339 | - }*/ | ||
340 | - | ||
341 | - switch( scriptType ) | ||
342 | - { | ||
343 | - case('mosaic'): | ||
344 | - { | ||
345 | - | ||
346 | - script += 'sync;mview 16'; | ||
347 | - } | ||
348 | - break; | ||
349 | - case('movie'): | ||
350 | - { | ||
351 | - script += 'blink '; | ||
352 | - for( var i=1; i < urlList.length; i++){ | ||
353 | - script += urlList[i].name+" "; | ||
354 | - } | ||
355 | - script += ';'; | ||
356 | - } | ||
357 | - break; | ||
358 | - } | ||
359 | - | ||
360 | - | ||
361 | - | ||
362 | - return script; | 250 | + script += 'sync;'; |
251 | + switch( scriptType ) | ||
252 | + { | ||
253 | + case('mosaic'): | ||
254 | + { | ||
255 | + script += 'sync;mview 16'; | ||
256 | + } | ||
257 | + break; | ||
258 | + case('movie'): | ||
259 | + { | ||
260 | + script += 'blink '; | ||
261 | + for( var i=1; i < urlList.length; i++){ | ||
262 | + script += urlList[i].name+" "; | ||
263 | + } | ||
264 | + script += ';'; | ||
265 | + } | ||
266 | + break; | ||
267 | + } | ||
268 | + return script; | ||
269 | + }, | ||
270 | + | ||
271 | + switchSampConnect : function() | ||
272 | + { | ||
273 | + var me = this; | ||
274 | + //loadMask.show(); | ||
275 | + this.initSampConnector(function (s){ | ||
276 | + if (me.samp.isConnected()) | ||
277 | + { | ||
278 | + me.samp.disconnect(); | ||
279 | + } | ||
280 | + else | ||
281 | + { | ||
282 | + me.samp.connect(); | ||
283 | + // loadMask.hide(); | ||
284 | + } | ||
285 | + }); | ||
286 | + }, | ||
287 | + | ||
288 | + forceSampDisconnect : function() | ||
289 | + { | ||
290 | + if (!this.samp) | ||
291 | + return; | ||
292 | + | ||
293 | + if (!this.samp.isConnected()) | ||
294 | + return; | ||
295 | + | ||
296 | + this.samp.disconnect(); | ||
363 | }, | 297 | }, |
364 | 298 | ||
365 | - switchSampConnect : function() | ||
366 | - { | ||
367 | - var me = this; | ||
368 | - //loadMask.show(); | ||
369 | - this.initSampConnector(function (s){ | ||
370 | - if (me.samp.isConnected()) | ||
371 | - { | ||
372 | - me.samp.disconnect(); | ||
373 | - } | ||
374 | - else | ||
375 | - { | ||
376 | - me.samp.connect(); | ||
377 | - // loadMask.hide(); | ||
378 | - } | ||
379 | - }); | ||
380 | - | ||
381 | - }, | ||
382 | - | ||
383 | - forceSampDisconnect : function() | ||
384 | - { | ||
385 | - if (!this.samp) | ||
386 | - return; | ||
387 | - | ||
388 | - if (!this.samp.isConnected()) | ||
389 | - return; | ||
390 | - | ||
391 | - this.samp.disconnect(); | ||
392 | - }, | ||
393 | - | ||
394 | - getVOTableClients : function () | ||
395 | - { | ||
396 | - //return list of all clients that can receive a VOTable | ||
397 | - if (!this.samp) | ||
398 | - return []; | ||
399 | - var result = new Array(); | ||
400 | - this.sampclientsStore.each(function (client){ | ||
401 | - if (client.get('acceptVOTable')) | ||
402 | - result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')}); | ||
403 | - | ||
404 | - },this); | ||
405 | - return result; | ||
406 | - }, | ||
407 | - | ||
408 | - getFITSClients : function () | ||
409 | - { | ||
410 | - //return list of all clients that can receive a FITS image | ||
411 | - if (!this.samp) | ||
412 | - return []; | ||
413 | - var result = new Array(); | ||
414 | - this.sampclientsStore.each(function (client){ | ||
415 | - if (client.get('acceptFITS')) | ||
416 | - result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')}); | ||
417 | - | ||
418 | - },this); | ||
419 | - return result; | ||
420 | - | ||
421 | - }, | 299 | + getVOTableClients : function () |
300 | + { | ||
301 | + //return list of all clients that can receive a VOTable | ||
302 | + if (!this.samp) | ||
303 | + return []; | ||
304 | + var result = new Array(); | ||
305 | + this.sampclientsStore.each(function (client){ | ||
306 | + if (client.get('acceptVOTable')) | ||
307 | + result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')}); | ||
308 | + | ||
309 | + },this); | ||
310 | + return result; | ||
311 | + }, | ||
312 | + | ||
313 | + getFITSClients : function () | ||
314 | + { | ||
315 | + //return list of all clients that can receive a FITS image | ||
316 | + if (!this.samp) | ||
317 | + return []; | ||
318 | + var result = new Array(); | ||
319 | + this.sampclientsStore.each(function (client){ | ||
320 | + if (client.get('acceptFITS')) | ||
321 | + result.push({id : client.get('id'), name : client.get('name'), icon : client.get('iconUrl')}); | ||
322 | + | ||
323 | + },this); | ||
324 | + return result; | ||
325 | + }, | ||
326 | + | ||
422 | // arguments from launcher : CONFIG (OBJECT!!!) | 327 | // arguments from launcher : CONFIG (OBJECT!!!) |
423 | createWindow : function(config){ | 328 | createWindow : function(config){ |
424 | - var me = this; | ||
425 | - var baseId = null; | 329 | + var me = this; |
330 | + var baseId = null; | ||
426 | 331 | ||
427 | - if (!Ext.isObject(config)) { | ||
428 | - baseId = config; | ||
429 | - } | ||
430 | - var desktop = this.app.getDesktop(); | ||
431 | - var win = desktop.getWindow(this.id); | ||
432 | - var activeTab = (config && 'activeTab' in config) ? config['activeTab']: 1; | ||
433 | - | ||
434 | - if(!win) | ||
435 | - { | ||
436 | - win = desktop.createWindow({ | ||
437 | - id: this.id, | ||
438 | - title:this.title, | 332 | + if (!Ext.isObject(config)) { |
333 | + baseId = config; | ||
334 | + var activeTab = 1; | ||
335 | + } | ||
336 | + else { | ||
337 | + var activeTab = ('activeTab' in config) ? config['activeTab'] : 1; | ||
338 | + } | ||
339 | + var desktop = this.app.getDesktop(); | ||
340 | + var win = desktop.getWindow(this.id); | ||
341 | + | ||
342 | + if(!win) | ||
343 | + { | ||
344 | + win = desktop.createWindow({ | ||
345 | + id: this.id, | ||
346 | + title:this.title, | ||
439 | layout: 'fit', | 347 | layout: 'fit', |
440 | minWidth: 650, | 348 | minWidth: 650, |
441 | minHeight: 350, | 349 | minHeight: 350, |
442 | minimizable: false, | 350 | minimizable: false, |
443 | - iconCls: this.icon, | ||
444 | - animCollapse:false, | ||
445 | - constrainHeader:true, | ||
446 | - bodyPadding : 5, | ||
447 | - stateful : true, | ||
448 | - stateId : this.id, | ||
449 | - stateEvents: ['move','show','resize'], | ||
450 | - tools: [{ | ||
451 | - type:'help', | ||
452 | - qtip: this.helpTitle, | ||
453 | - scope:this, | ||
454 | - handler: function(event, toolEl, panel) { | ||
455 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { | ||
456 | - module.createWindow(me.helpFile, me.helpTitle); | ||
457 | - }); | ||
458 | - } | ||
459 | - }], | ||
460 | - items : [ | ||
461 | - { | ||
462 | - xtype: 'panelInterop', | ||
463 | - clientsStore : this.sampclientsStore, | ||
464 | - activeTab : activeTab, | ||
465 | - baseId : baseId, | ||
466 | - loadTab: function(tab) { | ||
467 | - if(tab['id'] === 'epntapTab') { | ||
468 | - me.loadEpnTap(config && 'epntapFilter' in config ? config['epntapFilter']: false); | ||
469 | - } | ||
470 | - }, | ||
471 | - onSwitchConnect : function () | ||
472 | - { | ||
473 | - me.switchSampConnect(); | ||
474 | - } | ||
475 | - } | ||
476 | - ] | ||
477 | - }); | ||
478 | - } else if(activeTab == 2) { | 351 | + iconCls: this.icon, |
352 | + animCollapse:false, | ||
353 | + constrainHeader:true, | ||
354 | + bodyPadding : 5, | ||
355 | + stateful : true, | ||
356 | + stateId : this.id, | ||
357 | + stateEvents: ['move','show','resize'], | ||
358 | + tools: [{ | ||
359 | + type:'help', | ||
360 | + qtip: this.helpTitle, | ||
361 | + scope:this, | ||
362 | + handler: function(event, toolEl, panel) { | ||
363 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function(module) { | ||
364 | + module.createWindow(me.helpFile, me.helpTitle); | ||
365 | + }); | ||
366 | + } | ||
367 | + }], | ||
368 | + items : [ | ||
369 | + { | ||
370 | + xtype: 'panelInterop', | ||
371 | + clientsStore : this.sampclientsStore, | ||
372 | + activeTab : activeTab, | ||
373 | + baseId : baseId, | ||
374 | + loadTab: function(tab) { | ||
375 | + if(tab['id'] === 'epntapTab') { | ||
376 | + me.loadEpnTap(config && 'epntapFilter' in config ? config['epntapFilter']: false); | ||
377 | + } | ||
378 | + }, | ||
379 | + onSwitchConnect : function () | ||
380 | + { | ||
381 | + me.switchSampConnect(); | ||
382 | + } | ||
383 | + }] | ||
384 | + }); | ||
385 | + } else if(activeTab == 2) { | ||
479 | me.loadEpnTap(config && 'epntapFilter' in config ? config['epntapFilter']: false); | 386 | me.loadEpnTap(config && 'epntapFilter' in config ? config['epntapFilter']: false); |
480 | } | 387 | } |
481 | 388 | ||
482 | - if (me.samp && me.samp.ready) | ||
483 | - this.updateStatus(); | 389 | + if (me.samp && me.samp.ready) |
390 | + this.updateStatus(); | ||
484 | 391 | ||
485 | - win.show(); | ||
486 | - return win; | 392 | + win.show(); |
393 | + return win; | ||
487 | } | 394 | } |
488 | - | ||
489 | }); | 395 | }); |
js/app/models/InteractiveNode.js
@@ -89,13 +89,15 @@ Ext.define('amdaModel.InteractiveNode', { | @@ -89,13 +89,15 @@ Ext.define('amdaModel.InteractiveNode', { | ||
89 | { | 89 | { |
90 | this.callParent(arguments); | 90 | this.callParent(arguments); |
91 | this.set('nodeType',this.self.nodeType); | 91 | this.set('nodeType',this.self.nodeType); |
92 | - this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
93 | - // if id of this node have root category suffix | ||
94 | - if (Ext.util.Format.substr(this.get('id'), -(amdaUI.ExplorerUI.CAT_SUFFIX.length), this.get('id').length) === amdaUI.ExplorerUI.CAT_SUFFIX) | ||
95 | - { | ||
96 | - // set the expanded property to true | ||
97 | - this.set('expanded',true); | ||
98 | - } | 92 | + this.set('ownerTreeId',amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); |
93 | + if (this.get('id')) { // TODO why sometimes (delete in remote interoper tree) this.get('id') = undefined ? | ||
94 | + // if id of this node have root category suffix | ||
95 | + if (Ext.util.Format.substr(this.get('id'), -(amdaUI.ExplorerUI.CAT_SUFFIX.length), this.get('id').length) === amdaUI.ExplorerUI.CAT_SUFFIX) | ||
96 | + { | ||
97 | + // set the expanded property to true | ||
98 | + this.set('expanded',true); | ||
99 | + } | ||
100 | + } | ||
99 | }, | 101 | }, |
100 | 102 | ||
101 | /** | 103 | /** |
js/app/models/RemoteParamNode.js
@@ -3,152 +3,143 @@ | @@ -3,152 +3,143 @@ | ||
3 | * Name : RemoteParamNode.js | 3 | * Name : RemoteParamNode.js |
4 | * @class amdaModel.RemoteParamNode | 4 | * @class amdaModel.RemoteParamNode |
5 | * @extends amdaModel.LocalParamNode | 5 | * @extends amdaModel.LocalParamNode |
6 | - * @brief | ||
7 | - * @author | ||
8 | - * @version $Id: RemoteParamNode.js 2544 2014-10-03 10:21:56Z elena $ | 6 | + * @author elena |
9 | */ | 7 | */ |
10 | 8 | ||
11 | Ext.define('amdaModel.RemoteParamNode', { | 9 | Ext.define('amdaModel.RemoteParamNode', { |
10 | + extend: 'amdaModel.LocalParamNode', | ||
12 | 11 | ||
13 | - extend: 'amdaModel.LocalParamNode', | ||
14 | - | ||
15 | - statics:{ | ||
16 | - nodeType: 'remoteParam' | ||
17 | - }, | ||
18 | - | ||
19 | - fields: [ | ||
20 | - {name: 'isRemoteDataSet', type:'boolean', persist: false, defaultValue: false}, | ||
21 | - {name: 'isSimulation', type:'boolean', defaultValue: false} | ||
22 | - ], | ||
23 | - | ||
24 | - constructor : function(config){ | ||
25 | - this.callParent(arguments); | ||
26 | - //TODO only for INTEROPER TREE | ||
27 | - if (!this.get('leaf')) this.set('allowDrag', false); | ||
28 | - if (this.get('isParameter')) this.set('allowDrag',true); | ||
29 | - if (this.get('leaf') && this.get('isSpectra')) this.set('iconCls', 'icon-spectra'); | ||
30 | - if (this.get('disable')) { | ||
31 | - this.set('cls', 'icon-disabled'); | ||
32 | - this.set('allowDrag', false); | ||
33 | - } | ||
34 | - }, | ||
35 | - | ||
36 | - | ||
37 | - allMenuItems : function() { | ||
38 | - var menuItems = | ||
39 | - [{ | ||
40 | - fnId : 'dire-addData', | ||
41 | - text : 'Add Data' | ||
42 | - },{ | ||
43 | - fnId : 'root-addData', | ||
44 | - text : 'Add Data' | ||
45 | - },{ | ||
46 | - fnId : 'dire-deleteNode', | ||
47 | - text : 'Delete Data' | ||
48 | - },{ | ||
49 | - fnId : 'root-collapseAll', | ||
50 | - text : 'Close All' | ||
51 | - }, { | ||
52 | - fnId : 'dire-collapseAll', | ||
53 | - text : 'Close All' | ||
54 | - }, { | ||
55 | - fnId : 'para-plotParam', | ||
56 | - text : 'Plot Parameter', | ||
57 | - hidden : true | ||
58 | - }, { | ||
59 | - fnId : 'para-downParam', | ||
60 | - text : 'Download Parameter', | ||
61 | - hidden : true | ||
62 | - },{ | ||
63 | - fnId : 'leaf-createAlias', | ||
64 | - text : 'Create/Edit Alias' | ||
65 | - }, { | ||
66 | - fnId : 'leaf-createDerivedParam', | ||
67 | - text : 'Create Derived Parameter' | ||
68 | - },{ | ||
69 | - fnId : 'leaf-deleteNode', | ||
70 | - text : 'Delete Parameter' | ||
71 | - },{ | ||
72 | - fnId : 'leaf-plotParam', | ||
73 | - text : 'Plot Parameter', | ||
74 | - hidden : true | ||
75 | - }, { | ||
76 | - fnId : 'leaf-downParam', | ||
77 | - text : 'Download Parameter', | ||
78 | - hidden : true | ||
79 | - }]; | ||
80 | - | ||
81 | - return menuItems; | ||
82 | - } , | ||
83 | - | ||
84 | - onMenuItemClick : function(menu,item,event) { | 12 | + statics:{ |
13 | + nodeType: 'remoteParam' | ||
14 | + }, | ||
85 | 15 | ||
86 | - if (item) { | ||
87 | - switch (item.fnId) { | 16 | + fields: [{name: 'isRemoteDataSet', type:'boolean', persist: false, defaultValue: true}, |
17 | + {name: 'isSimulation', type:'boolean', defaultValue: false}], | ||
18 | + | ||
19 | + constructor : function(config){ | ||
20 | + this.callParent(arguments); | ||
21 | + | ||
22 | + //TODO only for INTEROPER TREE | ||
23 | + if (!this.get('leaf')) this.set('allowDrag', false); | ||
24 | + if (this.get('isParameter')) this.set('allowDrag',true); | ||
25 | + if (this.get('leaf') && this.get('isSpectra')) this.set('iconCls', 'icon-spectra'); | ||
26 | + | ||
27 | + if (this.get('disable')) { | ||
28 | + this.set('cls', 'icon-disabled'); | ||
29 | + this.set('allowDrag', false); | ||
30 | + } | ||
31 | + }, | ||
88 | 32 | ||
89 | - case 'root-collapseAll': | ||
90 | - case 'dire-collapseAll': | ||
91 | - if(this && !this.isLeaf()) { | ||
92 | - this.collapse(true); | ||
93 | - } | ||
94 | - break; | ||
95 | - case 'leaf-createDerivedParam': | ||
96 | - this.createLeaf(this); | ||
97 | - break; | ||
98 | - case 'leaf-createAlias': | ||
99 | - this.createAlias(this); | ||
100 | - break; | ||
101 | - case 'leaf-deleteNode': | ||
102 | - case 'dire-deleteNode' : | ||
103 | - this.deleteData(); | ||
104 | - break; | ||
105 | - case 'dire-addData': | ||
106 | - case 'root-addData': | ||
107 | - this.addData(); | ||
108 | - break; | ||
109 | - case 'leaf-plotParam': | ||
110 | - case 'para-plotParam': | ||
111 | - this.createPlot(this); | ||
112 | - break; | ||
113 | - case 'leaf-downParam': | ||
114 | - case 'para-downParam': | ||
115 | - this.createDownload(this); | ||
116 | - break; | ||
117 | - default: | ||
118 | - break; | ||
119 | - } | ||
120 | - } | ||
121 | - }, | 33 | + allMenuItems : function() { |
34 | + var menuItems = | ||
35 | + [{ | ||
36 | + fnId : 'dire-addData', | ||
37 | + text : 'Add Data' | ||
38 | + },{ | ||
39 | + fnId : 'root-addData', | ||
40 | + text : 'Add Data' | ||
41 | + },{ | ||
42 | + fnId : 'dire-deleteNode', | ||
43 | + text : 'Delete Data' | ||
44 | + },{ | ||
45 | + fnId : 'root-collapseAll', | ||
46 | + text : 'Close All' | ||
47 | + }, { | ||
48 | + fnId : 'dire-collapseAll', | ||
49 | + text : 'Close All' | ||
50 | + }, { | ||
51 | + fnId : 'para-plotParam', | ||
52 | + text : 'Plot Parameter', | ||
53 | + hidden : true | ||
54 | + }, { | ||
55 | + fnId : 'para-downParam', | ||
56 | + text : 'Download Parameter', | ||
57 | + hidden : true | ||
58 | + },{ | ||
59 | + fnId : 'leaf-createAlias', | ||
60 | + text : 'Create/Edit Alias' | ||
61 | + }, { | ||
62 | + fnId : 'leaf-createDerivedParam', | ||
63 | + text : 'Create Derived Parameter' | ||
64 | + },{ | ||
65 | + fnId : 'leaf-deleteNode', | ||
66 | + text : 'Delete Parameter' | ||
67 | + },{ | ||
68 | + fnId : 'leaf-plotParam', | ||
69 | + text : 'Plot Parameter', | ||
70 | + hidden : true | ||
71 | + }, { | ||
72 | + fnId : 'leaf-downParam', | ||
73 | + text : 'Download Parameter', | ||
74 | + hidden : true | ||
75 | + }]; | ||
76 | + | ||
77 | + return menuItems; | ||
78 | + }, | ||
122 | 79 | ||
123 | - deleteData : function() { | ||
124 | - // var parent = this.parentNode; | ||
125 | - AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ | ||
126 | - //TODO if () not error ?? | ||
127 | - this.remove(); | ||
128 | - this.destroy(); | ||
129 | - },this); | ||
130 | - }, | 80 | + onMenuItemClick : function(menu,item,event) { |
81 | + if (item) { | ||
82 | + switch (item.fnId) { | ||
83 | + case 'root-collapseAll': | ||
84 | + case 'dire-collapseAll': | ||
85 | + if(this && !this.isLeaf()) { | ||
86 | + this.collapse(true); | ||
87 | + } | ||
88 | + break; | ||
89 | + case 'leaf-createDerivedParam': | ||
90 | + this.createLeaf(this); | ||
91 | + break; | ||
92 | + case 'leaf-createAlias': | ||
93 | + this.createAlias(this); | ||
94 | + break; | ||
95 | + case 'leaf-deleteNode': | ||
96 | + case 'dire-deleteNode' : | ||
97 | + this.deleteData(); | ||
98 | + break; | ||
99 | + case 'dire-addData': | ||
100 | + case 'root-addData': | ||
101 | + this.addData(); | ||
102 | + break; | ||
103 | + case 'leaf-plotParam': | ||
104 | + case 'para-plotParam': | ||
105 | + this.createPlot(this); | ||
106 | + break; | ||
107 | + case 'leaf-downParam': | ||
108 | + case 'para-downParam': | ||
109 | + this.createDownload(this); | ||
110 | + break; | ||
111 | + default: | ||
112 | + break; | ||
113 | + } | ||
114 | + } | ||
115 | + }, | ||
131 | 116 | ||
132 | - addData : function() { | 117 | + deleteData : function() { |
118 | + // var parent = this.parentNode; | ||
119 | + AmdaAction.deleteFromTree({nodeType: this.get('nodeType'), id : this.get('id')}, function(res,e){ | ||
120 | + //TODO if () not error ?? | ||
121 | + this.remove(); | ||
122 | + this.destroy(); | ||
123 | + },this); | ||
124 | + }, | ||
133 | 125 | ||
134 | - if (this.get('disable')) return; | 126 | + addData : function() { |
127 | + if (this.get('disable')) return; | ||
135 | 128 | ||
136 | - var me = this; | ||
137 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | ||
138 | - module.createWindow(me.getBaseId()); | ||
139 | - }); | 129 | + var me = this; |
130 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | ||
131 | + module.createWindow(me.getBaseId()); | ||
132 | + }); | ||
140 | }, | 133 | }, |
141 | 134 | ||
142 | -// Depth of Base Root Node = 3 : root, Parameters, Remote Parameters, BaseName | ||
143 | - getBaseId : function() { | ||
144 | - | ||
145 | - if (this.getDepth() < 3) return 'root'; | 135 | + // Depth of Base Root Node = 3 : root, Parameters, Remote Parameters, BaseName |
136 | + getBaseId : function() { | ||
137 | + if (this.getDepth() < 3) return 'root'; | ||
146 | 138 | ||
147 | - var node = this; | ||
148 | - while (node.getDepth() > 3) { | ||
149 | - node = node.parentNode; | 139 | + var node = this; |
140 | + while (node.getDepth() > 3) { | ||
141 | + node = node.parentNode; | ||
142 | + } | ||
143 | + return node.get('id'); | ||
150 | } | 144 | } |
151 | - return node.get('id'); | ||
152 | - } | ||
153 | - | ||
154 | }); | 145 | }); |
js/app/views/ExplorerUI.js
1 | /** | 1 | /** |
2 | * Project : AMDA-NG4 | 2 | * Project : AMDA-NG4 |
3 | * Name : ExplorerUI.js | 3 | * Name : ExplorerUI.js |
4 | - * Description : Explorer Module UI definition (View) | ||
5 | - * @class amdaUI.ExplorerUI | 4 | + * @class amdaUI.ExplorerUI |
6 | * @extends Ext.tab.Panel | 5 | * @extends Ext.tab.Panel |
6 | + * @class amdaUI.TreeToolColumn | ||
7 | + * @extends Ext.tree.Column | ||
8 | + * @class MyTreeEditor | ||
9 | + * @extends Ext.grid.plugin.CellEditing | ||
7 | * @brief Explorer View | 10 | * @brief Explorer View |
8 | * @author CDA | 11 | * @author CDA |
9 | - * @version $Id: ExplorerUI.js 2544 2014-10-03 10:21:56Z elena $ | ||
10 | */ | 12 | */ |
11 | 13 | ||
12 | Ext.define('amdaUI.TreeToolColumn', { | 14 | Ext.define('amdaUI.TreeToolColumn', { |
13 | - extend: 'Ext.tree.Column', | ||
14 | - alias: 'widget.treetoolcolumn', | ||
15 | - | ||
16 | - /** | ||
17 | - * Add more tools here. These will be on the prototype for all TreeToolColumns | ||
18 | - */ | ||
19 | - tools: { | ||
20 | - 'info': 'js/resources/images/16x16/info_mini.png' | ||
21 | - }, | ||
22 | - | ||
23 | - initComponent: function() | ||
24 | - { | ||
25 | - var me = this; | ||
26 | - me.addEvents( 'toolclick' ); | ||
27 | - me.callParent(); | ||
28 | - me.on('toolclick', me.toolHandler, me); | ||
29 | - }, | ||
30 | - | ||
31 | - renderer: function(value, metaData, record, rowIdx, colIdx, store, view) | ||
32 | - { | ||
33 | - var toolCol = view.getHeaderAtIndex(colIdx); | ||
34 | - | ||
35 | - if (!toolCol.toolIsVisible(record)) | ||
36 | - return value; | ||
37 | - | ||
38 | - var toolId = 'tool-' + rowIdx + '-' + colIdx, | ||
39 | - toolImg = toolCol.tools[toolCol.tool], | ||
40 | - imgHtml = Ext.DomHelper.markup({ | ||
41 | - id : toolId, | ||
42 | - tag : 'img', | ||
43 | - tooltype: toolCol.tool, | ||
44 | - src : toolImg, | ||
45 | - style : 'cursor:hand;' | ||
46 | - }); | ||
47 | - | ||
48 | - return value + ' ' + imgHtml; | ||
49 | - }, | ||
50 | - | ||
51 | - processEvent: function(type, view, cell, recordIndex, cellIndex, e) | ||
52 | - { | ||
53 | - if(type === "click" && e.target.tagName === "IMG") | ||
54 | - { | ||
55 | - var tooltype = e.target.getAttribute("tooltype"); | ||
56 | - if(tooltype) | ||
57 | - return this.fireEvent("toolclick", view, cell, recordIndex, cellIndex, e); | ||
58 | - } | ||
59 | - return this.fireEvent.apply(this, arguments); | ||
60 | - }, | ||
61 | - | ||
62 | - /** | ||
63 | - * Override this when you add columns to the tree... see example below | ||
64 | - */ | 15 | + extend: 'Ext.tree.Column', |
16 | + alias: 'widget.treetoolcolumn', | ||
17 | + | ||
18 | + /** | ||
19 | + * Add more tools here. These will be on the prototype for all TreeToolColumns | ||
20 | + */ | ||
21 | + tools: { | ||
22 | + 'info': 'js/resources/images/16x16/info_mini.png' | ||
23 | + }, | ||
24 | + | ||
25 | + initComponent: function() | ||
26 | + { | ||
27 | + var me = this; | ||
28 | + me.addEvents('toolclick'); | ||
29 | + me.callParent(); | ||
30 | + me.on('toolclick', me.toolHandler, me); | ||
31 | + }, | ||
32 | + | ||
33 | + renderer: function(value, metaData, record, rowIdx, colIdx, store, view) | ||
34 | + { | ||
35 | + var toolCol = view.getHeaderAtIndex(colIdx); | ||
36 | + | ||
37 | + if (!toolCol.toolIsVisible(record)) return value; | ||
38 | + | ||
39 | + var toolId = 'tool-' + rowIdx + '-' + colIdx, | ||
40 | + toolImg = toolCol.tools[toolCol.tool], | ||
41 | + imgHtml = Ext.DomHelper.markup({ | ||
42 | + id : toolId, | ||
43 | + tag : 'img', | ||
44 | + tooltype: toolCol.tool, | ||
45 | + src : toolImg, | ||
46 | + style : 'cursor:hand;' | ||
47 | + }); | ||
48 | + | ||
49 | + return value + ' ' + imgHtml; | ||
50 | + }, | ||
51 | + | ||
52 | + processEvent: function(type, view, cell, recordIndex, cellIndex, e) | ||
53 | + { | ||
54 | + if(type === "click" && e.target.tagName === "IMG") | ||
55 | + { | ||
56 | + var tooltype = e.target.getAttribute("tooltype"); | ||
57 | + if(tooltype) | ||
58 | + return this.fireEvent("toolclick", view, cell, recordIndex, cellIndex, e); | ||
59 | + } | ||
60 | + return this.fireEvent.apply(this, arguments); | ||
61 | + }, | ||
62 | + | ||
63 | + /** | ||
64 | + * Override this when you add columns to the tree... see example below | ||
65 | + */ | ||
65 | // toolHandler: function() { | 66 | // toolHandler: function() { |
66 | // alert("override this"); | 67 | // alert("override this"); |
67 | // }, | 68 | // }, |
68 | 69 | ||
69 | - toolIsVisible : function(record) { | ||
70 | - return false; | ||
71 | - } | 70 | + toolIsVisible : function(record) { |
71 | + return false; | ||
72 | + } | ||
72 | }); | 73 | }); |
73 | 74 | ||
74 | 75 | ||
76 | +// ExplorerUI | ||
75 | Ext.define('amdaUI.ExplorerUI', { | 77 | Ext.define('amdaUI.ExplorerUI', { |
76 | - | ||
77 | - extend: 'Ext.tab.Panel', | ||
78 | - alias : 'widget.panelExplorer', | ||
79 | - | ||
80 | - statics: | ||
81 | - { | ||
82 | - RESRC_TAB : { | ||
83 | - TREE_ID:'resourcesTree', | ||
84 | - TREE_TYPE:'resources' | ||
85 | - }, | ||
86 | - OPE_TAB : { | ||
87 | - TREE_ID:'operationsTree', | ||
88 | - TREE_TYPE:'operations' | ||
89 | - }, | ||
90 | - JOB_TAB : { | ||
91 | - TREE_ID:'jobsTree', | ||
92 | - TREE_TYPE:'jobs' | ||
93 | - }, | ||
94 | - | ||
95 | - CAT_SUFFIX: '-treeBase', | ||
96 | - ROOT_SUFFIX: '-treeRootNode', | ||
97 | - SUB_ROOT_SUFFIX : 'RootNode', | ||
98 | - | ||
99 | - ITEM_KIND_ROOT : 'root', | ||
100 | - ITEM_KIND_LEAF : 'leaf', | ||
101 | - ITEM_KIND_DIRE : 'dire', | ||
102 | - ITEM_KIND_PARA : 'para', | ||
103 | - ITEM_KIND_MISS : 'miss' | ||
104 | - }, | ||
105 | - | ||
106 | - initComponent : function (config) { | ||
107 | - | ||
108 | - var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
109 | - | ||
110 | - var myConf = { | ||
111 | - split : true, | ||
112 | - width : '100%', | ||
113 | - height : '100%', | ||
114 | - autoScroll : true, | ||
115 | - border : true, | ||
116 | - header : false, | ||
117 | - defaults : { | ||
118 | - // applied to each contained panel | ||
119 | - containerScroll : true | ||
120 | - }, | ||
121 | - stateful: true, | ||
122 | - // stateId: 'tp1', | ||
123 | - stateEvents: ['tabchange'], | ||
124 | - getState: function() { | ||
125 | - return { | ||
126 | - activeTab: this.items.findIndex('id',this.getActiveTab().id) | ||
127 | - }; | ||
128 | - }, | ||
129 | - applyState: function(s) { | ||
130 | - this.setActiveTab(s.activeTab); | ||
131 | - }, | ||
132 | - // activeTab: 0, | ||
133 | - items: [ | ||
134 | - this.initTree(amdaUI.ExplorerUI.RESRC_TAB.TREE_TYPE), | ||
135 | - this.initTree(amdaUI.ExplorerUI.OPE_TAB.TREE_TYPE), | ||
136 | - this.initTree(amdaUI.ExplorerUI.JOB_TAB.TREE_TYPE) | ||
137 | - ], | ||
138 | - tbar : [ | ||
139 | - { | ||
140 | - xtype : 'combo', | ||
141 | - fieldLabel: 'Filter', | ||
142 | - labelWidth: 25, | ||
143 | - width: 140, | ||
144 | - store: explorerModule.filtersStore, | ||
145 | - queryMode: 'local', | ||
146 | - displayField: 'name', | ||
147 | - valueField: 'id', | ||
148 | - listeners : { | ||
149 | - scope : this, | ||
150 | - select: function(combo, records) { | ||
151 | - AmdaAction.setCrtFilterId({id : records[0].get('id')}, | ||
152 | - function (result, e) | ||
153 | - { | ||
154 | - var t = e.getTransaction(); | ||
155 | - if (e.status) | ||
156 | - { | ||
157 | - if (result) | ||
158 | - { | ||
159 | - var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
160 | - if (explorerModule) | ||
161 | - explorerModule.setCrtFilter(); | ||
162 | - } | ||
163 | - else | ||
164 | - Ext.Msg.show( { | ||
165 | - title : 'Filter', | ||
166 | - msg : 'Cannot apply filter', | ||
167 | - modal : true, | ||
168 | - icon : Ext.Msg.ERROR, | ||
169 | - buttons : Ext.Msg.OK | ||
170 | - }); | ||
171 | - } | ||
172 | - else | ||
173 | - { | ||
174 | - // FAILURE | ||
175 | - Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); | ||
176 | - } | ||
177 | - },this); | ||
178 | - } | ||
179 | - } | ||
180 | - }, | ||
181 | - { | ||
182 | - text: '', | ||
183 | - iconCls : 'icon-parameters', | ||
184 | - tooltip: { text: 'Edit Filter', align: 'bl-tl' }, | ||
185 | - handler: function(t){ | ||
186 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.filters.id, true, function (module) { | ||
187 | - module.createWindow(); | ||
188 | - }); | ||
189 | - } | ||
190 | - }, | ||
191 | - { | ||
192 | - text: '', | ||
193 | - iconCls : 'icon-remover', | ||
194 | - tooltip: { text: 'Reset Filter', align: 'bl-tl' }, | ||
195 | - handler: function(t){ | ||
196 | - var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
197 | - explorerModule.resetFilter(); | ||
198 | - } | ||
199 | - }, '-', | ||
200 | - { | ||
201 | - xtype: 'displayfield', | ||
202 | - fieldLabel: 'SortBy', | ||
203 | - width: 40 | ||
204 | - }, | ||
205 | - { | ||
206 | - text: 'Name', | ||
207 | - scope : this, | ||
208 | - tooltip: { text: 'Sort out AMDA DataBase Data by Mission Name', align: 'bl-tl' }, | ||
209 | - pressed: true, | ||
210 | - enableToggle : true, | ||
211 | - toggleGroup: 'sorting', | ||
212 | - handler: function(){ | ||
213 | - var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
214 | - tree.getStore().sort([ | ||
215 | - { sorterFn: function(o1, o2){ | ||
216 | - if (o1.get('nodeType') !== 'localParam') | ||
217 | - return; | ||
218 | - | ||
219 | - return o1.get('text').toUpperCase() < o2.get('text').toUpperCase() ? -1 : 1; | ||
220 | - } } ]); | ||
221 | - this.updateFilter(); | ||
222 | - } | ||
223 | - }, | ||
224 | - { | ||
225 | - text: 'Target', | ||
226 | - scope : this, | ||
227 | - tooltip: { text: 'Sort out AMDA DataBase Data by Mission Main Target', align: 'bl-tl' }, | ||
228 | - enableToggle : true, | ||
229 | - toggleGroup: 'sorting', | ||
230 | - handler: function(){ | ||
231 | - var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
232 | - tree.getStore().sort([{ property : 'rank' }]); | ||
233 | - this.updateFilter(); | ||
234 | - } | ||
235 | - } | ||
236 | - ] | ||
237 | - }; | ||
238 | - Ext.apply (this , Ext.apply (arguments, myConf)); | ||
239 | - this.callParent(arguments); | ||
240 | - }, | ||
241 | - | ||
242 | - initTree : function(treeType){ | ||
243 | - | ||
244 | - switch (treeType) { | ||
245 | - case amdaUI.ExplorerUI.RESRC_TAB.TREE_TYPE: | ||
246 | - treeId = amdaUI.ExplorerUI.RESRC_TAB.TREE_ID; | ||
247 | - break; | ||
248 | - case amdaUI.ExplorerUI.OPE_TAB.TREE_TYPE: | ||
249 | - treeId = amdaUI.ExplorerUI.OPE_TAB.TREE_ID; | ||
250 | - break; | ||
251 | - case amdaUI.ExplorerUI.JOB_TAB.TREE_TYPE: | ||
252 | - treeId = amdaUI.ExplorerUI.JOB_TAB.TREE_ID; | ||
253 | - break; | ||
254 | - default: | ||
255 | - treeId = amdaUI.ExplorerUI.RESRC_TAB.TREE_ID; | ||
256 | - break; | ||
257 | - } | ||
258 | - | ||
259 | - var store = Ext.create('Ext.data.TreeStore', { | ||
260 | - root: { | ||
261 | - expanded: true, | ||
262 | - nodeType : treeType | ||
263 | - }, | ||
264 | - model: 'amdaModel.AmdaNode', | ||
265 | - sorters:[{ direction: 'DES' }, | ||
266 | - { sorterFn: function(o1, o2){ | ||
267 | - if (o1.get('nodeType') !== 'localParam') | ||
268 | - return; | ||
269 | - | ||
270 | - return o1.get('text').toUpperCase() < o2.get('text').toUpperCase() ? -1 : 1; | ||
271 | - } }], | ||
272 | - listeners: { | ||
273 | - beforeload: function(store, operation){ | ||
274 | - store.proxy.extraParams = { | ||
275 | - nodeType: operation.node.get('nodeType') | ||
276 | - }; | ||
277 | - } | ||
278 | - } | ||
279 | - | ||
280 | - }); | ||
281 | - | ||
282 | - var menu = new Ext.menu.Menu(); | ||
283 | - | ||
284 | - var tree = Ext.create('Ext.tree.Panel', { | ||
285 | - id : treeId, | ||
286 | - title: treeType, | ||
287 | - store: store, | ||
288 | - rootVisible: false, | ||
289 | - animate: false, | ||
290 | - hideHeaders : true, | ||
291 | - selModel: Ext.create('Ext.selection.TreeModel', { | ||
292 | - // ignoreRightMouseSelection: true, | ||
293 | - mode: 'MULTI' | ||
294 | - }), | ||
295 | - | ||
296 | - viewConfig: | ||
297 | - { | ||
298 | - plugins: | ||
299 | - { | ||
300 | - ptype: 'treeviewdragdrop', | ||
301 | - enableDrag:true, | ||
302 | - enableDrop:true, | ||
303 | - //TODO - BRE - Wait a fix for drag&drop issue | ||
304 | - ddGroup:'explorerTree', | ||
305 | - pluginId : 'ddplugin', | ||
306 | - isValidDropPoint : function (node, position, dragZone, e, data) | ||
307 | - { | ||
308 | - if (!node || !data.item) { | ||
309 | - return false; | ||
310 | - } | ||
311 | - | ||
312 | - var view = this.view, | ||
313 | - targetNode = view.getRecord(node), | ||
314 | - draggedRecords = data.records, | ||
315 | - dataLength = draggedRecords.length, | ||
316 | - ln = draggedRecords.length, | ||
317 | - i, record; | ||
318 | - | ||
319 | - // No drop position, or dragged records: invalid drop point | ||
320 | - if (!(targetNode && position && dataLength)) { | ||
321 | - return false; | ||
322 | - } | ||
323 | - | ||
324 | - // If the targetNode is within the folder we are dragging | ||
325 | - for (i = 0; i < ln; i++) { | ||
326 | - record = draggedRecords[i]; | ||
327 | - if (record.isNode && record.contains(targetNode)) { | ||
328 | - return false; | ||
329 | - } | ||
330 | - } | ||
331 | - | ||
332 | - // Respect the allowDrop field on Tree nodes | ||
333 | - if (position === 'append' && targetNode.get('allowDrop') === false) { | ||
334 | - return false; | ||
335 | - } | ||
336 | - else if (position != 'append' && targetNode.parentNode.get('allowDrop') === false) { | ||
337 | - return false; | ||
338 | - } | ||
339 | - | ||
340 | - // If the target record is in the dragged dataset, then invalid drop | ||
341 | - if (Ext.Array.contains(draggedRecords, targetNode)) { | ||
342 | - return false; | ||
343 | - } | ||
344 | - | ||
345 | - // | ||
346 | - if (dataLength > 1) | ||
347 | - return false; | ||
348 | - var draggedRecord = draggedRecords[0]; | ||
349 | - | ||
350 | - // | ||
351 | - switch (targetNode.data.nodeType) | ||
352 | - { | ||
353 | - case 'localParam' : | ||
354 | - case 'remoteParam' : | ||
355 | - case 'remoteSimuParam' : | ||
356 | - case 'myData' : | ||
357 | - return false; | ||
358 | - default : | ||
359 | - if (draggedRecord.data.id == targetNode.data.nodeType+'-treeRootNode') | ||
360 | - return false; | ||
361 | - if ((position == 'before') && (targetNode.data.id == targetNode.data.nodeType+'-treeRootNode')) | ||
362 | - return false; | ||
363 | - return (draggedRecord.data.nodeType == targetNode.data.nodeType); | ||
364 | - } | ||
365 | - return false; | ||
366 | - }, | ||
367 | - onViewRender : function(view) | ||
368 | - { | ||
369 | - var me = this; | ||
370 | - | ||
371 | - view.on('itemupdate', function(record,index,node,opts) | ||
372 | - { | ||
373 | - var forceHide = false; | ||
374 | - var crtRec = record.parentNode; | ||
375 | - while (crtRec && !forceHide) | ||
376 | - { | ||
377 | - if (crtRec.get('filtered')) | ||
378 | - forceHide = crtRec.get('filtered'); | ||
379 | - crtRec = crtRec.parentNode; | ||
380 | - } | ||
381 | - tree.setNodesVisibility(record,forceHide); | ||
382 | - tree.applyDisableToNode(record); | ||
383 | - }); | ||
384 | - | ||
385 | - view.on('itemadd', function(records,index,node,opts) | ||
386 | - { | ||
387 | - Ext.each(records,function (rec) | ||
388 | - { | ||
389 | - tree.applyFilterToNode(rec); | ||
390 | - tree.applyDisableToNode(rec); | ||
391 | - }); | ||
392 | - | ||
393 | - }); | ||
394 | - | ||
395 | - view.on('afteritemexpand', function(record,index,node,opts) | ||
396 | - { | ||
397 | - var forceHide = false; | ||
398 | - var crtRec = record.parentNode; | ||
399 | - while (crtRec && !forceHide) | ||
400 | - { | ||
401 | - if (crtRec.get('filtered')) | ||
402 | - forceHide = crtRec.get('filtered'); | ||
403 | - crtRec = crtRec.parentNode; | ||
404 | - | ||
405 | - } | ||
406 | - tree.setNodesVisibility(record,forceHide); | ||
407 | - tree.applyDisableToNode(record); | ||
408 | - }); | ||
409 | - | ||
410 | - if (me.enableDrag) | ||
411 | - { | ||
412 | - me.dragZone = Ext.create('Ext.tree.ViewDragZone', { | ||
413 | - view: view, | ||
414 | - ddGroup: me.dragGroup || me.ddGroup, | ||
415 | - dragText: me.dragText, | ||
416 | - repairHighlightColor: me.nodeHighlightColor, | ||
417 | - repairHighlight: me.nodeHighlightOnRepair | ||
418 | - }); | ||
419 | - } | ||
420 | - | ||
421 | - if (me.enableDrop) | ||
422 | - { | ||
423 | - me.dropZone = Ext.create('Ext.tree.ViewDropZone', { | ||
424 | - view: view, | ||
425 | - ddGroup: me.dropGroup || me.ddGroup, | ||
426 | - allowContainerDrops: me.allowContainerDrops, | ||
427 | - appendOnly: me.appendOnly, | ||
428 | - allowParentInserts: me.allowParentInserts, | ||
429 | - expandDelay: me.expandDelay, | ||
430 | - dropHighlightColor: me.nodeHighlightColor, | ||
431 | - dropHighlight: me.nodeHighlightOnDrop, | ||
432 | - isValidDropPoint : me.isValidDropPoint | ||
433 | - }); | ||
434 | - } | ||
435 | - } | ||
436 | - }, | ||
437 | - listeners : | ||
438 | - { | ||
439 | - beforedrop : function(node, data, overModel, dropPosition) | ||
440 | - { | ||
441 | - var parentId; | ||
442 | - switch(dropPosition) | ||
443 | - { | ||
444 | - case 'append' : | ||
445 | - if (overModel.isLeaf()) | ||
446 | - parentId = overModel.parentNode.get('id'); | ||
447 | - else | ||
448 | - parentId = overModel.get('id'); | ||
449 | - | ||
450 | - if(!overModel.isExpanded() && overModel.isExpandable()) { | ||
451 | - myDesktopApp.warningMsg('Please open the folder before node adding'); | ||
452 | - return false; | ||
453 | - } | ||
454 | - break; | ||
455 | - case 'before' : | ||
456 | - case 'after' : | ||
457 | - parentId = overModel.parentNode.get('id'); | ||
458 | - break; | ||
459 | - } | ||
460 | - | ||
461 | - Ext.each(data.records, function(rec) | ||
462 | - { | ||
463 | - rec.renameDD(parentId,function(result) | ||
464 | - { | ||
465 | - if (result) | ||
466 | - { | ||
467 | - if (!result.id) | ||
468 | - { | ||
469 | - Ext.Msg.show({ | ||
470 | - title : 'Drop is impossible', | ||
471 | - msg : result.error, | ||
472 | - buttons : Ext.Msg.OK, | ||
473 | - icon : Ext.MessageBox.WARNING | ||
474 | - }); | ||
475 | - | ||
476 | - return false; | ||
477 | - } | ||
478 | - } | ||
479 | - else | ||
480 | - { | ||
481 | - Ext.Msg.show({ | ||
482 | - title : 'Drop is impossible', | ||
483 | - msg : 'Cannot connect to the server', | ||
484 | - buttons : Ext.Msg.OK, | ||
485 | - icon : Ext.MessageBox.WARNING | ||
486 | - }); | ||
487 | - | ||
488 | - return false; | ||
489 | - } | ||
490 | - | ||
491 | - return true; | ||
492 | - }); | ||
493 | - }); | ||
494 | - } | ||
495 | - }, | ||
496 | - }, | ||
497 | - listeners: { | ||
498 | - | ||
499 | - itemmouseenter: function(view, record, item){ | ||
500 | - if(record.get('isParameter')){ | ||
501 | - var el = Ext.get(item), | ||
502 | - td = el.down('td > div'); | ||
503 | - td.setStyle('cursor', 'crosshair'); | ||
504 | - } | ||
505 | - else | ||
506 | - { | ||
507 | - var el = Ext.get(item), | ||
508 | - td = el.down('td > div'); | ||
509 | - td.setStyle('cursor', 'pointer'); | ||
510 | - } | 78 | + extend: 'Ext.tab.Panel', |
79 | + alias : 'widget.panelExplorer', | ||
80 | + | ||
81 | + statics: | ||
82 | + { | ||
83 | + RESRC_TAB : { | ||
84 | + TREE_ID:'resourcesTree', | ||
85 | + TREE_TYPE:'resources' | ||
86 | + }, | ||
87 | + OPE_TAB : { | ||
88 | + TREE_ID:'operationsTree', | ||
89 | + TREE_TYPE:'operations' | ||
90 | + }, | ||
91 | + JOB_TAB : { | ||
92 | + TREE_ID:'jobsTree', | ||
93 | + TREE_TYPE:'jobs' | ||
511 | }, | 94 | }, |
512 | 95 | ||
513 | - itemcontextmenu: function(view, rec, item, index, e){ | ||
514 | - // block other events | ||
515 | - e.stopEvent(); | 96 | + CAT_SUFFIX: '-treeBase', |
97 | + ROOT_SUFFIX: '-treeRootNode', | ||
98 | + SUB_ROOT_SUFFIX : 'RootNode', | ||
516 | 99 | ||
517 | - // unlock selection | ||
518 | -// view.ownerCt.getSelectionModel().setLocked(false); | ||
519 | - // already selected by default by right click | ||
520 | -// view.ownerCt.getSelectionModel().select(rec,true); | 100 | + ITEM_KIND_ROOT : 'root', |
101 | + ITEM_KIND_LEAF : 'leaf', | ||
102 | + ITEM_KIND_DIRE : 'dire', | ||
103 | + ITEM_KIND_PARA : 'para', | ||
104 | + ITEM_KIND_MISS : 'miss' | ||
105 | + }, | ||
521 | 106 | ||
522 | - // clear menu items | ||
523 | - menu.removeAll(); | ||
524 | - var menuItems; | 107 | + initComponent : function (config) |
108 | + { | ||
109 | + var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
110 | + | ||
111 | + var myConf = { | ||
112 | + split : true, | ||
113 | + width : '100%', | ||
114 | + height : '100%', | ||
115 | + autoScroll : true, | ||
116 | + border : true, | ||
117 | + header : false, | ||
118 | + defaults : { | ||
119 | + // applied to each contained panel | ||
120 | + containerScroll : true | ||
121 | + }, | ||
122 | + stateful: true, | ||
123 | + //stateId: 'tp1', | ||
124 | + stateEvents: ['tabchange'], | ||
125 | + getState: function() { | ||
126 | + return { | ||
127 | + activeTab: this.items.findIndex('id',this.getActiveTab().id) | ||
128 | + }; | ||
129 | + }, | ||
130 | + applyState: function(s) { | ||
131 | + this.setActiveTab(s.activeTab); | ||
132 | + }, | ||
133 | + items: [ | ||
134 | + this.initTree(amdaUI.ExplorerUI.RESRC_TAB.TREE_TYPE), | ||
135 | + this.initTree(amdaUI.ExplorerUI.OPE_TAB.TREE_TYPE), | ||
136 | + this.initTree(amdaUI.ExplorerUI.JOB_TAB.TREE_TYPE) | ||
137 | + ], | ||
138 | + tbar : [ | ||
139 | + { | ||
140 | + xtype : 'combo', | ||
141 | + fieldLabel: 'Filter', | ||
142 | + labelWidth: 25, | ||
143 | + width: 140, | ||
144 | + store: explorerModule.filtersStore, | ||
145 | + queryMode: 'local', | ||
146 | + displayField: 'name', | ||
147 | + valueField: 'id', | ||
148 | + listeners : { | ||
149 | + scope : this, | ||
150 | + select: function(combo, records) { | ||
151 | + AmdaAction.setCrtFilterId({id : records[0].get('id')}, | ||
152 | + function (result, e) | ||
153 | + { | ||
154 | + var t = e.getTransaction(); | ||
155 | + if (e.status) | ||
156 | + { | ||
157 | + if (result) | ||
158 | + { | ||
159 | + var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
160 | + if (explorerModule) | ||
161 | + explorerModule.setCrtFilter(); | ||
162 | + } | ||
163 | + else | ||
164 | + Ext.Msg.show( { | ||
165 | + title : 'Filter', | ||
166 | + msg : 'Cannot apply filter', | ||
167 | + modal : true, | ||
168 | + icon : Ext.Msg.ERROR, | ||
169 | + buttons : Ext.Msg.OK | ||
170 | + }); | ||
171 | + } | ||
172 | + else | ||
173 | + { | ||
174 | + // FAILURE | ||
175 | + Ext.Msg.show({title:'Error System', msg: e.message, icon: Ext.MessageBox.ERROR, buttons: Ext.Msg.OK}); | ||
176 | + } | ||
177 | + },this); | ||
178 | + } | ||
179 | + } | ||
180 | + }, | ||
181 | + { | ||
182 | + text: '', | ||
183 | + iconCls : 'icon-parameters', | ||
184 | + tooltip: { text: 'Edit Filter', align: 'bl-tl' }, | ||
185 | + handler: function(t){ | ||
186 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.filters.id, true, function (module) { | ||
187 | + module.createWindow(); | ||
188 | + }); | ||
189 | + } | ||
190 | + }, | ||
191 | + { | ||
192 | + text: '', | ||
193 | + iconCls : 'icon-remover', | ||
194 | + tooltip: { text: 'Reset Filter', align: 'bl-tl' }, | ||
195 | + handler: function(t){ | ||
196 | + var explorerModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
197 | + explorerModule.resetFilter(); | ||
198 | + } | ||
199 | + }, '-', | ||
200 | + { | ||
201 | + xtype: 'displayfield', | ||
202 | + fieldLabel: 'SortBy', | ||
203 | + width: 40 | ||
204 | + }, | ||
205 | + { | ||
206 | + text: 'Name', | ||
207 | + scope : this, | ||
208 | + tooltip: { text: 'Sort out AMDA DataBase Data by Mission Name', align: 'bl-tl' }, | ||
209 | + pressed: true, | ||
210 | + enableToggle : true, | ||
211 | + toggleGroup: 'sorting', | ||
212 | + handler: function(){ | ||
213 | + var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
214 | + tree.getStore().sort([ | ||
215 | + { sorterFn: function(o1, o2){ | ||
216 | + if (o1.get('nodeType') !== 'localParam') | ||
217 | + return; | ||
525 | 218 | ||
526 | - // if it's a single selection | ||
527 | - if (view.ownerCt.getSelectionModel().selected.length === 1) { | ||
528 | - // get items menu corresponding to right clicked record | ||
529 | - menuItems = rec.getContextMenuItems(this); | 219 | + return o1.get('text').toUpperCase() < o2.get('text').toUpperCase() ? -1 : 1; |
220 | + } | ||
221 | + }]); | ||
222 | + this.updateFilter(); | ||
223 | + } | ||
224 | + }, | ||
225 | + { | ||
226 | + text: 'Target', | ||
227 | + scope : this, | ||
228 | + tooltip: {text: 'Sort out AMDA DataBase Data by Mission Main Target', align: 'bl-tl'}, | ||
229 | + enableToggle : true, | ||
230 | + toggleGroup: 'sorting', | ||
231 | + handler: function(){ | ||
232 | + var tree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
233 | + tree.getStore().sort([{ property : 'rank' }]); | ||
234 | + this.updateFilter(); | ||
235 | + } | ||
236 | + }] | ||
237 | + }; | ||
238 | + Ext.apply (this , Ext.apply (arguments, myConf)); | ||
239 | + this.callParent(arguments); | ||
240 | + }, | ||
241 | + | ||
242 | + initTree : function(treeType) | ||
243 | + { | ||
244 | + switch (treeType) | ||
245 | + { | ||
246 | + case amdaUI.ExplorerUI.RESRC_TAB.TREE_TYPE: | ||
247 | + treeId = amdaUI.ExplorerUI.RESRC_TAB.TREE_ID; | ||
248 | + break; | ||
249 | + case amdaUI.ExplorerUI.OPE_TAB.TREE_TYPE: | ||
250 | + treeId = amdaUI.ExplorerUI.OPE_TAB.TREE_ID; | ||
251 | + break; | ||
252 | + case amdaUI.ExplorerUI.JOB_TAB.TREE_TYPE: | ||
253 | + treeId = amdaUI.ExplorerUI.JOB_TAB.TREE_ID; | ||
254 | + break; | ||
255 | + default: | ||
256 | + treeId = amdaUI.ExplorerUI.RESRC_TAB.TREE_ID; | ||
257 | + break; | ||
258 | + } | ||
530 | 259 | ||
531 | - } else if (view.ownerCt.getSelectionModel().selected.length > 1) { | ||
532 | - // get items menu corresponding to right clicked record | ||
533 | - menuItems = rec.getContextMenuMultiItems(this); | 260 | + var store = Ext.create('Ext.data.TreeStore', { |
261 | + root: { | ||
262 | + expanded: true, | ||
263 | + nodeType : treeType | ||
264 | + }, | ||
265 | + model: 'amdaModel.AmdaNode', | ||
266 | + sorters:[{ direction: 'DES' }, | ||
267 | + { sorterFn: function(o1, o2){ | ||
268 | + if (o1.get('nodeType') !== 'localParam') | ||
269 | + return; | ||
270 | + | ||
271 | + return o1.get('text').toUpperCase() < o2.get('text').toUpperCase() ? -1 : 1; | ||
272 | + } | ||
273 | + }], | ||
274 | + listeners: { | ||
275 | + beforeload: function(store, operation){ | ||
276 | + store.proxy.extraParams = { | ||
277 | + nodeType: operation.node.get('nodeType') | ||
278 | + }; | ||
279 | + } | ||
534 | } | 280 | } |
535 | - // if there's at least one item menu | ||
536 | - if (menuItems && menuItems.length){ | ||
537 | - // add the items | ||
538 | - menu.add(menuItems); | ||
539 | - // add listener on right clicked record | ||
540 | - var onRecordClick = function (menu, item, e, eOpts) | 281 | + }); |
282 | + | ||
283 | + var menu = new Ext.menu.Menu(); | ||
284 | + | ||
285 | + var tree = Ext.create('Ext.tree.Panel', { | ||
286 | + id : treeId, | ||
287 | + title: treeType, | ||
288 | + store: store, | ||
289 | + rootVisible: false, | ||
290 | + animate: false, | ||
291 | + hideHeaders : true, | ||
292 | + selModel: Ext.create('Ext.selection.TreeModel', { | ||
293 | + // ignoreRightMouseSelection: true, | ||
294 | + mode: 'MULTI' | ||
295 | + }), | ||
296 | + viewConfig: | ||
297 | + { | ||
298 | + plugins: | ||
299 | + { | ||
300 | + ptype: 'treeviewdragdrop', | ||
301 | + enableDrag:true, | ||
302 | + enableDrop:true, | ||
303 | + //TODO - BRE - Wait a fix for drag&drop issue | ||
304 | + ddGroup:'explorerTree', | ||
305 | + pluginId : 'ddplugin', | ||
306 | + | ||
307 | + isValidDropPoint : function (node, position, dragZone, e, data) | ||
541 | { | 308 | { |
542 | - if (this.myGetOwnerTree().getSelectionModel().isSelected(this)) { | ||
543 | - //Dispatch click event to the record | ||
544 | - this.onMenuItemClick(menu,item,e); | 309 | + if (!node || !data.item) { |
310 | + return false; | ||
545 | } | 311 | } |
546 | - //Remove old click listener | ||
547 | - menu.removeListener('click',onRecordClick,this); | ||
548 | - }; | 312 | + var view = this.view, |
313 | + targetNode = view.getRecord(node), | ||
314 | + draggedRecords = data.records, | ||
315 | + dataLength = draggedRecords.length, | ||
316 | + ln = draggedRecords.length, | ||
317 | + i, record; | ||
318 | + | ||
319 | + // No drop position, or dragged records: invalid drop point | ||
320 | + if (!(targetNode && position && dataLength)) { | ||
321 | + return false; | ||
322 | + } | ||
323 | + // If the targetNode is within the folder we are dragging | ||
324 | + for (i = 0; i < ln; i++) { | ||
325 | + record = draggedRecords[i]; | ||
326 | + if (record.isNode && record.contains(targetNode)) { | ||
327 | + return false; | ||
328 | + } | ||
329 | + } | ||
330 | + // Respect the allowDrop field on Tree nodes | ||
331 | + if (position === 'append' && targetNode.get('allowDrop') === false) { | ||
332 | + return false; | ||
333 | + } | ||
334 | + else if (position != 'append' && targetNode.parentNode.get('allowDrop') === false) { | ||
335 | + return false; | ||
336 | + } | ||
337 | + // If the target record is in the dragged dataset, then invalid drop | ||
338 | + if (Ext.Array.contains(draggedRecords, targetNode)) { | ||
339 | + return false; | ||
340 | + } | ||
341 | + // | ||
342 | + if (dataLength > 1) | ||
343 | + return false; | ||
344 | + | ||
345 | + var draggedRecord = draggedRecords[0]; | ||
346 | + // | ||
347 | + switch (targetNode.data.nodeType) | ||
348 | + { | ||
349 | + case 'localParam' : | ||
350 | + case 'remoteParam' : | ||
351 | + case 'remoteSimuParam' : | ||
352 | + case 'myData' : | ||
353 | + return false; | ||
354 | + default : | ||
355 | + if (draggedRecord.data.id == targetNode.data.nodeType+'-treeRootNode') | ||
356 | + return false; | ||
357 | + if ((position == 'before') && (targetNode.data.id == targetNode.data.nodeType+'-treeRootNode')) | ||
358 | + return false; | ||
359 | + return (draggedRecord.data.nodeType == targetNode.data.nodeType); | ||
360 | + } | ||
361 | + return false; | ||
362 | + }, | ||
363 | + onViewRender : function(view) | ||
364 | + { | ||
365 | + var me = this; | ||
366 | + | ||
367 | + view.on('itemupdate', function(record,index,node,opts) | ||
368 | + { | ||
369 | + var forceHide = false; | ||
370 | + var crtRec = record.parentNode; | ||
371 | + while (crtRec && !forceHide) | ||
372 | + { | ||
373 | + if (crtRec.get('filtered')) | ||
374 | + forceHide = crtRec.get('filtered'); | ||
375 | + crtRec = crtRec.parentNode; | ||
376 | + } | ||
377 | + tree.setNodesVisibility(record,forceHide); | ||
378 | + tree.applyDisableToNode(record); | ||
379 | + }); | ||
380 | + | ||
381 | + view.on('itemadd', function(records,index,node,opts) | ||
382 | + { | ||
383 | + Ext.each(records,function (rec) | ||
384 | + { | ||
385 | + tree.applyFilterToNode(rec); | ||
386 | + tree.applyDisableToNode(rec); | ||
387 | + }); | ||
388 | + }); | ||
389 | + | ||
390 | + view.on('afteritemexpand', function(record,index,node,opts) | ||
391 | + { | ||
392 | + var forceHide = false; | ||
393 | + var crtRec = record.parentNode; | ||
394 | + while (crtRec && !forceHide) | ||
395 | + { | ||
396 | + if (crtRec.get('filtered')) | ||
397 | + forceHide = crtRec.get('filtered'); | ||
398 | + crtRec = crtRec.parentNode; | ||
549 | 399 | ||
550 | - menu.addListener('click',onRecordClick,rec); | ||
551 | - // then show menu | ||
552 | - menu.showAt(e.getXY()); | ||
553 | - } | ||
554 | - }, | 400 | + } |
401 | + tree.setNodesVisibility(record,forceHide); | ||
402 | + tree.applyDisableToNode(record); | ||
403 | + }); | ||
404 | + | ||
405 | + if (me.enableDrag) | ||
406 | + { | ||
407 | + me.dragZone = Ext.create('Ext.tree.ViewDragZone', { | ||
408 | + view: view, | ||
409 | + ddGroup: me.dragGroup || me.ddGroup, | ||
410 | + dragText: me.dragText, | ||
411 | + repairHighlightColor: me.nodeHighlightColor, | ||
412 | + repairHighlight: me.nodeHighlightOnRepair | ||
413 | + }); | ||
414 | + } | ||
555 | 415 | ||
556 | - itemdblclick: function(view, record, item, index, event){ | ||
557 | - event.stopEvent(); | ||
558 | - | ||
559 | - // first check if it is for SAVE-START-STOP plugin... | ||
560 | - if (Ext.PluginManager.getCount() > 0 && | ||
561 | - record.get('nodeType') == amdaModel.TimeTableNode.nodeType && record.isLeaf()) { | ||
562 | - var zmgr = myDesktopApp.desktop.getDesktopZIndexManager(); | ||
563 | - var winActive = zmgr.getActive(); | ||
564 | - var winId = winActive.getId(); | ||
565 | - if (winId == 'explorer-win') { | ||
566 | - zmgr.eachTopDown(function(win) { | ||
567 | - var id = win.getId(); | ||
568 | - if (id !== 'explorer-win') { | ||
569 | - winId = id; | ||
570 | - return false; | 416 | + if (me.enableDrop) |
417 | + { | ||
418 | + me.dropZone = Ext.create('Ext.tree.ViewDropZone', { | ||
419 | + view: view, | ||
420 | + ddGroup: me.dropGroup || me.ddGroup, | ||
421 | + allowContainerDrops: me.allowContainerDrops, | ||
422 | + appendOnly: me.appendOnly, | ||
423 | + allowParentInserts: me.allowParentInserts, | ||
424 | + expandDelay: me.expandDelay, | ||
425 | + dropHighlightColor: me.nodeHighlightColor, | ||
426 | + dropHighlight: me.nodeHighlightOnDrop, | ||
427 | + isValidDropPoint : me.isValidDropPoint | ||
428 | + }); | ||
429 | + } | ||
430 | + } | ||
431 | + }, | ||
432 | + listeners : | ||
433 | + { | ||
434 | + beforedrop : function(node, data, overModel, dropPosition) | ||
435 | + { | ||
436 | + var parentId; | ||
437 | + switch(dropPosition) | ||
438 | + { | ||
439 | + case 'append' : | ||
440 | + if (overModel.isLeaf()) | ||
441 | + parentId = overModel.parentNode.get('id'); | ||
442 | + else | ||
443 | + parentId = overModel.get('id'); | ||
444 | + | ||
445 | + if(!overModel.isExpanded() && overModel.isExpandable()) { | ||
446 | + myDesktopApp.warningMsg('Please open the folder before node adding'); | ||
447 | + return false; | ||
448 | + } | ||
449 | + break; | ||
450 | + case 'before' : | ||
451 | + case 'after' : | ||
452 | + parentId = overModel.parentNode.get('id'); | ||
453 | + break; | ||
571 | } | 454 | } |
572 | - }); | 455 | + |
456 | + Ext.each(data.records, function(rec) | ||
457 | + { | ||
458 | + rec.renameDD(parentId,function(result) | ||
459 | + { | ||
460 | + if (result) | ||
461 | + { | ||
462 | + if (!result.id) | ||
463 | + { | ||
464 | + Ext.Msg.show({ | ||
465 | + title : 'Drop is impossible', | ||
466 | + msg : result.error, | ||
467 | + buttons : Ext.Msg.OK, | ||
468 | + icon : Ext.MessageBox.WARNING | ||
469 | + }); | ||
470 | + | ||
471 | + return false; | ||
472 | + } | ||
473 | + } | ||
474 | + else | ||
475 | + { | ||
476 | + Ext.Msg.show({ | ||
477 | + title : 'Drop is impossible', | ||
478 | + msg : 'Cannot connect to the server', | ||
479 | + buttons : Ext.Msg.OK, | ||
480 | + icon : Ext.MessageBox.WARNING | ||
481 | + }); | ||
482 | + | ||
483 | + return false; | ||
484 | + } | ||
485 | + | ||
486 | + return true; | ||
487 | + }); | ||
488 | + }); | ||
489 | + } | ||
573 | } | 490 | } |
574 | - } | 491 | + }, |
492 | + listeners: | ||
493 | + { | ||
494 | + itemmouseenter: function(view, record, item){ | ||
495 | + if(record.get('isParameter')){ | ||
496 | + var el = Ext.get(item), | ||
497 | + td = el.down('td > div'); | ||
498 | + td.setStyle('cursor', 'crosshair'); | ||
499 | + } | ||
500 | + else | ||
501 | + { | ||
502 | + var el = Ext.get(item), | ||
503 | + td = el.down('td > div'); | ||
504 | + td.setStyle('cursor', 'pointer'); | ||
505 | + } | ||
506 | + }, | ||
507 | + | ||
508 | + itemcontextmenu: function(view, rec, item, index, e){ | ||
509 | + // block other events | ||
510 | + e.stopEvent(); | ||
511 | + | ||
512 | + // clear menu items | ||
513 | + menu.removeAll(); | ||
514 | + var menuItems; | ||
515 | + | ||
516 | + // if it's a single selection | ||
517 | + if (view.ownerCt.getSelectionModel().selected.length === 1) { | ||
518 | + // get items menu corresponding to right clicked record | ||
519 | + menuItems = rec.getContextMenuItems(this); | ||
520 | + | ||
521 | + } else if (view.ownerCt.getSelectionModel().selected.length > 1) { | ||
522 | + // get items menu corresponding to right clicked record | ||
523 | + menuItems = rec.getContextMenuMultiItems(this); | ||
524 | + } | ||
525 | + // if there's at least one item menu | ||
526 | + if (menuItems && menuItems.length){ | ||
527 | + // add the items | ||
528 | + menu.add(menuItems); | ||
529 | + // add listener on right clicked record | ||
530 | + var onRecordClick = function (menu, item, e, eOpts) | ||
531 | + { | ||
532 | + if (this.myGetOwnerTree().getSelectionModel().isSelected(this)) { | ||
533 | + //Dispatch click event to the record | ||
534 | + this.onMenuItemClick(menu,item,e); | ||
535 | + } | ||
536 | + //Remove old click listener | ||
537 | + menu.removeListener('click',onRecordClick,this); | ||
538 | + }; | ||
539 | + | ||
540 | + menu.addListener('click',onRecordClick,rec); | ||
541 | + // then show menu | ||
542 | + menu.showAt(e.getXY()); | ||
543 | + } | ||
544 | + }, | ||
545 | + | ||
546 | + itemdblclick: function(view, record, item, index, event){ | ||
547 | + event.stopEvent(); | ||
548 | + // first check if it is for SAVE-START-STOP plugin... | ||
549 | + if (Ext.PluginManager.getCount() > 0 && | ||
550 | + record.get('nodeType') == amdaModel.TimeTableNode.nodeType && record.isLeaf()) { | ||
551 | + var zmgr = myDesktopApp.desktop.getDesktopZIndexManager(); | ||
552 | + var winActive = zmgr.getActive(); | ||
553 | + var winId = winActive.getId(); | ||
554 | + if (winId == 'explorer-win') { | ||
555 | + zmgr.eachTopDown(function(win) { | ||
556 | + var id = win.getId(); | ||
557 | + if (id !== 'explorer-win') { | ||
558 | + winId = id; | ||
559 | + return false; | ||
560 | + } | ||
561 | + }); | ||
562 | + } | ||
563 | + } | ||
564 | + | ||
565 | + if (record.get('nodeType') == 'remoteParam' && !record.isLeaf() | ||
566 | + && !record.get('isParameter')) { | ||
567 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | ||
568 | + module.createWindow(record.getBaseId()); | ||
569 | + }); | ||
570 | + } | ||
571 | + | ||
572 | + if (record.isLeaf() || record.data.isParameter) | ||
573 | + switch (record.get('nodeType')) | ||
574 | + { | ||
575 | + case 'myData' : | ||
576 | + case 'myDataParam' : | ||
577 | + case 'derivedParam' : | ||
578 | + case 'timeTable' : | ||
579 | + case 'sharedtimeTable' : | ||
580 | + case 'sharedcatalog' : | ||
581 | + case 'catalog' : | ||
582 | + case 'request' : | ||
583 | + case 'condition' : | ||
584 | + record.editLeaf(); | ||
585 | + break; | ||
586 | + case 'localParam' : | ||
587 | + case 'remoteParam': | ||
588 | + case 'remoteSimuParam': | ||
589 | + record.createAlias(record); | ||
590 | + break; | ||
591 | + case 'bkgWorks' : | ||
592 | + if (!record.get('object')) { | ||
593 | + AmdaAction.getObject(record.get('id'), record.get('nodeType'), record.getObjectCallback, record); | ||
594 | + } | ||
595 | + else { | ||
596 | + if (record.get('status') == 'done') { | ||
597 | + var isInteractive = false; | ||
598 | + var isNewTab = true; | ||
599 | + record.editNode(isNewTab, isInteractive); | ||
600 | + } | ||
601 | + else { | ||
602 | + myDesktopApp.infoMsg('Job Status: ' + record.get('status')); | ||
603 | + } | ||
604 | + } | ||
605 | + break; | ||
606 | + } | ||
607 | + }, | ||
608 | + | ||
609 | + beforeselect: function(view,node,index,options){ | ||
610 | + // if there's at least one node already selected | ||
611 | + if(view.selected.length | ||
612 | + //AND (the node which is beeing selected has a different nodeType than the first selected node OR the first selected node isn't a leaf | ||
613 | + && ( node.get('nodeType')!== view.selected.items[0].get('nodeType') || !view.selected.items[0].isLeaf()) | ||
614 | + // OR the node which is beeing selected has no nodeType OR it isn't a leaf OR | ||
615 | + || !node.get('nodeType') || !node.isLeaf() | ||
616 | + ){ | ||
617 | + // clear old selection | ||
618 | + view.deselectAll(); | ||
619 | + } | ||
620 | + }, | ||
621 | + | ||
622 | + afterrender: function(comp){ | ||
623 | + var view = comp.getView(); | ||
624 | + view.tip = Ext.create('Ext.tip.ToolTip', { | ||
625 | + // The overall target element. | ||
626 | + target: view.el, | ||
627 | + // Each grid row causes its own seperate show and hide. | ||
628 | + delegate: view.itemSelector, | ||
629 | + dismissDelay : 0, | ||
630 | + // showDelay: 100, | ||
631 | + // anchor: 'left', | ||
632 | + // Moving within the row should not hide the tip. | ||
633 | + trackMouse: true, | ||
634 | + autoRender: true, | ||
635 | + listeners: { | ||
636 | + // Change content dynamically depending on which element triggered the show. | ||
637 | + beforeshow: function updateTipBody(tip) { | ||
638 | + if (view.getRecord(tip.triggerElement)) { | ||
639 | + var info = view.getRecord(tip.triggerElement).get('info'); | ||
640 | + if (!info || info == '') { | ||
641 | + tip.addCls('hide'); | ||
642 | + } | ||
643 | + else { | ||
644 | + tip.removeCls('hide'); | ||
645 | + tip.update(info); | ||
646 | + } | ||
647 | + } | ||
648 | + } | ||
649 | + } | ||
650 | + }); | ||
651 | + }, | ||
652 | + // if remote base is empty - open interoperability module | ||
653 | + itemexpand: function(node) { | ||
654 | + if ( node.get('nodeType') == amdaModel.RemoteParamNode.nodeType | ||
655 | + && node.getDepth() == 3 && !node.hasChildNodes()) { | ||
656 | + node.addData(); | ||
657 | + } | ||
658 | + }, | ||
659 | + scope: this | ||
660 | + }, | ||
575 | 661 | ||
576 | - if (record.get('nodeType') == 'remoteParam' && !record.isLeaf() | ||
577 | - && !record.get('isParameter')) { | ||
578 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | ||
579 | - module.createWindow(record.getBaseId()); | ||
580 | - }); | ||
581 | - } | 662 | + hideHeaders: true, |
663 | + // must define a column with a field to enable editor | ||
664 | + columns: [{ | ||
665 | + xtype : 'treetoolcolumn', | ||
666 | + text : 'Name', | ||
667 | + flex : 1, | ||
668 | + dataIndex: 'text', | ||
669 | + tool: 'info', // this references the "tools" object on the prototype | ||
670 | + toolHandler: function(view, cell, recordIndex, cellIndex, e) { | ||
671 | + var tooltype = e.target.getAttribute("tooltype"); | ||
672 | + var record = view.store.getAt(recordIndex); | ||
673 | + switch (tooltype) | ||
674 | + { | ||
675 | + case 'info' : | ||
676 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function (module) { | ||
677 | + module.createWindow(record.get('help'), record.get('info')); | ||
678 | + }); | ||
679 | + break; | ||
680 | + } | ||
681 | + }, | ||
682 | + toolIsVisible : function(record) { | ||
582 | 683 | ||
583 | - if (record.isLeaf() || record.data.isParameter) | ||
584 | - switch (record.get('nodeType')) | ||
585 | - { | ||
586 | - case 'myData' : | ||
587 | - case 'myDataParam' : | ||
588 | - case 'derivedParam' : | ||
589 | - case 'timeTable' : | ||
590 | - case 'sharedtimeTable' : | ||
591 | - case 'sharedcatalog' : | ||
592 | - case 'catalog' : | ||
593 | - case 'request' : | ||
594 | - case 'condition' : | ||
595 | - record.editLeaf(); | ||
596 | - break; | ||
597 | - case 'localParam' : | ||
598 | - case 'remoteParam': | ||
599 | - case 'remoteSimuParam': | ||
600 | - record.createAlias(record); | ||
601 | - break; | ||
602 | - case 'bkgWorks' : | ||
603 | - if (!record.get('object')) { | ||
604 | - AmdaAction.getObject(record.get('id'), record.get('nodeType'), record.getObjectCallback, record); | 684 | + switch (record.get('nodeType')) |
685 | + { | ||
686 | + case 'localParam' : | ||
687 | + case 'remoteParam' : | ||
688 | + case 'remoteSimuParam' : | ||
689 | + | ||
690 | + return record.get('help') != ''; | ||
691 | + } | ||
692 | + return false; | ||
693 | + }, | ||
694 | + field: { | ||
695 | + validFlag: false, | ||
696 | + validator : function(value) { | ||
697 | + // get explorerModule | ||
698 | + var explModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
699 | + var explUI = explModule.getUiContent(); | ||
700 | + var activeTreePanel = explUI.getActiveTab(); | ||
701 | + | ||
702 | + var editedNode = activeTreePanel.getSelectionModel().selected.items[0]; | ||
703 | + if (editedNode) { | ||
704 | + if (!editedNode.get('id') && value === amdaModel.AmdaNode.NEW_DIR_NAME){ | ||
705 | + return false; | ||
706 | + } else { | ||
707 | + return this.validFlag; | ||
708 | + } | ||
709 | + } else { | ||
710 | + return true; | ||
711 | + } | ||
712 | + }, | ||
713 | + listeners: { | ||
714 | + change : function( field, newValue, oldValue, eOpts ) | ||
715 | + { | ||
716 | + var explModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
717 | + var explUI = explModule.getUiContent(); | ||
718 | + var activeTreePanel = explUI.getActiveTab(); | ||
719 | + | ||
720 | + var editedNode = activeTreePanel.getSelectionModel().selected.items[0]; | ||
721 | + if (editedNode) { | ||
722 | + editedNode.isValidName(newValue, function (res) { | ||
723 | + if (!res) | ||
724 | + { | ||
725 | + field.validFlag = 'Error during object validation'; | ||
726 | + field.validate(); | ||
727 | + return; | ||
728 | + } | ||
729 | + if (!res.valid) | ||
730 | + { | ||
731 | + if (res.error) | ||
732 | + { | ||
733 | + field.validFlag = res.error; | ||
734 | + field.validate(); | ||
735 | + return; | ||
736 | + } | ||
737 | + else | ||
738 | + { | ||
739 | + field.validFlag = 'Invalid object name'; | ||
740 | + field.validate(); | ||
741 | + return; | ||
742 | + } | ||
743 | + } | ||
744 | + | ||
745 | + field.validFlag = true; | ||
746 | + field.validate(); | ||
747 | + }); | ||
748 | + } | ||
749 | + } | ||
750 | + }, | ||
751 | + scope: this | ||
605 | } | 752 | } |
606 | - else { | ||
607 | - if (record.get('status') == 'done') { | ||
608 | - var isInteractive = false; | ||
609 | - var isNewTab = true; | ||
610 | - record.editNode(isNewTab, isInteractive); | 753 | + }], |
754 | + //add our custom editor plugin | ||
755 | + plugins: [ new MyTreeEditor({ | ||
756 | + pluginId: 'treeEditor', | ||
757 | + listeners: { | ||
758 | + 'canceledit' : function(editor, context) { | ||
759 | + if (editor && editor.startValue===amdaModel.AmdaNode.NEW_DIR_NAME) { | ||
760 | + context.record.remove(true); | ||
761 | + } | ||
611 | } | 762 | } |
612 | - else { | ||
613 | - myDesktopApp.infoMsg('Job Status: ' + record.get('status')); | 763 | + } |
764 | + })], | ||
765 | + | ||
766 | + setNodesVisibility : function(node,forceHide) | ||
767 | + { | ||
768 | + var isFiltered = node.get('filtered'); | ||
769 | + | ||
770 | + for (var i = 0; i < node.childNodes.length; i++) | ||
771 | + this.setNodesVisibility(node.childNodes[i],forceHide || isFiltered); | ||
772 | + | ||
773 | + this.setNodeVisibility(node,!(forceHide || isFiltered)); | ||
774 | + }, | ||
775 | + | ||
776 | + setNodeVisibility : function(node,isVisible) | ||
777 | + { | ||
778 | + var record = store.getNodeById(node.internalId); | ||
779 | + var viewNode = Ext.fly(tree.getView().getNode(record)); | ||
780 | + if (viewNode) | ||
781 | + { | ||
782 | + viewNode.setVisibilityMode(Ext.Element.DISPLAY); | ||
783 | + if (isVisible) | ||
784 | + { | ||
785 | + viewNode.show(); | ||
786 | + this.applyDisableToNode(record); | ||
614 | } | 787 | } |
788 | + else | ||
789 | + viewNode.hide(); | ||
615 | } | 790 | } |
616 | - break; | ||
617 | - } | ||
618 | - }, | ||
619 | - beforeselect: function(view,node,index,options){ | ||
620 | - // if there's at least one node already selected | ||
621 | - if(view.selected.length | ||
622 | - //AND (the node which is beeing selected has a different nodeType than the first selected node OR the first selected node isn't a leaf | ||
623 | - && ( node.get('nodeType')!== view.selected.items[0].get('nodeType') || !view.selected.items[0].isLeaf()) | ||
624 | - // OR the node which is beeing selected has no nodeType OR it isn't a leaf OR | ||
625 | - || !node.get('nodeType') || !node.isLeaf() | ||
626 | - ){ | ||
627 | - // clear old selection | ||
628 | - view.deselectAll(); | ||
629 | - } | ||
630 | - }, | ||
631 | -// Already done in ExtJS 4.2.4 selection model | ||
632 | -// itemmousedown: function(tree,rec,item,index,event,options){ | ||
633 | -// if(event.button===2){ | ||
634 | -// // if the right clicked item is already selected | ||
635 | -// if (tree.getSelectionModel().isSelected(rec)) { | ||
636 | -// // lock selection to prevent the selection modification by the right click | ||
637 | -// tree.getSelectionModel().setLocked(true); | ||
638 | -// } | ||
639 | -// } | ||
640 | -// }, | ||
641 | - afterrender: function(comp){ | ||
642 | - var view = comp.getView(); | ||
643 | - view.tip = Ext.create('Ext.tip.ToolTip', { | ||
644 | - // The overall target element. | ||
645 | - target: view.el, | ||
646 | - // Each grid row causes its own seperate show and hide. | ||
647 | - delegate: view.itemSelector, | ||
648 | - dismissDelay : 0, | ||
649 | - // showDelay: 100, | ||
650 | - // anchor: 'left', | ||
651 | - // Moving within the row should not hide the tip. | ||
652 | - trackMouse: true, | ||
653 | - autoRender: true, | ||
654 | - listeners: { | ||
655 | - // Change content dynamically depending on which element triggered the show. | ||
656 | - beforeshow: function updateTipBody(tip) { | ||
657 | - if (view.getRecord(tip.triggerElement)) { | ||
658 | - var info = view.getRecord(tip.triggerElement).get('info'); | ||
659 | - if (!info || info == '') { | ||
660 | - tip.addCls('hide'); | ||
661 | - } | ||
662 | - else { | ||
663 | - tip.removeCls('hide'); | ||
664 | - tip.update(info); | ||
665 | - } | ||
666 | - } | ||
667 | - } | ||
668 | - } | 791 | + }, |
792 | + | ||
793 | + applyFilterToNode : function(node) | ||
794 | + { | ||
795 | + if (!node) | ||
796 | + return; | ||
797 | + | ||
798 | + var filter = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id).filter; | ||
799 | + | ||
800 | + switch (node.get('nodeType')) | ||
801 | + { | ||
802 | + case 'localParam' : | ||
803 | + if (!filter || !filter['param']) | ||
804 | + { | ||
805 | + //no filter applied | ||
806 | + node.set('filtered',false); | ||
807 | + return; | ||
808 | + } | ||
809 | + var pos = node.get('depth') - 3; //depth from local param root node | ||
810 | + if (pos < 0 || pos > 2) | ||
811 | + { | ||
812 | + node.set('filtered',false); | ||
813 | + return; | ||
814 | + } | ||
815 | + var isFiltered = true; | ||
816 | + for (var i = 0; i < filter['param'].length; i++) | ||
817 | + { | ||
818 | + s = filter['param'][i].split(';'); | ||
819 | + if (node.get('id') == s[pos]) | ||
820 | + { | ||
821 | + isFiltered = false; | ||
822 | + break; | ||
823 | + } | ||
824 | + } | ||
825 | + node.set('filtered',isFiltered); | ||
826 | + break; | ||
827 | + | ||
828 | + case 'remoteSimuParam' : | ||
829 | + if (!filter || !filter['simu'] ) | ||
830 | + { | ||
831 | + //no filter applied | ||
832 | + node.set('filtered',false); | ||
833 | + return; | ||
834 | + } | ||
835 | + var pos = node.get('depth') - 3; //depth from remote param root node | ||
836 | + | ||
837 | + if (pos < 0 || pos > 5) | ||
838 | + { | ||
839 | + node.set('filtered',false); | ||
840 | + return; | ||
841 | + } | ||
842 | + var isFiltered = true; | ||
843 | + | ||
844 | + for (var i = 0; i < filter['simu'].length; i++) | ||
845 | + { | ||
846 | + s = filter['simu'][i].split(';'); | ||
847 | + | ||
848 | + if (node.get('id') == s[pos]) | ||
849 | + { | ||
850 | + isFiltered = false; | ||
851 | + break; | ||
852 | + } | ||
853 | + } | ||
854 | + node.set('filtered',isFiltered); | ||
855 | + break; | ||
856 | + /*case 'alias' : | ||
857 | + if (!this.localParamFilter.result || this.localParamFilter.id == "" || | ||
858 | + !node.isLeaf()) | ||
859 | + { | ||
860 | + //no filter applied | ||
861 | + node.set('filtered',false); | ||
862 | + return; | ||
863 | + } | ||
864 | + var crtParam = node.get('id'); | ||
865 | + crtParam = crtParam.replace('alias_',''); | ||
866 | + crtParam = crtParam.replace(/_/g,':'); | ||
867 | + var isFiltered = true; | ||
868 | + for (var i = 0; i < this.localParamFilter.result.length; i++) | ||
869 | + { | ||
870 | + s = this.localParamFilter.result[i].split(';'); | ||
871 | + console.log(s[2]); | ||
872 | + if (crtParam == s[2]) | ||
873 | + { | ||
874 | + isFiltered = false; | ||
875 | + break; | ||
876 | + } | ||
877 | + } | ||
878 | + node.set('filtered',isFiltered); | ||
879 | + break;*/ | ||
880 | + default : | ||
881 | + return; | ||
882 | + } | ||
883 | + }, | ||
884 | + | ||
885 | + applyFilterToNodes : function(node) | ||
886 | + { | ||
887 | + node.eachChild(function (child){ | ||
888 | + tree.applyFilterToNodes(child); | ||
889 | + }); | ||
890 | + tree.applyFilterToNode(node); | ||
891 | + }, | ||
892 | + | ||
893 | + applyDisableToNode : function(node) | ||
894 | + { | ||
895 | + var crtNode = node; | ||
896 | + var disable = false; | ||
897 | + | ||
898 | + do | ||
899 | + { | ||
900 | + if (crtNode.get('disable')) | ||
901 | + { | ||
902 | + disable = true; | ||
903 | + break; | ||
904 | + } | ||
905 | + crtNode = crtNode.parentNode; | ||
906 | + } while (crtNode); | ||
907 | + | ||
908 | + | ||
909 | + var viewNode = Ext.fly(tree.getView().getNode(node)); | ||
910 | + if (disable) | ||
911 | + { | ||
912 | + node.set('disable',true); | ||
913 | + viewNode.setStyle('opacity',0.5); | ||
914 | + } | ||
915 | + } | ||
669 | }); | 916 | }); |
670 | - }, | ||
671 | - // if remote base is empty - open interoperability module | ||
672 | - itemexpand: function(node) { | ||
673 | - if ( node.get('nodeType') == amdaModel.RemoteParamNode.nodeType | ||
674 | - && node.getDepth() == 3 && !node.hasChildNodes()) { | ||
675 | - node.addData(); | ||
676 | - } | ||
677 | - }, | ||
678 | - scope: this | ||
679 | - }, | ||
680 | 917 | ||
681 | - hideHeaders: true, | ||
682 | - // must define a column with a field to enable editor | ||
683 | - columns: [{ | ||
684 | - xtype : 'treetoolcolumn', | ||
685 | - text : 'Name', | ||
686 | - flex : 1, | ||
687 | - dataIndex: 'text', | ||
688 | - tool: 'info', // this references the "tools" object on the prototype | ||
689 | - toolHandler: function(view, cell, recordIndex, cellIndex, e) { | ||
690 | - var tooltype = e.target.getAttribute("tooltype"); | ||
691 | - var record = view.store.getAt(recordIndex); | ||
692 | - switch (tooltype) | ||
693 | - { | ||
694 | - case 'info' : | ||
695 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.info.id, true, function (module) { | ||
696 | - module.createWindow(record.get('help'), record.get('info')); | ||
697 | - }); | ||
698 | - break; | ||
699 | - } | ||
700 | - }, | ||
701 | - toolIsVisible : function(record) { | ||
702 | - | ||
703 | - switch (record.get('nodeType')) | ||
704 | - { | ||
705 | - case 'localParam' : | ||
706 | - case 'remoteParam' : | ||
707 | - case 'remoteSimuParam' : | ||
708 | - | ||
709 | - return record.get('help') != ''; | ||
710 | - } | ||
711 | - return false; | ||
712 | - }, | ||
713 | - field: { | ||
714 | - validFlag: false, | ||
715 | - validator : function(value) { | ||
716 | - // get explorerModule | ||
717 | - var explModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
718 | - var explUI = explModule.getUiContent(); | ||
719 | - var activeTreePanel = explUI.getActiveTab(); | ||
720 | - | ||
721 | - var editedNode = activeTreePanel.getSelectionModel().selected.items[0]; | ||
722 | - if (editedNode) { | ||
723 | - if (!editedNode.get('id') && value === amdaModel.AmdaNode.NEW_DIR_NAME){ | ||
724 | - return false; | ||
725 | - } else { | ||
726 | - return this.validFlag; | ||
727 | - } | ||
728 | - } else { | ||
729 | - return true; | ||
730 | - } | ||
731 | - }, | ||
732 | - listeners: { | ||
733 | - change : function( field, newValue, oldValue, eOpts ) | ||
734 | - { | ||
735 | - var explModule = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id); | ||
736 | - var explUI = explModule.getUiContent(); | ||
737 | - var activeTreePanel = explUI.getActiveTab(); | ||
738 | - | ||
739 | - var editedNode = activeTreePanel.getSelectionModel().selected.items[0]; | ||
740 | - if (editedNode) { | ||
741 | - editedNode.isValidName(newValue, function (res) { | ||
742 | - if (!res) | ||
743 | - { | ||
744 | - field.validFlag = 'Error during object validation'; | ||
745 | - field.validate(); | ||
746 | - return; | ||
747 | - } | ||
748 | - | ||
749 | - if (!res.valid) | ||
750 | - { | ||
751 | - if (res.error) | ||
752 | - { | ||
753 | - field.validFlag = res.error; | ||
754 | - field.validate(); | ||
755 | - return; | ||
756 | - } | ||
757 | - else | ||
758 | - { | ||
759 | - field.validFlag = 'Invalid object name'; | ||
760 | - field.validate(); | ||
761 | - return; | ||
762 | - } | ||
763 | - } | ||
764 | - | ||
765 | - field.validFlag = true; | ||
766 | - field.validate(); | ||
767 | - }); | ||
768 | - } | ||
769 | - } | ||
770 | - }, | ||
771 | - scope: this | ||
772 | - } | ||
773 | - }], | ||
774 | - //add our custom editor plugin | ||
775 | - plugins: [new MyTreeEditor({ | ||
776 | - pluginId: 'treeEditor', | ||
777 | - listeners: { | ||
778 | - 'canceledit' : function(editor, context) { | ||
779 | - if (editor && editor.startValue===amdaModel.AmdaNode.NEW_DIR_NAME) { | ||
780 | - context.record.remove(true); | ||
781 | - } | ||
782 | - } | ||
783 | - | ||
784 | - }})], | ||
785 | - | ||
786 | - setNodesVisibility : function(node,forceHide) | ||
787 | - { | ||
788 | - var isFiltered = node.get('filtered'); | ||
789 | - | ||
790 | - for (var i = 0; i < node.childNodes.length; i++) | ||
791 | - this.setNodesVisibility(node.childNodes[i],forceHide || isFiltered); | ||
792 | - | ||
793 | - this.setNodeVisibility(node,!(forceHide || isFiltered)); | ||
794 | - }, | ||
795 | - | ||
796 | - setNodeVisibility : function(node,isVisible) | ||
797 | - { | ||
798 | - var record = store.getNodeById(node.internalId); | ||
799 | - var viewNode = Ext.fly(tree.getView().getNode(record)); | ||
800 | - if (viewNode) | ||
801 | - { | ||
802 | - viewNode.setVisibilityMode(Ext.Element.DISPLAY); | ||
803 | - if (isVisible) | ||
804 | - { | ||
805 | - viewNode.show(); | ||
806 | - this.applyDisableToNode(record); | ||
807 | - } | ||
808 | - else | ||
809 | - viewNode.hide(); | ||
810 | - } | ||
811 | - }, | ||
812 | - | ||
813 | - applyFilterToNode : function(node) | ||
814 | - { | ||
815 | - if (!node) | ||
816 | - return; | ||
817 | - | ||
818 | - var filter = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id).filter; | ||
819 | - | ||
820 | - switch (node.get('nodeType')) | ||
821 | - { | ||
822 | - case 'localParam' : | ||
823 | - if (!filter || !filter['param']) | ||
824 | - { | ||
825 | - //no filter applied | ||
826 | - node.set('filtered',false); | ||
827 | - return; | ||
828 | - } | ||
829 | - var pos = node.get('depth') - 3; //depth from local param root node | ||
830 | - if (pos < 0 || pos > 2) | ||
831 | - { | ||
832 | - node.set('filtered',false); | ||
833 | - return; | ||
834 | - } | ||
835 | - var isFiltered = true; | ||
836 | - for (var i = 0; i < filter['param'].length; i++) | ||
837 | - { | ||
838 | - s = filter['param'][i].split(';'); | ||
839 | - if (node.get('id') == s[pos]) | ||
840 | - { | ||
841 | - isFiltered = false; | ||
842 | - break; | ||
843 | - } | ||
844 | - } | ||
845 | - node.set('filtered',isFiltered); | ||
846 | - break; | ||
847 | - case 'remoteSimuParam' : | ||
848 | - | ||
849 | - if (!filter || !filter['simu'] ) | ||
850 | - { | ||
851 | - //no filter applied | ||
852 | - node.set('filtered',false); | ||
853 | - return; | ||
854 | - } | ||
855 | - | ||
856 | - var pos = node.get('depth') - 3; //depth from remote param root node | ||
857 | - | ||
858 | - if (pos < 0 || pos > 5) | ||
859 | - { | ||
860 | - node.set('filtered',false); | ||
861 | - return; | ||
862 | - } | ||
863 | - | ||
864 | - var isFiltered = true; | ||
865 | - | ||
866 | - for (var i = 0; i < filter['simu'].length; i++) | ||
867 | - { | ||
868 | - s = filter['simu'][i].split(';'); | ||
869 | - | ||
870 | - if (node.get('id') == s[pos]) | ||
871 | - { | ||
872 | - isFiltered = false; | ||
873 | - break; | ||
874 | - } | ||
875 | - } | ||
876 | - node.set('filtered',isFiltered); | ||
877 | - break; | ||
878 | - /*case 'alias' : | ||
879 | - if (!this.localParamFilter.result || this.localParamFilter.id == "" || | ||
880 | - !node.isLeaf()) | ||
881 | - { | ||
882 | - //no filter applied | ||
883 | - node.set('filtered',false); | ||
884 | - return; | ||
885 | - } | ||
886 | - var crtParam = node.get('id'); | ||
887 | - crtParam = crtParam.replace('alias_',''); | ||
888 | - crtParam = crtParam.replace(/_/g,':'); | ||
889 | - var isFiltered = true; | ||
890 | - for (var i = 0; i < this.localParamFilter.result.length; i++) | ||
891 | - { | ||
892 | - s = this.localParamFilter.result[i].split(';'); | ||
893 | - console.log(s[2]); | ||
894 | - if (crtParam == s[2]) | ||
895 | - { | ||
896 | - isFiltered = false; | ||
897 | - break; | ||
898 | - } | ||
899 | - } | ||
900 | - node.set('filtered',isFiltered); | ||
901 | - break;*/ | ||
902 | - default : | ||
903 | - return; | ||
904 | - } | ||
905 | - }, | ||
906 | - | ||
907 | - applyFilterToNodes : function(node) | ||
908 | - { | ||
909 | - node.eachChild(function (child){ | ||
910 | - tree.applyFilterToNodes(child); | ||
911 | - }); | ||
912 | - tree.applyFilterToNode(node); | ||
913 | - }, | ||
914 | - | ||
915 | - applyDisableToNode : function(node) | ||
916 | - { | ||
917 | - var crtNode = node; | ||
918 | - var disable = false; | ||
919 | - | ||
920 | - do | ||
921 | - { | ||
922 | - if (crtNode.get('disable')) | ||
923 | - { | ||
924 | - disable = true; | ||
925 | - break; | ||
926 | - } | ||
927 | - crtNode = crtNode.parentNode; | ||
928 | - } while (crtNode); | ||
929 | - | ||
930 | - | ||
931 | - var viewNode = Ext.fly(tree.getView().getNode(node)); | ||
932 | - if (disable) | ||
933 | - { | ||
934 | - node.set('disable',true); | ||
935 | - viewNode.setStyle('opacity',0.5); | ||
936 | - } | ||
937 | - } | ||
938 | - }); | ||
939 | - | ||
940 | - tree.addEvents('edition'); | ||
941 | - | ||
942 | - | ||
943 | - | ||
944 | - return tree; | ||
945 | - }, | ||
946 | - | ||
947 | - updateFilter : function() | ||
948 | - { | ||
949 | - var filter = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id).filter; | ||
950 | - | ||
951 | - var keys = []; | ||
952 | - for (var f in filter) { | ||
953 | - if (hasOwnProperty.call(filter, f)) | ||
954 | - keys.push(f); | ||
955 | - } | ||
956 | - | ||
957 | - var tree = this.query('#'+amdaUI.ExplorerUI.RESRC_TAB.TREE_ID)[0]; | ||
958 | - tree.getView().refresh(); | ||
959 | - | ||
960 | - for (var i = 0; i < keys.length; i++) | ||
961 | - { | ||
962 | - if (keys[i] == "_empty_") | ||
963 | - continue; | 918 | + tree.addEvents('edition'); |
919 | + | ||
920 | + return tree; | ||
921 | + }, | ||
964 | 922 | ||
965 | - switch (keys[i]) | 923 | + updateFilter : function() |
966 | { | 924 | { |
967 | - case 'param' : | ||
968 | - | ||
969 | - //apply filter to local datasets | ||
970 | - var localNode = tree.getRootNode().findChild('id','myLocalData-treeRootNode',true); | ||
971 | - tree.applyFilterToNodes(localNode); | ||
972 | - tree.setNodesVisibility(localNode,false); | ||
973 | - tree.applyDisableToNode(localNode); | ||
974 | - | ||
975 | - //apply filter to aliases | ||
976 | - var aliasNode = tree.getRootNode().findChild('id','alias-treeRootNode',true); | ||
977 | - tree.applyFilterToNodes(aliasNode); | ||
978 | - tree.setNodesVisibility(aliasNode,false); | ||
979 | - tree.applyDisableToNode(aliasNode); | ||
980 | - break; | ||
981 | - | ||
982 | - case 'simu' : | ||
983 | - //apply filter to simulation datasets (in remote data) | ||
984 | - var remoteNode = tree.getRootNode().findChild('id','myRemoteSimuData-treeRootNode',true); | ||
985 | - tree.applyFilterToNodes(remoteNode); | ||
986 | - tree.setNodesVisibility(remoteNode,false); | ||
987 | - tree.applyDisableToNode(remoteNode); | ||
988 | - break; | ||
989 | - } | ||
990 | - } | 925 | + var filter = myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.explorer.id).filter; |
991 | 926 | ||
992 | - this.dockedItems.getAt(1).items.items[0].select(filter['name']); | ||
993 | - } | 927 | + var keys = []; |
928 | + for (var f in filter) { | ||
929 | + if (hasOwnProperty.call(filter, f)) | ||
930 | + keys.push(f); | ||
931 | + } | ||
932 | + | ||
933 | + var tree = this.query('#'+amdaUI.ExplorerUI.RESRC_TAB.TREE_ID)[0]; | ||
934 | + tree.getView().refresh(); | ||
935 | + | ||
936 | + for (var i = 0; i < keys.length; i++) | ||
937 | + { | ||
938 | + if (keys[i] == "_empty_") | ||
939 | + continue; | ||
994 | 940 | ||
941 | + switch (keys[i]) | ||
942 | + { | ||
943 | + case 'param' : | ||
944 | + //apply filter to local datasets | ||
945 | + var localNode = tree.getRootNode().findChild('id','myLocalData-treeRootNode',true); | ||
946 | + tree.applyFilterToNodes(localNode); | ||
947 | + tree.setNodesVisibility(localNode,false); | ||
948 | + tree.applyDisableToNode(localNode); | ||
949 | + | ||
950 | + //apply filter to aliases | ||
951 | + var aliasNode = tree.getRootNode().findChild('id','alias-treeRootNode',true); | ||
952 | + tree.applyFilterToNodes(aliasNode); | ||
953 | + tree.setNodesVisibility(aliasNode,false); | ||
954 | + tree.applyDisableToNode(aliasNode); | ||
955 | + break; | ||
956 | + | ||
957 | + case 'simu' : | ||
958 | + //apply filter to simulation datasets (in remote data) | ||
959 | + var remoteNode = tree.getRootNode().findChild('id','myRemoteSimuData-treeRootNode',true); | ||
960 | + tree.applyFilterToNodes(remoteNode); | ||
961 | + tree.setNodesVisibility(remoteNode,false); | ||
962 | + tree.applyDisableToNode(remoteNode); | ||
963 | + break; | ||
964 | + } | ||
965 | + } | ||
966 | + | ||
967 | + this.dockedItems.getAt(1).items.items[0].select(filter['name']); | ||
968 | + } | ||
995 | }); | 969 | }); |
996 | 970 | ||
971 | +// MyTreeEditor | ||
997 | Ext.define( 'MyTreeEditor', { | 972 | Ext.define( 'MyTreeEditor', { |
998 | - extend: 'Ext.grid.plugin.CellEditing', | ||
999 | - alias: 'editing.treeeditor', | ||
1000 | - | ||
1001 | - // initialization method of plugin | ||
1002 | - init: function(cmp) { | ||
1003 | - var me = this; | ||
1004 | - me.hostCmp = cmp; | ||
1005 | - // on parent event | ||
1006 | - me.hostCmp.on({ | ||
1007 | - // on edition event | ||
1008 | - edition : { | ||
1009 | - delay: 50, | ||
1010 | - fn : function(view, record, item, index, e){ | ||
1011 | - view.getHeaderAtIndex(0).field.validFlag = 'Not modified'; | ||
1012 | - // call the start edition method | ||
1013 | - me.startEdit(record, view.getHeaderAtIndex(0)); | ||
1014 | - }, | ||
1015 | - scope: me | ||
1016 | - } | ||
1017 | - }); | ||
1018 | - me.callParent(arguments); | ||
1019 | - }, | ||
1020 | - | ||
1021 | - /** | ||
1022 | - * Cancel any active editing. | ||
1023 | - */ | ||
1024 | - cancelEdit: function() { | ||
1025 | - var me = this, | ||
1026 | - activeEd = me.getActiveEditor(), | ||
1027 | - viewEl = me.grid.getView().getEl(me.getActiveColumn()); | ||
1028 | - | ||
1029 | - me.setActiveEditor(null); | ||
1030 | - me.setActiveColumn(null); | ||
1031 | - me.setActiveRecord(null); | ||
1032 | - if (activeEd) { | ||
1033 | - activeEd.cancelEdit(); | ||
1034 | - viewEl.focus(); | ||
1035 | - this.fireEvent('canceledit', activeEd, me.context); | ||
1036 | - } | ||
1037 | - }, | ||
1038 | - | ||
1039 | - /** | ||
1040 | - * overwrite the initEditTriggers to disable edition on click/dblclick | ||
1041 | - * and to add custom | ||
1042 | - */ | ||
1043 | - initEditTriggers: function() { | ||
1044 | - | ||
1045 | - var me = this, | ||
1046 | - view = me.view; | ||
1047 | - | ||
1048 | - me.on({ | ||
1049 | - edit: function(editor,event){ | ||
1050 | - // if there is a modification | ||
1051 | - if (event.originalValue !== event.value) { | ||
1052 | - // delegate rename action on model | ||
1053 | - event.record.rename(event.value,function(result){ | ||
1054 | - // if a result has been returned : success | ||
1055 | - if(result) { | ||
1056 | - // delegate commit action to delete modification flag | ||
1057 | - event.record.commit(); | ||
1058 | - var rec = event.record.data; | ||
1059 | - // in case of directory | ||
1060 | - if (!rec.leaf){ | ||
1061 | - // set folder's ID returned by server | ||
1062 | - rec.id = result.id; | ||
1063 | - } | ||
1064 | - } else { // in case of transaction error | ||
1065 | - // reset originalValue | ||
1066 | - event.record.value = event.originalValue; | ||
1067 | - event.record.get('text') = event.originalValue; | ||
1068 | - event.record.commit(); | ||
1069 | - } | ||
1070 | - }); | ||
1071 | - } | ||
1072 | - | ||
1073 | - } | ||
1074 | - }); | ||
1075 | - | ||
1076 | - // enable Enter key and Esc Key | ||
1077 | - view.on('render', function() { | ||
1078 | - me.keyNav = Ext.create('Ext.util.KeyNav', view.el, { | ||
1079 | - enter: me.onEnterKey, | ||
1080 | - esc: me.onEscKey, | ||
1081 | - scope: me | ||
1082 | - }); | ||
1083 | - }, me, { single: true }); | ||
1084 | - }, | ||
1085 | - | ||
1086 | - //overwrite the getEditing context because we do not need the rowId | ||
1087 | - getEditingContext: function(record, columnHeader) { | ||
1088 | - var me = this, | ||
1089 | - grid = me.grid, | ||
1090 | - store = grid.store, | ||
1091 | - colIdx, | ||
1092 | - view = grid.getView(), | ||
1093 | - value; | ||
1094 | - | ||
1095 | - // getting colIdx and real columnHeader | ||
1096 | - if (Ext.isNumber(columnHeader)) { | ||
1097 | - colIdx = columnHeader; | ||
1098 | - columnHeader = grid.headerCt.getHeaderAtIndex(colIdx); | ||
1099 | - } else { | ||
1100 | - colIdx = columnHeader.getIndex(); | ||
1101 | - } | ||
1102 | - // getting current value | ||
1103 | - value = record.get(columnHeader.dataIndex); | ||
1104 | - | ||
1105 | - // return editing context | ||
1106 | - return { | ||
1107 | - grid: grid, | ||
1108 | - record: record, | ||
1109 | - field: columnHeader.dataIndex, | ||
1110 | - value: value, | ||
1111 | - column: columnHeader, | ||
1112 | - colIdx: colIdx, | ||
1113 | - view: columnHeader.getOwnerHeaderCt().view | ||
1114 | - }; | ||
1115 | - } | ||
1116 | -} ); | 973 | + extend: 'Ext.grid.plugin.CellEditing', |
974 | + alias: 'editing.treeeditor', | ||
975 | + | ||
976 | + // initialization method of plugin | ||
977 | + init: function(cmp) { | ||
978 | + var me = this; | ||
979 | + me.hostCmp = cmp; | ||
980 | + // on parent event | ||
981 | + me.hostCmp.on({ | ||
982 | + // on edition event | ||
983 | + edition : { | ||
984 | + delay: 50, | ||
985 | + fn : function(view, record, item, index, e){ | ||
986 | + view.getHeaderAtIndex(0).field.validFlag = 'Not modified'; | ||
987 | + // call the start edition method | ||
988 | + me.startEdit(record, view.getHeaderAtIndex(0)); | ||
989 | + }, | ||
990 | + scope: me | ||
991 | + } | ||
992 | + }); | ||
993 | + me.callParent(arguments); | ||
994 | + }, | ||
995 | + | ||
996 | + /** | ||
997 | + * Cancel any active editing. | ||
998 | + */ | ||
999 | + cancelEdit: function() { | ||
1000 | + var me = this, | ||
1001 | + activeEd = me.getActiveEditor(), | ||
1002 | + viewEl = me.grid.getView().getEl(me.getActiveColumn()); | ||
1003 | + | ||
1004 | + me.setActiveEditor(null); | ||
1005 | + me.setActiveColumn(null); | ||
1006 | + me.setActiveRecord(null); | ||
1007 | + if (activeEd) { | ||
1008 | + activeEd.cancelEdit(); | ||
1009 | + viewEl.focus(); | ||
1010 | + this.fireEvent('canceledit', activeEd, me.context); | ||
1011 | + } | ||
1012 | + }, | ||
1013 | + | ||
1014 | + /** | ||
1015 | + * overwrite the initEditTriggers to disable edition on click/dblclick | ||
1016 | + * and to add custom | ||
1017 | + */ | ||
1018 | + initEditTriggers: function() | ||
1019 | + { | ||
1020 | + var me = this, | ||
1021 | + view = me.view; | ||
1022 | + | ||
1023 | + me.on({ | ||
1024 | + edit: function(editor,event){ | ||
1025 | + // if there is a modification | ||
1026 | + if (event.originalValue !== event.value) { | ||
1027 | + // delegate rename action on model | ||
1028 | + event.record.rename(event.value,function(result){ | ||
1029 | + // if a result has been returned : success | ||
1030 | + if(result) { | ||
1031 | + // delegate commit action to delete modification flag | ||
1032 | + event.record.commit(); | ||
1033 | + var rec = event.record.data; | ||
1034 | + // in case of directory | ||
1035 | + if (!rec.leaf){ | ||
1036 | + // set folder's ID returned by server | ||
1037 | + rec.id = result.id; | ||
1038 | + } | ||
1039 | + } else { // in case of transaction error | ||
1040 | + // reset originalValue | ||
1041 | + event.record.value = event.originalValue; | ||
1042 | + event.record.get('text') = event.originalValue; | ||
1043 | + event.record.commit(); | ||
1044 | + } | ||
1045 | + }); | ||
1046 | + } | ||
1047 | + } | ||
1048 | + }); | ||
1049 | + | ||
1050 | + // enable Enter key and Esc Key | ||
1051 | + view.on('render', function() { | ||
1052 | + me.keyNav = Ext.create('Ext.util.KeyNav', view.el, { | ||
1053 | + enter: me.onEnterKey, | ||
1054 | + esc: me.onEscKey, | ||
1055 | + scope: me | ||
1056 | + }); | ||
1057 | + }, me, { single: true }); | ||
1058 | + }, | ||
1059 | + //overwrite the getEditing context because we do not need the rowId | ||
1060 | + getEditingContext: function(record, columnHeader) { | ||
1061 | + var me = this, | ||
1062 | + grid = me.grid, | ||
1063 | + store = grid.store, | ||
1064 | + colIdx, | ||
1065 | + view = grid.getView(), | ||
1066 | + value; | ||
1067 | + | ||
1068 | + // getting colIdx and real columnHeader | ||
1069 | + if (Ext.isNumber(columnHeader)) { | ||
1070 | + colIdx = columnHeader; | ||
1071 | + columnHeader = grid.headerCt.getHeaderAtIndex(colIdx); | ||
1072 | + } else { | ||
1073 | + colIdx = columnHeader.getIndex(); | ||
1074 | + } | ||
1075 | + // getting current value | ||
1076 | + value = record.get(columnHeader.dataIndex); | ||
1077 | + | ||
1078 | + // return editing context | ||
1079 | + return { | ||
1080 | + grid: grid, | ||
1081 | + record: record, | ||
1082 | + field: columnHeader.dataIndex, | ||
1083 | + value: value, | ||
1084 | + column: columnHeader, | ||
1085 | + colIdx: colIdx, | ||
1086 | + view: columnHeader.getOwnerHeaderCt().view | ||
1087 | + }; | ||
1088 | + } | ||
1089 | +}); |
js/app/views/ParamsMgrUI.js
1 | /** | 1 | /** |
2 | * Project : AMDA-NG | 2 | * Project : AMDA-NG |
3 | - * Name : amdaUI.ParamsMgrUI | ||
4 | - * @class : | 3 | + * Name : ParamsMgrUI.js |
4 | + * @class amdaUI.ParamsMgrUI | ||
5 | * @extends Ext.Panel.Panel | 5 | * @extends Ext.Panel.Panel |
6 | * @brief | 6 | * @brief |
7 | - * @author Elena | ||
8 | - * @version $Id: ParamsMgrUI.js 1871 2013-11-22 13:54:17Z elena $ | ||
9 | - ****************************************************************************** | ||
10 | - * FT Id : Date : Name - Description | ||
11 | - ****************************************************************************** | ||
12 | - * | 7 | + * @author Elena |
13 | */ | 8 | */ |
14 | 9 | ||
15 | -Ext.define('amdaUI.ParamsMgrUI', { | ||
16 | - extend: 'Ext.panel.Panel', | ||
17 | - | ||
18 | - alias: 'widget.paramsMgrPanel', | ||
19 | - | ||
20 | - baseId : null, | ||
21 | - srcTree : null, | ||
22 | - destTree : null, | 10 | +Ext.define('amdaUI.ParamsMgrUI',{ |
11 | + extend: 'Ext.panel.Panel', | ||
12 | + alias: 'widget.paramsMgrPanel', | ||
13 | + | ||
14 | + baseId : null, | ||
15 | + srcTree : null, | ||
16 | + destTree : null, | ||
23 | 17 | ||
18 | + //TODO where keep this (==baseId) description ? Global variable? | ||
19 | + basesNames : ['CDAWEB', 'THEMIS', 'MAPSKP'], | ||
20 | + bases : [], | ||
24 | 21 | ||
25 | - hasModifs: false, | ||
26 | - | ||
27 | - //TODO where keep this (==baseId) description ? Global variable? | ||
28 | - basesNames : ['VEXGRAZ', 'CDAWEB', 'THEMIS', 'MAPSKP'], | ||
29 | - bases : [], | ||
30 | - | ||
31 | - configSrc : {title: 'source', enableDrag : true, enableDrop: false}, | ||
32 | - configDest : {title: 'destination', enableDrag : false, enableDrop:true}, | 22 | + configSrc : {title: 'source', enableDrag : true, enableDrop: false}, |
23 | + configDest : {title: 'destination', enableDrag : false, enableDrop:true}, | ||
24 | + | ||
25 | + constructor: function(config){ | ||
26 | + this.init(config); | ||
27 | + this.callParent(arguments); | ||
28 | + }, | ||
33 | 29 | ||
34 | - | ||
35 | - constructor: function(config) { | ||
36 | - this.init(config); | ||
37 | - this.callParent(arguments); | ||
38 | - }, | ||
39 | - | ||
40 | - /* | ||
41 | - * Load new data bases trees : source & destination | ||
42 | - */ | ||
43 | - loadTrees : function(button, pressed) { | ||
44 | - if (pressed) { | ||
45 | - this.baseId = button.text; | ||
46 | - this.loadTree('source'); | ||
47 | - this.loadTree('destination'); | ||
48 | - } | ||
49 | - }, | ||
50 | - | ||
51 | - /* | ||
52 | - * Real Load data base tree | ||
53 | - */ | ||
54 | - loadTree : function(type) { | ||
55 | - | ||
56 | - var title = this.baseId; | ||
57 | - if (type == 'source') var store = this.srcTree.getStore(); | ||
58 | - else { | ||
59 | - var store = this.destTree.getStore(); | ||
60 | - title = 'My '+ this.baseId; | ||
61 | - } | ||
62 | - // or RELOAD? | ||
63 | - var root = store.getRootNode(); | ||
64 | - store.load({ | ||
65 | - node: root, | ||
66 | - params: { | ||
67 | - nodeType: type, | ||
68 | - baseId: this.baseId | ||
69 | - } | ||
70 | - }); | ||
71 | - root.set('text', title); | ||
72 | - }, | ||
73 | - | ||
74 | -/* | ||
75 | - * Store and tree creation | ||
76 | - */ | ||
77 | - initTree: function(config) { | ||
78 | - | ||
79 | - if (this.baseId) { | ||
80 | - var title = config.title == 'source' ? this.baseId : 'My '+ this.baseId; | ||
81 | - } | ||
82 | - else var title = config.title; | ||
83 | - | ||
84 | - var selMode = config.title == 'source' ? {mode: 'SIMPLE'} : {mode: 'SINGLE'}; | ||
85 | - | ||
86 | - var store = Ext.create('Ext.data.TreeStore', { | ||
87 | - model: 'amdaModel.AmdaNode', | ||
88 | - root: { | ||
89 | - text: title, | ||
90 | - //TODO if use the same logic for localParam? | ||
91 | - nodeType : 'remoteParam', | ||
92 | - expanded: true | ||
93 | - }, | ||
94 | - listeners: { | ||
95 | - scope : this, | ||
96 | - beforeload: function(store, operation){ | ||
97 | - store.proxy.extraParams = { | ||
98 | - nodeType: config.title, | ||
99 | - baseId: this.baseId | ||
100 | - } | ||
101 | - }} | ||
102 | - }); | 30 | + /* |
31 | + * Load new data bases trees : source & destination | ||
32 | + */ | ||
33 | + loadTrees : function(button, pressed){ | ||
34 | + if (pressed) { | ||
35 | + this.baseId = button.text; | ||
36 | + this.loadTree('source'); | ||
37 | + this.loadTree('destination'); | ||
38 | + } | ||
39 | + }, | ||
103 | 40 | ||
104 | - var menu = new Ext.menu.Menu({ | ||
105 | - items: [{ | ||
106 | - text: 'Delete Data' | ||
107 | - }], | ||
108 | - listeners: { | ||
109 | - scope : this, | ||
110 | - click : this.deleteMulti | ||
111 | - } | ||
112 | - }); | 41 | + /* |
42 | + * Real Load data base tree | ||
43 | + */ | ||
44 | + loadTree : function(type){ | ||
45 | + var title = this.baseId; | ||
46 | + if (type == 'source'){ | ||
47 | + var store = this.srcTree.getStore(); | ||
48 | + | ||
49 | + } | ||
50 | + else { | ||
51 | + var store = this.destTree.getStore(); | ||
52 | + title = 'My '+ this.baseId; | ||
53 | + } | ||
54 | + // sort alphabetically | ||
55 | + store.sort([ | ||
56 | + { sorterFn: function(o1, o2){ | ||
57 | + return o1.get('text').toUpperCase() < o2.get('text').toUpperCase() ? -1 : 1; | ||
58 | + } | ||
59 | + } | ||
60 | + ]); | ||
61 | + // or RELOAD? | ||
62 | + var root = store.getRootNode(); | ||
63 | + store.load({ | ||
64 | + node: root, | ||
65 | + params: { | ||
66 | + nodeType: type, | ||
67 | + baseId: this.baseId | ||
68 | + } | ||
69 | + }); | ||
70 | + root.set('text', title); | ||
71 | + }, | ||
113 | 72 | ||
114 | - var tree = Ext.create('Ext.tree.Panel', { | ||
115 | - store: store, | ||
116 | - id : config.title, | ||
117 | - flex: 1, | ||
118 | - height: 400, | ||
119 | - selModel: selMode, //{mode: 'SIMPLE'}, | ||
120 | - viewConfig: { | ||
121 | - plugins: { | ||
122 | - ptype: 'treeviewdragdrop', | ||
123 | - allowContainerDrops : true, | ||
124 | - enableDrag: config.enableDrag, | ||
125 | - enableDrop: config.enableDrop, | ||
126 | - //TODO dataset drag/drop by parameters SELECTION | ||
127 | - dragText : "{0} selected parameter{1}", | ||
128 | - expandDelay : 100, | ||
129 | - ddGroup : "RemoteTreeDD", | ||
130 | - isValidDropPoint : function(){ | ||
131 | - return true; | ||
132 | - }, | ||
133 | - onContainerOver : function() { | ||
134 | - return this.dropAllowed; | ||
135 | - | ||
136 | - }, | ||
137 | - onNodeOver : function() { | ||
138 | - return this.dropAllowed; | ||
139 | - }, | ||
140 | - onNodeDrop : function(nodeData, dd, e, data) { | ||
141 | - if (!data.records) | ||
142 | - return false; | ||
143 | - Ext.Array.each(data.records, this.onDrop, this); | ||
144 | -// deselect source tree selection | ||
145 | - data.view.getSelectionModel().deselectAll(); | ||
146 | - return true; | ||
147 | - }, | ||
148 | - onContainerDrop : function(dd, e, data) { | ||
149 | - | ||
150 | - if (!data.records) | ||
151 | - return false; | ||
152 | - Ext.Array.each(data.records, this.onDrop, this); | ||
153 | -// deselect source tree selection | ||
154 | - data.view.getSelectionModel().deselectAll(); | ||
155 | - return true; | ||
156 | - }, | 73 | + /* |
74 | + * Store and tree creation | ||
75 | + */ | ||
76 | + initTree: function(config){ | ||
77 | + if (this.baseId){ | ||
78 | + var title = config.title == 'source' ? this.baseId : 'My '+ this.baseId; | ||
79 | + } | ||
80 | + else | ||
81 | + var title = config.title; | ||
82 | + | ||
83 | + var selMode = config.title == 'source' ? {mode: 'SIMPLE'} : {mode: 'SINGLE'}; | ||
157 | 84 | ||
158 | - onDrop : function(record) { | ||
159 | - | ||
160 | - var root = tree.getRootNode(); | ||
161 | - var srcNode = record; | ||
162 | - var id = srcNode.get('id'); | ||
163 | - | ||
164 | - // Check if node exists already at destination | ||
165 | - if (root.findChild('id',id, true)) return; | ||
166 | - | ||
167 | - var ddNode = srcNode; | ||
168 | - // Array of parent nodes description | ||
169 | - var Arr = []; | ||
170 | - | ||
171 | - while (!ddNode.isRoot()) { | ||
172 | - ddNode = ddNode.parentNode; | ||
173 | - Arr.push(ddNode); | 85 | + var store = Ext.create('Ext.data.TreeStore', { |
86 | + model: 'amdaModel.AmdaNode', | ||
87 | + root: { | ||
88 | + text: title, | ||
89 | + nodeType : 'remoteParam', | ||
90 | + expanded: true | ||
91 | + }, | ||
92 | + listeners: { | ||
93 | + scope : this, | ||
94 | + beforeload: function(store, operation){ | ||
95 | + store.proxy.extraParams = { | ||
96 | + nodeType: config.title, | ||
97 | + baseId: this.baseId | ||
98 | + } | ||
99 | + }} | ||
100 | + }); | ||
101 | + | ||
102 | + var menu = new Ext.menu.Menu({ | ||
103 | + items: [{ | ||
104 | + text: 'Delete Data' | ||
105 | + }], | ||
106 | + listeners: { | ||
107 | + scope : this, | ||
108 | + click : this.deleteMulti | ||
174 | } | 109 | } |
175 | - // start with the highest node | ||
176 | - Arr.reverse(); | ||
177 | - | ||
178 | - // create parent nodes if they do not exist | ||
179 | - var parentNode = root; | ||
180 | - Ext.Array.each(Arr,function(srcNode, index){ | ||
181 | - if (index > 0) { | ||
182 | - var nodeId = srcNode.get('id'); | ||
183 | - var node = root.findChild('id',nodeId, true); | ||
184 | - if (!node) { | ||
185 | - node = srcNode.copy(); | ||
186 | - parentNode.appendChild(node); | ||
187 | - parentNode.expand(); | ||
188 | - node.setDirty(); | ||
189 | - } | ||
190 | - parentNode = node; | ||
191 | - } | ||
192 | - }); | ||
193 | - | ||
194 | - // Add new node to correct location | ||
195 | - parentNode.expand(!this.isDataSet, function(res){ | ||
196 | - var newNode = srcNode.copy(); | ||
197 | - parentNode.appendChild(newNode); | ||
198 | - //to sync treeStore | ||
199 | - newNode.setDirty(); | ||
200 | - //expand the whole subtree of added node | ||
201 | - tree.selectPath(newNode.getPath( 'id', '|'), 'id', '|'); | ||
202 | - }); | ||
203 | - return true; | ||
204 | - }, | ||
205 | - | ||
206 | - onViewRender : function(view) { | ||
207 | - var me = this; | 110 | + }); |
111 | + | ||
112 | + var tree = Ext.create('Ext.tree.Panel', { | ||
113 | + store: store, | ||
114 | + id : config.title, | ||
115 | + flex: 1, | ||
116 | + height: 500, | ||
117 | + selModel: selMode, //{mode: 'SIMPLE'}, | ||
118 | + viewConfig: { | ||
119 | + plugins:{ | ||
120 | + ptype: 'treeviewdragdrop', | ||
121 | + allowContainerDrops : true, | ||
122 | + enableDrag: config.enableDrag, | ||
123 | + enableDrop: config.enableDrop, | ||
124 | + //TODO dataset drag/drop by parameters SELECTION | ||
125 | + dragText : "{0} selected parameter{1}", | ||
126 | + expandDelay : 100, | ||
127 | + ddGroup : "RemoteTreeDD", | ||
128 | + | ||
129 | + isValidDropPoint : function(){ | ||
130 | + return true; | ||
131 | + }, | ||
132 | + | ||
133 | + onContainerOver : function() { | ||
134 | + return this.dropAllowed; | ||
135 | + }, | ||
136 | + | ||
137 | + onNodeOver : function() { | ||
138 | + return this.dropAllowed; | ||
139 | + }, | ||
140 | + | ||
141 | + onNodeDrop : function(nodeData, dd, e, data){ | ||
142 | + if (!data.records) | ||
143 | + return false; | ||
144 | + Ext.Array.each(data.records, this.onDrop, this); | ||
145 | + // deselect source tree selection | ||
146 | + data.view.getSelectionModel().deselectAll(); | ||
147 | + | ||
148 | + return true; | ||
149 | + }, | ||
150 | + | ||
151 | + onContainerDrop : function(dd, e, data){ | ||
152 | + if (!data.records) | ||
153 | + return false; | ||
154 | + Ext.Array.each(data.records, this.onDrop, this); | ||
155 | + // deselect source tree selection | ||
156 | + data.view.getSelectionModel().deselectAll(); | ||
157 | + | ||
158 | + return true; | ||
159 | + }, | ||
160 | + | ||
161 | + onDrop : function(record) { | ||
162 | + var root = tree.getRootNode(); | ||
163 | + var srcNode = record; | ||
164 | + var id = srcNode.get('id'); | ||
165 | + // Check if node exists already at destination | ||
166 | + var idToCheck = id.toLowerCase().replace(":", "_", "gi"); | ||
167 | + // TODO check at sever side | ||
168 | + if (root.findChild('id',idToCheck, true)) { | ||
169 | + myDesktopApp.infoMsg('This parameter exists already in your treee'); | ||
170 | + return; | ||
171 | + } | ||
172 | + var ddNode = srcNode; | ||
173 | + // Array of parent nodes description | ||
174 | + var Arr = []; | ||
175 | + while (!ddNode.isRoot()) { | ||
176 | + ddNode = ddNode.parentNode; | ||
177 | + Arr.push(ddNode); | ||
178 | + } | ||
179 | + // start with the highest node | ||
180 | + Arr.reverse(); | ||
181 | + // create parent nodes if they do not exist | ||
182 | + var parentNode = root; | ||
183 | + Ext.Array.each(Arr,function(srcNode, index) { | ||
184 | + if (index > 0) { | ||
185 | + var nodeId = srcNode.get('id'); | ||
186 | + var node = root.findChild('id',nodeId, true); | ||
187 | + if (!node) { | ||
188 | + node = srcNode.copy(); | ||
189 | + parentNode.appendChild(node); | ||
190 | + parentNode.expand(); | ||
191 | + node.setDirty(); | ||
192 | + } | ||
193 | + parentNode = node; | ||
194 | + } | ||
195 | + }); | ||
208 | 196 | ||
209 | - if (me.enableDrag) { | ||
210 | - me.dragZone = Ext.create('Ext.tree.ViewDragZone', { | ||
211 | - view: view, | ||
212 | - ddGroup: me.dragGroup || me.ddGroup, | ||
213 | - dragText: me.dragText | ||
214 | - }); | ||
215 | - } | 197 | + // Add new node to correct location |
198 | + parentNode.expand(!this.isDataSet, function(res){ | ||
199 | + var newNode = srcNode.copy(); | ||
200 | + parentNode.appendChild(newNode); | ||
201 | + //to sync treeStore | ||
202 | + newNode.setDirty(); | ||
203 | + //expand the whole subtree of added node | ||
204 | + tree.selectPath(newNode.getPath( 'id', '|'), 'id', '|'); | ||
205 | + }); | ||
206 | + return true; | ||
207 | + }, | ||
208 | + | ||
209 | + onViewRender : function(view){ | ||
210 | + var me = this; | ||
216 | 211 | ||
217 | - if (me.enableDrop) { | ||
218 | - me.dropZone = Ext.create('Ext.tree.ViewDropZone', { | ||
219 | - view: view, | ||
220 | - ddGroup: me.dropGroup || me.ddGroup, | ||
221 | - allowContainerDrops: me.allowContainerDrops, | ||
222 | - expandDelay: me.expandDelay, | ||
223 | - isValidDropPoint : me.isValidDropPoint, | ||
224 | - onContainerDrop : me.onContainerDrop, | ||
225 | - onNodeDrop : me.onNodeDrop, | ||
226 | - onContainerOver : me.onContainerOver, | ||
227 | - onNodeOver : me.onNodeOver, | ||
228 | - onDrop : me.onDrop, | ||
229 | - onSimpleDrop : me.onSimpleDrop | ||
230 | - }); | ||
231 | - } | ||
232 | - } | ||
233 | - } | ||
234 | - }, | ||
235 | - listeners: { | ||
236 | - afterrender: function(comp){ | ||
237 | - var view = comp.getView(); | ||
238 | - view.tip = Ext.create('Ext.tip.ToolTip', { | ||
239 | - // The overall target element. | ||
240 | - target: view.el, | ||
241 | - // Each grid row causes its own seperate show and hide. | ||
242 | - delegate: view.itemSelector, | ||
243 | - // Moving within the row should not hide the tip. | ||
244 | - trackMouse: true, | ||
245 | - autoRender: true, | 212 | + if (me.enableDrag){ |
213 | + me.dragZone = Ext.create('Ext.tree.ViewDragZone', { | ||
214 | + view: view, | ||
215 | + ddGroup: me.dragGroup || me.ddGroup, | ||
216 | + dragText: me.dragText | ||
217 | + }); | ||
218 | + } | ||
219 | + | ||
220 | + if (me.enableDrop){ | ||
221 | + me.dropZone = Ext.create('Ext.tree.ViewDropZone', { | ||
222 | + view: view, | ||
223 | + ddGroup: me.dropGroup || me.ddGroup, | ||
224 | + allowContainerDrops: me.allowContainerDrops, | ||
225 | + expandDelay: me.expandDelay, | ||
226 | + isValidDropPoint : me.isValidDropPoint, | ||
227 | + onContainerDrop : me.onContainerDrop, | ||
228 | + onNodeDrop : me.onNodeDrop, | ||
229 | + onContainerOver : me.onContainerOver, | ||
230 | + onNodeOver : me.onNodeOver, | ||
231 | + onDrop : me.onDrop, | ||
232 | + onSimpleDrop : me.onSimpleDrop | ||
233 | + }); | ||
234 | + } | ||
235 | + } | ||
236 | + } | ||
237 | + }, | ||
238 | + | ||
246 | listeners: { | 239 | listeners: { |
247 | - // Change content dynamically depending on which element triggered the show. | ||
248 | - beforeshow: function updateTipBody(tip) { | ||
249 | - var trigger = view.getRecord(tip.triggerElement); | ||
250 | - if (trigger) { | ||
251 | - var info = trigger.get('info'); | ||
252 | - if (!info || info == '') { | ||
253 | - tip.addCls('hide'); | ||
254 | - } | ||
255 | - else { | ||
256 | - tip.removeCls('hide'); | ||
257 | - tip.update(info); | ||
258 | - } | 240 | + afterrender: function(comp) { |
241 | + var view = comp.getView(); | ||
242 | + view.tip = Ext.create('Ext.tip.ToolTip', { | ||
243 | + // The overall target element. | ||
244 | + target: view.el, | ||
245 | + // Each grid row causes its own seperate show and hide. | ||
246 | + delegate: view.itemSelector, | ||
247 | + // Moving within the row should not hide the tip. | ||
248 | + trackMouse: true, | ||
249 | + autoRender: true, | ||
250 | + listeners: { | ||
251 | + // Change content dynamically depending on which element triggered the show. | ||
252 | + beforeshow: function updateTipBody(tip) { | ||
253 | + var trigger = view.getRecord(tip.triggerElement); | ||
254 | + if (trigger) { | ||
255 | + var info = trigger.get('info'); | ||
256 | + if (!info || info == '') { | ||
257 | + tip.addCls('hide'); | ||
258 | + } | ||
259 | + else { | ||
260 | + tip.removeCls('hide'); | ||
261 | + tip.update(info); | ||
262 | + } | ||
263 | + } | ||
264 | + } | ||
265 | + } | ||
266 | + }); | ||
267 | + }, | ||
268 | + | ||
269 | + itemmouseenter: function(view, record, item){ | ||
270 | + if(record.get('allowDrag') && view.ownerCt.id == 'source'){ | ||
271 | + var el = Ext.get(item), | ||
272 | + td = el.down('td > div'); | ||
273 | + td.setStyle('cursor', 'crosshair'); | ||
274 | + } | ||
275 | + }, | ||
276 | + | ||
277 | + beforeselect: function(selmodel, record, index) { | ||
278 | + if (!(record.get('isRemoteDataSet') || record.get('isParameter')) && tree.id == 'source') return false; | ||
279 | + }, | ||
280 | + | ||
281 | + select: function(selmodel, record, index){ | ||
282 | + if (record.get('isRemoteDataSet') && tree.id == 'source' && record.isExpanded()) { | ||
283 | + var toSelect = selmodel.getCount() !== record.childNodes.length + 1; | ||
284 | + var alreadySelected = selmodel.isSelected(record.firstChild); | ||
285 | + | ||
286 | + selmodel.deselectAll(); | ||
287 | + | ||
288 | + if (toSelect && !alreadySelected) | ||
289 | + selmodel.select(record.childNodes); | ||
290 | + } | ||
291 | + }, | ||
292 | + | ||
293 | + itemcontextmenu: function(view, rec, item, index, e) | ||
294 | + { | ||
295 | + e.preventDefault();//stopEvent(); | ||
296 | + if (tree.id == 'destination' && rec.getDepth() > 0) | ||
297 | + menu.showAt(e.getXY()); | ||
259 | } | 298 | } |
260 | - } | ||
261 | - } | ||
262 | - }); | ||
263 | - }, | ||
264 | - | ||
265 | - itemmouseenter: function(view, record, item){ | ||
266 | - if(record.get('allowDrag') && view.ownerCt.id == 'source'){ | ||
267 | - var el = Ext.get(item), | ||
268 | - td = el.down('td > div'); | ||
269 | - td.setStyle('cursor', 'crosshair'); | ||
270 | - } | ||
271 | - }, | 299 | + } |
300 | + }); | ||
301 | + return tree; | ||
302 | + }, | ||
303 | + | ||
304 | + // for the moment SINGLE! | ||
305 | + deleteMulti: function(){ | ||
306 | + var selected = this.destTree.getSelectionModel().getSelection(); | ||
307 | + Ext.Array.each(selected, function(rec){ | ||
308 | + rec.deleteData(); | ||
309 | + }); | ||
272 | 310 | ||
273 | - beforeselect: function(selmodel, record, index) { | ||
274 | - if (!(record.get('isRemoteDataSet') || record.get('isParameter')) && tree.id == 'source') return false; | ||
275 | - }, | ||
276 | - | ||
277 | - select: function(selmodel, record, index) { | ||
278 | - | ||
279 | - if (record.get('isRemoteDataSet') && tree.id == 'source' && record.isExpanded()) { | ||
280 | - var toSelect = selmodel.getCount() !== record.childNodes.length + 1; | ||
281 | - var alreadySelected = selmodel.isSelected(record.firstChild); | ||
282 | - | ||
283 | - selmodel.deselectAll(); | ||
284 | - | ||
285 | - if (toSelect && !alreadySelected) selmodel.select(record.childNodes); | ||
286 | - } | ||
287 | - }, | ||
288 | - | ||
289 | - itemcontextmenu: function(view, rec, item, index, e){ | ||
290 | - e.preventDefault();//stopEvent(); | ||
291 | - if (tree.id == 'destination' && rec.getDepth() > 0) | ||
292 | - menu.showAt(e.getXY()); | ||
293 | - } | ||
294 | - } | ||
295 | - }); | ||
296 | - return tree; | ||
297 | - }, | ||
298 | -// for the moment SINGLE! | ||
299 | - deleteMulti: function(){ | ||
300 | - var selected = this.destTree.getSelectionModel().getSelection(); | ||
301 | - Ext.Array.each(selected, function(rec){ | ||
302 | - rec.deleteData(); | ||
303 | - }); | ||
304 | - }, | ||
305 | - | ||
306 | - | ||
307 | - successCallBack : function(batch, options) { | ||
308 | - this.hasModifs = true; | ||
309 | - loadMask.hide(); | ||
310 | - var createdNodes = options.operations.update; | ||
311 | - | ||
312 | -// define Pathes to the created nodes | ||
313 | - var Arr = []; | ||
314 | - Ext.Array.each(createdNodes,function(item){ | ||
315 | - if (item.getDepth() == 4) { // parameter level | ||
316 | - Arr.push(item.getPath('id', '|')); | ||
317 | - } | ||
318 | - }); | ||
319 | - | ||
320 | -// reload destination tree and expand created nodes | ||
321 | - var panel = this.destTree; | ||
322 | - var store = this.destTree.getStore(); | ||
323 | - var root = store.getRootNode(); | ||
324 | - store.load({ node : root, | ||
325 | - params : { nodeType: 'destination', | ||
326 | - baseId: this.baseId }, | ||
327 | - callback : function(){ | ||
328 | - for (var i = 0; i < Arr.length; i++){ | ||
329 | - panel.selectPath(Arr[i], 'id', '|'); | ||
330 | - } | ||
331 | - } | ||
332 | - }); | ||
333 | - | ||
334 | - | ||
335 | - }, | ||
336 | - | ||
337 | - failureCallBack : function(batch, options) { | ||
338 | - //TODO message error | ||
339 | - alert('FAILURE!'); | ||
340 | - loadMask.hide(); | ||
341 | - this.loadTree('destination'); | ||
342 | - }, | ||
343 | - | ||
344 | - /* | ||
345 | - * Panel Trees generation | ||
346 | - */ | ||
347 | - | ||
348 | - init: function(config) { | ||
349 | - | ||
350 | - if (config.baseId && config.baseId != 'root') | ||
351 | - this.baseId = config.baseId; | ||
352 | - | ||
353 | - this.srcTree = this.initTree(this.configSrc); | ||
354 | - this.destTree = this.initTree(this.configDest); | 311 | + // reload destination tree and expand created nodes |
312 | + var store = this.destTree.getStore(); | ||
313 | + var root = store.getRootNode(); | ||
314 | + store.load({ node : root, | ||
315 | + params : { nodeType: 'destination', | ||
316 | + baseId : this.baseId } | ||
317 | + }); | ||
318 | + }, | ||
319 | + | ||
320 | + successCallBack : function(batch, options) { | ||
321 | + loadMask.hide(); | ||
322 | + var createdNodes = options.operations.create; | ||
323 | + // define Pathes to the created nodes | ||
324 | + Arr = []; | ||
325 | + Ext.Array.each(createdNodes,function(item){ | ||
326 | + // if (item.getDepth() == 5) { // parameter level | ||
327 | + if (item.get('isParameter')){ // parameter level | ||
328 | + Arr.push(item.getPath('id', '|')); | ||
329 | + } | ||
330 | + }); | ||
331 | + // reload destination tree and expand created nodes | ||
332 | + var panel = this.destTree; | ||
333 | + var store = this.destTree.getStore(); | ||
334 | + var root = store.getRootNode(); | ||
335 | + store.load({ node : root, | ||
336 | + params : { nodeType: 'destination', | ||
337 | + baseId : this.baseId }, | ||
338 | + scope : this, | ||
339 | + callback : function(){ | ||
340 | + for (var i = 0; i < Arr.length; i++){ | ||
341 | + panel.selectPath(Arr[i], 'id', '|'); | ||
342 | + } | ||
343 | + } | ||
344 | + }); | ||
345 | + | ||
346 | + this.updateUserTree(); | ||
347 | + }, | ||
348 | + | ||
349 | + failureCallBack : function(batch, options) { | ||
350 | + myDesktopApp.errorMsg('Error while saving modifs'); | ||
351 | + loadMask.hide(); | ||
352 | + this.loadTree('destination'); | ||
353 | + }, | ||
354 | + | ||
355 | + /* | ||
356 | + * Update User Tree in Explorer after the the modifs | ||
357 | + */ | ||
358 | + updateUserTree : function() { | ||
359 | + // reload RemoteParam Tree in explorer | ||
360 | + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
361 | + if (explorerTree) | ||
362 | + { | ||
363 | + var explorerTreeStore = explorerTree.getStore(); | ||
364 | + var explorerRoot = explorerTreeStore.getRootNode(); | ||
365 | + var explorerPath = '/root/parameters-treeBase/myRemoteData-treeRootNode/'; | ||
366 | + | ||
367 | + explorerTreeStore.load( { node : explorerRoot, | ||
368 | + params : { nodeType: 'resources'}, | ||
369 | + callback : function(){ | ||
370 | + explorerTree.selectPath(explorerPath); | ||
371 | + } | ||
372 | + }); | ||
373 | + } | ||
374 | + myDesktopApp.infoMsg('Modifs have been saved'); | ||
375 | + }, | ||
376 | + | ||
377 | + /* | ||
378 | + * Panel Trees generation | ||
379 | + */ | ||
380 | + init: function(config) { | ||
381 | + if (config.baseId && config.baseId != 'root') | ||
382 | + this.baseId = config.baseId; | ||
383 | + | ||
384 | + this.srcTree = this.initTree(this.configSrc); | ||
385 | + this.destTree = this.initTree(this.configDest); | ||
355 | 386 | ||
356 | -// synchron load of destination tree if the corresponding node exists | ||
357 | - this.srcTree.on('itemexpand', function(node) { | ||
358 | - var root = this.destTree.getRootNode(); | ||
359 | - var destNode = root.findChild('id',node.get('id'),true); | ||
360 | - if (destNode) destNode.expand(); | ||
361 | - }, | ||
362 | - this); | ||
363 | -// toolbar | ||
364 | - Ext.Array.each(this.basesNames, function(baseName,index){ | ||
365 | - var isTheBase = false; | ||
366 | - if (this.baseId && baseName == this.baseId) var isTheBase = true; | ||
367 | - this.bases[index] = {text: baseName, toggleGroup: 'remoteBases', pressed: isTheBase, scope : this, toggleHandler: this.loadTrees} | ||
368 | - }, this); | 387 | + // synchron load of destination tree if the corresponding node exists |
388 | + this.srcTree.on('itemexpand', function(node) { | ||
389 | + var root = this.destTree.getRootNode(); | ||
390 | + var destNode = root.findChild('id',node.get('id'),true); | ||
391 | + if (destNode) destNode.expand(); | ||
392 | + }, this); | ||
393 | + | ||
394 | + // toolbar | ||
395 | + Ext.Array.each(this.basesNames, function(baseName,index){ | ||
396 | + var isTheBase = false; | ||
397 | + if (this.baseId && baseName == this.baseId) var isTheBase = true; | ||
398 | + this.bases[index] = {text: baseName, toggleGroup: 'remoteBases', pressed: isTheBase, scope : this, toggleHandler: this.loadTrees} | ||
399 | + }, this); | ||
369 | 400 | ||
370 | - var myConf = { | ||
371 | - | ||
372 | - id : 'rb_tab_panel', | ||
373 | - title : 'Remote Data Base', | ||
374 | - items: [ | ||
375 | - this.srcTree, | ||
376 | - this.destTree | ||
377 | - ], | ||
378 | - tbar: this.bases, | ||
379 | - fbar: [ | ||
380 | - { text: 'Save Modifs', | ||
381 | - scope : this, | ||
382 | - handler: function(){ | ||
383 | - var store = this.destTree.getStore(); | ||
384 | - | ||
385 | - var removed = store.getRemovedRecords(); | ||
386 | - var updated = store.getUpdatedRecords(); | ||
387 | - // if only removed: no sync - already removed at Server by node.delete | ||
388 | - //TODO is this condition OK?? | ||
389 | - if (Ext.Array.union(removed,updated).length != removed.length) { | ||
390 | - loadMask.show(); | ||
391 | - store.sync({ success : this.successCallBack, failure: this.failureCallBack, scope : this}); | 401 | + var myConf = { |
402 | + id : 'rb_tab_panel', | ||
403 | + title : 'Remote Data Base', | ||
404 | + items: [ | ||
405 | + this.srcTree, | ||
406 | + this.destTree | ||
407 | + ], | ||
408 | + tbar: this.bases, | ||
409 | + fbar: [ | ||
410 | + { text: 'Save Modifs', | ||
411 | + scope : this, | ||
412 | + handler: function(){ | ||
413 | + var store = this.destTree.getStore(); | ||
414 | + var new_nodes = store.getNewRecords(); | ||
415 | + var removed_nodes = store.getRemovedRecords(); | ||
416 | + // if only removed: no sync - already removed at Server by node.delete | ||
417 | + if ( new_nodes.length === 0 && removed_nodes.length > 0) this.updateUserTree(); | ||
418 | + if ( new_nodes.length > 0 ){ | ||
419 | + loadMask.show(); | ||
420 | + store.sync({ success : this.successCallBack, failure: this.failureCallBack, scope : this}); | ||
421 | + } | ||
392 | } | 422 | } |
393 | - } | ||
394 | - } | ||
395 | - ], | ||
396 | - listeners : { | ||
397 | - scope : this, | ||
398 | - destroy : function() { | ||
399 | - if (this.hasModifs) { | ||
400 | - // reload RemoteParam Tree in explorer | ||
401 | - var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); | ||
402 | - if (explorerTree) { | ||
403 | - var explorerTreeStore = explorerTree.getStore(); | ||
404 | - var explorerRoot = explorerTreeStore.getRootNode(); | ||
405 | - var explorerPath = '/root/parameters-treeBase/myRemoteData-treeRootNode/'; | ||
406 | - | ||
407 | - explorerTreeStore.load( { node : explorerRoot, | ||
408 | - params : { nodeType: 'resources'}, | ||
409 | - callback : function(){ | ||
410 | - explorerTree.selectPath(explorerPath); | ||
411 | - } | ||
412 | - }); | ||
413 | - } | ||
414 | - } | ||
415 | - } | ||
416 | - } | 423 | + } |
424 | + ] | ||
417 | }; | 425 | }; |
418 | - | ||
419 | - Ext.apply(this, Ext.apply(arguments, myConf)); | ||
420 | - | ||
421 | - } | ||
422 | - | ||
423 | -}); | ||
424 | \ No newline at end of file | 426 | \ No newline at end of file |
427 | + Ext.apply(this, Ext.apply(arguments, myConf)); | ||
428 | + } | ||
429 | +}); |
js/lib/ext-override.js
@@ -95,10 +95,25 @@ Ext.onReady(function () { | @@ -95,10 +95,25 @@ Ext.onReady(function () { | ||
95 | comp.setPosition(x,y); | 95 | comp.setPosition(x,y); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | - });*/ | ||
99 | - | 98 | + }); |
100 | 99 | ||
101 | - /*Ext.override(Ext.selection.Model, { | 100 | + Ext.override(Ext.selection.TreeModel, { |
101 | + | ||
102 | + onRowClick: function (view, record, item, index, e) { | ||
103 | + // Record index will be -1 if the clicked record is a metadata record and not selectable | ||
104 | + if (index !== -1) { | ||
105 | + if (!this.allowRightMouseSelection(e)) { | ||
106 | + return ; | ||
107 | + } | ||
108 | + | ||
109 | + //Don't process if it's a right-click over a previously selected record. | ||
110 | + // if (!(e.type === 'contextmenu' && this.isSelected(record))) { | ||
111 | + this.processSelection(view, record, item, index, e); | ||
112 | + // } | ||
113 | + } | ||
114 | + } | ||
115 | + }); | ||
116 | + Ext.override(Ext.selection.Model, { | ||
102 | storeHasSelected: function(record) { | 117 | storeHasSelected: function(record) { |
103 | var store = this.store, | 118 | var store = this.store, |
104 | records, | 119 | records, |
php/AmdaUpdate.php
@@ -21,8 +21,7 @@ | @@ -21,8 +21,7 @@ | ||
21 | exit(1); | 21 | exit(1); |
22 | } | 22 | } |
23 | $updateOnly = false; | 23 | $updateOnly = false; |
24 | - } | ||
25 | - | 24 | + } |
26 | 25 | ||
27 | $amda = new AmdaClient($updateOnly); | 26 | $amda = new AmdaClient($updateOnly); |
28 | 27 | ||
@@ -37,35 +36,6 @@ | @@ -37,35 +36,6 @@ | ||
37 | } */ | 36 | } */ |
38 | } | 37 | } |
39 | 38 | ||
40 | - | ||
41 | - $locBases = $amda->getAvailableMissions(); | ||
42 | - | ||
43 | - if(is_string($locBases)) { | ||
44 | - $msg = "Warning: No Local Amda Data info exists!".PHP_EOL; | ||
45 | - print_r($msg); | ||
46 | - } | ||
47 | - else { | ||
48 | - | ||
49 | -/* | ||
50 | -* update DD_*.xml files for local bases. If 'updateOnly', we keep DD_*.xml that already exists to not erase current user modifications. | ||
51 | -*/ | ||
52 | - $amda->getDDLocalParamsFiles($locBases); | ||
53 | - | ||
54 | -/* | ||
55 | -* Update Start Stop for AMDA local data | ||
56 | -*/ | ||
57 | - $ok = $amda->updateStartStop($locBases); | ||
58 | - | ||
59 | -/* | ||
60 | - * Create/update Orbites.xml file | ||
61 | - */ | ||
62 | -// if (!$updateOnly) { | ||
63 | -// $postProcessing = new PostProcessing(); | ||
64 | -// $postProcessing->createOrbites(); | ||
65 | -// $postProcessing->createOrbites(LocalDataParam.'InternalParams.xml'); | ||
66 | -// $postProcessing->createOrbitesInfoFiles($locBases); | ||
67 | -// } | ||
68 | - | ||
69 | /* | 39 | /* |
70 | * Get available external bases if exist | 40 | * Get available external bases if exist |
71 | */ | 41 | */ |
@@ -0,0 +1,35 @@ | @@ -0,0 +1,35 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @class CDAWEB | ||
4 | + * @brief | ||
5 | + */ | ||
6 | + | ||
7 | +class CDAWEB extends RemoteDataCenterClientClass | ||
8 | +{ | ||
9 | + | ||
10 | + protected function dataset2dd($id) | ||
11 | + { | ||
12 | + return $id; | ||
13 | + } | ||
14 | + | ||
15 | + public function getParamSize() | ||
16 | + { | ||
17 | + $cmd = "ncinfo_remote ".RemoteData.$this->baseID."/".$this->infoFile." ".$this->ParamId; | ||
18 | + $res = shell_exec($cmd); | ||
19 | + | ||
20 | + return $res; | ||
21 | + } | ||
22 | + | ||
23 | + public function getParamComponents() | ||
24 | + { | ||
25 | + $cmd = "ncinfo_remote ".RemoteData.$this->baseID."/".$this->infoFile." ".$this->ParamId." 1"; | ||
26 | + $res = shell_exec($cmd); | ||
27 | + | ||
28 | + return $res; | ||
29 | + } | ||
30 | + | ||
31 | + public function setInfoFile() | ||
32 | + { | ||
33 | + $this->infoFile = strtolower($this->ViId).".nc"; | ||
34 | + } | ||
35 | +} | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
@@ -0,0 +1,96 @@ | @@ -0,0 +1,96 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @class RemoteDataCenterClientClass | ||
4 | + * @brief | ||
5 | + * @details | ||
6 | + */ | ||
7 | +class RemoteDataCenterClientClass | ||
8 | +{ | ||
9 | + public $baseDom = null, $dataCenter = null; | ||
10 | + public $baseDomName; | ||
11 | + public $baseID = null; | ||
12 | + public $ViId = null, $ParamId = null; | ||
13 | + protected $client; | ||
14 | + public $infoFile = null; | ||
15 | + | ||
16 | + /* | ||
17 | + * @brief Constructor | ||
18 | + */ | ||
19 | + function __construct() | ||
20 | + { | ||
21 | + $this->baseID = get_class($this); | ||
22 | + $this->baseDom = new DomDocument("1.0"); | ||
23 | + $this->baseDomName = RemoteData.$this->baseID."/base.xml"; | ||
24 | + | ||
25 | + // if (!file_exists($this->baseDomName)) | ||
26 | + // return -1; | ||
27 | + // if (!$this->baseDom->load($this->baseDomName)) | ||
28 | + // return -2; | ||
29 | + $this->baseDom->load($this->baseDomName); | ||
30 | + | ||
31 | + date_default_timezone_set('UTC'); | ||
32 | + | ||
33 | + try { | ||
34 | + $this->client = new SoapClient(DD_WSDL); | ||
35 | + } | ||
36 | + catch (SoapFault $exception) { | ||
37 | + $msg = $exception->faultstring.PHP_EOL; | ||
38 | + exit($msg); | ||
39 | + } | ||
40 | + | ||
41 | + // return 0; | ||
42 | + } | ||
43 | + | ||
44 | + public function param2dd($paramID) | ||
45 | + { | ||
46 | + $pairs = array(" " => "_","-" => "_","/" => "_","%" => "_","\\" => "_","$" => "_",":" => "_","+" =>"_", | ||
47 | + "#" => "_","@" => "_","." => "_", ">" => "_", "<" => "_", "," => "_", ")" => "", "(" => "_"); | ||
48 | + | ||
49 | + return strtr($paramID,$pairs); | ||
50 | + } | ||
51 | + | ||
52 | + | ||
53 | + public function setViId($id) | ||
54 | + { | ||
55 | + $this->ViId = $id; | ||
56 | + } | ||
57 | + | ||
58 | + public function setParamId($id) | ||
59 | + { | ||
60 | + $this->ParamId = $id; | ||
61 | + } | ||
62 | + | ||
63 | + public function addViToDD() | ||
64 | + { | ||
65 | + if (!$this->ViId) return false; | ||
66 | + | ||
67 | + $this->setInfoFile(); | ||
68 | + //check if VI already added | ||
69 | + try { | ||
70 | + $res = $this->client->isRemoteViAdded($this->baseID, strtolower($this->ViId)); | ||
71 | + if (!$res) | ||
72 | + { | ||
73 | + // call to DD Server to create new VI | ||
74 | + $command = 'AddVI '.$this->dataset2dd($this->ViId).' '.$this->ViId.' '.$this->baseID; | ||
75 | + system($command, $err); | ||
76 | + | ||
77 | + return ($err == 0); | ||
78 | + } | ||
79 | + | ||
80 | + return true; | ||
81 | + } | ||
82 | + catch (SoapFault $exception) { | ||
83 | +// echo $this->client->__getLastRequest(); | ||
84 | +// echo $this->client->__getLastResponse(); | ||
85 | + $msg = $exception->faultstring.PHP_EOL; | ||
86 | + return false; | ||
87 | + } | ||
88 | + } | ||
89 | + | ||
90 | + | ||
91 | + protected function dataset2dd($id){} | ||
92 | + public function setInfoFile(){} | ||
93 | + public function getParamSize(){} | ||
94 | + public function getParamComponents(){} | ||
95 | +} | ||
96 | +?> |
@@ -0,0 +1,293 @@ | @@ -0,0 +1,293 @@ | ||
1 | +<?php | ||
2 | +/** | ||
3 | + * @class RemoteParamManager | ||
4 | + * @brief Manage Remote Data Centers via DDServer | ||
5 | + */ | ||
6 | + | ||
7 | +class RemoteParamManager | ||
8 | +{ | ||
9 | + protected $Bases, $basesDom; | ||
10 | + protected $baseDom; | ||
11 | + | ||
12 | + protected $center; | ||
13 | + | ||
14 | + public $xmlDom, $xmlName; | ||
15 | + public $baseId, $paramId, $remoteViId, $localInfo, $paramDom, $paramXML; | ||
16 | + | ||
17 | + function __construct() | ||
18 | + { | ||
19 | + if (!file_exists(RemoteData."Bases.xml")) | ||
20 | + return array("err" => "No Remote Data Bases"); | ||
21 | + | ||
22 | + $this->basesDom = new DomDocument("1.0"); | ||
23 | + if (!$this->basesDom->load(RemoteData."Bases.xml")) | ||
24 | + return array("err" => "Can not load Remote Data Bases definitions"); | ||
25 | + $bases = $this->basesDom->getElementsByTagName('dataCenter'); | ||
26 | + | ||
27 | + foreach ($bases as $base) | ||
28 | + $this->Bases[] = $base->getAttribute('xml:id'); | ||
29 | + | ||
30 | + if (!file_exists(USERWSDIR."RemoteParams.xml")) | ||
31 | + return array("err" => "No RemoteParams.xml"); | ||
32 | + | ||
33 | + if (!is_dir(RemoteData."/PARAMS")) | ||
34 | + mkdir(RemoteData."/PARAMS", 0755, true); | ||
35 | + | ||
36 | + if (!is_dir(RemoteData."/PARAMS_INFO")) | ||
37 | + mkdir(RemoteData."/PARAMS_INFO", 0755, true); | ||
38 | + | ||
39 | + $this->xmlName = USERWSDIR."RemoteParams.xml"; | ||
40 | + $this->xmlDom = new DomDocument("1.0"); | ||
41 | + $this->xmlDom->load($this->xmlName); | ||
42 | + } | ||
43 | + | ||
44 | + /* | ||
45 | + * get baseId from parameter descriptor | ||
46 | + */ | ||
47 | + protected function setBaseId($id) | ||
48 | + { | ||
49 | + foreach ($this->Bases as $base) { | ||
50 | + // Special Themis case | ||
51 | + if (substr($id,0,2) == "th") { | ||
52 | + $baseId = "THEMIS"; | ||
53 | + break; | ||
54 | + } | ||
55 | + if (strncmp($id, $base, strlen($base)) === 0) | ||
56 | + { | ||
57 | + $baseId = $base; | ||
58 | + break; | ||
59 | + } | ||
60 | + } | ||
61 | + | ||
62 | + $this->center = new $baseId(); | ||
63 | + } | ||
64 | + | ||
65 | +/* | ||
66 | + <param xml:id="ace_r"> | ||
67 | + <get> | ||
68 | + <vi name="ace:orb:all"> | ||
69 | + <baseParam name="R"/> | ||
70 | + </vi></get> | ||
71 | + <process>$ace_orb_all_R/RADIUS_EARTH</process> | ||
72 | + <output/> | ||
73 | + </param> | ||
74 | +*/ | ||
75 | + public function makeInternalParamXml() | ||
76 | + { | ||
77 | + if (!$this->center->ViId) return false; | ||
78 | + if (!$this->center->ParamId) return false; | ||
79 | + | ||
80 | + // $this->paramId = strtolower($this->center->baseID."_".$this->center->ViId."_".$this->center->ParamId); | ||
81 | + | ||
82 | + $xmlNameRemote = RemoteData."/PARAMS/".$this->paramId.".xml"; | ||
83 | + $xmlNameTemp = PARAMS_LOCALDB_DIR."/".$this->paramId.".xml"; | ||
84 | + | ||
85 | + if (file_exists($xmlNameRemote)) { | ||
86 | + return copy($xmlNameRemote, $xmlNameTemp); | ||
87 | + } | ||
88 | + | ||
89 | + $xml = new DomDocument("1.0"); | ||
90 | + $paramNode = $xml->createElement("param"); | ||
91 | + $xml->appendChild($paramNode); | ||
92 | + | ||
93 | + $paramNode->setAttribute("xml:id", $this->paramId); | ||
94 | + $getNode = $xml->createElement("get"); | ||
95 | + $viNode = $xml->createElement("vi"); | ||
96 | + $baseParamNode = $xml->createElement("baseParam"); | ||
97 | + $baseParamNode->setAttribute("name", $this->center->ParamId); | ||
98 | + $viNode->setAttribute("name", strtolower(strtr($this->center->ViId,"_", ":"))); | ||
99 | + $viNode->appendChild($baseParamNode); | ||
100 | + $getNode->appendChild($viNode); | ||
101 | + $paramNode->appendChild($getNode); | ||
102 | + $paramNode->appendChild($xml->createElement("process")); | ||
103 | + $paramNode->appendChild($xml->createElement("output")); | ||
104 | + | ||
105 | + $res = $xml->save($xmlNameRemote); | ||
106 | + if ($res) | ||
107 | + return copy($xmlNameRemote, $xmlNameTemp); | ||
108 | + | ||
109 | + return $res; | ||
110 | + } | ||
111 | + | ||
112 | + protected function makeComponents($node, $size, $components) | ||
113 | + { | ||
114 | + $compArray = explode(";",$components); | ||
115 | + | ||
116 | + for ($i = 0; $i < $size; $i++) | ||
117 | + { | ||
118 | + $compNode = $this->xmlDom->createElement("component"); | ||
119 | + $compNode->setAttribute('xml:id',$this->paramId."($i)"); | ||
120 | + $compNode->setAttribute('name',strtolower($compArray[$i])); // LABEL | ||
121 | + | ||
122 | + $node->appendChild($compNode); | ||
123 | + } | ||
124 | + } | ||
125 | + | ||
126 | + protected function addNode($id) | ||
127 | + { | ||
128 | + // Node exists already | ||
129 | + $this->paramId = strtr(strtolower($id),":","_"); | ||
130 | + | ||
131 | + if ($this->xmlDom->getElementById($this->paramId)) return true; | ||
132 | + | ||
133 | + // Node to be added | ||
134 | + $nodeRemote = $this->center->baseDom->getElementById($id); | ||
135 | + | ||
136 | + // No such node in base.xml | ||
137 | + if (!$nodeRemote) return false; | ||
138 | + | ||
139 | + if ($nodeRemote->tagName == 'dataset') | ||
140 | + { | ||
141 | + $this->center->setViId($nodeRemote->getAttribute('name')); | ||
142 | + $status = $this->center->addViToDD(); | ||
143 | + | ||
144 | + if (!$status) return false; | ||
145 | + //TODO "http://apus.irap.omp.eu/ | ||
146 | + $remoteDatasetInfo = "/home/budnik/DDBASE/INFO/bases/".$this->center->baseID."/".$this->center->infoFile; | ||
147 | + $localDatasetInfo = RemoteData.$this->center->baseID."/".$this->center->infoFile; | ||
148 | + | ||
149 | + if (!copy($remoteDatasetInfo,$localDatasetInfo)) return false; | ||
150 | + } | ||
151 | + | ||
152 | + $node = $this->xmlDom->importNode($nodeRemote); | ||
153 | + | ||
154 | + if ($nodeRemote->tagName == 'parameter') | ||
155 | + { | ||
156 | + $this->center->setParamId($nodeRemote->getAttribute('name')); | ||
157 | + $this->center->setViId($nodeRemote->parentNode->getAttribute('name')); | ||
158 | + $this->center->setInfoFile(); | ||
159 | + | ||
160 | + if (!$this->makeInternalParamXml()) return false; | ||
161 | + | ||
162 | + if (($size = $this->center->getParamSize()) > 1) | ||
163 | + { | ||
164 | + // make components and args | ||
165 | + $components = $this->center->getParamComponents(); | ||
166 | + $this->makeComponents($node, $size, $components); // return false; | ||
167 | + } | ||
168 | + | ||
169 | + // convert remote paramID into AMDA paramID | ||
170 | + $node->setAttribute("xml:id", strtr(strtolower($node->getAttribute("xml:id")), ":","_")); | ||
171 | + } | ||
172 | + | ||
173 | + $parentRemote= $nodeRemote->parentNode; | ||
174 | + $parentRemoteId = $parentRemote->getAttribute('xml:id'); | ||
175 | + | ||
176 | + $parent = $this->xmlDom->getElementById($parentRemoteId); | ||
177 | + | ||
178 | + if (!$parent) | ||
179 | + { | ||
180 | + $parent = $this->xmlDom->importNode($parentRemote); | ||
181 | + } | ||
182 | + | ||
183 | + $parent->appendChild($node); | ||
184 | + | ||
185 | + $toAddDataCentertToDoc = false; | ||
186 | + | ||
187 | + while ($parent->tagName != 'dataCenter') | ||
188 | + { | ||
189 | + $node = $parent; | ||
190 | + $parentRemote = $parentRemote->parentNode; | ||
191 | + $parentRemoteId = $parentRemote->getAttribute('xml:id'); | ||
192 | + $parent = $this->xmlDom->getElementById($parentRemoteId); | ||
193 | + | ||
194 | + if (!$parent) | ||
195 | + { | ||
196 | + if ($parentRemote->tagName == 'dataCenter') | ||
197 | + $toAddDataCenterToDoc = true; | ||
198 | + $parent = $this->xmlDom->importNode($parentRemote); | ||
199 | + $parent->appendChild($node); | ||
200 | + } | ||
201 | + } | ||
202 | + | ||
203 | + if ($toAddDataCenterToDoc) | ||
204 | + { | ||
205 | + //TODO if this is necessary ??? | ||
206 | + // special bases 'hand-made' descriptions | ||
207 | + $basesDom = new DomDocument("1.0"); | ||
208 | + $basesDom -> load(RemoteData.'Bases.xml'); | ||
209 | + $theBase = $basesDom->getElementById($parent->getAttribute('xml:id')); | ||
210 | + | ||
211 | + if ($theBase) $parent -> setAttribute('name', $theBase->getAttribute('name')); | ||
212 | + $this->xmlDom->documentElement->appendChild($parent); | ||
213 | + } | ||
214 | + | ||
215 | + return true; | ||
216 | + } | ||
217 | + | ||
218 | +/* | ||
219 | +* PUBLIC FUNCTIONS | ||
220 | +*/ | ||
221 | + public function saveTree($obj) | ||
222 | + { | ||
223 | + if (count($obj) == 1) | ||
224 | + { | ||
225 | + $id = $obj->id; | ||
226 | + | ||
227 | + if ($id == 'root') return array('res' => 'ok'); | ||
228 | + | ||
229 | + $this->setBaseId($id); | ||
230 | + | ||
231 | + $res = $this->addNode($id); | ||
232 | + | ||
233 | + if ($res === false) return array("err" => "Cannot add node : $id"); | ||
234 | + } | ||
235 | + else | ||
236 | + { | ||
237 | + foreach ($obj as $o) | ||
238 | + { | ||
239 | + $id = $o->id; | ||
240 | + | ||
241 | + if ($id == 'root') continue; | ||
242 | + | ||
243 | + if (!$this->baseId) $this->setBaseId($id); | ||
244 | + | ||
245 | + $res = $this->addNode($id); | ||
246 | + | ||
247 | + if ($res === false) return array("err" => "Cannot add node : $id"); | ||
248 | + | ||
249 | + } | ||
250 | + } | ||
251 | + | ||
252 | + if (!$this->xmlDom->save($this->xmlName)) | ||
253 | + return array("err" => "Cannot save RemoteParams.xml"); | ||
254 | + | ||
255 | + return array('res' => 'ok'); | ||
256 | + } | ||
257 | + | ||
258 | + public function deleteFromTree($obj) | ||
259 | + { | ||
260 | + $id = $obj->id; | ||
261 | + $nodeToDelete = $this->xmlDom->getElementById($id); | ||
262 | + | ||
263 | + if (!$nodeToDelete) | ||
264 | + return array("err" => "No such id : $id"); | ||
265 | + | ||
266 | + $tagName = $nodeToDelete->tagName; | ||
267 | + | ||
268 | + while ( $tagName != "dataRoot" ) // "dataCenter" ? | ||
269 | + { | ||
270 | + $parentNode = $nodeToDelete->parentNode; | ||
271 | + $parentNode->removeChild($nodeToDelete); | ||
272 | + $otherChildren = $parentNode->getElementsByTagName($tagName); | ||
273 | + | ||
274 | + if ( $otherChildren->length > 0 ) | ||
275 | + break; | ||
276 | + | ||
277 | + $nodeToDelete = $parentNode; | ||
278 | + $tagName = $nodeToDelete->tagName; | ||
279 | + } | ||
280 | + $this->xmlDom->save($this->xmlName); | ||
281 | + | ||
282 | + return array('res'=> $obj->id); | ||
283 | + } | ||
284 | + | ||
285 | + public function getInfoName($datasetId) { | ||
286 | + | ||
287 | +// if ($this->baseId == 'CDAWEB') | ||
288 | +// return strtolower($datasetId)."_00000000_v01.cdf"; | ||
289 | + return $datasetId.'.xml'; | ||
290 | + | ||
291 | + } | ||
292 | +} | ||
293 | +?> | ||
0 | \ No newline at end of file | 294 | \ No newline at end of file |
php/classes/AmdaAction.php
@@ -575,27 +575,34 @@ class AmdaAction | @@ -575,27 +575,34 @@ class AmdaAction | ||
575 | return $childrenToReturn; | 575 | return $childrenToReturn; |
576 | } | 576 | } |
577 | 577 | ||
578 | + /* | ||
579 | + * add Remote Parameter to user RemoteParams.xml | ||
580 | + * send request to DDServer to AddVi if Vi doesn't exist | ||
581 | + * create Remote Parameter Description | ||
582 | + */ | ||
578 | public function saveTree($obj) | 583 | public function saveTree($obj) |
579 | { | 584 | { |
580 | - $paramMgr = new ParamMgr(); | 585 | + $paramMgr = new RemoteParamManager(); |
581 | return $paramMgr->saveTree($obj); | 586 | return $paramMgr->saveTree($obj); |
582 | } | 587 | } |
583 | - | ||
584 | - public function doNothing($obj) | ||
585 | - { | ||
586 | - return array("res" => 'ok'); | ||
587 | - | ||
588 | - } | ||
589 | - | 588 | + |
589 | + /* | ||
590 | + * delete Remote Parameter from user RemoteParams.xml | ||
591 | + */ | ||
590 | public function deleteFromTree($obj) | 592 | public function deleteFromTree($obj) |
591 | { | 593 | { |
592 | - $paramMgr = new ParamMgr(); | 594 | + $paramMgr = new RemoteParamManager(); |
593 | return $paramMgr->deleteFromTree($obj); | 595 | return $paramMgr->deleteFromTree($obj); |
594 | } | 596 | } |
597 | + | ||
598 | + public function doNothing($obj) | ||
599 | + { | ||
600 | + return array("res" => 'ok'); | ||
601 | + } | ||
595 | 602 | ||
596 | -/* | ||
597 | -* temporary object fromUpload | ||
598 | -*/ | 603 | + /* |
604 | + * get temporary object from Upload | ||
605 | + */ | ||
599 | public function getUploadedObject($name, $format, $nodeType) | 606 | public function getUploadedObject($name, $format, $nodeType) |
600 | { | 607 | { |
601 | switch ($nodeType) | 608 | switch ($nodeType) |
@@ -612,14 +619,12 @@ class AmdaAction | @@ -612,14 +619,12 @@ class AmdaAction | ||
612 | default: | 619 | default: |
613 | return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); | 620 | return array("error" => $nodeType." NOT_IMPLEMENTED_YET"); |
614 | } | 621 | } |
615 | - | ||
616 | return $objectMgr->getUploadedObject($name, $format, true); | 622 | return $objectMgr->getUploadedObject($name, $format, true); |
617 | - | ||
618 | } | 623 | } |
619 | 624 | ||
620 | -/* | ||
621 | -* fill ascii file into grid | ||
622 | -*/ | 625 | + /* |
626 | + * fill ascii file into grid | ||
627 | + */ | ||
623 | public function getAsciiFile($obj) | 628 | public function getAsciiFile($obj) |
624 | { | 629 | { |
625 | $objectMgr = new FilesMgr(); | 630 | $objectMgr = new FilesMgr(); |
@@ -632,9 +637,9 @@ class AmdaAction | @@ -632,9 +637,9 @@ class AmdaAction | ||
632 | return $objectMgr->getParamInfo($object); | 637 | return $objectMgr->getParamInfo($object); |
633 | } | 638 | } |
634 | 639 | ||
635 | -/* | ||
636 | -* temporary object from Search | ||
637 | -*/ | 640 | + /* |
641 | + * get temporary object from Search | ||
642 | + */ | ||
638 | public function getTmpObject($folderId, $name, $nodeType) | 643 | public function getTmpObject($folderId, $name, $nodeType) |
639 | { | 644 | { |
640 | switch ($nodeType) | 645 | switch ($nodeType) |
@@ -901,9 +906,11 @@ class AmdaAction | @@ -901,9 +906,11 @@ class AmdaAction | ||
901 | 906 | ||
902 | private function executeRequest($obj, $function) | 907 | private function executeRequest($obj, $function) |
903 | { | 908 | { |
904 | - $res = $this->checkUser($obj); | ||
905 | - if (!$res['success']) return $res; | ||
906 | - | 909 | + if ($function != FunctionTypeEnumClass::PROCESSDELETE) { |
910 | + $res = $this->checkUser($obj); | ||
911 | + if (!$res['success']) return $res; | ||
912 | + } | ||
913 | + | ||
907 | $requestManager = new RequestManagerClass(); | 914 | $requestManager = new RequestManagerClass(); |
908 | 915 | ||
909 | try | 916 | try |
php/classes/ParamMgr.php deleted
@@ -1,415 +0,0 @@ | @@ -1,415 +0,0 @@ | ||
1 | -<?php | ||
2 | -/** | ||
3 | - * @class ParamMgr | ||
4 | - * @version $Id: ParamMgr.php 1947 2013-11-28 15:10:46Z elena $ | ||
5 | - * | ||
6 | - */ | ||
7 | - | ||
8 | - class ParamMgr { | ||
9 | - | ||
10 | - | ||
11 | - protected $Bases, $basesDom; | ||
12 | - protected $baseDom; | ||
13 | - public $xmlDom, $xmlName; | ||
14 | - public $baseId, $paramId, $remoteViId, $localInfo, $paramDom, $paramXML; | ||
15 | - | ||
16 | - function __construct() { | ||
17 | -//TODO check if files exist.... | ||
18 | - $this->basesDom = new DomDocument("1.0"); | ||
19 | - $this->basesDom->load(RemoteData.'Bases.xml'); | ||
20 | - $bases = $this->basesDom->getElementsByTagName('dataCenter'); | ||
21 | - foreach ($bases as $base) $this->Bases[] = $base->getAttribute('xml:id'); | ||
22 | - | ||
23 | - $this->xmlName = USERWSDIR.'RemoteParams.xml'; | ||
24 | - $this->xmlDom = new DomDocument("1.0"); | ||
25 | - $this->xmlDom->load($this->xmlName); | ||
26 | - | ||
27 | - } | ||
28 | - | ||
29 | -/* | ||
30 | -* | ||
31 | -*/ | ||
32 | - protected function param2dd($paramID) { | ||
33 | - | ||
34 | - $pairs = array("%" => "_","\\" => "_","$" => "_",":" => "_","+" =>"_","-" => "_","#" => "_","@" => "_","." => "_", ">" => "_", "<" => "_"); | ||
35 | - return strtr($paramID,$pairs); | ||
36 | - } | ||
37 | - | ||
38 | -/* | ||
39 | -* Make Aliases - Remote data set ID -> DD data set ID (xxxx_xxxx_xxxx) | ||
40 | -*/ | ||
41 | - public function dataset2dd($remVIID) { | ||
42 | - // TODO method of ???? class | ||
43 | - | ||
44 | - $ddVIID = $remVIID; | ||
45 | - return $ddVIID; | ||
46 | - } | ||
47 | - | ||
48 | -/* | ||
49 | -* get baseId from parameter descriptor | ||
50 | -*/ | ||
51 | - protected function setBaseId($id) { | ||
52 | - | ||
53 | - foreach ($this->Bases as $base) { | ||
54 | -// Special Themis case | ||
55 | - if (substr($id,0,2) == "th") { | ||
56 | - $this->baseId = "THEMIS"; | ||
57 | - break; | ||
58 | - } | ||
59 | - if (strncmp($id, $base, strlen($base)) === 0) { | ||
60 | - $this->baseId = $base; | ||
61 | - break; | ||
62 | - } | ||
63 | - } | ||
64 | - | ||
65 | - $this->baseDom = new DomDocument("1.0"); | ||
66 | - $this->baseDom->load(RemoteData.$this->baseId.'/base.xml'); | ||
67 | - } | ||
68 | - | ||
69 | -/* | ||
70 | -* get Info File name | ||
71 | -*/ | ||
72 | -//TODO not to hardly code special stuff... | ||
73 | - public function getInfoName($datasetId) { | ||
74 | - | ||
75 | - if ($this->baseId == 'CDAWEB') | ||
76 | - return strtolower($datasetId)."_00000000_v01.cdf"; | ||
77 | - return $datasetId.'.xml'; | ||
78 | - | ||
79 | - } | ||
80 | - | ||
81 | -/* | ||
82 | -* | ||
83 | -*/ | ||
84 | - protected function getDatasetInfo() { | ||
85 | - | ||
86 | - $infoFileName = $this->getInfoName($this->remoteViId); | ||
87 | - $this->localInfo = RemoteData.$this->baseId.'/'.$infoFileName; | ||
88 | - if (file_exists($this->localInfo)) return true; | ||
89 | - | ||
90 | -// call to DD Server to create new VI | ||
91 | - $command = OLD_CLASSPATH.'AddVI '.$this->dataset2dd($this->remoteViId).' '.$this->remoteViId.' '.$this->baseId; | ||
92 | - system($command, $err); | ||
93 | - | ||
94 | - $remoteInfo = INFOSITE.'INFO/'.$this->baseId.'/DATASETS/'.$infoFileName; | ||
95 | -// Get dataset info from DD Server if it doesn't yet exists locally | ||
96 | -//TODO may be not neccessary to copy file? load from URL? | ||
97 | - $res = copy($remoteInfo, $this->localInfo); | ||
98 | - return $res; | ||
99 | - } | ||
100 | - | ||
101 | -/* | ||
102 | -* | ||
103 | -*/ | ||
104 | - public function getParamInfo() { | ||
105 | - | ||
106 | - if (!$this->localInfo) { | ||
107 | - $infoFileName = $this->getInfoName($this->remoteViId); | ||
108 | - $this->localInfo = RemoteData.$this->baseId.'/'.$infoFileName; | ||
109 | - } | ||
110 | - switch ($this->baseId) { | ||
111 | -// CDAWEB specific function to parse master CDF - idl | ||
112 | - case 'CDAWEB' : | ||
113 | - $command = OLD_CLASSPATH.'cdfInfo '.$this->localInfo.' "'.$this->paramId.'"'; | ||
114 | - $info = exec($command); | ||
115 | - break; | ||
116 | - case 'VEXGRAZ' : | ||
117 | - case 'MAPSKP' : | ||
118 | - $info = $this->getInfoSpase(); | ||
119 | - break; | ||
120 | - default: | ||
121 | - | ||
122 | - } | ||
123 | - if ($info == "%-9999") return false; | ||
124 | - return $info; | ||
125 | - } | ||
126 | - | ||
127 | -/* | ||
128 | -* | ||
129 | -*/ | ||
130 | - protected function getInfoSpase() { | ||
131 | - | ||
132 | - $xmlinfo = new DomDocument("1.0"); | ||
133 | - $xmlinfo->load($this->localInfo); | ||
134 | - $mission = $xmlinfo->getElementsByTagName("PARENT_MISSION"); | ||
135 | - $instrument = $xmlinfo->getElementsByTagName("PARENT_INSTRUMENT"); | ||
136 | - | ||
137 | - $xp = new domxpath($xmlinfo); | ||
138 | - $param = $xp->query("//PARAM_ID[.='".$this->paramId."']"); | ||
139 | - $paramNode = $param->item(0)->parentNode; | ||
140 | - if (!$paramNode) return false; | ||
141 | - | ||
142 | - $info = "paramID%" . $this->paramId . "&&"; | ||
143 | - // Data Type | ||
144 | - $tag = $paramNode->getElementsByTagName("DATA_TYPE"); | ||
145 | - $value = $tag->item(0)->nodeValue; | ||
146 | - switch ($value) { | ||
147 | - case 'FLOAT' : $dataTypeS = '2'; break; | ||
148 | - case 'DOUBLE': $dataTypeS = '3'; break; | ||
149 | - case 'INT' : $dataTypeS = '1'; break; | ||
150 | - case 'CHAR' : $dataTypeS = '0'; break; | ||
151 | - default : $dataTypeS = '2' ; | ||
152 | - } | ||
153 | - $info = $info . "DATATYPE%" . $dataTypeS ."&&"; | ||
154 | - $tag = $paramNode->getElementsByTagName("SIZES"); | ||
155 | - $value = $tag->item(0)->nodeValue; | ||
156 | - $info = $info . "DIMENSION%" . $value; | ||
157 | - $tags=array("PARENT_MISSION", "PARENT_EXPERIMENT", "PARAMETER_SHORT_DESCRIPTION", "FILLVAL", "UNITS","DISPLAY_TYPE", "COORDINATE_SYSTEM", "TENSOR_ORDER_VALUE", "LABEL_I", "FIELDNAM"); | ||
158 | - | ||
159 | - foreach ($tags as $atag){ | ||
160 | - $tag = $paramNode->getElementsByTagName($atag); | ||
161 | - $value = $tag->length > 0 ? $tag->item(0)->nodeValue : -9999; | ||
162 | - switch ($atag) { | ||
163 | - case "LABEL_I" : $name = "LABLAXIS"; | ||
164 | - $val_arr = array(); | ||
165 | - for ($j = 0; $j < $tag->length; $j++) | ||
166 | - $val_arr[$j] = $tag->item($j)->nodeValue; | ||
167 | - $value = implode($val_arr, '$').'$'; break; | ||
168 | - case "COORDINATE_SYSTEM" : $name = "FRAME"; break; | ||
169 | - case "TENSOR_ORDER_VALUE" : $name = "TENSOR"; break; | ||
170 | - case "PARAMETER_SHORT_DESCRIPTION" : $name = "DESCRIPTOR"; break; | ||
171 | - case "PARENT_MISSION" : $name = "SOURCE_NAME"; | ||
172 | - $value = $mission->item(0)->nodeValue; | ||
173 | - break; | ||
174 | - case "PARENT_EXPERIMENT" : $name = "DATA_TYPE"; | ||
175 | - $value = $instrument->item(0)->nodeValue; | ||
176 | - break; | ||
177 | - case "FILLVAL": | ||
178 | - $value = $tag->length > 0 ? $tag->item(0)->nodeValue : -1.e31; | ||
179 | - $name = "FILLVAL"; | ||
180 | - break; | ||
181 | - default: $name = $atag; | ||
182 | - } | ||
183 | - $info = $info . "&&".$name."%". $value; | ||
184 | - } | ||
185 | - | ||
186 | - return $info; | ||
187 | - } | ||
188 | -/* | ||
189 | -* Create XML parameter descriptor in the generic_data/RemoteData/PARAMS dir | ||
190 | -*/ | ||
191 | - public function createParamXml($infoTotal) { | ||
192 | - | ||
193 | - $this->paramDom = new DomDocument("1.0"); | ||
194 | - $this->paramDom->preserveWhiteSpace = false; | ||
195 | - $this->paramDom->formatOutput = true; | ||
196 | - | ||
197 | - $param = $this->paramDom->createElement('PARAM'); | ||
198 | - $param->appendChild($this->paramDom->createElement("baseID",$this->baseId)); | ||
199 | - $param->appendChild($this->paramDom->createElement("viID",$this->remoteViId)); | ||
200 | - | ||
201 | - $info = explode("&&",$infoTotal); | ||
202 | - for ($i = 0; $i < count($info); $i++){ | ||
203 | - $attr = explode("%",$info[$i]); | ||
204 | - try { | ||
205 | - $param->appendChild($this->paramDom->createElement($attr[0],$attr[1])); | ||
206 | - } | ||
207 | - catch (Exception $e) { | ||
208 | - return false; | ||
209 | - } | ||
210 | - } | ||
211 | - $this->paramDom->appendChild($param); | ||
212 | - if (!$this->paramDom->save($this->paramXML)) return false; | ||
213 | - | ||
214 | - return true; // NO ERROR | ||
215 | - | ||
216 | - } | ||
217 | - | ||
218 | -/* | ||
219 | -* special themis case: componets from base.xml | ||
220 | -*/ | ||
221 | - public function makeThemisComponents($param) { | ||
222 | - | ||
223 | - $sizes = $param->getAttribute('size'); | ||
224 | - if (!$sizes) return true; // scalar | ||
225 | - | ||
226 | - | ||
227 | - $labels = $param->getAttribute('labels'); | ||
228 | - $id = $param->getAttribute('xml:id'); | ||
229 | - $name = $param->getAttribute('name'); | ||
230 | - | ||
231 | - if (!$labels) { | ||
232 | - $param->setAttribute('needsArgs', true); | ||
233 | - return true; | ||
234 | - } | ||
235 | - | ||
236 | - $labelArr = explode("$",$labels); | ||
237 | - for ($i = 0; $i < count($labelArr); $i++) | ||
238 | - { | ||
239 | - $component = $this->xmlDom->createElement('component'); | ||
240 | - $component->setAttribute('xml:id',$id.'('.$i.')'); | ||
241 | - | ||
242 | - $component->setAttribute('name',$labelArr[$i]); | ||
243 | - $param->appendChild($component); | ||
244 | - } | ||
245 | - return true; | ||
246 | - | ||
247 | - } | ||
248 | - | ||
249 | -/* | ||
250 | -* | ||
251 | -*/ | ||
252 | - public function makeComponents($param) { | ||
253 | - | ||
254 | - $sizes = $this->paramDom->getElementsByTagName('DIMENSION')->item(0)->nodeValue; | ||
255 | - $display = strtolower($this->paramDom->getElementsByTagName('DISPLAY_TYPE')->item(0)->nodeValue); | ||
256 | - $units = $this->paramDom->getElementsByTagName('UNITS')->item(0)->nodeValue; | ||
257 | - | ||
258 | - if (!$units || ($units == "-9999")) $units = "no"; | ||
259 | - $param->setAttribute("units", $units); | ||
260 | - | ||
261 | - if ($sizes == "1") return true; // Scalar - Nothing to do | ||
262 | - | ||
263 | - $id = $param->getAttribute('xml:id'); | ||
264 | - $name = $param->getAttribute('name'); | ||
265 | - // Not a Scalar - add components to user tree | ||
266 | - $labels = $this->paramDom->getElementsByTagName('LABLAXIS')->item(0)->nodeValue; | ||
267 | - | ||
268 | - // No labels | ||
269 | - if (!$labels || ($labels == "$") || (substr($display,0,6) == "spectr")) { | ||
270 | - if (!$param->getAttribute('needsArgs')) { | ||
271 | - $param->setAttribute('needsArgs', true); | ||
272 | - if (substr($display,0,6) == "spectr") | ||
273 | - $param->setAttribute('display_type', 'spectrogram'); | ||
274 | - } | ||
275 | - return true; | ||
276 | - } | ||
277 | - | ||
278 | - $labelArr = explode("$",$labels); | ||
279 | - for ($i = 0; $i < count($labelArr)-1; $i++) | ||
280 | - { | ||
281 | - $component = $this->xmlDom->createElement('component'); | ||
282 | - $component->setAttribute('xml:id',$id.'('.$i.')'); | ||
283 | - $component->setAttribute('name',$labelArr[$i]); | ||
284 | - $param->appendChild($component); | ||
285 | - } | ||
286 | - return true; | ||
287 | - } | ||
288 | -/* | ||
289 | -* | ||
290 | -*/ | ||
291 | - protected function addNode($id){ | ||
292 | - | ||
293 | -// NODE EXISTS | ||
294 | - | ||
295 | - if ($this->xmlDom->getElementById($id)) return true; | ||
296 | - | ||
297 | -// NODE TO BE ADD | ||
298 | - $nodeRemote = $this->baseDom->getElementById($id); | ||
299 | - | ||
300 | - if (!$nodeRemote) return false; | ||
301 | - | ||
302 | - if ($nodeRemote->tagName == 'dataset') { | ||
303 | - | ||
304 | - $this->remoteViId = $nodeRemote->getAttribute('name'); | ||
305 | - $datasetExists = $this->baseId != 'THEMIS' ? $this->getDatasetInfo() : true; | ||
306 | - if (!$datasetExists) return false; | ||
307 | - } | ||
308 | - | ||
309 | - $node = $this->xmlDom->importNode($nodeRemote); | ||
310 | - | ||
311 | - if ($nodeRemote->tagName == 'parameter') { | ||
312 | - | ||
313 | - $this->paramId = $nodeRemote->getAttribute('name'); | ||
314 | - $this->remoteViId = $nodeRemote->parentNode->getAttribute('name'); | ||
315 | - | ||
316 | - $info = $this->baseId != 'THEMIS' ? $this->getParamInfo() : true; | ||
317 | - if (!$info) return false; | ||
318 | - | ||
319 | - | ||
320 | - // XML descriptor of the parameter; themis excluded | ||
321 | - if ($this->baseId == 'THEMIS') { | ||
322 | - | ||
323 | - if (!$this->makeThemisComponents($node)) return false; | ||
324 | - } | ||
325 | - else { | ||
326 | - | ||
327 | - $paramGlobalId = $this->baseId.":".$this->dataset2dd($this->remoteViId).":".$this->param2dd($this->paramId); | ||
328 | - $node->setAttribute('xml:id', $paramGlobalId); | ||
329 | - $this->paramXML = RemoteData.'PARAMS/'.$paramGlobalId.'.xml'; | ||
330 | - | ||
331 | - if (!file_exists($this->paramXML) && !$this->createParamXml($info)) return false; | ||
332 | - if (!$this->paramDom) { | ||
333 | - $this->paramDom = new DomDocument("1.0"); | ||
334 | - } | ||
335 | - $this->paramDom->load($this->paramXML); | ||
336 | - | ||
337 | - if (!$this->makeComponents($node)) return false; | ||
338 | - } | ||
339 | - } | ||
340 | - | ||
341 | - $parentRemote= $nodeRemote->parentNode; | ||
342 | - $parentRemoteId = $parentRemote->getAttribute('xml:id'); | ||
343 | - | ||
344 | - $parent = $this->xmlDom->getElementById($parentRemoteId); | ||
345 | - if (!$parent) { | ||
346 | - $parent = $this->xmlDom->importNode($parentRemote); | ||
347 | - } | ||
348 | - $parent -> appendChild($node); | ||
349 | - | ||
350 | - $toAddDataCentertToDoc = false; | ||
351 | - | ||
352 | - while ($parent->tagName != 'dataCenter') { | ||
353 | - $node = $parent; | ||
354 | - $parentRemote = $parentRemote->parentNode; | ||
355 | - $parentRemoteId = $parentRemote->getAttribute('xml:id'); | ||
356 | - $parent = $this->xmlDom->getElementById($parentRemoteId); | ||
357 | - | ||
358 | - if (!$parent) { | ||
359 | - if ($parentRemote->tagName == 'dataCenter') $toAddDataCenterToDoc = true; | ||
360 | - $parent = $this->xmlDom->importNode($parentRemote); | ||
361 | - $parent -> appendChild($node); | ||
362 | - } | ||
363 | - } | ||
364 | - | ||
365 | - if ($toAddDataCenterToDoc) { | ||
366 | -//TODO if this is neccessary ??? | ||
367 | -// special bases 'hand-made' descriptions | ||
368 | - $basesDom = new DomDocument("1.0"); | ||
369 | - $basesDom -> load(RemoteData.'Bases.xml'); | ||
370 | - $theBase = $basesDom -> getElementById($parent->getAttribute('xml:id')); | ||
371 | - | ||
372 | - if ($theBase) $parent -> setAttribute('name', $theBase->getAttribute('name')); | ||
373 | - $this->xmlDom->documentElement->appendChild($parent); | ||
374 | - } | ||
375 | - return true; | ||
376 | - } | ||
377 | - | ||
378 | -/* | ||
379 | -* PUBLIC FUNCTIONS | ||
380 | -*/ | ||
381 | - public function saveTree($obj) { | ||
382 | - | ||
383 | - if (count($obj) == 1) { | ||
384 | - $id = $obj->id; | ||
385 | - $this->setBaseId($id); | ||
386 | - $res = $this->addNode($id); | ||
387 | - } | ||
388 | - else { | ||
389 | - foreach ($obj as $o) { | ||
390 | - $id = $o->id; | ||
391 | - if ($id == 'root') continue; | ||
392 | - if (!$this->baseId) $this->setBaseId($id); | ||
393 | - $res = $this->addNode($id); | ||
394 | - } | ||
395 | - } | ||
396 | - | ||
397 | - $this->xmlDom->save($this->xmlName); | ||
398 | - return array('res' => 'ok'); | ||
399 | - } | ||
400 | - | ||
401 | - public function deleteFromTree($obj) { | ||
402 | - | ||
403 | - $id = $obj->id; | ||
404 | - $nodeToDelete = $this->xmlDom->getElementById($id); | ||
405 | - if (!$nodeToDelete) return array('err' => 'NO SUCH ID'); | ||
406 | - $nodeToDelete->parentNode->removeChild($nodeToDelete); | ||
407 | - | ||
408 | - $this->xmlDom->save($this->xmlName); | ||
409 | - | ||
410 | - return array('res'=> $obj->id); | ||
411 | - } | ||
412 | - | ||
413 | -} | ||
414 | - | ||
415 | -?> | ||
416 | \ No newline at end of file | 0 | \ No newline at end of file |
php/classes/UserMgr.php
@@ -77,7 +77,7 @@ class UserMgr | @@ -77,7 +77,7 @@ class UserMgr | ||
77 | $this->user = $_GET['sessionID']; | 77 | $this->user = $_GET['sessionID']; |
78 | else if (isset($sessionID)) | 78 | else if (isset($sessionID)) |
79 | $this->user = $sessionID; | 79 | $this->user = $sessionID; |
80 | - $this->amdaClient = new AmdaClient(); | 80 | + // $this->amdaClient = new AmdaClient(); |
81 | } | 81 | } |
82 | 82 | ||
83 | //TODO if needed?? set session ID | 83 | //TODO if needed?? set session ID |
@@ -260,7 +260,7 @@ class UserMgr | @@ -260,7 +260,7 @@ class UserMgr | ||
260 | { | 260 | { |
261 | $remoteBases = new DomDocument("1.0"); | 261 | $remoteBases = new DomDocument("1.0"); |
262 | $availableMis = $this->userMissions['external']; | 262 | $availableMis = $this->userMissions['external']; |
263 | - | 263 | +unlink(USERWSDIR.'RemoteParams.xml'); |
264 | if (file_exists(USERWSDIR.'RemoteParams.xml')) | 264 | if (file_exists(USERWSDIR.'RemoteParams.xml')) |
265 | { | 265 | { |
266 | // replace IMPEX nodes | 266 | // replace IMPEX nodes |
@@ -325,7 +325,7 @@ class UserMgr | @@ -325,7 +325,7 @@ class UserMgr | ||
325 | 325 | ||
326 | if ($bases->length == 0) return 'NO REMOTE BASES'; | 326 | if ($bases->length == 0) return 'NO REMOTE BASES'; |
327 | 327 | ||
328 | - $paramMgr = new ParamMgr(); | 328 | + $paramMgr = new RemoteParamManager(); |
329 | $paramMgr->xmlDom = new DomDocument("1.0"); | 329 | $paramMgr->xmlDom = new DomDocument("1.0"); |
330 | $paramMgr->xmlDom->formatOutput = true; | 330 | $paramMgr->xmlDom->formatOutput = true; |
331 | $paramMgr->xmlDom->preserveWhiteSpace = false; | 331 | $paramMgr->xmlDom->preserveWhiteSpace = false; |
@@ -537,22 +537,22 @@ class UserMgr | @@ -537,22 +537,22 @@ class UserMgr | ||
537 | // if new info exists it will be shown to : | 537 | // if new info exists it will be shown to : |
538 | // public => to all | 538 | // public => to all |
539 | // special => to group members | 539 | // special => to group members |
540 | - if (file_exists($this->userdir.'newInfo')) | ||
541 | - { | ||
542 | - $amdaInfo = new AmdaNews($this->user); | ||
543 | - // if status = 0 - it is special info to group members only | ||
544 | - // else to all | ||
545 | - $info = $this->getUserInfo($this->user); | ||
546 | - $status = $amdaInfo->makeInfo($info['group']); | ||
547 | - | ||
548 | - if ($status) $this->isNewInfo = true; | ||
549 | - | ||
550 | - unlink($this->userdir.'newInfo'); | ||
551 | - } | 540 | +// if (file_exists($this->userdir.'newInfo')) |
541 | +// { | ||
542 | +// $amdaInfo = new AmdaNews($this->user); | ||
543 | +// // if status = 0 - it is special info to group members only | ||
544 | +// // else to all | ||
545 | +// $info = $this->getUserInfo($this->user); | ||
546 | +// $status = $amdaInfo->makeInfo($info['group']); | ||
547 | +// | ||
548 | +// if ($status) $this->isNewInfo = true; | ||
549 | +// | ||
550 | +// unlink($this->userdir.'newInfo'); | ||
551 | +// } | ||
552 | touch($this->userdir.'newLogin'); | 552 | touch($this->userdir.'newLogin'); |
553 | 553 | ||
554 | $this->setPath(); | 554 | $this->setPath(); |
555 | - $this->userMissions = $this->getAvailableMissionsByUser(); | 555 | + // $this->userMissions = $this->getAvailableMissionsByUser(); |
556 | 556 | ||
557 | if (file_exists(USERWSDIR.'LocalParams.xml')) | 557 | if (file_exists(USERWSDIR.'LocalParams.xml')) |
558 | unlink(USERWSDIR.'LocalParams.xml'); | 558 | unlink(USERWSDIR.'LocalParams.xml'); |
@@ -571,8 +571,8 @@ class UserMgr | @@ -571,8 +571,8 @@ class UserMgr | ||
571 | /* | 571 | /* |
572 | * Special groups are defined in the generic_data/SpecialSettings/Groups.xml | 572 | * Special groups are defined in the generic_data/SpecialSettings/Groups.xml |
573 | */ | 573 | */ |
574 | - $specialGroup = $this->isSpecialGroup(); | ||
575 | - | 574 | + // $specialGroup = $this->isSpecialGroup(); |
575 | + $specialGroup = false; | ||
576 | // Special Info for special groups | 576 | // Special Info for special groups |
577 | if ($specialGroup) | 577 | if ($specialGroup) |
578 | { | 578 | { |
php/my_config.php
@@ -3,18 +3,18 @@ | @@ -3,18 +3,18 @@ | ||
3 | * @file my_config.php | 3 | * @file my_config.php |
4 | * @version $Id: my_config.php 2372 2014-05-21 09:38:38Z myriam $ | 4 | * @version $Id: my_config.php 2372 2014-05-21 09:38:38Z myriam $ |
5 | * | 5 | * |
6 | - * | ||
7 | */ | 6 | */ |
8 | 7 | ||
9 | //AKKA - Path to AMDA_Integration base dir | 8 | //AKKA - Path to AMDA_Integration base dir |
10 | -define('INTEGRATION_BASE_PATH', '/home/benjamin/AMDA-GIT/AMDA_Integration/'); | 9 | +define('INTEGRATION_BASE_PATH', '/home/budnik/AMDA/AMDA_Integration/'); |
11 | 10 | ||
12 | require_once(INTEGRATION_BASE_PATH.'config/AMDAIntegrationConfig.php'); | 11 | require_once(INTEGRATION_BASE_PATH.'config/AMDAIntegrationConfig.php'); |
13 | 12 | ||
14 | define('CEFLIB', '/usr/local/cef/lib'); | 13 | define('CEFLIB', '/usr/local/cef/lib'); |
15 | define('CDFLIB', '/opt/local/lib'); | 14 | define('CDFLIB', '/opt/local/lib'); |
15 | + | ||
16 | define('SYS_LIBS', '/lib:/usr/lib:/usr/local/lib64'); | 16 | define('SYS_LIBS', '/lib:/usr/lib:/usr/local/lib64'); |
17 | -define('SYS_BIN','/bin:/usr/bin/:/usr/local/bin/'); | 17 | +define('SYS_BIN', '/bin:/usr/bin/:/usr/local/bin/'); |
18 | 18 | ||
19 | //AKKA - For compatibility with IHM | 19 | //AKKA - For compatibility with IHM |
20 | define('BASE_PATH', IHM_SRC_DIR); | 20 | define('BASE_PATH', IHM_SRC_DIR); |
@@ -26,9 +26,9 @@ define('log', IHM_SRC_DIR.'LOG'); | @@ -26,9 +26,9 @@ define('log', IHM_SRC_DIR.'LOG'); | ||
26 | // User apache | 26 | // User apache |
27 | define('APACHE_USER', 'apache'); | 27 | define('APACHE_USER', 'apache'); |
28 | // Alias for name of AMDA | 28 | // Alias for name of AMDA |
29 | -define('APACHE_ALIAS', '/NEWAMDA-BENJAMIN/'); | 29 | +define('APACHE_ALIAS', '/NEWAMDA/'); |
30 | //email to send errors from AmdaUpdate/AmdaInstall | 30 | //email to send errors from AmdaUpdate/AmdaInstall |
31 | -define('email','brenard@irap.omp.eu'); | 31 | +define('email','ebudnik@irap.omp.eu'); |
32 | 32 | ||
33 | //DDPATH | 33 | //DDPATH |
34 | define('DDBIN','/opt/local/bin/'); | 34 | define('DDBIN','/opt/local/bin/'); |
@@ -38,6 +38,7 @@ define('DDLIB','/opt/local/lib/'); | @@ -38,6 +38,7 @@ define('DDLIB','/opt/local/lib/'); | ||
38 | define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl'); | 38 | define('DD_WSDL','http://amda-dev.irap.omp.eu/BASE/DDService/dd.wsdl'); |
39 | define('TITLE', 'AMDANEW-Test'); | 39 | define('TITLE', 'AMDANEW-Test'); |
40 | 40 | ||
41 | + | ||
41 | $is64 = true; | 42 | $is64 = true; |
42 | 43 | ||
43 | ?> | 44 | ?> |
@@ -0,0 +1,23 @@ | @@ -0,0 +1,23 @@ | ||
1 | +/* $Id: AddVI.c,v 1.2 2012/10/29 08:03:14 budnik Exp $*/ | ||
2 | +/*=========================================================================== | ||
3 | + * DD SYSTEM CLIENT-SERVER | ||
4 | + * AddVI.c | ||
5 | + * v.1.0 | ||
6 | + * Executable to add new VI to server | ||
7 | + * List of changes: | ||
8 | + * 17 Jun 2007: V.1.0 | ||
9 | + ===========================================================================*/ | ||
10 | + | ||
11 | +#include <stdio.h> | ||
12 | +#include <string.h> | ||
13 | +#include <DD.h> | ||
14 | + | ||
15 | +main(int argc, char **argv) | ||
16 | +{ | ||
17 | + int Err; | ||
18 | + | ||
19 | + Err = DD_AddDataSet(argv[1],argv[2],argv[3]); | ||
20 | + // printf("Err = %d\n",Err); | ||
21 | + return Err; | ||
22 | +} | ||
23 | +/*===========================================================================*/ |
php/src/Makefile
1 | -INC = -I/usr/include -I/usr/local/include -I${CDF_DIR}/include -I${CEF_DIR}/include -I${DD_INCLUDE} | ||
2 | -LIB = -L/usr/lib64 -L/usr/local/lib64 -L${CDF_DIR}/lib -L${CEF_DIR}/lib -L${DD_LIB} | 1 | +INC = -I/usr/include -I/usr/local/include -I/opt/local/include -I/opt/local/include/DDClientLibC |
2 | +LIB = -L/usr/lib64 -L/usr/local/lib64 -L/opt/local/lib -L/opt/local/lib | ||
3 | CFLAGS = -ggdb -DLINUX -m64 -march=core2 -fPIC -Dlinux -D_REENTRANT -malign-double | 3 | CFLAGS = -ggdb -DLINUX -m64 -march=core2 -fPIC -Dlinux -D_REENTRANT -malign-double |
4 | CC = gcc | 4 | CC = gcc |
5 | 5 | ||
6 | EXE = nctimestring2double nctimeinfo getncvars ncvarinfo \ | 6 | EXE = nctimestring2double nctimeinfo getncvars ncvarinfo \ |
7 | - cefstartstop cefvarinfo cefinfo cefsampling ceftimeinfo \ | ||
8 | - cdfinfo cdfvarinfo cdfstartstopfromdata cdfsamplingfromdata | 7 | + ncinfo_remote \ |
8 | + cdfinfo cdfvarinfo cdfstartstopfromdata cdfsamplingfromdata \ | ||
9 | + AddVI | ||
9 | 10 | ||
10 | lib: ${EXE} | 11 | lib: ${EXE} |
11 | 12 | ||
12 | -nctimestring2double: nctimestring2double.o | ||
13 | - ${CC} -o nctimestring2double nctimestring2double.o ${LIB} -lDDClientLibC -lnetcdf | 13 | +AddVI: AddVI.c |
14 | + ${CC} ${CFLAGS} -o AddVI AddVI.c ${INC} ${LIB} -lDDClientLibC | ||
15 | + | ||
16 | +ncinfo_remote: ncinfo_remote.c | ||
17 | + ${CC} ${CFLAGS} -o ncinfo_remote ncinfo_remote.c ${INC} ${LIB} -lnetcdf | ||
18 | + | ||
19 | +nctimestring2double: nctimestring2double.c | ||
20 | + ${CC} ${CFLAGS} -o nctimestring2double nctimestring2double.c ${INC} ${LIB} -lDDClientLibC -lnetcdf | ||
14 | 21 | ||
15 | -nctimestring2double.o: nctimestring2double.c | ||
16 | - ${CC} ${CFLAGS} -c nctimestring2double.c ${INC} | 22 | +nctimeinfo: nctimeinfo.c |
23 | + ${CC} ${CFLAGS} -o nctimeinfo nctimeinfo.c ${INC} ${LIB} -lnetcdf | ||
17 | 24 | ||
18 | -nctimeinfo: nctimeinfo.o | ||
19 | - ${CC} -o nctimeinfo nctimeinfo.o ${LIB} -lnetcdf | 25 | +getncvars: getncvars.c |
26 | + ${CC} ${CFLAGS} -o getncvars getncvars.c ${INC} ${LIB} -lnetcdf | ||
20 | 27 | ||
21 | -nctimeinfo.o: nctimeinfo.c | ||
22 | - ${CC} ${CFLAGS} -c nctimeinfo.c ${INC} | 28 | +ncvarinfo: ncvarinfo.c |
29 | + ${CC} ${CFLAGS} -o ncvarinfo ncvarinfo.c ${INC} ${LIB} -lnetcdf | ||
23 | 30 | ||
24 | -getncvars: getncvars.o | ||
25 | - ${CC} -o getncvars getncvars.o ${LIB} -lnetcdf | 31 | +cefvarinfo: cefvarinfo.c |
32 | + ${CC} ${CFLAGS} -o cefvarinfo cefvarinfo.c ${INC} ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
26 | 33 | ||
27 | -getncvars.o: getncvars.c | ||
28 | - ${CC} ${CFLAGS} -c getncvars.c ${INC} | 34 | +cefinfo: cefinfo.c |
35 | + ${CC} ${CFLAGS} -o cefinfo cefinfo.c ${INC} ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
29 | 36 | ||
30 | -ncvarinfo: ncvarinfo.o | ||
31 | - ${CC} -o ncvarinfo ncvarinfo.o ${LIB} -lnetcdf | 37 | +cefstartstop: cefstartstop.c |
38 | + ${CC} ${CFLAGS} -o cefstartstop cefstartstop.c ${INC} ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
32 | 39 | ||
33 | -ncvarinfo.o: ncvarinfo.c | ||
34 | - ${CC} ${CFLAGS} -c ncvarinfo.c ${INC} | 40 | +cefsampling: cefsampling.c |
41 | + ${CC} ${CFLAGS} -o cefsampling cefsampling.c ${INC} ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
35 | 42 | ||
36 | -cefvarinfo: cefvarinfo.o | ||
37 | - ${CC} -o cefvarinfo cefvarinfo.o ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | 43 | +ceftimeinfo: ceftimeinfo.c |
44 | + ${CC} ${CFLAGS} -o ceftimeinfo ceftimeinfo.c ${INC} ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
38 | 45 | ||
39 | -cefvarinfo.o: cefvarinfo.c | ||
40 | - ${CC} ${CFLAGS} -c cefvarinfo.c ${INC} | 46 | +cdfinfo: cdfinfo.c |
47 | + ${CC} ${CFLAGS} -o cdfinfo cdfinfo.c ${INC} ${LIB} -lcdf | ||
41 | 48 | ||
42 | -cefinfo: cefinfo.o | ||
43 | - ${CC} -o cefinfo cefinfo.o ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | 49 | +cdfvarinfo: cdfvarinfo.c |
50 | + ${CC} ${CFLAGS} -o cdfvarinfo cdfvarinfo.c ${INC} ${LIB} -lcdf | ||
44 | 51 | ||
45 | -cefinfo.o: cefinfo.c | ||
46 | - ${CC} ${CFLAGS} -c cefinfo.c ${INC} | 52 | +cdfstartstopfromdata: cdfstartstopfromdata.c |
53 | + ${CC} ${CFLAGS} -o cdfstartstopfromdata cdfstartstopfromdata.c ${INC} ${LIB} -lcdf | ||
47 | 54 | ||
48 | -cefstartstop: cefstartstop.o | ||
49 | - ${CC} -o cefstartstop cefstartstop.o ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
50 | - | ||
51 | -cefstartstop.o: cefstartstop.c | ||
52 | - ${CC} ${CFLAGS} -c cefstartstop.c ${INC} | ||
53 | - | ||
54 | -cefsampling: cefsampling.o | ||
55 | - ${CC} -o cefsampling cefsampling.o ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
56 | - | ||
57 | -cefsampling.o: cefsampling.c | ||
58 | - ${CC} ${CFLAGS} -c cefsampling.c ${INC} | ||
59 | - | ||
60 | -ceftimeinfo: ceftimeinfo.o | ||
61 | - ${CC} -o ceftimeinfo ceftimeinfo.o ${LIB} -lm -lz -lCEF_gcc -lCIS_gcc | ||
62 | - | ||
63 | -ceftimeinfo.o: ceftimeinfo.c | ||
64 | - ${CC} ${CFLAGS} -c ceftimeinfo.c ${INC} | ||
65 | - | ||
66 | -cdfinfo: cdfinfo.o | ||
67 | - ${CC} -o cdfinfo cdfinfo.o ${LIB} -lcdf | ||
68 | - | ||
69 | -cdfinfo.o: cdfinfo.c | ||
70 | - ${CC} ${CFLAGS} -c cdfinfo.c ${INC} | ||
71 | - | ||
72 | -cdfvarinfo: cdfvarinfo.o | ||
73 | - ${CC} -o cdfvarinfo cdfvarinfo.o ${LIB} -lcdf | ||
74 | - | ||
75 | -cdfvarinfo.o: cdfvarinfo.c | ||
76 | - ${CC} ${CFLAGS} -c cdfvarinfo.c ${INC} | ||
77 | - | ||
78 | -cdfstartstopfromdata: cdfstartstopfromdata.o | ||
79 | - ${CC} -o cdfstartstopfromdata cdfstartstopfromdata.o ${LIB} -lcdf | ||
80 | - | ||
81 | -cdfstartstopfromdata.o: cdfstartstopfromdata.c | ||
82 | - ${CC} ${CFLAGS} -c cdfstartstopfromdata.c ${INC} | ||
83 | - | ||
84 | -cdfsamplingfromdata: cdfsamplingfromdata.o | ||
85 | - ${CC} -o cdfsamplingfromdata cdfsamplingfromdata.o ${LIB} -lcdf | ||
86 | - | ||
87 | -cdfsamplingfromdata.o: cdfsamplingfromdata.c | ||
88 | - ${CC} ${CFLAGS} -c cdfsamplingfromdata.c ${INC} | 55 | +cdfsamplingfromdata: cdfsamplingfromdata.c |
56 | + ${CC} ${CFLAGS} -o cdfsamplingfromdata cdfsamplingfromdata.c ${INC} ${LIB} -lcdf | ||
89 | 57 | ||
90 | install: | 58 | install: |
91 | install -d -m a+rx,ug+w ${IHM_DIR}/php/bin | 59 | install -d -m a+rx,ug+w ${IHM_DIR}/php/bin |
@@ -0,0 +1,96 @@ | @@ -0,0 +1,96 @@ | ||
1 | + #include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <string.h> | ||
4 | +#include <netcdf.h> | ||
5 | + | ||
6 | +void check(int stat) | ||
7 | +{ | ||
8 | + if (stat != NC_NOERR) | ||
9 | + { | ||
10 | + printf("NetCDF error: %s\n", nc_strerror(stat)); | ||
11 | + exit(1); | ||
12 | + } | ||
13 | +} | ||
14 | + | ||
15 | +main(int argc, char **argv) | ||
16 | +{ | ||
17 | + int ncID, varID, labelID, ndims, dimids[NC_MAX_DIMS]; | ||
18 | + size_t i, k; | ||
19 | +// char varname[NC_MAX_NAME]; | ||
20 | + int stat = 0; | ||
21 | + nc_type xtype; | ||
22 | + size_t start[] = {0, 0}; | ||
23 | + size_t count[] = {1, 0}; | ||
24 | + size_t size, length; | ||
25 | + | ||
26 | + if (argc <= 2) { | ||
27 | + printf("Incorrect number of arguments\n"); | ||
28 | + exit(1); | ||
29 | + } | ||
30 | + | ||
31 | + stat = nc_open(argv[1],NC_WRITE|NC_SHARE,&ncID); check(stat); | ||
32 | + | ||
33 | + stat = nc_inq_varid(ncID, argv[2], &varID); check(stat); | ||
34 | + | ||
35 | + stat = nc_inq_varndims(ncID, varID, &ndims); check(stat); | ||
36 | + | ||
37 | + stat = nc_inq_vardimid(ncID, varID, dimids); check(stat); | ||
38 | + | ||
39 | + size_t len = 0; | ||
40 | + if (ndims > 1) | ||
41 | + for (i = 1; i < ndims; i++) { | ||
42 | + stat = nc_inq_dimlen(ncID, dimids[i], &len); check(stat); | ||
43 | + if (argc == 3) | ||
44 | + { | ||
45 | + fprintf(stdout, "%d ", len); | ||
46 | + } | ||
47 | + } | ||
48 | + else | ||
49 | + if (argc == 3) | ||
50 | + { | ||
51 | + fprintf(stdout,"%d ", len); | ||
52 | + } | ||
53 | + | ||
54 | + if (argc == 4) | ||
55 | + { | ||
56 | + size_t attlen = 0; | ||
57 | + stat = nc_inq_attlen(ncID, varID, "LABL_PTR_1", &attlen); check(stat); | ||
58 | + // stat = nc_inq_atttype(ncID, varID, "LABL_PTR_1", &xtype); check(stat); | ||
59 | + | ||
60 | + unsigned char *string_attr = (unsigned char *)malloc(attlen * sizeof(char*)); | ||
61 | + stat = nc_get_att(ncID, varID, "LABL_PTR_1", string_attr); check(stat); | ||
62 | + | ||
63 | + // printf("attribute = %s\n", string_attr); | ||
64 | + stat = nc_inq_varid(ncID, string_attr, &labelID); check(stat); | ||
65 | + // stat = nc_inq_vartype(ncID, labelID, &xtype); check(stat); | ||
66 | + | ||
67 | + // printf("%d \n", xtype); | ||
68 | + | ||
69 | + stat = nc_inq_varndims(ncID, labelID, &ndims); check(stat); | ||
70 | + | ||
71 | + stat = nc_inq_vardimid(ncID, labelID, dimids); check(stat); | ||
72 | + | ||
73 | + for (i = 0; i < ndims; i++) { | ||
74 | + stat = nc_inq_dimlen(ncID, dimids[i], &len); check(stat); | ||
75 | + // printf("%d \n", len); | ||
76 | + if (i == 0) size = len; | ||
77 | + if (i == 1) length = len; | ||
78 | + } | ||
79 | + count[1] = length; | ||
80 | + | ||
81 | + unsigned char *string_var = (unsigned char *)malloc(length * sizeof(char*)); | ||
82 | + for (i = 0; i < size; i++) | ||
83 | + { | ||
84 | + stat = nc_get_vara(ncID, labelID, start, count, string_var); check(stat); | ||
85 | + fprintf(stdout, "%s;", string_var); | ||
86 | + start[0]++; | ||
87 | + } | ||
88 | + free(string_attr); | ||
89 | + free(string_var); | ||
90 | + } | ||
91 | + | ||
92 | + stat = nc_close(ncID); | ||
93 | + exit(0); | ||
94 | +} | ||
95 | + | ||
96 | + |