Skip to content
This repository was archived by the owner on Sep 10, 2021. It is now read-only.

Commit 9161614

Browse files
author
Charles Marion
committed
ENH: 0009653: Add a browser in the import page to select where import
1 parent a9b6d31 commit 9161614

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

core/controllers/AdminController.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -329,13 +329,17 @@ function upgradeAction()
329329
*/
330330
function serversidefilechooserAction()
331331
{
332-
$userid = $this->CheckSession();
333-
if(!$this->User->isAdmin($userid))
332+
if(!$this->logged)
334333
{
335-
echo "Administrative privileges required";
336-
exit ();
334+
throw new Zend_Exception("You should be logged in");
337335
}
338-
336+
if(!$this->userSession->Dao->isAdmin())
337+
{
338+
throw new Zend_Exception("Administrative privileges required");
339+
}
340+
341+
$this->_helper->layout->disableLayout();
342+
$this->_helper->viewRenderer->setNoRender();
339343

340344
// Display the tree
341345
$_POST['dir'] = urldecode($_POST['dir']);
@@ -386,7 +390,6 @@ function serversidefilechooserAction()
386390
echo "File ".$_POST['dir']." doesn't exist";
387391
}
388392
// No views
389-
exit();
390393
} // end function serversidefilechooserAction
391394

392395

@@ -396,8 +399,9 @@ function serversidefilechooserAction()
396399
*/
397400
function migratemidas2Action()
398401
{
402+
$this->_helper->layout->disableLayout();
403+
$this->_helper->viewRenderer->setNoRender();
399404
$this->Component->MIDAS2Migration->migrate();
400-
exit();
401405
}
402406

403407
} // end class

core/public/js/import/import.index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $(document).ready(function()
1414
$('#inputdirectory').change(function(){inputdirectoryChanged()});
1515

1616
// Form for the new assetstore
17-
options = { success:assetstoreAddCallback, beforeSubmit: assetstoreSubmit, dataType:'json' };
17+
options = {success:assetstoreAddCallback, beforeSubmit: assetstoreSubmit, dataType:'json'};
1818
$('#assetstoreForm').ajaxForm(options);
1919

2020
// Load the window for the new assetstore
@@ -33,6 +33,18 @@ $(document).ready(function()
3333
$("#assetstoretype").attr('disabled', 'disabled');
3434

3535
importSubmitButtonValue = $("#importsubmit").html();
36+
37+
//Init Browser
38+
$('input[name=importFolder]').val('');
39+
$('input[name=importFolder]').attr('id','destinationId');
40+
$('input[name=importFolder]').hide();
41+
$('input[name=importFolder]').before('<input style="margin-left:0px;" id="browseMIDASLink" class="globalButton" type="button" value="Select location" />');
42+
$('input[name=importFolder]').before('<span style="margin-left:5px;" id="destinationUpload"/>');
43+
$('#browseMIDASLink').click(function()
44+
{
45+
loadDialog("select","/browse/movecopy/?selectElement=true");
46+
showDialog('Browse');
47+
});
3648
});
3749

3850

0 commit comments

Comments
 (0)