call hook to filter documents in folder tree

can be used to show only certain documents, e.g. those which are
released
This commit is contained in:
Uwe Steinmann 2019-02-04 08:46:03 +01:00
parent 64e517a02e
commit cad94cd18b

View File

@ -1719,7 +1719,7 @@ $(document).ready(function() {
} /* }}} */
function printNewTreeNavigationHtml($folderid=0, $accessmode=M_READ, $showdocs=0, $formid='form1', $expandtree=0, $orderby='') { /* {{{ */
echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\" data-url=\"../op/op.Ajax.php?command=subtree&showdocs=".$showdocs."&orderby=".$orderby."\"></div>\n";
echo "<div id=\"jqtree".$formid."\" style=\"margin-left: 10px;\"></div>\n";
} /* }}} */
/**
@ -1749,6 +1749,8 @@ $(document).ready(function() {
if($showdocs) {
$documents = $folder->getDocuments($orderby);
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, $accessmode);
if($this->hasHook('filterTreeDocuments'))
$documents = $this->callHook('filterTreeDocuments', $folder, $documents);
foreach($documents as $document) {
$node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false);
$children[] = $node2;
@ -1785,6 +1787,8 @@ $(document).ready(function() {
if($showdocs) {
$documents = $folder->getDocuments($orderby);
$documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode);
if($this->hasHook('filterTreeDocuments'))
$documents = $this->callHook('filterTreeDocuments', $folder, $documents);
foreach($documents as $document) {
$node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false);
$node['children'][] = $node2;
@ -1795,6 +1799,8 @@ $(document).ready(function() {
if($showdocs) {
$documents = $folder->getDocuments($orderby);
$documents = SeedDMS_Core_DMS::filterAccess($documents, $this->params['user'], $accessmode);
if($this->hasHook('filterTreeDocuments'))
$documents = $this->callHook('filterTreeDocuments', $folder, $documents);
foreach($documents as $document) {
$node2 = array('label'=>$document->getName(), 'id'=>$document->getID(), 'load_on_demand'=>false, 'is_folder'=>false);
$node['children'][] = $node2;