diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php
index 77f9cff9f..eb7c3f4a3 100644
--- a/views/bootstrap/class.Search.php
+++ b/views/bootstrap/class.Search.php
@@ -127,6 +127,7 @@ function typeahead() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$fullsearch = $this->params['fullsearch'];
+ $total = $this->params['total'];
$totaldocs = $this->params['totaldocs'];
$totalfolders = $this->params['totalfolders'];
$attrdefs = $this->params['attrdefs'];
@@ -139,6 +140,7 @@ function typeahead() { /* {{{ */
$enableclipboard = $this->params['enableclipboard'];
$attributes = $this->params['attributes'];
$categories = $this->params['categories'];
+ $category = $this->params['category'];
$mimetype = $this->params['mimetype'];
$owner = $this->params['owner'];
$startfolder = $this->params['startfolder'];
@@ -152,6 +154,7 @@ function typeahead() { /* {{{ */
$expirationdate = $this->params['expirationdate'];
$statusdate = $this->params['statusdate'];
$status = $this->params['status'];
+ $record_type = $this->params['recordtype'];
$this->query = $this->params['query'];
$orderby = $this->params['orderby'];
$entries = $this->params['searchhits'];
@@ -331,8 +334,8 @@ function typeahead() { /* {{{ */
$tmpcatids[] = $tmpcat->getID();
$options = array();
$allcategories = $dms->getDocumentCategories();
- foreach($allcategories as $category) {
- $options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids));
+ foreach($allcategories as $acategory) {
+ $options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids));
}
$this->formField(
getMLText("categories"),
@@ -449,93 +452,127 @@ function typeahead() { /* {{{ */
);
$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $startfolder, 'folderfullsearchid'));
if(!isset($facets['owner'])) {
- $options = array();
- foreach ($allUsers as $currUser) {
- if($user->isAdmin() || (!$currUser->isGuest() && (!$currUser->isHidden() || $currUser->getID() == $user->getID())))
- $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
+ $options = array();
+ foreach ($allUsers as $currUser) {
+ if($user->isAdmin() || (!$currUser->isGuest() && (!$currUser->isHidden() || $currUser->getID() == $user->getID())))
+ $options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
+ }
+ $this->formField(
+ getMLText("owner"),
+ array(
+ 'element'=>'select',
+ 'name'=>'owner[]',
+ 'class'=>'chzn-select',
+ 'multiple'=>true,
+ 'options'=>$options
+ )
+ );
}
- $this->formField(
- getMLText("owner"),
- array(
- 'element'=>'select',
- 'name'=>'owner[]',
- 'class'=>'chzn-select',
- 'multiple'=>true,
- 'options'=>$options
- )
- );
- }
- if(!isset($facets['category'])) {
- $tmpcatids = array();
- foreach($categories as $tmpcat)
- $tmpcatids[] = $tmpcat->getID();
- $options = array();
- $allcategories = $dms->getDocumentCategories();
- foreach($allcategories as $category) {
- $options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids));
+ if(!isset($facets['category'])) {
+ $tmpcatids = array();
+ foreach($categories as $tmpcat)
+ $tmpcatids[] = $tmpcat->getID();
+ $options = array();
+ $allcategories = $dms->getDocumentCategories();
+ foreach($allcategories as $acategory) {
+ $options[] = array($acategory->getID(), $acategory->getName(), in_array($acategory->getId(), $tmpcatids));
+ }
+ $this->formField(
+ getMLText("category_filter"),
+ array(
+ 'element'=>'select',
+ 'class'=>'chzn-select',
+ 'name'=>'category[]',
+ 'multiple'=>true,
+ 'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
+ 'options'=>$options
+ )
+ );
}
- $this->formField(
- getMLText("category_filter"),
- array(
- 'element'=>'select',
- 'class'=>'chzn-select',
- 'name'=>'category[]',
- 'multiple'=>true,
- 'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
- 'options'=>$options
- )
- );
- }
- $options = array();
- if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
- if($workflowmode == 'traditional') {
- $options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status));
+ if(!isset($facets['status'])) {
+ $options = array();
+ if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
+ if($workflowmode == 'traditional') {
+ $options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status));
+ }
+ } elseif($workflowmode == 'advanced') {
+ $options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status));
+ }
+ $options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status));
+ $options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status));
+ $options[] = array(S_REJECTED, getOverallStatusText(S_REJECTED), in_array(S_REJECTED, $status));
+ $options[] = array(S_EXPIRED, getOverallStatusText(S_EXPIRED), in_array(S_EXPIRED, $status));
+ $options[] = array(S_OBSOLETE, getOverallStatusText(S_OBSOLETE), in_array(S_OBSOLETE, $status));
+ $this->formField(
+ getMLText("status"),
+ array(
+ 'element'=>'select',
+ 'class'=>'chzn-select',
+ 'name'=>'status[]',
+ 'multiple'=>true,
+ 'attributes'=>array(array('data-placeholder', getMLText('select_status')), array('data-no_results_text', getMLText('unknown_status'))),
+ 'options'=>$options
+ )
+ );
}
- } elseif($workflowmode == 'advanced') {
- $options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status));
- }
- $options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status));
- $options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status));
- $options[] = array(S_REJECTED, getOverallStatusText(S_REJECTED), in_array(S_REJECTED, $status));
- $options[] = array(S_EXPIRED, getOverallStatusText(S_EXPIRED), in_array(S_EXPIRED, $status));
- $options[] = array(S_OBSOLETE, getOverallStatusText(S_OBSOLETE), in_array(S_OBSOLETE, $status));
- $this->formField(
- getMLText("status"),
- array(
- 'element'=>'select',
- 'class'=>'chzn-select',
- 'name'=>'status[]',
- 'multiple'=>true,
- 'attributes'=>array(array('data-placeholder', getMLText('select_status')), array('data-no_results_text', getMLText('unknown_status'))),
- 'options'=>$options
- )
- );
- if($facets) {
-foreach($facets as $facetname=>$values) {
- $options = array();
- foreach($values as $v=>$c) {
- $option = array($v, $v.' ('.$c.')');
- if(isset(${$facetname}) && in_array($v, ${$facetname}))
- $option[] = true;
- $options[] = $option;
- }
- $this->formField(
- getMLText($facetname),
- array(
- 'element'=>'select',
- 'id'=>$facetname,
- 'name'=>$facetname."[]",
- 'class'=>'chzn-select',
- 'attributes'=>array(array('data-placeholder', getMLText('select_'.$facetname))),
- 'options'=>$options,
- 'multiple'=>true
- )
- );
-}
- }
- $this->contentContainerEnd();
- $this->formSubmit(" ".getMLText('search'));
+ if($facets) {
+ foreach($facets as $facetname=>$values) {
+ $multiple = true;
+// if(in_array($facetname, ['owner', 'status', 'mimetype']))
+// $multiple = false;
+ $options = array();
+ if($facetname == 'owner') {
+ foreach($values as $v=>$c) {
+ $uu = $dms->getUserByLogin($v);
+ if($uu) {
+ $option = array($uu->getId(), $v.' ('.$c.')');
+ if(isset(${$facetname}) && in_array($uu->getId(), ${$facetname}))
+ $option[] = true;
+ $options[] = $option;
+ }
+ }
+ } elseif($facetname == 'category') {
+ foreach($values as $v=>$c) {
+ $cat = $dms->getDocumentCategoryByName($v);
+ if($cat) {
+ $option = array($cat->getId(), $v.' ('.$c.')');
+ if(isset(${$facetname}) && in_array($cat->getId(), ${$facetname}))
+ $option[] = true;
+ $options[] = $option;
+ }
+ }
+ } elseif($facetname == 'status') {
+ foreach($values as $v=>$c) {
+ $option = array($v, getOverallStatusText($v).' ('.$c.')');
+ if(isset(${$facetname}) && in_array($v, ${$facetname}))
+ $option[] = true;
+ $options[] = $option;
+ }
+ } else {
+ foreach($values as $v=>$c) {
+ $option = array($v, $v.' ('.$c.')');
+ if(isset(${$facetname}) && in_array($v, ${$facetname}))
+ $option[] = true;
+ $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
+ )
+ );
+ }
+ }
+ $this->contentContainerEnd();
+ $this->formSubmit(" ".getMLText('search'));
?>
$values) {
}
}
*/
- echo $this->infoMsg(getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime)));
+ echo $this->infoMsg(getMLText("search_report", array("count"=>$total, "doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime)));
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart();