From d778006170da0ef1a17171a83c9bab6336b92b05 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 21 Apr 2023 13:00:05 +0200 Subject: [PATCH 1/5] use conversion mgr in show() --- views/bootstrap/class.DropFolderChooser.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/views/bootstrap/class.DropFolderChooser.php b/views/bootstrap/class.DropFolderChooser.php index 0b0435be8..d45f1a87e 100644 --- a/views/bootstrap/class.DropFolderChooser.php +++ b/views/bootstrap/class.DropFolderChooser.php @@ -115,12 +115,18 @@ $('.folderselect').click(function(ev) { $form = $this->params['form']; $dropfolderdir = $this->params['dropfolderdir']; $cachedir = $this->params['cachedir']; + $conversionmgr = $this->params['conversionmgr']; $previewwidth = $this->params['previewWidthList']; + $previewconverters = $this->params['previewConverters']; $timeout = $this->params['timeout']; $xsendfile = $this->params['xsendfile']; $showfolders = $this->params['showfolders']; $previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile); + if($conversionmgr) + $previewer->setConversionMgr($conversionmgr); + else + $previewer->setConverters($previewconverters); $dir = $dropfolderdir.'/'.$user->getLogin(); /* Check if we are still looking in the configured directory and From 3d4a63f3353d09dba944094077d490dbdbba70a5 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 21 Apr 2023 13:00:31 +0200 Subject: [PATCH 2/5] indent typeahead() --- 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 05b2223bc..43e5b8fb0 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -352,7 +352,7 @@ $(document).ready(function() { echo $content; } /* }}} */ -function typeahead() { /* {{{ */ + function typeahead() { /* {{{ */ $dms = $this->params['dms']; $user = $this->params['user']; $query = $this->params['query']; From 66ecc57780587e13f36ba714cf30120917e1ee5f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 21 Apr 2023 13:02:42 +0200 Subject: [PATCH 3/5] add new config var suggestTerms --- inc/inc.ClassSettings.php | 5 +++++ op/op.Settings.php | 1 + views/bootstrap/class.Settings.php | 1 + 3 files changed, 7 insertions(+) diff --git a/inc/inc.ClassSettings.php b/inc/inc.ClassSettings.php index fdfd9c277..6fad081d4 100644 --- a/inc/inc.ClassSettings.php +++ b/inc/inc.ClassSettings.php @@ -132,6 +132,8 @@ class Settings { /* {{{ */ var $_fullSearchEngine = 'lucene'; // default search method var $_defaultSearchMethod = 'database'; // or 'fulltext' + // suggest search term + var $_suggestTerms = array(); // or 'all', 'title' // jump straight to the document if it is the only hit of a search var $_showSingleSearchHit = true; // contentOffsetDirTo @@ -532,6 +534,8 @@ class Settings { /* {{{ */ $this->_maxSizeForFullText = intval($tab["maxSizeForFullText"]); $this->_fullSearchEngine = strval($tab["fullSearchEngine"]); $this->_defaultSearchMethod = strval($tab["defaultSearchMethod"]); + if(trim(strval($tab["suggestTerms"]))) + $this->_suggestTerms = explode(',',strval($tab["suggestTerms"])); $this->_showSingleSearchHit = Settings::boolVal($tab["showSingleSearchHit"]); $this->_stopWordsFile = strval($tab["stopWordsFile"]); $this->_sortUsersInList = strval($tab["sortUsersInList"]); @@ -914,6 +918,7 @@ class Settings { /* {{{ */ $this->setXMLAttributValue($node, "maxSizeForFullText", $this->_maxSizeForFullText); $this->setXMLAttributValue($node, "fullSearchEngine", $this->_fullSearchEngine); $this->setXMLAttributValue($node, "defaultSearchMethod", $this->_defaultSearchMethod); + $this->setXMLAttributValue($node, "suggestTerms", implode(',', $this->_suggestTerms)); $this->setXMLAttributValue($node, "showSingleSearchHit", $this->_showSingleSearchHit); $this->setXMLAttributValue($node, "expandFolderTree", $this->_expandFolderTree); $this->setXMLAttributValue($node, "stopWordsFile", $this->_stopWordsFile); diff --git a/op/op.Settings.php b/op/op.Settings.php index cd9217325..b8e06520d 100644 --- a/op/op.Settings.php +++ b/op/op.Settings.php @@ -133,6 +133,7 @@ if ($action == "saveSettings") setIntValue('maxSizeForFullText'); setStrValue('fullSearchEngine'); setStrValue('defaultSearchMethod'); + setStrValue('suggestTerms'); setBoolValue("showSingleSearchHit"); setBoolValue("enableSessionList"); setBoolValue("enableClipboard"); diff --git a/views/bootstrap/class.Settings.php b/views/bootstrap/class.Settings.php index a67406f00..a6ee21dd8 100644 --- a/views/bootstrap/class.Settings.php +++ b/views/bootstrap/class.Settings.php @@ -358,6 +358,7 @@ if(($kkk = $this->callHook('getFullSearchEngine')) && is_array($kkk)) showConfigOption('settings_fullSearchEngine', 'fullSearchEngine', $fullsearchengines, false, true); ?> showConfigOption('settings_defaultSearchMethod', 'defaultSearchMethod', array('database'=>'settings_defaultSearchMethod_valdatabase', 'fulltext'=>'settings_defaultSearchMethod_valfulltext'), false, true); ?> showConfigCheckbox('settings_showSingleSearchHit', 'showSingleSearchHit'); ?> +showConfigOption('settings_suggestTerms', 'suggestTerms', array('title','comment', 'keywords'), true, true); ?> showConfigText('settings_stopWordsFile', 'stopWordsFile'); ?> showConfigCheckbox('settings_enableClipboard', 'enableClipboard'); ?> showConfigCheckbox('settings_enableMenuTasks', 'enableMenuTasks'); ?> From 89e930ba0094487894329418634bf5a4556289cb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 21 Apr 2023 13:03:08 +0200 Subject: [PATCH 4/5] add search terms to typeahead if configured --- out/out.Search.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/out/out.Search.php b/out/out.Search.php index 82b35359d..b0a9ff7e1 100644 --- a/out/out.Search.php +++ b/out/out.Search.php @@ -196,7 +196,9 @@ if($fullsearch) { $total = 0; $index = $fulltextservice->Indexer(); if($index) { -// $terms = $index->terms($_GET['query']); + if(!empty($settings->_suggestTerms)) { + $terms = $index->terms($_GET['query'], $settings->_suggestTerms); + } $lucenesearch = $fulltextservice->Search(); $searchresult = $lucenesearch->search($query, array('record_type'=>$record_type, 'owner'=>$ownernames, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype, 'startFolder'=>$startFolder, 'rootFolder'=>$rootFolder, 'attributes'=>$attributes), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1)))); if($searchresult === false) { From 3cfcfaa558a91190f8e2661013bbb2f593dda7f4 Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Fri, 21 Apr 2023 16:52:07 +0200 Subject: [PATCH 5/5] typeahead will also show the column where the search terms comes from --- views/bootstrap/class.Search.php | 2 +- views/bootstrap/styles/application.js | 2 +- views/bootstrap4/styles/application.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 43e5b8fb0..548bbe029 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -362,7 +362,7 @@ $(document).ready(function() { $recs[] = array('type'=>'S', 'name'=>$query, 'occurences'=>''); if($terms) { foreach($terms as $term) - $recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence); + $recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence, 'column'=>$term->field); } if($entries) { foreach ($entries as $entry) { diff --git a/views/bootstrap/styles/application.js b/views/bootstrap/styles/application.js index 1eb3d2243..cb261a983 100644 --- a/views/bootstrap/styles/application.js +++ b/views/bootstrap/styles/application.js @@ -150,7 +150,7 @@ function initMost() { else if(item.type.charAt(0) == 'F') return ' ' + item.name.replace(/' + item.path + ''; else - return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : ''); + return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '
' + item.column + '' : ''); }, /* This only works with a modified version of bootstrap typeahead located * in boostrap-typeahead.js Search for 'render' diff --git a/views/bootstrap4/styles/application.js b/views/bootstrap4/styles/application.js index 419a92731..f72da452d 100644 --- a/views/bootstrap4/styles/application.js +++ b/views/bootstrap4/styles/application.js @@ -155,7 +155,7 @@ function initMost() { else if(item.type.charAt(0) == 'F') return ' ' + item.name.replace(/' + item.path + ''; else - return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : ''); + return ' ' + item.name.replace(/ 0 ? ' (' + item.occurences + ')' : '') + (typeof(item.column) != 'undefined' ? '
' + item.column + '' : ''); }, /* This only works with a modified version of bootstrap typeahead located * in boostrap-typeahead.js Search for 'render'