Commit 0bda97f319df9a47d0531454012073e876d5e0a8
1 parent
2325998f
Exists in
master
and in
110 other branches
Fix SAMP export from TabResult
Showing
4 changed files
with
33 additions
and
9 deletions
Show diff stats
js/app/views/DownloadUI.js
... | ... | @@ -375,6 +375,7 @@ Ext.define('amdaUI.DownloadUI', { |
375 | 375 | }, |
376 | 376 | |
377 | 377 | init : function (config){ |
378 | + var me = this; | |
378 | 379 | |
379 | 380 | this.timeSelector = new amdaUI.TimeSelectorUI({id: 'downloadTimeSelector',flex: 1}); |
380 | 381 | |
... | ... | @@ -711,7 +712,13 @@ Ext.define('amdaUI.DownloadUI', { |
711 | 712 | items: [ |
712 | 713 | this.paramPanel, |
713 | 714 | this.ttPanel |
714 | - ] | |
715 | + ], | |
716 | + listeners: { | |
717 | + 'tabchange' : function (tabPanel, tab) { | |
718 | + var sampAvailable = (tab.title == me.paramPanel.title); | |
719 | + me.down('sendToSampButton').setDisabled(!sampAvailable); | |
720 | + } | |
721 | + } | |
715 | 722 | }], |
716 | 723 | fbar: [ |
717 | 724 | { | ... | ... |
js/app/views/TabResultUI.js
... | ... | @@ -141,11 +141,21 @@ Ext.define('amdaUI.ResultItem', { |
141 | 141 | }, |
142 | 142 | |
143 | 143 | onSendVOTableToSamp : function (clientId, sendOpt){ |
144 | - var o = {folderId : sendOpt.downFolder, downId : sendOpt.downId}; | |
145 | - | |
146 | - var me = this; | |
147 | - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | |
148 | - }); | |
144 | + loadMask.show(); | |
145 | + AmdaAction.getRequestByProcessId(sendOpt, function(res,e) { | |
146 | + var request = res; | |
147 | + request.sendToSamp = true; | |
148 | + AmdaAction.execute({nodeType : 'download'}, request, function(res,e) { | |
149 | + loadMask.hide(); | |
150 | + var files = res.result.split(","); | |
151 | + Ext.each(files, function(file) { | |
152 | + var href = 'data/'+sessionID+'/RES/'+ res.folder + '/' + file; | |
153 | + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.interop.id, true, function (module) { | |
154 | + module.sendVOTable(href, clientId ? clientId : 'hub'); | |
155 | + }); | |
156 | + }); | |
157 | + }); | |
158 | + }); | |
149 | 159 | }, |
150 | 160 | |
151 | 161 | constructor: function(config) { |
... | ... | @@ -155,7 +165,7 @@ Ext.define('amdaUI.ResultItem', { |
155 | 165 | |
156 | 166 | initConfig: function(config){ |
157 | 167 | var jobtitle = config.title; |
158 | - | |
168 | + | |
159 | 169 | switch (config.type) { |
160 | 170 | case 'request' : |
161 | 171 | var resultId = config.resultId; |
... | ... | @@ -302,7 +312,7 @@ Ext.define('amdaUI.ResultItem', { |
302 | 312 | xtype : 'sendToSampButton', |
303 | 313 | type : 'votable', |
304 | 314 | onSendToSamp : this.onSendVOTableToSamp, |
305 | - sendOpt : {'downId' : downId, 'downFolder' : downFolder} | |
315 | + sendOpt : {'processId' : config.processId} | |
306 | 316 | }] |
307 | 317 | }; |
308 | 318 | ... | ... |
php/classes/AmdaAction.php
... | ... | @@ -1425,5 +1425,11 @@ class AmdaAction |
1425 | 1425 | return array('success' => true, 'alreadyUsed' => $alreadyUsed); |
1426 | 1426 | } |
1427 | 1427 | |
1428 | + public function getRequestByProcessId($obj) | |
1429 | + { | |
1430 | + require_once(INTEGRATION_SRC_DIR."RequestManager.php"); | |
1431 | + | |
1432 | + return $this->executeRequest($obj->processId, FunctionTypeEnumClass::PROCESSGETREQUEST); | |
1433 | + } | |
1428 | 1434 | } |
1429 | 1435 | ?> | ... | ... |
php/config.php
... | ... | @@ -213,7 +213,8 @@ $API = array( |
213 | 213 | 'getParamInfo'=>array('len'=>1), |
214 | 214 | 'getSharedObjectFolders' => array('len'=>1), |
215 | 215 | 'shareObjects' => array('len'=>1), |
216 | - 'isSharedObjectNameAlreadyUsed' => array('len'=>1) | |
216 | + 'isSharedObjectNameAlreadyUsed' => array('len'=>1), | |
217 | + 'getRequestByProcessId' => array('len'=>1), | |
217 | 218 | ) |
218 | 219 | ) |
219 | 220 | ); | ... | ... |