From 4184cd4f1d7b0de9a50b1e35ba299a59a687e4e7 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 24 Apr 2025 14:50:32 +0200 Subject: [PATCH 1/9] add hook for creating preview image (like preview images in lists) --- views/bootstrap/class.ViewDocument.php | 49 +++++++++++++++----------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index e40237207..bdd46324a 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -314,8 +314,8 @@ $(document).ready( function() { print ""; print ""; - $previewer->createPreview($file, $previewwidthdetail); if($file_exists) { + $previewer->createPreview($file, $previewwidthdetail); if ($viewonlinefiletypes && (in_array(strtolower($file->getFileType()), $viewonlinefiletypes) || in_array(strtolower($file->getMimeType()), $viewonlinefiletypes))) { if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) { print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$documentid."&file=". $file->getID()."\">"; @@ -325,15 +325,15 @@ $(document).ready( function() { print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$documentid."&file=".$file->getID()."\">"; } } - } - if($previewer->hasPreview($file)) { - print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); - } else { - print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; - } - if($file_exists) { + if($previewer->hasPreview($file)) { + print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$document->getID()."&file=".$file->getID()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($file->getMimeType())."\">"); + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; + } if($accessobject->check_controller_access('Download', array('action'=>'run')) || $accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) print ""; + } else { + print "getMimeIcon($file->getFileType())."\" title=\"".htmlspecialchars($file->getMimeType())."\">"; } print ""; @@ -717,23 +717,30 @@ $(document).ready( function() { $this->rowStart(); $this->columnStart(3); if ($file_exists) { - if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { - if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) - print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; - } else { - if($accessobject->check_controller_access('Download', array('action'=>'version'))) - print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; + $previewer->createPreview($latestContent); + $previewhtml = $this->callHook('documentPreviewThumb', $previewer, $latestContent->getDocument(), $latestContent); + if(is_string($previewhtml)) + echo $previewhtml; + else { + if ($viewonlinefiletypes && (in_array(strtolower($latestContent->getFileType()), $viewonlinefiletypes) || in_array(strtolower($latestContent->getMimeType()), $viewonlinefiletypes))) { + if($accessobject->check_controller_access('ViewOnline', array('action'=>'run'))) + print "params['settings']->_httpRoot."op/op.ViewOnline.php?documentid=".$latestContent->getDocument()->getId()."&version=". $latestContent->getVersion()."\">"; + } else { + if($accessobject->check_controller_access('Download', array('action'=>'version'))) + print "params['settings']->_httpRoot."op/op.Download.php?documentid=".$latestContent->getDocument()->getId()."&version=".$latestContent->getVersion()."\">"; + } + if($previewer->hasPreview($latestContent)) { + print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"); + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + if ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version'))) { + print ""; + } } - } - $previewer->createPreview($latestContent); - if($previewer->hasPreview($latestContent)) { - print("params['settings']->_httpRoot."op/op.Preview.php?documentid=".$latestContent->getDocument()->getID()."&version=".$latestContent->getVersion()."&width=".$previewwidthdetail."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"); } else { print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; } - if ($file_exists && ($accessobject->check_controller_access('ViewOnline', array('action'=>'run')) || $accessobject->check_controller_access('Download', array('action'=>'version')))) { - print ""; - } // print "\n"; // print ""; From 8b0d8e85c21801823f7e30478464c7656e7542b5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 24 Apr 2025 14:52:06 +0200 Subject: [PATCH 2/9] add changes for 5.1.40 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 6734d2e54..b16341c08 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -6,6 +6,7 @@ - fix possible xss attacks - saver way to collect plugin configuration - fix update of postgres database +- add hook displayPreviewThumb -------------------------------------------------------------------------------- Changes in version 5.1.39 From a5edba86aed015895d0678550411ba72b3e7ac59 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 24 Apr 2025 16:30:48 +0200 Subject: [PATCH 3/9] fix search url, add search for mime types --- views/bootstrap/class.Charts.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/views/bootstrap/class.Charts.php b/views/bootstrap/class.Charts.php index a370f646d..2ee5b797e 100644 --- a/views/bootstrap/class.Charts.php +++ b/views/bootstrap/class.Charts.php @@ -246,34 +246,36 @@ $(document).ready( function() { protected function getSearchUrl($type, $item) { $dms = $this->params['dms']; + $settings = $this->params['settings']; $searchurl = null; switch($type) { case 'docsperuser': case 'sizeperuser': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res']; break; case 'foldersperuser': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res']; break; case 'docspercategory': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res']; break; case 'docsperstatus': - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res']; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res']; break; case 'docspermonth': case 'sizepermonth': $startmonth = $item['key'].'-01'; $endmonth = date('Y-m-t', strtotime($startmonth)); - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth; break; case 'docspermimetype': + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&mimetype%5B%5D='.urlencode($item['key']); break; case 'docsaccumulated': $start = date('Y-m-d', $item['key']/1000); $end = date('Y-m-d', $item['key']/1000 + 86400); - $searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end; + $searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end; break; } return $searchurl; From ae66ec223cd86a51df80636eb09e70b00371f4f0 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 24 Apr 2025 16:31:27 +0200 Subject: [PATCH 4/9] add searching for mime types --- out/out.Search.php | 16 ++++++++++++++++ views/bootstrap/class.Search.php | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/out/out.Search.php b/out/out.Search.php index 09c079f50..cae2b796f 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -574,6 +574,21 @@ if($fullsearch) { } /* }}} */ + // Check to see if the search has been restricted to a particular + // mimetype. {{{ + $mimetype = []; + if (isset($_GET["mimetype"])) { + if (!is_array($_GET['mimetype'])) { + if(!empty($_GET['mimetype'])) + $mimetype[] = $_GET['mimetype']; + } else { + foreach($_GET["mimetype"] as $l) { + if($l) + $mimetype[] = $l; + } + } + } /* }}} */ + // status $status = isset($_GET['status']) ? $_GET['status'] : array(); /* @@ -661,6 +676,7 @@ if($fullsearch) { 'startFolder'=>$startFolder, 'owner'=>$ownerobjs, 'status'=>$status, + 'mimetype'=>$mimetype, 'creationstartdate'=>$created['from'], //$createstartdate ? $createstartdate : array(), 'creationenddate'=>$created['to'], //$createenddate ? $createenddate : array(), 'modificationstartdate'=>$modified['from'], diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 7df547f82..fa6a97844 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -707,6 +707,8 @@ $(document).ready(function() { $openfilterdlg = true; if($status) $openfilterdlg = true; + if($mimetype) + $openfilterdlg = true; if($modifyenddate || $modifystartdate) $openfilterdlg = true; if($expenddate || $expstartdate) @@ -761,6 +763,22 @@ $(document).ready(function() { 'options'=>$options ) ); + $options = []; + foreach($dms->getMimeTypes() as $m) { + $options[] = array($m['mimeType'], $m['mimeType'], in_array($m['mimeType'], $mimetype)/*, array(array('data-subtitle', htmlspecialchars($m['c'].' ×')))*/); + } + $this->formField( + getMLText("mimetype"), + array( + 'element'=>'select', + 'class'=>'chzn-select', + 'name'=>'mimetype[]', + 'multiple'=>true, + 'attributes'=>array(array('data-placeholder', getMLText('select_mimetype')), array('data-no_results_text', getMLText('unknown_mimetype'))), + 'options'=>$options + ) + ); + $this->formField( getMLText("modified")." (".getMLText('from').")", $this->getDateChooser(!empty($modifystartdate) ? getReadableDate($modifystartdate) : null, "modified[from]", $this->params['session']->getLanguage()) From f46ae013864838d0512295590801c0ea129cf2b0 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 24 Apr 2025 16:31:44 +0200 Subject: [PATCH 5/9] add changes of 5.1.40 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index b16341c08..9ad1a5953 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ - saver way to collect plugin configuration - fix update of postgres database - add hook displayPreviewThumb +- add searching for mimetype in database -------------------------------------------------------------------------------- Changes in version 5.1.39 From b2cfde85ca0366c6b383afbdec8995be9ed06d65 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 29 Apr 2025 10:30:42 +0200 Subject: [PATCH 6/9] contentOffsetDir may be a string --- op/op.Settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/op/op.Settings.php b/op/op.Settings.php index c72aaa84b..1e199a30d 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -273,7 +273,7 @@ if ($action == "saveSettings") // SETTINGS - ADVANCED - SERVER setStrValue("coreDir"); setStrValue("luceneClassDir"); - setIntValue("contentOffsetDir"); + setStrValue("contentOffsetDir"); setIntValue("maxDirID"); setIntValue("updateNotifyTime"); setIntValue("maxExecutionTime"); From 181482a1a7036035a55755c1bf0ffb97975265c6 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 29 Apr 2025 10:32:20 +0200 Subject: [PATCH 7/9] set text for no-result in selection of mimetype --- views/bootstrap/class.Search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index fa6a97844..89918276c 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -774,7 +774,7 @@ $(document).ready(function() { 'class'=>'chzn-select', 'name'=>'mimetype[]', 'multiple'=>true, - 'attributes'=>array(array('data-placeholder', getMLText('select_mimetype')), array('data-no_results_text', getMLText('unknown_mimetype'))), + 'attributes'=>array(array('data-placeholder', getMLText('select_mimetype')), array('data-no_results_text', getMLText('no_mimetype'))), 'options'=>$options ) ); From e069f784b4063c46ca65048469326795644ae440 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Tue, 29 Apr 2025 10:33:13 +0200 Subject: [PATCH 8/9] add hooks for addtional tabs --- views/bootstrap/class.Search.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 89918276c..261ab49d0 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -542,6 +542,12 @@ $(document).ready(function() { callHook('extraTabs'); + if($tabs) { + foreach($tabs as $tabid=>$tab) { + echo ''; + } + } ?>
@@ -1484,6 +1490,14 @@ $(document).ready(function() { echo "
\n"; } // }}} + + if($tabs) { + foreach($tabs as $tabid=>$tab) { + echo '
'; + echo $tab['content']; + echo "
\n"; + } + } ?> Date: Tue, 29 Apr 2025 10:34:16 +0200 Subject: [PATCH 9/9] rename methode and class for inline editiing of document name --- views/bootstrap/class.Bootstrap.php | 4 ++-- views/bootstrap/class.ViewDocument.php | 2 +- views/bootstrap/styles/application.js | 3 +-- views/bootstrap4/class.Bootstrap4.php | 4 ++-- views/bootstrap4/styles/application.js | 3 +-- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 129ad00f0..b4ed554ab 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -2552,9 +2552,9 @@ $(function() { * * @param string text */ - function printInlineEdit($text, $object){ /* {{{ */ + function printInlineEditDocumentName($text, $object){ /* {{{ */ if(!empty($this->params['settings']->_inlineEditing)) { - echo "isType('document')) echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\""; echo ">".$text; diff --git a/views/bootstrap/class.ViewDocument.php b/views/bootstrap/class.ViewDocument.php index bdd46324a..88be86c8d 100644 --- a/views/bootstrap/class.ViewDocument.php +++ b/views/bootstrap/class.ViewDocument.php @@ -413,7 +413,7 @@ $(document).ready( function() { ?> : - printInlineEdit(htmlspecialchars($document->getName()), $document);?> + printInlineEditDocumentName(htmlspecialchars($document->getName()), $document);?> : diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index bb3affe27..cc8b8508c 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -721,8 +721,7 @@ $(document).ready( function() { window.history.back(); }); /* }}} */ - $("body").on("blur", "span.editable", function(e) { /* {{{ */ - console.log($(this).data('document')); + $("body").on("blur", "span.editdocname", function(e) { /* {{{ */ e.preventDefault(); $.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() }) .done(function( data ) { diff --git a/views/bootstrap4/class.Bootstrap4.php b/views/bootstrap4/class.Bootstrap4.php index 68d1391f5..203235887 100644 --- a/views/bootstrap4/class.Bootstrap4.php +++ b/views/bootstrap4/class.Bootstrap4.php @@ -2578,9 +2578,9 @@ $(function() { * * @param string text */ - function printInlineEdit($text, $object){ /* {{{ */ + function printInlineEditDocumentName($text, $object){ /* {{{ */ if(!empty($this->params['settings']->_inlineEditing)) { - echo "isType('document')) echo " data-document=\"".$object->getId()."\" data-formtoken=\"".createFormKey('setdocumentname')."\""; echo ">".$text; diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index c231e6044..d39b0ac65 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -769,8 +769,7 @@ $(document).ready( function() { window.history.back(); }); /* }}} */ - $("body").on("blur", "span.editable", function(e) { /* {{{ */ - console.log($(this).data('document')); + $("body").on("blur", "span.editdocname", function(e) { /* {{{ */ e.preventDefault(); $.post(seeddms_webroot+"op/op.Ajax.php", { command: "setdocumentname", id: $(this).data('document'), formtoken: $(this).data('formtoken'), name: $(this).text() }) .done(function( data ) {