more general folder chooser

the choosen folder will no longer use targetidformx for the input field
containing the id. It is now independent of the form name.
This commit is contained in:
Uwe Steinmann 2014-07-08 08:30:59 +02:00
parent 7930ddec8d
commit 73bfecb5a8
7 changed files with 13 additions and 13 deletions

View File

@ -157,10 +157,10 @@ function createFolderTar($folder,$ark) { /* {{{ */
return true;
} /* }}} */
if (!isset($_GET["targetidform2"]) || !is_numeric($_GET["targetidform2"]) || intval($_GET["targetidform2"])<1) {
if (!isset($_GET["targetid"]) || !is_numeric($_GET["targetid"]) || intval($_GET["targetid"])<1) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
}
$folderid = $_GET["targetidform2"];
$folderid = $_GET["targetid"];
$folder = $dms->getFolder($folderid);
if (!is_object($folder)) {

View File

@ -47,10 +47,10 @@ function createVersionigFiles($folder)
return true;
}
if (!isset($_GET["targetidform1"]) || !is_numeric($_GET["targetidform1"]) || intval($_GET["targetidform1"])<1) {
if (!isset($_GET["targetid"]) || !is_numeric($_GET["targetid"]) || intval($_GET["targetid"])<1) {
UI::exitError(getMLText("admin_tools"),getMLText("invalid_folder_id"));
}
$folderid = $_GET["targetidform1"];
$folderid = $_GET["targetid"];
$folder = $dms->getFolder($folderid);
if (!is_object($folder)) {

View File

@ -84,8 +84,8 @@ if ($_GET["type"]=="document"){
} else if ($_GET["type"]=="folder") {
if ($_GET["action"]=="add"){
if (!isset($_POST["targetidform1"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
$folderid = $_POST["targetidform1"];
if (!isset($_POST["targetid"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
$folderid = $_POST["targetid"];
}else if ($_GET["action"]=="del"){
if (!isset($_GET["id"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
$folderid = $_GET["id"];

View File

@ -38,11 +38,11 @@ if (!is_object($document)) {
$oldFolder = $document->getFolder();
if (!isset($_GET["targetidform1"]) || !is_numeric($_GET["targetidform1"]) || $_GET["targetidform1"]<1) {
if (!isset($_GET["targetid"]) || !is_numeric($_GET["targetid"]) || $_GET["targetid"]<1) {
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_folder"));
}
$targetid = $_GET["targetidform1"];
$targetid = $_GET["targetid"];
$targetFolder = $dms->getFolder($targetid);
if (!is_object($targetFolder)) {

View File

@ -39,11 +39,11 @@ if ($folderid == $settings->_rootFolderID || !$folder->getParent()) {
UI::exitError(getMLText("folder_title", array("foldername" => $folder->getName())),getMLText("cannot_move_root"));
}
if (!isset($_GET["targetidform1"]) || !is_numeric($_GET["targetidform1"]) || intval($_GET["targetidform1"])<1) {
if (!isset($_GET["targetid"]) || !is_numeric($_GET["targetid"]) || intval($_GET["targetid"])<1) {
UI::exitError(getMLText("folder_title", array("foldername" => getMLText("invalid_folder_id"))),getMLText("invalid_folder_id"));
}
$targetid = $_GET["targetidform1"];
$targetid = $_GET["targetid"];
$targetFolder = $dms->getFolder($targetid);
if (!is_object($targetFolder)) {

View File

@ -220,8 +220,8 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"]) {
// Check to see if the search has been restricted to a particular sub-tree in
// the folder hierarchy.
if (isset($_GET["targetidform1"]) && is_numeric($_GET["targetidform1"]) && $_GET["targetidform1"]>0) {
$targetid = $_GET["targetidform1"];
if (isset($_GET["targetid"]) && is_numeric($_GET["targetid"]) && $_GET["targetid"]>0) {
$targetid = $_GET["targetid"];
$startFolder = $dms->getFolder($targetid);
}
else {

View File

@ -921,7 +921,7 @@ function folderSelected<?php echo $formName ?>(id, name) {
} /* }}} */
function printFolderChooser($formName, $accessMode, $exclude = -1, $default = false) { /* {{{ */
print "<input type=\"hidden\" id=\"targetid".$formName."\" name=\"targetid".$formName."\" value=\"". (($default) ? $default->getID() : "") ."\">";
print "<input type=\"hidden\" id=\"targetid".$formName."\" name=\"targetid\" value=\"". (($default) ? $default->getID() : "") ."\">";
print "<div class=\"input-append\">\n";
print "<input type=\"text\" id=\"choosefoldersearch".$formName."\" data-target=\"targetid".$formName."\" data-provide=\"typeahead\" name=\"targetname".$formName."\" value=\"". (($default) ? htmlspecialchars($default->getName()) : "") ."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
print "<a data-target=\"#folderChooser".$formName."\" href=\"../out/out.FolderChooser.php?form=".$formName."&mode=".$accessMode."&exclude=".$exclude."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".getMLText("folder")."…</a>\n";