mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 07:04:57 +00:00
allow to use jqtree more than once on a page
also uses just 'docid' for id in the document chooser instead of appending the form name.
This commit is contained in:
parent
7710ea7a6b
commit
31015784ac
|
@ -49,11 +49,11 @@ if ($public && ($document->getAccessMode($user) == M_READ)) {
|
|||
$public = false;
|
||||
}
|
||||
|
||||
if (!isset($_GET["docidform1"]) || !is_numeric($_GET["docidform1"]) || intval($_GET["docidform1"])<1) {
|
||||
if (!isset($_GET["docid"]) || !is_numeric($_GET["docid"]) || intval($_GET["docid"])<1) {
|
||||
UI::exitError(getMLText("document_title", array("documentname" => $document->getName())),getMLText("invalid_target_doc_id"));
|
||||
}
|
||||
|
||||
$docid = $_GET["docidform1"];
|
||||
$docid = $_GET["docid"];
|
||||
$doc = $dms->getDocument($docid);
|
||||
|
||||
if (!is_object($doc)) {
|
||||
|
|
|
@ -63,8 +63,8 @@ $userid=$user->getID();
|
|||
if ($_GET["type"]=="document"){
|
||||
|
||||
if ($_GET["action"]=="add"){
|
||||
if (!isset($_POST["docidform1"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
|
||||
$documentid = $_POST["docidform1"];
|
||||
if (!isset($_POST["docid"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
|
||||
$documentid = $_POST["docid"];
|
||||
}else if ($_GET["action"]=="del"){
|
||||
if (!isset($_GET["id"])) UI::exitError(getMLText("my_account"),getMLText("error_occured"));
|
||||
$documentid = $_GET["id"];
|
||||
|
|
|
@ -705,7 +705,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
} /* }}} */
|
||||
|
||||
function printDocumentChooser($formName) { /* {{{ */
|
||||
print "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid".$formName."\">";
|
||||
print "<input type=\"hidden\" id=\"docid".$formName."\" name=\"docid\">";
|
||||
print "<div class=\"input-append\">\n";
|
||||
print "<input type=\"text\" id=\"choosedocsearch\" data-provide=\"typeahead\" name=\"docname".$formName."\" placeholder=\"".getMLText('type_to_search')."\" autocomplete=\"off\" />";
|
||||
print "<a data-target=\"#docChooser".$formName."\" href=\"out.DocumentChooser.php?form=".$formName."&folderid=".$this->params['rootfolderid']."\" role=\"button\" class=\"btn\" data-toggle=\"modal\">".getMLText("document")."…</a>\n";
|
||||
|
@ -725,7 +725,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
|
|||
</div>
|
||||
<script language="JavaScript">
|
||||
modalDocChooser<?= $formName ?> = $('#docChooser<?= $formName ?>');
|
||||
function documentSelected(id, name) {
|
||||
function documentSelected<?= $formName ?>(id, name) {
|
||||
$('#docid<?= $formName ?>').val(id);
|
||||
$('#choosedocsearch').val(name);
|
||||
modalDocChooser<?= $formName ?>.modal('hide');
|
||||
|
@ -756,7 +756,7 @@ function documentSelected(id, name) {
|
|||
<script language="JavaScript">
|
||||
/* Set up a callback which is called when a folder in the tree is selected */
|
||||
modalFolderChooser<?= $formName ?> = $('#folderChooser<?= $formName ?>');
|
||||
function folderSelected(id, name) {
|
||||
function folderSelected<?= $formName ?>(id, name) {
|
||||
$('#targetid<?= $formName ?>').val(id);
|
||||
$('#choosefoldersearch<?= $formName ?>').val(name);
|
||||
modalFolderChooser<?= $formName ?>.modal('hide');
|
||||
|
@ -951,7 +951,7 @@ function clearFilename<?php print $formName ?>() {
|
|||
* @params boolean $showdocs set to true if tree shall contain documents
|
||||
* as well.
|
||||
*/
|
||||
function printNewTreeNavigation($folderid=0, $accessmode=M_READ, $showdocs=0) { /* {{{ */
|
||||
function printNewTreeNavigation($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1') { /* {{{ */
|
||||
function jqtree($path, $folder, $user, $accessmode, $showdocs=1) {
|
||||
if($path) {
|
||||
$pathfolder = array_shift($path);
|
||||
|
@ -1005,20 +1005,20 @@ function clearFilename<?php print $formName ?>() {
|
|||
$tree = array(array('label'=>$root->getName(), 'id'=>$root->getID(), 'load_on_demand'=>true, 'is_folder'=>true));
|
||||
}
|
||||
|
||||
echo "<div id=\"jqtree\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."\"></div>\n";
|
||||
echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."\"></div>\n";
|
||||
?>
|
||||
<script language="JavaScript">
|
||||
var data = <?php echo json_encode($tree); ?>;
|
||||
$(function() {
|
||||
$('#jqtree').tree({
|
||||
$('#jqtree<?= $formid ?>').tree({
|
||||
data: data,
|
||||
openedIcon: '<i class="icon-minus-sign"></i>',
|
||||
closedIcon: '<i class="icon-plus-sign"></i>',
|
||||
onCanSelectNode: function(node) {
|
||||
if(node.is_folder)
|
||||
folderSelected(node.id, node.name);
|
||||
folderSelected<?= $formid ?>(node.id, node.name);
|
||||
else
|
||||
documentSelected(node.id, node.name);
|
||||
documentSelected<?= $formid ?>(node.id, node.name);
|
||||
},
|
||||
autoOpen: true,
|
||||
drapAndDrop: true,
|
||||
|
@ -1046,7 +1046,7 @@ $(function() {
|
|||
}
|
||||
</script>
|
||||
<?php
|
||||
$this->printNewTreeNavigation($folderid, M_READ, 0);
|
||||
$this->printNewTreeNavigation($folderid, M_READ, 0, '');
|
||||
$this->contentContainerEnd();
|
||||
} else {
|
||||
$this->contentHeading("<a href=\"../out/out.ViewFolder.php?folderid=". $folderid."&showtree=1\"><i class=\"icon-plus-sign\"></i></a>", true);
|
||||
|
|
Loading…
Reference in New Issue
Block a user