add searching for mime types

This commit is contained in:
Uwe Steinmann 2025-04-24 16:31:27 +02:00
parent a5edba86ae
commit ae66ec223c
2 changed files with 34 additions and 0 deletions

View File

@ -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'],

View File

@ -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())