mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-12-24 05:48:29 +00:00
output additional filters only if attributes exists
This commit is contained in:
parent
4eef2bd0b0
commit
4bbf6ddecf
|
|
@ -286,7 +286,7 @@ function typeahead() { /* {{{ */
|
|||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database">
|
||||
<form class="form-horizontal" action="<?= $this->params['settings']->_httpRoot ?>out/out.Search.php" name="form1">
|
||||
<form class="form-horizontal mb-4" action="<?= $this->params['settings']->_httpRoot ?>out/out.Search.php" name="form1">
|
||||
<input type="hidden" name="fullsearch" value="0" />
|
||||
<?php
|
||||
// Database search Form {{{
|
||||
|
|
@ -386,36 +386,42 @@ function typeahead() { /* {{{ */
|
|||
);
|
||||
$this->contentContainerEnd();
|
||||
|
||||
// Seach options for documents and folders {{{
|
||||
/* First check if any of the folder/document filters are set. If it is,
|
||||
* open the accordion.
|
||||
*/
|
||||
$openfilterdlg = false;
|
||||
$hasattrs = 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.
|
||||
*/
|
||||
$hasattrs = true;
|
||||
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) {
|
||||
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
|
||||
} else
|
||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
|
||||
if($hasattrs) {
|
||||
ob_start();
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
||||
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
|
||||
} else
|
||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
|
||||
}
|
||||
}
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_documents_and_folders'), $content, $openfilterdlg);
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_documents_and_folders'), $content, $openfilterdlg);
|
||||
// }}}
|
||||
|
||||
// Seach options for documents {{{
|
||||
/* First check if any of the folder filters are set. If it is,
|
||||
|
|
@ -515,39 +521,43 @@ function typeahead() { /* {{{ */
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_documents'), $content, $openfilterdlg);
|
||||
// }}}
|
||||
|
||||
// Seach options for folders {{{
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_documents'), $content, $openfilterdlg);
|
||||
/* First check if any of the folder filters are set. If it is,
|
||||
* open the accordion.
|
||||
*/
|
||||
$openfilterdlg = false;
|
||||
$hasattrs = false;
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
||||
$hasattrs = true;
|
||||
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_folder) {
|
||||
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
|
||||
} else
|
||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
|
||||
if($hasattrs) {
|
||||
ob_start();
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
||||
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
|
||||
$this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
|
||||
} else
|
||||
$this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$content = ob_get_clean();
|
||||
if($content)
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_folders'), $content, $openfilterdlg);
|
||||
}
|
||||
// }}}
|
||||
|
||||
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user