diff --git a/out/out.MoveDocument.php b/out/out.MoveDocument.php index 3aab2bbea..0cd1345c9 100644 --- a/out/out.MoveDocument.php +++ b/out/out.MoveDocument.php @@ -29,7 +29,6 @@ if (!isset($_GET["documentid"]) || !is_numeric($_GET["documentid"]) || intval($_ } $document = $dms->getDocument($_GET["documentid"]); - if (!is_object($document)) { UI::exitError(getMLText("document_title", array("documentname" => getMLText("invalid_doc_id"))),getMLText("invalid_doc_id")); } @@ -38,10 +37,24 @@ if ($document->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); } +if(isset($_GET['targetid']) && $_GET['targetid']) { + $target = $dms->getFolder($_GET["targetid"]); + if (!is_object($target)) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_folder")); + } + + if ($target->getAccessMode($user) < M_READWRITE) { + UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); + } + +} else { + $target = null; +} + $folder = $document->getFolder(); $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document)); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'document'=>$document, 'target'=>$target)); if($view) { $view->show(); exit; diff --git a/out/out.MoveFolder.php b/out/out.MoveFolder.php index ffa4618f3..d78f35593 100644 --- a/out/out.MoveFolder.php +++ b/out/out.MoveFolder.php @@ -43,8 +43,22 @@ if ($folder->getAccessMode($user) < M_READWRITE) { UI::exitError(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))),getMLText("access_denied")); } +if(isset($_GET['targetid']) && $_GET['targetid']) { + $target = $dms->getFolder($_GET["targetid"]); + if (!is_object($target)) { + UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_folder")); + } + + if ($target->getAccessMode($user) < M_READWRITE) { + UI::exitError(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName()))),getMLText("access_denied")); + } + +} else { + $target = null; +} + $tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME'])); -$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder)); +$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'folder'=>$folder, 'target'=>$target)); if($view) { $view->show(); exit; diff --git a/views/bootstrap/class.MoveDocument.php b/views/bootstrap/class.MoveDocument.php index 81b20150a..dfb03934c 100644 --- a/views/bootstrap/class.MoveDocument.php +++ b/views/bootstrap/class.MoveDocument.php @@ -36,6 +36,7 @@ class LetoDMS_View_MoveDocument extends LetoDMS_Bootstrap_Style { $user = $this->params['user']; $folder = $this->params['folder']; $document = $this->params['document']; + $target = $this->params['target']; $this->htmlStartPage(getMLText("document_title", array("documentname" => htmlspecialchars($document->getName())))); $this->globalNavigation($folder); @@ -49,7 +50,7 @@ class LetoDMS_View_MoveDocument extends LetoDMS_Bootstrap_Style {
: | -printFolderChooser("form1", M_READWRITE);?> | +printFolderChooser("form1", M_READWRITE, -1, $target);?> | |||
"> |
diff --git a/views/bootstrap/class.MoveFolder.php b/views/bootstrap/class.MoveFolder.php
index c994dc6b4..b57b331d1 100644
--- a/views/bootstrap/class.MoveFolder.php
+++ b/views/bootstrap/class.MoveFolder.php
@@ -35,6 +35,7 @@ class LetoDMS_View_MoveFolder extends LetoDMS_Bootstrap_Style {
$dms = $this->params['dms'];
$user = $this->params['user'];
$folder = $this->params['folder'];
+ $target = $this->params['target'];
$this->htmlStartPage(getMLText("folder_title", array("foldername" => htmlspecialchars($folder->getName()))));
$this->globalNavigation($folder);
@@ -50,7 +51,7 @@ class LetoDMS_View_MoveFolder extends LetoDMS_Bootstrap_Style {
: | -printFolderChooser("form1", M_READWRITE, $folder->getID());?> | +printFolderChooser("form1", M_READWRITE, $folder->getID(), $target);?> |