From ec570c9ba494012728c8c63b752f35f9ca7185fb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Aug 2022 08:37:25 +0200 Subject: [PATCH 1/3] add parameter to printAccordion() in order to open/close it --- views/bootstrap/class.Bootstrap.php | 4 ++-- views/bootstrap4/class.Bootstrap4.php | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/views/bootstrap/class.Bootstrap.php b/views/bootstrap/class.Bootstrap.php index 516529ea5..d63ba34fc 100644 --- a/views/bootstrap/class.Bootstrap.php +++ b/views/bootstrap/class.Bootstrap.php @@ -3766,7 +3766,7 @@ $("body").on("click", "span.openpopupbox", function(e) { echo $html; } /* }}} */ - public function printAccordion($title, $content) { /* {{{ */ + public function printAccordion($title, $content, $open=false) { /* {{{ */ $id = substr(md5(uniqid()), 0, 4); ?>
@@ -3776,7 +3776,7 @@ $("body").on("click", "span.openpopupbox", function(e) {
-
+
">
-
+
Date: Thu, 18 Aug 2022 08:38:09 +0200 Subject: [PATCH 2/3] open accordion if a filter parameter is set --- views/bootstrap/class.Search.php | 39 ++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 647fa1e45..591248aaf 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -306,6 +306,25 @@ function typeahead() { /* {{{ */ getMLText("creation_date")." (".getMLText('to').")", $this->getDateChooser($createenddate, "createend", $this->params['session']->getLanguage()) ); + $this->contentContainerEnd(); + + /* First check if any of the folder/document filters are set. If it is, + * open the accordion. + */ + $openfilterdlg = false; + if($attrdefs) { + foreach($attrdefs as $attrdef) { + if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { + /* Do not check dates because they always have 'from' and 'to' element + * even if it is empty. FIXME should be also checked. + */ + if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!empty($attributes[$attrdef->getID()])) + $openfilterdlg = true; + } + } + } + ob_start(); if($attrdefs) { foreach($attrdefs as $attrdef) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { @@ -317,7 +336,8 @@ function typeahead() { /* {{{ */ } } } - $this->contentContainerEnd(); + $content = ob_get_clean(); + $this->printAccordion(getMLText('filter_for_documents_and_folders'), $content, $openfilterdlg); /* First check if any of the folder filters are set. If it is, * open the accordion. @@ -326,8 +346,12 @@ function typeahead() { /* {{{ */ if($attrdefs) { foreach($attrdefs as $attrdef) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { - if(!empty($attributes[$attrdef->getID()])) - $openfilterdlg = true; + /* Do not check dates because they always have 'from' and 'to' element + * even if it is empty. FIXME should be also checked. + */ + if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!empty($attributes[$attrdef->getID()])) + $openfilterdlg = true; } } } @@ -415,7 +439,7 @@ function typeahead() { /* {{{ */ ?> printAccordion(getMLText('filter_for_documents'), $content); + $this->printAccordion(getMLText('filter_for_documents'), $content, $openfilterdlg); /* First check if any of the folder filters are set. If it is, * open the accordion. */ @@ -423,8 +447,9 @@ function typeahead() { /* {{{ */ if($attrdefs) { foreach($attrdefs as $attrdef) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { - if(!empty($attributes[$attrdef->getID()])) - $openfilterdlg = true; + if($attrdef->getType() != SeedDMS_Core_AttributeDefinition::type_date) + if(!empty($attributes[$attrdef->getID()])) + $openfilterdlg = true; } } } @@ -442,7 +467,7 @@ function typeahead() { /* {{{ */ } $content = ob_get_clean(); if($content) - $this->printAccordion(getMLText('filter_for_folders'), $content); + $this->printAccordion(getMLText('filter_for_folders'), $content, $openfilterdlg); // }}} $this->formSubmit(" ".getMLText('search')); From 256a8ec6cab69bc6ec70b52f657ff99087b379eb Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Thu, 18 Aug 2022 08:38:50 +0200 Subject: [PATCH 3/3] add changes for 5.1.27 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 4115503ba..3799ff2b9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -7,6 +7,7 @@ - running the controller will always call the hooks preRun and postRun - add tabs on ViewFolder page - link behind logo in header can be set in extension +- move attributes for documents and folders on search page into own accordion -------------------------------------------------------------------------------- Changes in version 5.1.26