Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2023-03-04 09:05:08 +01:00
commit 359cdedfdb
2 changed files with 45 additions and 13 deletions

View File

@ -161,6 +161,11 @@ if($fullsearch) {
else
$record_type = array();
if (isset($_GET["attributes"]))
$attributes = $_GET["attributes"];
else
$attributes = array();
// Check to see if the search has been restricted to a particular sub-tree in
// the folder hierarchy.
$startFolder = null;
@ -193,7 +198,7 @@ if($fullsearch) {
if($index) {
// $terms = $index->terms($_GET['query']);
$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), ($pageNumber == 'all' ? array() : array('limit'=>$limit, 'offset'=>$limit * ($pageNumber-1))));
$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) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
$dcount = 0;

View File

@ -897,6 +897,13 @@ function typeahead() { /* {{{ */
$option[] = true;
$options[] = $option;
}
} elseif(substr($facetname, 0, 5) == 'attr_') {
foreach($values as $v=>$c) {
$option = array($v, $v.' ('.$c.')');
if(isset($attributes[$facetname]) && in_array($v, $attributes[$facetname]))
$option[] = true;
$options[] = $option;
}
} else {
foreach($values as $v=>$c) {
$option = array($v, $v.' ('.$c.')');
@ -905,18 +912,38 @@ function typeahead() { /* {{{ */
$options[] = $option;
}
}
$this->formField(
getMLText($facetname),
array(
'element'=>'select',
'id'=>$facetname,
'name'=>$facetname."[]",
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_'.$facetname)), array('data-allow-clear', 'true')),
'options'=>$options,
'multiple'=>$multiple
)
);
if(substr($facetname, 0, 5) == 'attr_') {
$tmp = explode('_', $facetname);
if($attrdef = $dms->getAttributeDefinition($tmp[1]))
$dispname = $attrdef->getName();
else
$dispname = getMLText($facetname);
$this->formField(
$dispname,
array(
'element'=>'select',
'id'=>$facetname,
'name'=>'attributes['.$facetname.'][]',
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', $dispname), array('data-allow-clear', 'true')),
'options'=>$options,
'multiple'=>$multiple
)
);
} else {
$this->formField(
getMLText($facetname),
array(
'element'=>'select',
'id'=>$facetname,
'name'=>$facetname."[]",
'class'=>'chzn-select',
'attributes'=>array(array('data-placeholder', getMLText('select_'.$facetname)), array('data-allow-clear', 'true')),
'options'=>$options,
'multiple'=>$multiple
)
);
}
}
}
$this->contentContainerEnd();