From 3f0cbc50bde06fc52f1719bcc2725ce104d04670 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 29 Dec 2021 12:06:50 +0100 Subject: [PATCH 01/19] use conversion manager --- restapi/index.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/restapi/index.php b/restapi/index.php index 242bef52f..377e101db 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -1308,6 +1308,7 @@ class RestapiController { /* {{{ */ $dms = $this->container->dms; $userobj = $this->container->userobj; $settings = $this->container->config; + $conversionmgr = $this->container->conversionmgr; if(!ctype_digit($args['id'])) { return $response->withJson(array('success'=>false, 'message'=>'Invalid parameter', 'data'=>''), 400); @@ -1328,6 +1329,10 @@ class RestapiController { /* {{{ */ $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir, $args['width']); else $previewer = new SeedDMS_Preview_Previewer($settings->_cacheDir); + if($conversionmgr) + $previewer->setConversionMgr($conversionmgr); + else + $previewer->setConverters($settings->_converters['preview']); if(!$previewer->hasPreview($object)) $previewer->createPreview($object); @@ -2425,6 +2430,7 @@ class Auth { /* {{{ */ $container = $app->getContainer(); $container['dms'] = $dms; $container['config'] = $settings; +$container['conversionmgr'] = $conversionmgr; $app->add(new Auth($container)); // Make CORS preflighted request possible From 5c93d53e6067fada16b2b746f1f0e93e5c159fae Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 3 Jan 2022 13:29:24 +0100 Subject: [PATCH 02/19] add methods to show list headers and columns of doc/folder lists --- views/bootstrap/class.Bootstrap.php | 195 +++++++++++++++++-------- views/bootstrap4/class.Bootstrap4.php | 200 ++++++++++++++++++-------- 2 files changed, 274 insertions(+), 121 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index a106f29e9..3d04ae468 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2830,6 +2830,44 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return $belowtitle; } /* }}} */ + public function folderListHeaderImage() { /* {{{ */ + $folder = $this->getParam('folder'); + $onepage = $this->params['onepage']; + $parent = ($folder && $onepage) ? $folder->getParent() : null; + $headcol = ($parent ? '' : '')."\n"; + return $headcol; + } /* }}} */ + + public function folderListHeaderName() { /* {{{ */ + $folder = $this->getParam('folder'); + $headcol = getMLText("name"); + if($folder) { + $folderid = $folder->getId(); + $orderby = $this->params['orderby']; + $orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc'); + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' ':($orderby=="sd"?' ':' ')).""; + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; + } + return $headcol; + } /* }}} */ + + public function folderListHeader() { /* {{{ */ + $content = ""; + $content .= "\n\n"; + $headcols = array(); + $headcols['image'] = $this->folderListHeaderImage(); + $headcols['name'] = $this->folderListHeaderName(); + if($ec = $this->callHook('folderListHeaderExtraColumns')) + $headcols = array_merge($headcols, $ec); + $headcols['status'] = getMLText("status"); + $headcols['action'] = getMLText("action"); + foreach($headcols as $headcol) + $content .= "\n"; + $content .= "\n\n"; + return $content; + } /* }}} */ + /** * Start the row for a folder in list of documents and folders * @@ -2845,6 +2883,46 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ + $user = $this->params['user']; + $enableClipboard = $this->params['enableclipboard']; + $accessop = $this->params['accessobject']; + $onepage = $this->params['onepage']; + + $content = ''; + $content .= "
"; + if(!empty($extracontent['begin_action_list'])) + $content .= $extracontent['begin_action_list']; + if($accessop->check_view_access('RemoveDocument')) { + if($document->getAccessMode($user) >= M_ALL) { + $content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true); + } else { + $content .= ''; + } + } + $docID = $document->getID(); + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= ''; + } else { + $content .= ''; + } + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); + } + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= $this->printAccessButton($document, true); + } + if($enableClipboard) { + $content .= ''; + } + if($onepage) + $content .= ''; + if(!empty($extracontent['end_action_list'])) + $content .= $extracontent['end_action_list']; + $content .= "
"; + return $content; + } /* }}} */ + /** * Return HTML of a single row in the document list table * @@ -2906,6 +2984,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $revlinks = $document->getReverseDocumentLinks(); $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); + if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent)) + $extracontent = array_merge($extracontent, $ec); + $content .= "\n"; + if(!empty($extracontent['columns'])) { + foreach($extracontent['columns'] as $col) + $content .= ''; + } + $content .= ""; -// $content .= ""; $content .= ""; if(!$skipcont) $content .= $this->documentListRowEnd($document); @@ -3050,6 +3107,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function folderListRowAction($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; +// $folder = $this->params['folder']; + $showtree = $this->params['showtree']; + $enableRecursiveCount = $this->params['enableRecursiveCount']; + $maxRecursiveCount = $this->params['maxRecursiveCount']; + $enableClipboard = $this->params['enableclipboard']; + $accessop = $this->params['accessobject']; + $onepage = $this->params['onepage']; + + $content = ''; + $content .= "
"; + if(!empty($extracontent['begin_action_list'])) + $content .= $extracontent['begin_action_list']; + $subFolderAccessMode = $subFolder->getAccessMode($user); + if ($accessop->check_view_access('RemoveFolder')) { + if($subFolderAccessMode >= M_ALL) { + $content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true); + } else { + $content .= ''; + } + } + if($subFolderAccessMode >= M_READWRITE) { + $content .= ''; + } else { + $content .= ''; + } + if($subFolderAccessMode >= M_READWRITE) { + $content .= $this->printAccessButton($subFolder, true); + } + if($enableClipboard) { + $content .= ''; + } + if($onepage) + $content .= ''; + if(!empty($extracontent['end_action_list'])) + $content .= $extracontent['end_action_list']; + $content .= "
"; + return $content; + } /* }}} */ + function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -3068,6 +3167,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; + if($ec = $this->callHook('folderListRowExtraContent', $subFolder)) + $extracontent = array_merge($extracontent, $ec); + $content = ''; if(!$skipcont) $content .= $this->folderListRowStart($subFolder); @@ -3114,35 +3216,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); } $content .= ""; -// $content .= ""; $content .= ""; if(!$skipcont) $content .= $this->folderListRowEnd($subFolder); diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 3588bb8a2..a1258e420 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -151,7 +151,10 @@ background-image: linear-gradient(to bottom, #882222, #111111);; } /* }}} */ function htmlAddHeader($head, $type='js') { /* {{{ */ - $this->extraheader[$type] .= $head; + if($type == 'logo' || $type == 'favicon') + $this->extraheader[$type] = $head; + else + $this->extraheader[$type] .= $head; } /* }}} */ function htmlAddJsHeader($script) { /* {{{ */ @@ -2892,6 +2895,44 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return $belowtitle; } /* }}} */ + public function folderListHeaderImage() { /* {{{ */ + $folder = $this->getParam('folder'); + $onepage = $this->params['onepage']; + $parent = ($folder && $onepage) ? $folder->getParent() : null; + $headcol = ($parent ? '' : '')."\n"; + return $headcol; + } /* }}} */ + + public function folderListHeaderName() { /* {{{ */ + $folder = $this->getParam('folder'); + $headcol = getMLText("name"); + if($folder) { + $folderid = $folder->getId(); + $orderby = $this->params['orderby']; + $orderdir = (isset($orderby[1]) ? ($orderby[1] == 'd' ? 'desc' : 'asc') : 'asc'); + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' ':($orderby=="sd"?' ':' ')).""; + $headcol .= " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; + } + return $headcol; + } /* }}} */ + + public function folderListHeader() { /* {{{ */ + $content = "
".$headcol."
"; if (file_exists($dms->contentDir . $latestContent->getPath())) { $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent); @@ -2950,6 +3031,11 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= $extracontent['bottom_title']; $content .= "'.$col.'"; $attentionstr = ''; if ( $document->isLocked() ) { @@ -2966,43 +3052,14 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if(count($links) || count($revlinks)) $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { - $workflowstate = $latestContent->getWorkflowState(); - $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; + if($workflowstate = $latestContent->getWorkflowState()) + $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; } else { $content .= getOverallStatusText($status["status"]); } $content .= "
".$version.""; - $content .= "
"; - if(!empty($extracontent['begin_action_list'])) - $content .= $extracontent['begin_action_list']; - if($accessop->check_view_access('RemoveDocument')) { - if($document->getAccessMode($user) >= M_ALL) { - $content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true); - } else { - $content .= ''; - } - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= ''; - } else { - $content .= ''; - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= $this->printAccessButton($document, true); - } - if($enableClipboard) { - $content .= ''; - } - if($onepage) - $content .= ''; - if(!empty($extracontent['end_action_list'])) - $content .= $extracontent['end_action_list']; - $content .= "
"; + $content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent); $content .= "
"; - $content .= "
"; - if(!empty($extracontent['begin_action_list'])) - $content .= $extracontent['begin_action_list']; - $subFolderAccessMode = $subFolder->getAccessMode($user); - if ($accessop->check_view_access('RemoveFolder')) { - if($subFolderAccessMode >= M_ALL) { - $content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true); - } else { - $content .= ''; - } - } - if($subFolderAccessMode >= M_READWRITE) { - $content .= ''; - } else { - $content .= ''; - } - if($subFolderAccessMode >= M_READWRITE) { - $content .= $this->printAccessButton($subFolder, true); - } - if($enableClipboard) { - $content .= ''; - } - if($onepage) - $content .= ''; - if(!empty($extracontent['end_action_list'])) - $content .= $extracontent['end_action_list']; - $content .= "
"; + $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= "
"; + $content .= "\n\n"; + $headcols = array(); + $headcols['image'] = $this->folderListHeaderImage(); + $headcols['name'] = $this->folderListHeaderName(); + if($ec = $this->callHook('folderListHeaderExtraColumns')) + $headcols = array_merge($headcols, $ec); + $headcols['status'] = getMLText("status"); + $headcols['action'] = getMLText("action"); + foreach($headcols as $headcol) + $content .= "\n"; + $content .= "\n\n"; + return $content; + } /* }}} */ + /** * Start the row for a folder in list of documents and folders * @@ -2913,6 +2954,46 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ + $user = $this->params['user']; + $enableClipboard = $this->params['enableclipboard']; + $accessop = $this->params['accessobject']; + $onepage = $this->params['onepage']; + + $content = ''; + $content .= "
"; + if(!empty($extracontent['begin_action_list'])) + $content .= $extracontent['begin_action_list']; + if($accessop->check_view_access('RemoveDocument')) { + if($document->getAccessMode($user) >= M_ALL) { + $content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true); + } else { + $content .= ''; + } + } + $docID = $document->getID(); + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= ''; + } else { + $content .= ''; + } + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); + } + if($document->getAccessMode($user) >= M_READWRITE) { + $content .= $this->printAccessButton($document, true); + } + if($enableClipboard) { + $content .= ''; + } + if($onepage) + $content .= ''; + if(!empty($extracontent['end_action_list'])) + $content .= $extracontent['end_action_list']; + $content .= "
"; + return $content; + } /* }}} */ + /** * Return HTML of a single row in the document list table * @@ -2974,6 +3055,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $revlinks = $document->getReverseDocumentLinks(); $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); + if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent)) + $extracontent = array_merge($extracontent, $ec); + $content .= "\n"; + if(!empty($extracontent['columns'])) { + foreach($extracontent['columns'] as $col) + $content .= ''; + } + $content .= ""; -// $content .= ""; $content .= ""; if(!$skipcont) $content .= $this->documentListRowEnd($document); @@ -3118,6 +3178,48 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function folderListRowAction($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; +// $folder = $this->params['folder']; + $showtree = $this->params['showtree']; + $enableRecursiveCount = $this->params['enableRecursiveCount']; + $maxRecursiveCount = $this->params['maxRecursiveCount']; + $enableClipboard = $this->params['enableclipboard']; + $accessop = $this->params['accessobject']; + $onepage = $this->params['onepage']; + + $content = ''; + $content .= "
"; + if(!empty($extracontent['begin_action_list'])) + $content .= $extracontent['begin_action_list']; + $subFolderAccessMode = $subFolder->getAccessMode($user); + if ($accessop->check_view_access('RemoveFolder')) { + if($subFolderAccessMode >= M_ALL) { + $content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true); + } else { + $content .= ''; + } + } + if($subFolderAccessMode >= M_READWRITE) { + $content .= ''; + } else { + $content .= ''; + } + if($subFolderAccessMode >= M_READWRITE) { + $content .= $this->printAccessButton($subFolder, true); + } + if($enableClipboard) { + $content .= ''; + } + if($onepage) + $content .= ''; + if(!empty($extracontent['end_action_list'])) + $content .= $extracontent['end_action_list']; + $content .= "
"; + return $content; + } /* }}} */ + function folderListRow($subFolder, $skipcont=false, $extracontent=array()) { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -3136,6 +3238,9 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $comment = $subFolder->getComment(); if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; + if($ec = $this->callHook('folderListRowExtraContent', $subFolder)) + $extracontent = array_merge($extracontent, $ec); + $content = ''; if(!$skipcont) $content .= $this->folderListRowStart($subFolder); @@ -3182,35 +3287,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= count($subsub)." ".getMLText("folders")."
".count($subdoc)." ".getMLText("documents"); } $content .= ""; -// $content .= ""; $content .= ""; if(!$skipcont) $content .= $this->folderListRowEnd($subFolder); From 771b9674ccb59aa7cbb49a3260c2d99526ffc1ae Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 3 Jan 2022 13:35:12 +0100 Subject: [PATCH 03/19] use new methods to show list of docs/folders --- views/bootstrap/class.Search.php | 167 ++++++++++++++------------- views/bootstrap/class.ViewFolder.php | 22 ++-- 2 files changed, 94 insertions(+), 95 deletions(-) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index a437912d6..d9f2a8a0c 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -123,6 +123,20 @@ function typeahead() { /* {{{ */ echo json_encode($recs); } /* }}} */ + public function folderListHeaderName() { /* {{{ */ + $orderby = $this->params['orderby']; + $fullsearch = $this->params['fullsearch']; + parse_str($_SERVER['QUERY_STRING'], $tmp); + $tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n"; + $headcol = getMLText("name"); + if(!$fullsearch) { + $headcol .= $orderby." ".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; + $tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d"; + $headcol .= " ".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; + } + return $headcol; + } /* }}} */ + function show() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; @@ -606,92 +620,89 @@ function typeahead() { /* {{{ */ // $this->contentContainerStart(); $txt = $this->callHook('searchListHeader', $orderby, 'asc'); - if(is_string($txt)) + if(is_string($txt)) { echo $txt; - else { - parse_str($_SERVER['QUERY_STRING'], $tmp); - $tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n"; + } elseif(is_array($txt)) { print "
".$headcol."
"; if (file_exists($dms->contentDir . $latestContent->getPath())) { $previewhtml = $this->callHook('documentListPreview', $previewer, $document, $latestContent); @@ -3018,6 +3102,11 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $content .= $extracontent['bottom_title']; $content .= "'.$col.'"; $attentionstr = ''; if ( $document->isLocked() ) { @@ -3034,43 +3123,14 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) if(count($links) || count($revlinks)) $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { - $workflowstate = $latestContent->getWorkflowState(); - $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; + if($workflowstate = $latestContent->getWorkflowState()) + $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; } else { $content .= getOverallStatusText($status["status"]); } $content .= "
".$version.""; - $content .= "
"; - if(!empty($extracontent['begin_action_list'])) - $content .= $extracontent['begin_action_list']; - if($accessop->check_view_access('RemoveDocument')) { - if($document->getAccessMode($user) >= M_ALL) { - $content .= $this->printDeleteDocumentButton($document, 'splash_rm_document', true); - } else { - $content .= ''; - } - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= ''; - } else { - $content .= ''; - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= $this->printLockButton($document, 'splash_document_locked', 'splash_document_unlocked', true); - } - if($document->getAccessMode($user) >= M_READWRITE) { - $content .= $this->printAccessButton($document, true); - } - if($enableClipboard) { - $content .= ''; - } - if($onepage) - $content .= ''; - if(!empty($extracontent['end_action_list'])) - $content .= $extracontent['end_action_list']; - $content .= "
"; + $content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent); $content .= "
"; - $content .= "
"; - if(!empty($extracontent['begin_action_list'])) - $content .= $extracontent['begin_action_list']; - $subFolderAccessMode = $subFolder->getAccessMode($user); - if ($accessop->check_view_access('RemoveFolder')) { - if($subFolderAccessMode >= M_ALL) { - $content .= $this->printDeleteFolderButton($subFolder, 'splash_rm_folder', true); - } else { - $content .= ''; - } - } - if($subFolderAccessMode >= M_READWRITE) { - $content .= ''; - } else { - $content .= ''; - } - if($subFolderAccessMode >= M_READWRITE) { - $content .= $this->printAccessButton($subFolder, true); - } - if($enableClipboard) { - $content .= ''; - } - if($onepage) - $content .= ''; - if(!empty($extracontent['end_action_list'])) - $content .= $extracontent['end_action_list']; - $content .= "
"; + $content .= $this->folderListRowAction($subFolder, $skipcont, $extracontent); $content .= "
"; print "\n\n"; - print "\n"; - print "\n"; - //print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; + foreach($txt as $headcol) + echo "\n"; + print "\n\n"; + } else { + echo $this->folderListHeader(null, 'search'); + /* + print "
".getMLText("name"); - if(!$fullsearch) { - print $orderby." ".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; - $tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d"; - print " ".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; - } - print "".getMLText("attributes")."".getMLText("status")."".getMLText("action")."
".$headcol."
"; + print "\n\n"; + $headcols['image'] = $this->folderListHeaderImage(); + $headcols['name'] = $this->folderListHeaderName(); + $headcols['status'] = getMLText("status"); + $headcols['action'] = getMLText("action"); + foreach($headcols as $headcol) + echo "\n"; + print "\n\n"; + */ } + print "\n"; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); foreach ($entries as $entry) { if($entry->isType('document')) { - $txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search'); + $document = $entry; + if($lc = $document->getLatestContent()) + $previewer->createPreview($lc); + + $lcattributes = $lc ? $lc->getAttributes() : null; + $attrstr = ''; + if($lcattributes) { + $attrstr .= "
".$headcol."
\n"; + $attrstr .= ""; + foreach($lcattributes as $lcattribute) { + $arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute); + if(is_array($arr)) { + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + } elseif(is_string($arr)) { + $attrstr .= $arr; + } else { + $attrdef = $lcattribute->getAttributeDefinition(); + $attrstr .= "\n"; + // TODO: better use printAttribute() + // $this->printAttribute($lcattribute); + } + } + $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
\n"; + } + $docattributes = $document->getAttributes(); + if($docattributes) { + $attrstr .= "\n"; + $attrstr .= ""; + foreach($docattributes as $docattribute) { + $arr = $this->callHook('showDocumentAttribute', $document, $docattribute); + if(is_array($arr)) { + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + } elseif(is_string($arr)) { + $attrstr .= $arr; + } else { + $attrdef = $docattribute->getAttributeDefinition(); + $attrstr .= "\n"; + } + } + $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."
\n"; + } + $extracontent = array(); + $extracontent['below_title'] = $this->getListRowPath($document); + if($attrstr) + $extracontent['bottom_title'] = '
'.$this->printPopupBox(''.getMLText('attributes').'', $attrstr, true); + + $txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search', $extracontent); if(is_string($txt)) echo $txt; else { - $document = $entry; - $owner = $document->getOwner(); - if($lc = $document->getLatestContent()) - $previewer->createPreview($lc); - - if (in_array(3, $searchin)) - $comment = $this->markQuery(htmlspecialchars($document->getComment())); - else - $comment = htmlspecialchars($document->getComment()); - if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; - - $lcattributes = $lc ? $lc->getAttributes() : null; - $attrstr = ''; - if($lcattributes) { - $attrstr .= "\n"; - $attrstr .= ""; - foreach($lcattributes as $lcattribute) { - $arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute); - if(is_array($arr)) { - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - } elseif(is_string($arr)) { - $attrstr .= $arr; - } else { - $attrdef = $lcattribute->getAttributeDefinition(); - $attrstr .= "\n"; - // TODO: better use printAttribute() - // $this->printAttribute($lcattribute); - } - } - $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
\n"; - } - $docattributes = $document->getAttributes(); - if($docattributes) { - $attrstr .= "\n"; - $attrstr .= ""; - foreach($docattributes as $docattribute) { - $arr = $this->callHook('showDocumentAttribute', $document, $docattribute); - if(is_array($arr)) { - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - } elseif(is_string($arr)) { - $attrstr .= $arr; - } else { - $attrdef = $docattribute->getAttributeDefinition(); - $attrstr .= "\n"; - } - } - $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."
\n"; - } - $extracontent = array(); - $extracontent['below_title'] = $this->getListRowPath($document); - if($attrstr) - $extracontent['bottom_title'] = '
'.$this->printPopupBox(''.getMLText('attributes').'', $attrstr, true); print $this->documentListRow($document, $previewer, false, 0, $extracontent); } } elseif($entry->isType('folder')) { @@ -700,12 +711,6 @@ function typeahead() { /* {{{ */ echo $txt; else { $folder = $entry; - $owner = $folder->getOwner(); - if (in_array(2, $searchin)) { - $folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i"); - } else { - $folderName = htmlspecialchars($folder->getName()); - } $attrstr = ''; $folderattributes = $folder->getAttributes(); diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index ffd14c398..78d071436 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -382,7 +382,6 @@ $('body').on('click', '.order-btn', function(ev) { if($documents === null) $documents = $folder->getDocuments($orderby[0], $orderdir); $documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ); - $parent = $onepage ? $folder->getParent() : null; $txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents); if(is_string($txt)) @@ -390,23 +389,18 @@ $('body').on('click', '.order-btn', function(ev) { $i = 0; if ((count($subFolders) > 0)||(count($documents) > 0)){ $txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir); - if(is_string($txt)) + if(is_string($txt)) { echo $txt; - else { + } elseif(is_array($txt)) { print ""; print "\n\n"; - print "\n"; - print "\n"; - // print "\n"; - print "\n"; - // print "\n"; - print "\n"; - print "\n\n\n"; + foreach($txt as $headcol) + echo "\n"; + print "\n\n"; + } else { + echo $this->folderListHeader(); } + print "\n"; foreach($subFolders as $subFolder) { if(!$maxItemsPerPage || $i < $maxItemsPerPage) { From cff6b66d1c33c9d905a010394da8edf5404c1035 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 3 Jan 2022 19:14:13 +0100 Subject: [PATCH 04/19] use new method folderListHeader() --- views/bootstrap/class.AttributeMgr.php | 9 ++------- views/bootstrap/class.Calendar.php | 17 +++++------------ views/bootstrap/class.Categories.php | 9 ++------- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/views/bootstrap/class.AttributeMgr.php b/views/bootstrap/class.AttributeMgr.php index b7aea967d..16934ddb5 100644 --- a/views/bootstrap/class.AttributeMgr.php +++ b/views/bootstrap/class.AttributeMgr.php @@ -134,13 +134,8 @@ $(document).ready( function() { } if($res['folders'] || $res['docs']) { - print "
".($parent ? '' : '')."".getMLText("name"); - print " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; - print " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' ':($orderby=="sd"?' ':' ')).""; - print " params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; - print "".getMLText("owner")."".getMLText("status")."".getMLText("version")."".getMLText("action")."
".$headcol."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; + print $this->folderListHeader(); + print "\n"; foreach($res['folders'] as $subFolder) { echo $this->folderListRow($subFolder); } diff --git a/views/bootstrap/class.Calendar.php b/views/bootstrap/class.Calendar.php index ac7e91971..b85eac334 100644 --- a/views/bootstrap/class.Calendar.php +++ b/views/bootstrap/class.Calendar.php @@ -49,18 +49,11 @@ class SeedDMS_View_Calendar extends SeedDMS_Theme_Style { $xsendfile = $this->params['xsendfile']; if($document) { - // $this->contentHeading(getMLText("timeline_selected_item")); - print "
".getMLText("name")."".getMLText("status")."".getMLText("action")."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; - $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile); - echo $this->documentListRow($document, $previewer); - - echo "\n
".getMLText("name")."".getMLText("status")."".getMLText("action")."
\n"; + print $this->folderListHeader(); + print "\n"; + $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile); + echo $this->documentListRow($document, $previewer); + echo "\n\n"; } if($event) { // print_r($event); diff --git a/views/bootstrap/class.Categories.php b/views/bootstrap/class.Categories.php index e3711fb53..f2688277b 100644 --- a/views/bootstrap/class.Categories.php +++ b/views/bootstrap/class.Categories.php @@ -70,13 +70,8 @@ $(document).ready( function() { $documents = $selcat->getDocumentsByCategory(10); if($documents) { - print ""; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; + print $this->folderListHeader(); + print "\n"; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); foreach($documents as $doc) { echo $this->documentListRow($doc, $previewer); From 84f1afc1d362352a5561f0b3043c8efad912c3be Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 3 Jan 2022 19:14:35 +0100 Subject: [PATCH 05/19] use new method folderListHeader() --- views/bootstrap/class.Timeline.php | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/views/bootstrap/class.Timeline.php b/views/bootstrap/class.Timeline.php index a32107e19..951db6f11 100644 --- a/views/bootstrap/class.Timeline.php +++ b/views/bootstrap/class.Timeline.php @@ -47,14 +47,8 @@ class SeedDMS_View_Timeline extends SeedDMS_Theme_Style { $xsendfile = $this->params['xsendfile']; if($document && $version) { - // $this->contentHeading(getMLText("timeline_selected_item")); - print "
".getMLText("name")."".getMLText("status")."".getMLText("action")."
"; - print "\n\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; + print $this->folderListHeader(); + print "\n"; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidthdetail, $timeout, $xsendfile); $extracontent = array(); $extracontent['below_title'] = $this->getListRowPath($document); From a93fdd91c81aa705c76fce0dd2dbe403bed31e02 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 3 Jan 2022 19:14:53 +0100 Subject: [PATCH 06/19] remove old code --- views/bootstrap/class.Search.php | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index d9f2a8a0c..9b61a9fe2 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -630,17 +630,6 @@ function typeahead() { /* {{{ */ print "\n\n"; } else { echo $this->folderListHeader(null, 'search'); - /* - print "
".getMLText("name")."".getMLText("status")."".getMLText("action")."
"; - print "\n\n"; - $headcols['image'] = $this->folderListHeaderImage(); - $headcols['name'] = $this->folderListHeaderName(); - $headcols['status'] = getMLText("status"); - $headcols['action'] = getMLText("action"); - foreach($headcols as $headcol) - echo "\n"; - print "\n\n"; - */ } print "\n"; From 4dda2549c735077580372593d3af4c4b36e5c8be Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 5 Jan 2022 07:29:23 +0100 Subject: [PATCH 07/19] fix error when sending notification after owner change --- inc/inc.ClassNotificationService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index d77e33d84..4ddad7c91 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -1235,7 +1235,7 @@ class SeedDMS_NotificationService { /* Send mail to old owner only if the currently logged in user is not the * owner and the owner is not already in the list of notifiers. */ - if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users'])) + if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) $this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } /* }}} */ @@ -1264,7 +1264,7 @@ class SeedDMS_NotificationService { /* Send mail to old owner only if the currently logged in user is not the * owner and the owner is not already in the list of notifiers. */ - if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner(), $notifyList['users'])) + if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) $this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } /* }}} */ From 22915df3e1943e58375197fbf673551f3d417cd8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 5 Jan 2022 07:34:51 +0100 Subject: [PATCH 08/19] add method documentListRowStatus() --- views/bootstrap/class.Bootstrap.php | 93 +++++++++++++++------------ views/bootstrap4/class.Bootstrap4.php | 93 +++++++++++++++------------ 2 files changed, 104 insertions(+), 82 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 3d04ae468..78094a577 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2883,6 +2883,56 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function documentListRowStatus($latestContent) { /* {{{ */ + $user = $this->params['user']; + $workflowmode = $this->params['workflowmode']; + $document = $latestContent->getDocument(); + + $status = $latestContent->getStatus(); + $attentionstr = ''; + if ( $document->isLocked() ) { + $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; + } + $needwkflaction = false; + if($workflowmode == 'advanced') { + $workflow = $latestContent->getWorkflow(); + if($workflow) { + $needwkflaction = $latestContent->needsWorkflowAction($user); + } + } + if ( $needwkflaction ) { + $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> "; + } + $content = ''; + if($attentionstr) + $content .= $attentionstr."
"; + $content .= ""; + /* Retrieve attacheѕ files */ + $files = $document->getDocumentFiles($latestContent->getVersion()); + $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); + + /* Retrieve linked documents */ + $links = $document->getDocumentLinks(); + $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); + + /* Retrieve reverse linked documents */ + $revlinks = $document->getReverseDocumentLinks(); + $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); + + if(count($files)) + $content .= count($files)." ".getMLText("linked_files")."
"; + if(count($links) || count($revlinks)) + $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; + if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { + if($workflowstate = $latestContent->getWorkflowState()) + $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; + } else { + $content .= getOverallStatusText($status["status"]); + } + $content .= "
"; + return $content; + } /* }}} */ + function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ $user = $this->params['user']; $enableClipboard = $this->params['enableclipboard']; @@ -2963,27 +3013,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $previewer->createPreview($latestContent); $version = $latestContent->getVersion(); - $status = $latestContent->getStatus(); - $needwkflaction = false; - if($workflowmode == 'advanced') { - $workflow = $latestContent->getWorkflow(); - if($workflow) { - $needwkflaction = $latestContent->needsWorkflowAction($user); - } - } - /* Retrieve attacheѕ files */ - $files = $document->getDocumentFiles($latestContent->getVersion()); - $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); - - /* Retrieve linked documents */ - $links = $document->getDocumentLinks(); - $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); - - /* Retrieve reverse linked documents */ - $revlinks = $document->getReverseDocumentLinks(); - $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); - if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent)) $extracontent = array_merge($extracontent, $ec); @@ -3037,27 +3067,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) } $content .= "
"; + $content .= $this->documentListRowStatus($latestContent); + $content .= ""; $content .= ""; diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index a1258e420..8e88f4542 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2954,6 +2954,56 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) return "\n"; } /* }}} */ + function documentListRowStatus($latestContent) { /* {{{ */ + $user = $this->params['user']; + $workflowmode = $this->params['workflowmode']; + $document = $latestContent->getDocument(); + + $status = $latestContent->getStatus(); + $attentionstr = ''; + if ( $document->isLocked() ) { + $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; + } + $needwkflaction = false; + if($workflowmode == 'advanced') { + $workflow = $latestContent->getWorkflow(); + if($workflow) { + $needwkflaction = $latestContent->needsWorkflowAction($user); + } + } + if ( $needwkflaction ) { + $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> "; + } + $content = ''; + if($attentionstr) + $content .= $attentionstr."
"; + $content .= ""; + /* Retrieve attacheѕ files */ + $files = $document->getDocumentFiles($latestContent->getVersion()); + $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); + + /* Retrieve linked documents */ + $links = $document->getDocumentLinks(); + $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); + + /* Retrieve reverse linked documents */ + $revlinks = $document->getReverseDocumentLinks(); + $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); + + if(count($files)) + $content .= count($files)." ".getMLText("linked_files")."
"; + if(count($links) || count($revlinks)) + $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; + if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { + if($workflowstate = $latestContent->getWorkflowState()) + $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; + } else { + $content .= getOverallStatusText($status["status"]); + } + $content .= "
"; + return $content; + } /* }}} */ + function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */ $user = $this->params['user']; $enableClipboard = $this->params['enableclipboard']; @@ -3034,27 +3084,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) $previewer->createPreview($latestContent); $version = $latestContent->getVersion(); - $status = $latestContent->getStatus(); - $needwkflaction = false; - if($workflowmode == 'advanced') { - $workflow = $latestContent->getWorkflow(); - if($workflow) { - $needwkflaction = $latestContent->needsWorkflowAction($user); - } - } - /* Retrieve attacheѕ files */ - $files = $document->getDocumentFiles($latestContent->getVersion()); - $files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files); - - /* Retrieve linked documents */ - $links = $document->getDocumentLinks(); - $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); - - /* Retrieve reverse linked documents */ - $revlinks = $document->getReverseDocumentLinks(); - $revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks); - if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent)) $extracontent = array_merge($extracontent, $ec); @@ -3108,27 +3138,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev) } $content .= ""; + $content .= $this->documentListRowStatus($latestContent); + $content .= ""; $content .= ""; From ea5218ea03f76a9c376509e27dfa5b8797f91db4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 5 Jan 2022 08:04:38 +0100 Subject: [PATCH 09/19] add SeeddmsAjax for running function after updating div.ajax --- views/bootstrap/styles/application.js | 26 ++++++++++++++++++++++++++ views/bootstrap4/styles/application.js | 26 ++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index db29c60f0..6795d4586 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -492,6 +492,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -542,6 +543,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -1366,3 +1368,27 @@ $(document).ready(function() { /* {{{ */ timeOutId = setTimeout(SeedDMSTask.run, timeout); } }( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */ + +(function( SeedDMSAjax, $, undefined ) { /* {{{ */ + var tasks = Array( + {name: 'test', view: 'null', action: null, func: + test = function() { + console.log('Run in SeedDMSAjax'); + } + } + ); + + SeedDMSAjax.add = function(task) { + tasks.push(task); + } + + SeedDMSAjax.run = function(view, action) { + for(let task of tasks) { + //console.log('Checking for '+view+':'+action); + if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) { + //console.log('Running '+task.name+' after update for '+view+':'+action); + task.func(); + } + } + } +}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */ diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 80ea3ae7d..a404f2def 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -523,6 +523,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -573,6 +574,7 @@ $(document).ready( function() { } } initMost(); + SeedDMSAjax.run(view, action); }); }); /* }}} */ @@ -1422,3 +1424,27 @@ $(document).ready(function() { /* {{{ */ timeOutId = setTimeout(SeedDMSTask.run, timeout); } }( window.SeedDMSTask = window.SeedDMSTask || {}, jQuery )); /* }}} */ + +(function( SeedDMSAjax, $, undefined ) { /* {{{ */ + var tasks = Array( + {name: 'test', view: 'null', action: null, func: + test = function() { + console.log('Run in SeedDMSAjax'); + } + } + ); + + SeedDMSAjax.add = function(task) { + tasks.push(task); + } + + SeedDMSAjax.run = function(view, action) { + for(let task of tasks) { + //console.log('Checking for '+view+':'+action); + if(task.view == null || (task.view == view && task.action == null) || (task.view == view && task.action == action)) { + //console.log('Running '+task.name+' after update for '+view+':'+action); + task.func(); + } + } + } +}( window.SeedDMSAjax = window.SeedDMSAjax || {}, jQuery )); /* }}} */ From 7fc1a62b75927268f8d5285443b36514061130ea Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 5 Jan 2022 08:25:57 +0100 Subject: [PATCH 10/19] fix error when sending notification after owner change (see 4dda2549c73) --- inc/inc.ClassNotificationService.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/inc.ClassNotificationService.php b/inc/inc.ClassNotificationService.php index 4ddad7c91..908861b37 100644 --- a/inc/inc.ClassNotificationService.php +++ b/inc/inc.ClassNotificationService.php @@ -1235,7 +1235,7 @@ class SeedDMS_NotificationService { /* Send mail to old owner only if the currently logged in user is not the * owner and the owner is not already in the list of notifiers. */ - if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) + if($user->getID() != $oldowner->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) $this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } /* }}} */ @@ -1264,7 +1264,7 @@ class SeedDMS_NotificationService { /* Send mail to old owner only if the currently logged in user is not the * owner and the owner is not already in the list of notifiers. */ - if($user->getID() != $oldowner()->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) + if($user->getID() != $oldowner->getID() && false === SeedDMS_Core_DMS::inList($oldowner, $notifyList['users'])) $this->toIndividual($user, $oldowner, $subject, $message, $params, SeedDMS_NotificationService::RECV_OWNER); } } /* }}} */ From b7315c501fe167f1d75594ef48b69bc3f8590e13 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Sun, 16 Jan 2022 10:58:19 +0100 Subject: [PATCH 11/19] get id from args in getFolderParent() --- restapi/index.php | 1 + 1 file changed, 1 insertion(+) diff --git a/restapi/index.php b/restapi/index.php index 377e101db..4b9db252f 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -330,6 +330,7 @@ class RestapiController { /* {{{ */ $dms = $this->container->dms; $userobj = $this->container->userobj; + $id = $args['id']; if($id == 0) { return $response->withJson(array('success'=>true, 'message'=>'id is 0', 'data'=>''), 200); } From d9d434a7bea7910394c1f1e249a7d4b392348a17 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 31 Jan 2022 07:14:52 +0100 Subject: [PATCH 12/19] make it work with 6.0.17 --- utils/adddoc.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/utils/adddoc.php b/utils/adddoc.php index 925d86d59..9ff44051f 100644 --- a/utils/adddoc.php +++ b/utils/adddoc.php @@ -122,9 +122,9 @@ if(isset($options['f'])) { exit(1); } -$mimetype = ''; +$mymimetype = ''; if(isset($options['t'])) { - $mimetype = $options['t']; + $mymimetype = $options['t']; } $reqversion = 0; @@ -248,8 +248,8 @@ if(isset($GLOBALS['SEEDDMS_HOOKS']['notification'])) { if(is_readable($filename)) { if(filesize($filename)) { $finfo = new finfo(FILEINFO_MIME_TYPE); - if(!$mimetype) { - $mimetype = $finfo->file($filename); + if(!$mymimetype) { + $mymimetype = $finfo->file($filename); } $filetype = "." . pathinfo($filename, PATHINFO_EXTENSION); } else { @@ -304,20 +304,11 @@ $filetmp = $filename; $reviewers = array(); $approvers = array(); -if($settings->_enableFullSearch) { - $index = $indexconf['Indexer']::open($settings->_luceneDir); - $indexconf['Indexer']::init($settings->_stopWordsFile); -} else { - $index = null; - $indexconf = null; -} - if($folder) { $controller = Controller::factory('AddDocument', array('dms'=>$dms, 'user'=>$user)); $controller->setParam('documentsource', 'script'); $controller->setParam('folder', $folder); - $controller->setParam('index', $index); - $controller->setParam('indexconf', $indexconf); + $controller->setParam('fulltextservice', $fulltextservice); $controller->setParam('name', $name); $controller->setParam('comment', $comment); $controller->setParam('expires', $expires); @@ -327,7 +318,7 @@ if($folder) { $controller->setParam('userfiletmp', $filetmp); $controller->setParam('userfilename', basename($filename)); $controller->setParam('filetype', $filetype); - $controller->setParam('userfiletype', $mimetype); + $controller->setParam('userfiletype', $mymimetype); $minmax = $folder->getDocumentsMinMax(); if($settings->_defaultDocPosition == 'start') $controller->setParam('sequence', $minmax['min'] - 1); From 8b558c71427b22f50a10dd0dc06cd6c50eeabfa5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 31 Jan 2022 12:05:48 +0100 Subject: [PATCH 13/19] take out relodge --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f833e8a70..40a6ad44f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ VERSION=$(shell php -r 'include("inc/inc.Version.php"); $$v=new SeedDMS_Version( SRC=CHANGELOG inc conf utils index.php .htaccess languages op out controllers doc TODO LICENSE webdav install restapi pdfviewer VIEWS ?= bootstrap bootstrap4 -NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder .svn .gitignore +NODISTFILES=utils/importmail.php utils/seedddms-importmail utils/remote-email-upload utils/remote-upload utils/da-bv-reminder.php utils/seeddms-da-bv-reminder utils/relodge.php utils/seeddms-relodge .svn .gitignore PHPDOC=~/Downloads/phpDocumentor.phar From aa8eb38560cd4aad6d59c2ec25596e5158dabbbb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 31 Jan 2022 12:06:19 +0100 Subject: [PATCH 14/19] do not access $settings before loading it --- utils/xmldump.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/utils/xmldump.php b/utils/xmldump.php index 54a14bf09..e85ef09fa 100644 --- a/utils/xmldump.php +++ b/utils/xmldump.php @@ -87,10 +87,9 @@ if(isset($options['sections'])) { $sections = explode(',', $options['sections']); } +$folderid = 0; if(isset($options['folder'])) { $folderid = intval($options['folder']); -} else { - $folderid = $settings->_rootFolderID; } $skiproot = false; @@ -464,6 +463,10 @@ include($myincpath."/inc/inc.Init.php"); include($myincpath."/inc/inc.Extension.php"); include($myincpath."/inc/inc.DBInit.php"); +if(!$folderid) { + $folderid = $settings->_rootFolderID; +} + echo "\n"; echo "getDBVersion(), 1, 3))."\" date=\"".date('Y-m-d H:i:s')."\">\n"; From 35b8b9b7035b20fb0f561263b6670af014dbb6ed Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 2 Feb 2022 21:36:27 +0100 Subject: [PATCH 15/19] images can be passed to toIndividual() for adding it to the html part --- inc/inc.ClassEmailNotify.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/inc/inc.ClassEmailNotify.php b/inc/inc.ClassEmailNotify.php index 673fa0433..f0445082f 100644 --- a/inc/inc.ClassEmailNotify.php +++ b/inc/inc.ClassEmailNotify.php @@ -83,7 +83,7 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { * @param array $attachments list of attachments * @return false or -1 in case of error, otherwise true */ - function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array()) { /* {{{ */ + function toIndividual($sender, $recipient, $subject, $messagekey, $params=array(), $attachments=array(), $images=array()) { /* {{{ */ if(is_object($recipient) && $recipient->isType('user') && !$recipient->isDisabled() && $recipient->getEmail()!="") { $to = $recipient->getEmail(); $lang = $recipient->getLanguage(); @@ -158,6 +158,19 @@ class SeedDMS_EmailNotify extends SeedDMS_Notify { if($bodyhtml) $mime->setHTMLBody($bodyhtml); + if($images) { + foreach($images as $image) { + if(!$mime->addHTMLImage( + $image['file'], + $image['mimetype'], + isset($image['name']) ? $image['name'] : '', + isset($image['isfile']) ? $image['isfile'] : true + )) { + return false; + } + } + } + if($attachments) { foreach($attachments as $attachment) { if(!$mime->addAttachment( From 82d9a42968a1dfd4d8f605dae38ed3225013dcb8 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 9 Feb 2022 08:10:17 +0100 Subject: [PATCH 16/19] comment old unused code --- views/bootstrap/class.Bootstrap.php | 4 ++-- views/bootstrap4/class.Bootstrap4.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 78094a577..ab1f0c934 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1302,8 +1302,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);; * @return string */ function getModalBoxLink($config) { /* {{{ */ - $content = ''; - $content .= " Date: Fri, 11 Feb 2022 07:07:01 +0100 Subject: [PATCH 17/19] allow placeholder for textarea --- views/bootstrap/class.Bootstrap.php | 1 + 1 file changed, 1 insertion(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index ab1f0c934..e14624190 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1123,6 +1123,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);; (!empty($value['class']) ? ' class="'.$value['class'].'"' : ''). (!empty($value['rows']) ? ' rows="'.$value['rows'].'"' : ''). (!empty($value['cols']) ? ' cols="'.$value['cols'].'"' : ''). + (!empty($value['placeholder']) ? ' placeholder="'.$value['placeholder'].'"' : ''). (!empty($value['required']) ? ' required="required"' : '').">".(!empty($value['value']) ? $value['value'] : '').""; break; case 'plain': From 7a21fa77b5034602d355b7f71eab9cf8eaf94665 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 11 Feb 2022 07:07:19 +0100 Subject: [PATCH 18/19] add new parameter 'addon' in formField() used by input fields --- views/bootstrap/class.Bootstrap.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index e14624190..6516c1e1a 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -1133,6 +1133,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);; default: switch($value['type']) { default: + if(!empty($value['addon'])) + echo ""; echo '"; + if(!empty($value['addon'])) { + echo ''.$value['addon'].''; + echo "\n"; + } break; } break; From 2ad448581af1577f5ab088f469c8401f3a78f371 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 11 Feb 2022 07:07:54 +0100 Subject: [PATCH 19/19] add new parameter 'addon' used by input fields --- views/bootstrap4/class.Bootstrap4.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index a4ea4cc53..9996345b4 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -1130,6 +1130,8 @@ background-image: linear-gradient(to bottom, #882222, #111111);; echo ""; break; default: + if(!empty($value['addon'])) + echo '
'; echo '"; + if(!empty($value['addon'])) { + echo '
'; + echo ''.$value['addon'].''; + echo '
'; + echo '
'; + } break; } break;
".$headcol."
"; - $attentionstr = ''; - if ( $document->isLocked() ) { - $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; - } - if ( $needwkflaction ) { - $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> "; - } - if($attentionstr) - $content .= $attentionstr."
"; - $content .= ""; - if(count($files)) - $content .= count($files)." ".getMLText("linked_files")."
"; - if(count($links) || count($revlinks)) - $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; - if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { - if($workflowstate = $latestContent->getWorkflowState()) - $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; - } else { - $content .= getOverallStatusText($status["status"]); - } - $content .= "
"; $content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent); $content .= "
"; - $attentionstr = ''; - if ( $document->isLocked() ) { - $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; - } - if ( $needwkflaction ) { - $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> "; - } - if($attentionstr) - $content .= $attentionstr."
"; - $content .= ""; - if(count($files)) - $content .= count($files)." ".getMLText("linked_files")."
"; - if(count($links) || count($revlinks)) - $content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."
"; - if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') { - if($workflowstate = $latestContent->getWorkflowState()) - $content .= 'getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').''; - } else { - $content .= getOverallStatusText($status["status"]); - } - $content .= "
"; $content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent); $content .= "