open accordion if a filter parameter is set

This commit is contained in:
Uwe Steinmann 2022-08-18 08:38:09 +02:00
parent ec570c9ba4
commit 0344ad0c80

View File

@ -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() { /* {{{ */
?>
<?php
$content = ob_get_clean();
$this->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("<i class=\"fa fa-search\"></i> ".getMLText('search'));