- target folder can be passed as targetid in URL

This commit is contained in:
steinm 2013-01-30 09:49:37 +00:00
parent beb82e94c8
commit fe7243a412
4 changed files with 34 additions and 5 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 {
<table>
<tr>
<td><?php printMLText("choose_target_folder");?>:</td>
<td><?php $this->printFolderChooser("form1", M_READWRITE);?></td>
<td><?php $this->printFolderChooser("form1", M_READWRITE, -1, $target);?></td>
</tr>
<tr>
<td colspan="2"><br /><input type="submit" class="btn" value="<?php printMLText("move");?>"></td>

View File

@ -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 {
<table class="table-condensed">
<tr>
<td><?php printMLText("choose_target_folder");?>:</td>
<td><?php $this->printFolderChooser("form1", M_READWRITE, $folder->getID());?></td>
<td><?php $this->printFolderChooser("form1", M_READWRITE, $folder->getID(), $target);?></td>
</tr>
<tr>
<td></td>