redo the search form

This commit is contained in:
Uwe Steinmann 2021-05-05 13:47:38 +02:00
parent 805dbe212a
commit e870e2071b
2 changed files with 313 additions and 435 deletions

View File

@ -64,15 +64,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
$categories = array(); $categories = array();
$categorynames = array(); $categorynames = array();
if(isset($_GET['category']) && $_GET['category']) { if(isset($_GET['category']) && $_GET['category']) {
foreach($_GET['category'] as $catname) { foreach($_GET['category'] as $catid) {
if($catname) {
$cat = $dms->getDocumentCategoryByName($catname);
$categories[] = $cat;
$categorynames[] = $cat->getName();
}
}
} elseif(isset($_GET['categoryids']) && $_GET['categoryids']) {
foreach($_GET['categoryids'] as $catid) {
if($catid) { if($catid) {
$cat = $dms->getDocumentCategory($catid); $cat = $dms->getDocumentCategory($catid);
$categories[] = $cat; $categories[] = $cat;
@ -104,16 +96,18 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
// Check to see if the search has been restricted to a particular // Check to see if the search has been restricted to a particular
// document owner. // document owner.
$owner = []; $owner = [];
$ownernames = [];
if (isset($_GET["owner"])) { if (isset($_GET["owner"])) {
$owner = $_GET['owner'];
if (!is_array($_GET['owner'])) { if (!is_array($_GET['owner'])) {
if(!empty($_GET['owner']) && $o = $dms->getUserByLogin($_GET['owner'])) if(!empty($_GET['owner']) && $o = $dms->getUser($_GET['owner']))
$owner[] = $o->getLogin(); $ownernames[] = $o->getLogin();
else else
UI::exitError(getMLText("search"),getMLText("unknown_owner")); UI::exitError(getMLText("search"),getMLText("unknown_owner"));
} else { } else {
foreach($_GET["owner"] as $l) { foreach($_GET["owner"] as $l) {
if($l && $o = $dms->getUserByLogin($l)) if($l && $o = $dms->getUser($l))
$owner[] = $o->getLogin(); $ownernames[] = $o->getLogin();
} }
} }
} }
@ -134,34 +128,16 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
} }
// status // status
if(isset($_GET['status']))
$status = $_GET['status'];
else
$status = array(); $status = array();
if (isset($_GET["pendingReview"])){
$status[] = S_DRAFT_REV;
}
if (isset($_GET["pendingApproval"])){
$status[] = S_DRAFT_APP;
}
if (isset($_GET["inWorkflow"])){
$status[] = S_IN_WORKFLOW;
}
if (isset($_GET["released"])){
$status[] = S_RELEASED;
}
if (isset($_GET["rejected"])){
$status[] = S_REJECTED;
}
if (isset($_GET["obsolete"])){
$status[] = S_OBSOLETE;
}
if (isset($_GET["expired"])){
$status[] = S_EXPIRED;
}
// Check to see if the search has been restricted to a particular sub-tree in // Check to see if the search has been restricted to a particular sub-tree in
// the folder hierarchy. // the folder hierarchy.
$startFolder = null; $startFolder = null;
if (isset($_GET["targetid"]) && is_numeric($_GET["targetid"]) && $_GET["targetid"]>0) { if (isset($_GET["folderfullsearchid"]) && is_numeric($_GET["folderfullsearchid"]) && $_GET["folderfullsearchid"]>0) {
$targetid = $_GET["targetid"]; $targetid = $_GET["folderfullsearchid"];
$startFolder = $dms->getFolder($targetid); $startFolder = $dms->getFolder($targetid);
if (!is_object($startFolder)) { if (!is_object($startFolder)) {
UI::exitError(getMLText("search"),getMLText("invalid_folder_id")); UI::exitError(getMLText("search"),getMLText("invalid_folder_id"));
@ -188,7 +164,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
$index = $fulltextservice->Indexer(); $index = $fulltextservice->Indexer();
if($index) { if($index) {
$lucenesearch = $fulltextservice->Search(); $lucenesearch = $fulltextservice->Search();
$searchresult = $lucenesearch->search($query, array('owner'=>$owner, '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('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))));
if($searchresult === false) { if($searchresult === false) {
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm'))); $session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
$dcount = 0; $dcount = 0;
@ -313,105 +289,81 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
$owner = array(); $owner = array();
$ownerobjs = array(); $ownerobjs = array();
if (isset($_GET["owner"])) { if (isset($_GET["owner"])) {
$owner = $_GET['owner'];
if (!is_array($_GET['owner'])) { if (!is_array($_GET['owner'])) {
if(!empty($_GET['owner']) && $o = $dms->getUserByLogin($_GET['owner'])) { if(!empty($_GET['owner']) && $o = $dms->getUser($_GET['owner'])) {
$ownerobjs[] = $o; $ownerobjs[] = $o;
$owner = $o->getLogin();
} else } else
UI::exitError(getMLText("search"),getMLText("unknown_owner")); UI::exitError(getMLText("search"),getMLText("unknown_owner"));
} else { } else {
foreach($_GET["owner"] as $l) { foreach($_GET["owner"] as $l) {
if($o = $dms->getUserByLogin($l)) { if($o = $dms->getUser($l)) {
$ownerobjs[] = $o; $ownerobjs[] = $o;
$owner[] = $o->getLogin();
} }
} }
} }
} }
// Is the search restricted to documents created between two specific dates? /* Creation date {{{ */
$startdate = array(); $createstartdate = array();
$stopdate = array(); $createenddate = array();
if (isset($_GET["creationdate"]) && $_GET["creationdate"]!=null) { if(!empty($_GET["createstart"])) {
$creationdate = true; $createstartts = makeTsFromDate($_GET["createstart"]);
} else { $createstartdate = array('year'=>(int)date('Y', $createstartts), 'month'=>(int)date('m', $createstartts), 'day'=>(int)date('d', $createstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
$creationdate = false;
} }
if ($createstartdate && !checkdate($createstartdate['month'], $createstartdate['day'], $createstartdate['year'])) {
if(isset($_GET["createstart"])) {
$tmp = explode("-", $_GET["createstart"]);
$startdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0);
} else {
if(isset($_GET["createstartyear"]))
$startdate = array('year'=>$_GET["createstartyear"], 'month'=>$_GET["createstartmonth"], 'day'=>$_GET["createstartday"], 'hour'=>0, 'minute'=>0, 'second'=>0);
}
if ($startdate && !checkdate($startdate['month'], $startdate['day'], $startdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); UI::exitError(getMLText("search"),getMLText("invalid_create_date_end"));
} }
if(isset($_GET["createend"])) { if(!empty($_GET["createend"])) {
$tmp = explode("-", $_GET["createend"]); $createendts = makeTsFromDate($_GET["createend"]);
$stopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>23, 'minute'=>59, 'second'=>59); $createenddate = array('year'=>(int)date('Y', $createendts), 'month'=>(int)date('m', $createendts), 'day'=>(int)date('d', $createendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
} else {
if(isset($_GET["createendyear"]))
$stopdate = array('year'=>$_GET["createendyear"], 'month'=>$_GET["createendmonth"], 'day'=>$_GET["createendday"], 'hour'=>23, 'minute'=>59, 'second'=>59);
} }
if ($stopdate && !checkdate($stopdate['month'], $stopdate['day'], $stopdate['year'])) { if ($createenddate && !checkdate($createenddate['month'], $createenddate['day'], $createenddate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_create_date_end")); UI::exitError(getMLText("search"),getMLText("invalid_create_date_end"));
} }
/* }}} */
/* Status date {{{ */
$statusstartdate = array(); $statusstartdate = array();
$statusstopdate = array(); $statusenddate = array();
if (isset($_GET["statusdate"]) && $_GET["statusdate"]!=null) { if(!empty($_GET["statusdatestart"])) {
$statusdate = true; $statusstartts = makeTsFromDate($_GET["statusdatestart"]);
} else { $statusstartdate = array('year'=>(int)date('Y', $statusstartts), 'month'=>(int)date('m', $statusstartts), 'day'=>(int)date('d', $statusstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
$statusdate = false;
} }
if ($statusstartdate && !checkdate($statusstartdate['month'], $statusstartdate['day'], $statusstartdate['year'])) {
if(isset($_GET["statusstart"])) { UI::exitError(getMLText("search"),getMLText("invalid_status_date_start"));
$tmp = explode("-", $_GET["statusstart"]);
$statusstartdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0);
} }
if ($statusstartdate && !checkdate($statusstartdate['month'], $startdate['day'], $startdate['year'])) { if(!empty($_GET["statusdateend"])) {
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end")); $statusendts = makeTsFromDate($_GET["statusdateend"]);
} $statusenddate = array('year'=>(int)date('Y', $statusendts), 'month'=>(int)date('m', $statusendts), 'day'=>(int)date('d', $statusendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
if(isset($_GET["statusend"])) { }
$tmp = explode("-", $_GET["statusend"]); if ($statusenddate && !checkdate($statusenddate['month'], $statusenddate['day'], $statusenddate['year'])) {
$statusstopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>23, 'minute'=>59, 'second'=>59);
}
if ($statusstopdate && !checkdate($statusstopdate['month'], $stopdate['day'], $stopdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end")); UI::exitError(getMLText("search"),getMLText("invalid_status_date_end"));
} }
/* }}} */
/* Expiration date {{{ */
$expstartdate = array(); $expstartdate = array();
$expstopdate = array(); $expenddate = array();
if (isset($_GET["expirationdate"]) && $_GET["expirationdate"]!=null) { if(!empty($_GET["expirationstart"])) {
$expirationdate = true; $expstartts = makeTsFromDate($_GET["expirationstart"]);
} else { $expstartdate = array('year'=>(int)date('Y', $expstartts), 'month'=>(int)date('m', $expstartts), 'day'=>(int)date('d', $expstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
$expirationdate = false;
}
if(isset($_GET["expirationstart"]) && $_GET["expirationstart"]) {
$tmp = explode("-", $_GET["expirationstart"]);
$expstartdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0);
if (!checkdate($expstartdate['month'], $expstartdate['day'], $expstartdate['year'])) { if (!checkdate($expstartdate['month'], $expstartdate['day'], $expstartdate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_start")); UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_start"));
} }
} else {
// $expstartdate = array('year'=>$_GET["expirationstartyear"], 'month'=>$_GET["expirationstartmonth"], 'day'=>$_GET["expirationstartday"], 'hour'=>0, 'minute'=>0, 'second'=>0);
$expstartdate = array();
} }
if(isset($_GET["expirationend"]) && $_GET["expirationend"]) { if(!empty($_GET["expirationend"])) {
$tmp = explode("-", $_GET["expirationend"]); $expendts = makeTsFromDate($_GET["expirationend"]);
$expstopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0); $expenddate = array('year'=>(int)date('Y', $expendts), 'month'=>(int)date('m', $expendts), 'day'=>(int)date('d', $expendts), 'hour'=>23, 'minute'=>59, 'second'=>59);
if (!checkdate($expstopdate['month'], $expstopdate['day'], $expstopdate['year'])) { if (!checkdate($expenddate['month'], $expenddate['day'], $expenddate['year'])) {
UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_end")); UI::exitError(getMLText("search"),getMLText("invalid_expiration_date_end"));
} }
} else {
//$expstopdate = array('year'=>$_GET["expirationendyear"], 'month'=>$_GET["expirationendmonth"], 'day'=>$_GET["expirationendday"], 'hour'=>23, 'minute'=>59, 'second'=>59);
$expstopdate = array();
} }
/* }}} */
// status // status
$status = isset($_GET['status']) ? $_GET['status'] : array();
/*
$status = array(); $status = array();
if (isset($_GET["pendingReview"])){ if (isset($_GET["pendingReview"])){
$status[] = S_DRAFT_REV; $status[] = S_DRAFT_REV;
@ -434,6 +386,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
if (isset($_GET["expired"])){ if (isset($_GET["expired"])){
$status[] = S_EXPIRED; $status[] = S_EXPIRED;
} }
*/
/* Do not search for folders if result shall be filtered by status. /* Do not search for folders if result shall be filtered by status.
* If this is not done, unexplainable results will be delivered. * If this is not done, unexplainable results will be delivered.
@ -446,13 +399,10 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
// category // category
$categories = array(); $categories = array();
$categorynames = array();
if(isset($_GET['category']) && $_GET['category']) { if(isset($_GET['category']) && $_GET['category']) {
foreach($_GET['category'] as $catname) { foreach($_GET['category'] as $catid) {
if($catname) { if($cat = $dms->getDocumentCategory($catid)) {
$cat = $dms->getDocumentCategoryByName($catname);
$categories[] = $cat; $categories[] = $cat;
$categorynames[] = $cat->getName();
} }
} }
} }
@ -513,17 +463,17 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
'startFolder'=>$startFolder, 'startFolder'=>$startFolder,
'owner'=>$ownerobjs, 'owner'=>$ownerobjs,
'status'=>$status, 'status'=>$status,
'creationstartdate'=>$creationdate ? $startdate : array(), 'creationstartdate'=>$createstartdate ? $createstartdate : array(),
'creationenddate'=>$creationdate ? $stopdate : array(), 'creationenddate'=>$createenddate ? $createenddate : array(),
'modificationstartdate'=>array(), 'modificationstartdate'=>array(),
'modificationenddate'=>array(), 'modificationenddate'=>array(),
'categories'=>$categories, 'categories'=>$categories,
'attributes'=>$attributes, 'attributes'=>$attributes,
'mode'=>$resultmode, 'mode'=>$resultmode,
'expirationstartdate'=>$expirationdate ? $expstartdate : array(), 'expirationstartdate'=>$expstartdate ? $expstartdate : array(),
'expirationenddate'=>$expirationdate ? $expstopdate : array(), 'expirationenddate'=>$expenddate ? $expenddate : array(),
'statusstartdate'=>$statusdate ? $statusstartdate : array(), 'statusstartdate'=>$statusstartdate ? $statusstartdate : array(),
'statusenddate'=>$statusdate ? $statusstopdate : array(), 'statusenddate'=>$statusenddate ? $statusenddate : array(),
'orderby'=>$orderby 'orderby'=>$orderby
)); ));
$total = $resArr['totalDocs'] + $resArr['totalFolders']; $total = $resArr['totalDocs'] + $resArr['totalFolders'];
@ -593,18 +543,17 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
$view->setParam('searchin', isset($searchin) ? $searchin : array()); $view->setParam('searchin', isset($searchin) ? $searchin : array());
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null); $view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
$view->setParam('owner', $owner); $view->setParam('owner', $owner);
$view->setParam('startdate', isset($startdate) ? $startdate : array()); $view->setParam('createstartdate', $createstartdate ? getReadableDate($createstartts) : '');
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array()); $view->setParam('createenddate', $createenddate ? getReadableDate($createendts) : '');
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array()); $view->setParam('expstartdate', $expstartdate ? getReadableDate($expstartts) : '');
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array()); $view->setParam('expenddate', $expenddate ? getReadableDate($expendts) : '');
$view->setParam('statusstartdate', isset($statusstartdate) ? $statusstartdate : array()); $view->setParam('statusstartdate', $statusstartdate ? getReadableDate($statusstartts) : '');
$view->setParam('statusstopdate', isset($statusstopdate) ? $statusstopdate : array()); $view->setParam('statusenddate', $statusenddate ? getReadableDate($statusendts) : '');
$view->setParam('creationdate', isset($creationdate) ? $creationdate : ''); $view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: ''); $view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
$view->setParam('statusdate', isset($statusdate) ? $statusdate: ''); $view->setParam('statusdate', isset($statusdate) ? $statusdate: '');
$view->setParam('status', isset($status) ? $status : array()); $view->setParam('status', isset($status) ? $status : array());
$view->setParam('categories', isset($categories) ? $categories : ''); $view->setParam('categories', isset($categories) ? $categories : '');
$view->setParam('category', isset($categorynames) ? $categorynames : '');
$view->setParam('mimetype', isset($mimetype) ? $mimetype : ''); $view->setParam('mimetype', isset($mimetype) ? $mimetype : '');
$view->setParam('attributes', isset($attributes) ? $attributes : ''); $view->setParam('attributes', isset($attributes) ? $attributes : '');
$attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all)); $attrdefs = $dms->getAllAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent, SeedDMS_Core_AttributeDefinition::objtype_folder, SeedDMS_Core_AttributeDefinition::objtype_all));

View File

@ -132,17 +132,16 @@ function typeahead() { /* {{{ */
$enablefullsearch = $this->params['enablefullsearch']; $enablefullsearch = $this->params['enablefullsearch'];
$enableclipboard = $this->params['enableclipboard']; $enableclipboard = $this->params['enableclipboard'];
$attributes = $this->params['attributes']; $attributes = $this->params['attributes'];
$category = $this->params['category'];
$categories = $this->params['categories']; $categories = $this->params['categories'];
$mimetype = $this->params['mimetype']; $mimetype = $this->params['mimetype'];
$owner = $this->params['owner']; $owner = $this->params['owner'];
$startfolder = $this->params['startfolder']; $startfolder = $this->params['startfolder'];
$startdate = $this->params['startdate']; $createstartdate = $this->params['createstartdate'];
$stopdate = $this->params['stopdate']; $createenddate = $this->params['createenddate'];
$expstartdate = $this->params['expstartdate']; $expstartdate = $this->params['expstartdate'];
$expstopdate = $this->params['expstopdate']; $expenddate = $this->params['expenddate'];
$statusstartdate = $this->params['statusstartdate']; $statusstartdate = $this->params['statusstartdate'];
$statusstopdate = $this->params['statusstopdate']; $statusenddate = $this->params['statusenddate'];
$creationdate = $this->params['creationdate']; $creationdate = $this->params['creationdate'];
$expirationdate = $this->params['expirationdate']; $expirationdate = $this->params['expirationdate'];
$statusdate = $this->params['statusdate']; $statusdate = $this->params['statusdate'];
@ -161,8 +160,6 @@ function typeahead() { /* {{{ */
$timeout = $this->params['timeout']; $timeout = $this->params['timeout'];
$xsendfile = $this->params['xsendfile']; $xsendfile = $this->params['xsendfile'];
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("search_results")); $this->htmlStartPage(getMLText("search_results"));
$this->globalNavigation(); $this->globalNavigation();
$this->contentStart(); $this->contentStart();
@ -172,7 +169,7 @@ function typeahead() { /* {{{ */
$this->columnStart(4); $this->columnStart(4);
//echo "<pre>";print_r($_GET);echo "</pre>"; //echo "<pre>";print_r($_GET);echo "</pre>";
?> ?>
<ul class="nav nav-tabs" id="searchtab"> <ul class="nav nav-pills" id="searchtab">
<li class="nav-item <?php echo ($fullsearch == false) ? 'active' : ''; ?>"><a class="nav-link <?php echo ($fullsearch == false) ? 'active' : ''; ?>" data-target="#database" data-toggle="tab"><?php printMLText('databasesearch'); ?></a></li> <li class="nav-item <?php echo ($fullsearch == false) ? 'active' : ''; ?>"><a class="nav-link <?php echo ($fullsearch == false) ? 'active' : ''; ?>" data-target="#database" data-toggle="tab"><?php printMLText('databasesearch'); ?></a></li>
<?php <?php
if($enablefullsearch) { if($enablefullsearch) {
@ -184,110 +181,97 @@ function typeahead() { /* {{{ */
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database"> <div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database">
<form action="../out/out.Search.php" name="form1"> <form class="form-horizontal" action="../out/out.Search.php" name="form1">
<input type="hidden" name="fullsearch" value="0" /> <input type="hidden" name="fullsearch" value="0" />
<?php <?php
// Database search Form {{{ // Database search Form {{{
$this->contentContainerStart(); $this->contentContainerStart();
?>
<table class="table-condensed">
<tr>
<td><?php printMLText("search_query");?>:</td>
<td>
<input type="text" name="query" value="<?php echo htmlspecialchars($this->query); ?>" />
<select name="mode">
<option value="1" <?php echo ($mode=='AND') ? "selected" : ""; ?>><?php printMLText("search_mode_and");?>
<option value="0"<?php echo ($mode=='OR') ? "selected" : ""; ?>><?php printMLText("search_mode_or");?>
</select>
</td>
</tr>
<tr>
<td><?php printMLText("search_in");?>:</td>
<td>
<label class="checkbox" for="keywords"><input type="checkbox" id="keywords" name="searchin[]" value="1" <?php if(in_array('1', $searchin)) echo " checked"; ?>><?php printMLText("keywords");?> (<?php printMLText('documents_only'); ?>)</label>
<label class="checkbox" for="searchName"><input type="checkbox" name="searchin[]" id="searchName" value="2" <?php if(in_array('2', $searchin)) echo " checked"; ?>><?php printMLText("name");?></label>
<label class="checkbox" for="comment"><input type="checkbox" name="searchin[]" id="comment" value="3" <?php if(in_array('3', $searchin)) echo " checked"; ?>><?php printMLText("comment");?></label>
<label class="checkbox" for="attributes"><input type="checkbox" name="searchin[]" id="attributes" value="4" <?php if(in_array('4', $searchin)) echo " checked"; ?>><?php printMLText("attributes");?></label>
<label class="checkbox" for="id"><input type="checkbox" name="searchin[]" id="id" value="5" <?php if(in_array('5', $searchin)) echo " checked"; ?>><?php printMLText("id");?></label>
</td>
</tr>
<tr>
<td><?php printMLText("owner");?>:</td>
<td>
<select class="chzn-select" name="owner[]" data-allow-clear="true" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<option value=""></option>
<?php
foreach ($allUsers as $userObj) {
if ($userObj->isGuest() || ($userObj->isHidden() && $userObj->getID() != $user->getID() && !$user->isAdmin()))
continue;
print "<option value=\"".$userObj->getLogin()."\" ".(in_array($userObj->getLogin(), $owner) ? "selected" : "").">" . htmlspecialchars($userObj->getLogin()." - ".$userObj->getFullName()) . "</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><?php printMLText("search_resultmode");?>:</td>
<td>
<select name="resultmode" class="form-control">
<option value="1"<?php echo ($resultmode=='1') ? "selected" : ""; ?>><?php printMLText("search_mode_documents");?>
<option value="2"<?php echo ($resultmode=='2') ? "selected" : ""; ?>><?php printMLText("search_mode_folders");?>
<option value="3" <?php echo ($resultmode=='3') ? "selected" : ""; ?>><?php printMLText("search_resultmode_both");?>
</select>
</td>
</tr>
<tr>
<td><?php printMLText("under_folder")?>:</td>
<td><?php $this->printFolderChooserHtml("form1", M_READ, -1, $startfolder);?></td>
</tr>
<tr>
<td><?php printMLText("creation_date");?>:</td>
<td>
<label class="checkbox inline">
<input type="checkbox" name="creationdate" value="true" <?php if($creationdate) echo "checked"; ?>/><?php printMLText("between");?>
</label><br />
<span class="input-append date" style="display: inline;" id="createstartdate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
<input class="span4" size="16" name="createstart" type="text" value="<?php if($startdate) printf("%04d-%02d-%02d", $startdate['year'], $startdate['month'], $startdate['day']); else echo date('Y-m-d'); ?>">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>&nbsp;
<?php printMLText("and"); ?>
<span class="input-append date" style="display: inline;" id="createenddate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>">
<input class="span4" size="16" name="createend" type="text" value="<?php if($stopdate) printf("%04d-%02d-%02d", $stopdate['year'], $stopdate['month'], $stopdate['day']); else echo date('Y-m-d'); ?>">
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>
</td>
</tr>
<?php $this->formField(
getMLText("search_query"),
array(
'element'=>'input',
'name'=>'query',
'value'=>htmlspecialchars($this->query)
)
);
$options = array();
$options[] = array('1', getMLText('search_mode_and'), $mode=='AND');
$options[] = array('0', getMLText('search_mode_or'), $mode=='OR');
$this->formField(
getMLText("search_mode"),
array(
'element'=>'select',
'name'=>'mode',
'multiple'=>false,
'options'=>$options
)
);
$options = array();
$options[] = array('1', getMLText('keywords').' ('.getMLText('documents_only').')', in_array('1', $searchin));
$options[] = array('2', getMLText('name'), in_array('2', $searchin));
$options[] = array('3', getMLText('comment'), in_array('3', $searchin));
$options[] = array('4', getMLText('attributes'), in_array('4', $searchin));
$options[] = array('5', getMLText('id'), in_array('5', $searchin));
$this->formField(
getMLText("search_in"),
array(
'element'=>'select',
'name'=>'searchin[]',
'class'=>'chzn-select',
'multiple'=>true,
'options'=>$options
)
);
$options = array();
foreach ($allUsers as $currUser) {
if($user->isAdmin() || (!$currUser->isGuest() && (!$currObj->isHidden() || $currObj->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
)
);
$options = array();
$options[] = array('1', getMLText('search_mode_documents'), $resultmode==1);
$options[] = array('2', getMLText('search_mode_folders'), $resultmode==2);
$options[] = array('3', getMLText('search_resultmode_both'), $resultmode==3);
$this->formField(
getMLText("search_resultmode"),
array(
'element'=>'select',
'name'=>'resultmode',
'multiple'=>false,
'options'=>$options
)
);
$this->formField(getMLText("under_folder"), $this->getFolderChooserHtml("form1", M_READ, -1, $startfolder));
$this->formField(
getMLText("creation_date")." (".getMLText('from').")",
$this->getDateChooser($createstartdate, "createstart", $this->params['session']->getLanguage())
);
$this->formField(
getMLText("creation_date")." (".getMLText('to').")",
$this->getDateChooser($createenddate, "createend", $this->params['session']->getLanguage())
);
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
?> if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
<tr> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
<td> } else
<?php $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
echo $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from').'&nbsp; '.getMLText('to').' '.$this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to');
else
$this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)
?>
</td>
</tr>
<?php
} }
} }
} }
?> $this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
<tr>
<td></td><td><button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
</tr>
</table>
<?php
$this->contentContainerEnd(); $this->contentContainerEnd();
/* First check if any of the folder filters are set. If it is, /* First check if any of the folder filters are set. If it is,
@ -296,14 +280,13 @@ function typeahead() { /* {{{ */
$openfilterdlg = false; $openfilterdlg = false;
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
if(!empty($attributes[$attrdef->getID()])) if(!empty($attributes[$attrdef->getID()]))
$openfilterdlg = true; $openfilterdlg = true;
} }
} }
} }
if($category) if($categories)
$openfilterdlg = true; $openfilterdlg = true;
if($status) if($status)
$openfilterdlg = true; $openfilterdlg = true;
@ -311,159 +294,109 @@ function typeahead() { /* {{{ */
$openfilterdlg = true; $openfilterdlg = true;
if($statusdate) if($statusdate)
$openfilterdlg = true; $openfilterdlg = true;
?>
<div class="accordion" id="accordion2"> /* Start of fields only applicable to documents */
<div class="accordion-group"> ob_start();
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion2" href="#collapseOne">
<?php printMLText('filter_for_documents'); ?>
</a>
</div>
<div id="collapseOne" class="accordion-body <?php if(!$openfilterdlg) echo "collapse";?>" style="_height: 0px;">
<div class="accordion-inner">
<table class="table-condensed">
<tr>
<td><?php printMLText("category");?>:</td>
<td>
<select class="chzn-select" name="category[]" multiple="multiple" data-placeholder="<?php printMLText('select_category'); ?>" data-no_results_text="<?php printMLText('unknown_document_category'); ?>">
<!--
<option value="-1"><?php printMLText("all_categories");?>
-->
<?php
$tmpcatids = array(); $tmpcatids = array();
foreach($categories as $tmpcat) foreach($categories as $tmpcat)
$tmpcatids[] = $tmpcat->getID(); $tmpcatids[] = $tmpcat->getID();
foreach ($allCats as $catObj) { $options = array();
print "<option value=\"".$catObj->getName()."\" ".(in_array($catObj->getID(), $tmpcatids) ? "selected" : "").">" . htmlspecialchars($catObj->getName()) . "\n"; $allcategories = $dms->getDocumentCategories();
foreach($allcategories as $category) {
$options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids));
} }
?> $this->formField(
</select> getMLText("categories"),
</td> array(
</tr> 'element'=>'select',
<tr> 'class'=>'chzn-select',
<td><?php printMLText("status");?>:</td> 'name'=>'category[]',
<td> 'multiple'=>true,
<?php if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { ?> 'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
<?php if($workflowmode == 'traditional') { ?> 'options'=>$options
<label class="checkbox" for='pendingReview'><input type="checkbox" id="pendingReview" name="pendingReview" value="1" <?php echo in_array(S_DRAFT_REV, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_DRAFT_REV);?></label> )
<?php } ?> );
<label class="checkbox" for='pendingApproval'><input type="checkbox" id="pendingApproval" name="pendingApproval" value="1" <?php echo in_array(S_DRAFT_APP, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_DRAFT_APP);?></label> $options = array();
<?php } elseif($workflowmode == 'advanced') { ?> if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
<label class="checkbox" for='inWorkflow'><input type="checkbox" id="inWorkflow" name="inWorkflow" value="1" <?php echo in_array(S_IN_WORKFLOW, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_IN_WORKFLOW);?></label> if($workflowmode == 'traditional') {
<?php } ?> $options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status));
<label class="checkbox" for='released'><input type="checkbox" id="released" name="released" value="1" <?php echo in_array(S_RELEASED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_RELEASED);?></label> }
<label class="checkbox" for='rejected'><input type="checkbox" id="rejected" name="rejected" value="1" <?php echo in_array(S_REJECTED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_REJECTED);?></label> } elseif($workflowmode == 'advanced') {
<label class="checkbox" for='obsolete'><input type="checkbox" id="obsolete" name="obsolete" value="1" <?php echo in_array(S_OBSOLETE, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_OBSOLETE);?></label> $options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status));
<label class="checkbox" for='expired'><input type="checkbox" id="expired" name="expired" value="1" <?php echo in_array(S_EXPIRED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_EXPIRED);?></label> }
</td> $options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status));
</tr> $options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status));
<tr> $options[] = array(S_REJECTED, getOverallStatusText(S_REJECTED), in_array(S_REJECTED, $status));
<td><?php printMLText("expires");?>:</td> $options[] = array(S_EXPIRED, getOverallStatusText(S_EXPIRED), in_array(S_EXPIRED, $status));
<td> $options[] = array(S_OBSOLETE, getOverallStatusText(S_OBSOLETE), in_array(S_OBSOLETE, $status));
<label class="checkbox inline"> $this->formField(
<input type="checkbox" name="expirationdate" value="true" <?php if($expirationdate) echo "checked"; ?>/><?php printMLText("between");?> getMLText("status"),
</label><br /> array(
<span class="input-append date" style="display: inline;" id="expirationstartdate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>"> 'element'=>'select',
<input class="span4" size="16" name="expirationstart" type="text" value="<?php if($expstartdate) printf("%04d-%02d-%02d", $expstartdate['year'], $expstartdate['month'], $expstartdate['day']); else echo date('Y-m-d'); ?>"> 'class'=>'chzn-select',
<span class="add-on"><i class="fa fa-calendar"></i></span> 'name'=>'status[]',
</span>&nbsp; 'multiple'=>true,
<?php printMLText("and"); ?> 'attributes'=>array(array('data-placeholder', getMLText('select_status')), array('data-no_results_text', getMLText('unknown_status'))),
<span class="input-append date" style="display: inline;" id="expirationenddate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>"> 'options'=>$options
<input class="span4" size="16" name="expirationend" type="text" value="<?php if($expstopdate) printf("%04d-%02d-%02d", $expstopdate['year'], $expstopdate['month'], $expstopdate['day']); else echo date('Y-m-d'); ?>"> )
<span class="add-on"><i class="fa fa-calendar"></i></span> );
</span> $this->formField(
</td> getMLText("expires")." (".getMLText('from').")",
</tr> $this->getDateChooser($expstartdate, "expirationstart", $this->params['session']->getLanguage())
<tr> );
<td><?php printMLText("status_change");?>:</td> $this->formField(
<td> getMLText("expires")." (".getMLText('to').")",
<label class="checkbox inline"> $this->getDateChooser($expenddate, "expirationend", $this->params['session']->getLanguage())
<input type="checkbox" name="statusdate" value="true" <?php if($statusdate) echo "checked"; ?>/><?php printMLText("between");?> );
</label><br /> $this->formField(
<span class="input-append date datepicker" style="display: inline;" id="statusstartdate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>"> getMLText("status_change")." (".getMLText('from').")",
<input class="span4" size="16" name="statusstart" type="text" value="<?php if($statusstartdate) printf("%04d-%02d-%02d", $statusstartdate['year'], $statusstartdate['month'], $statusstartdate['day']); else echo date('Y-m-d'); ?>"> $this->getDateChooser($statusstartdate, "statusdatestart", $this->params['session']->getLanguage())
<span class="add-on"><i class="fa fa-calendar"></i></span> );
</span>&nbsp; $this->formField(
<?php printMLText("and"); ?> getMLText("status_change")." (".getMLText('to').")",
<span class="input-append date datepicker" style="display: inline;" id="statusenddate" data-date="<?php echo date('Y-m-d'); ?>" data-date-format="yyyy-mm-dd" data-date-language="<?php echo str_replace('_', '-', $this->params['session']->getLanguage()); ?>"> $this->getDateChooser($statusenddate, "statusdateend", $this->params['session']->getLanguage())
<input class="span4" size="16" name="statusend" type="text" value="<?php if($statusstopdate) printf("%04d-%02d-%02d", $statusstopdate['year'], $statusstopdate['month'], $statusstopdate['day']); else echo date('Y-m-d'); ?>"> );
<span class="add-on"><i class="fa fa-calendar"></i></span>
</span>
</td>
</tr>
<?php
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
?> if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
<tr> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
<td> } else
<?php $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date)
echo $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from').'&nbsp; '.getMLText('to').' '.$this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to');
else
$this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true)
?></td>
</tr>
<?php
} }
} }
} }
?> ?>
</table>
</div>
</div>
</div>
</div>
<?php <?php
$content = ob_get_clean();
$this->printAccordion(getMLText('filter_for_documents'), $content);
/* First check if any of the folder filters are set. If it is, /* First check if any of the folder filters are set. If it is,
* open the accordion. * open the accordion.
*/ */
$openfilterdlg = false; $openfilterdlg = false;
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
if(!empty($attributes[$attrdef->getID()])) if(!empty($attributes[$attrdef->getID()]))
$openfilterdlg = true; $openfilterdlg = true;
} }
} }
} }
?> ob_start();
<div class="accordion" id="accordion3">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion3" href="#collapseFolder">
<?php printMLText('filter_for_folders'); ?>
</a>
</div>
<div id="collapseFolder" class="accordion-body <?php if(!$openfilterdlg) echo "collapse";?>" style="_height: 0px;">
<div class="accordion-inner">
<table class="table-condensed">
<?php
if($attrdefs) { if($attrdefs) {
foreach($attrdefs as $attrdef) { foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) { if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
?> if($attrdef->getType() == SeedDMS_Core_AttributeDefinition::type_date) {
<tr> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('from').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['from']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['from'])) : '', 'attributes', true, 'from'));
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td> $this->formField(htmlspecialchars($attrdef->getName().' ('.getMLText('to').')'), $this->getAttributeEditField($attrdef, !empty($attributes[$attrdef->getID()]['to']) ? getReadableDate(makeTsFromDate($attributes[$attrdef->getID()]['to'])) : '', 'attributes', true, 'to'));
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true) ?></td> } else
</tr> $this->formField(htmlspecialchars($attrdef->getName()), $this->getAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true));
<?php
} }
} }
} }
?> $content = ob_get_clean();
</table> $this->printAccordion(getMLText('filter_for_folders'), $content);
</div>
</div>
</div>
</div>
<?php
// }}} // }}}
?> ?>
</form> </form>
@ -471,84 +404,85 @@ function typeahead() { /* {{{ */
<?php <?php
if($enablefullsearch) { if($enablefullsearch) {
echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n"; echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n";
$this->contentContainerStart();
?> ?>
<form action="../out/out.Search.php" name="form2" style="min-height: 330px;"> <form action="../out/out.Search.php" name="form2" style="min-height: 330px;">
<input type="hidden" name="fullsearch" value="1" /> <input type="hidden" name="fullsearch" value="1" />
<table class="table-condensed">
<tr>
<td><?php printMLText("search_query");?>:</td>
<td>
<input type="text" class="form-control" name="query" value="<?php echo htmlspecialchars($this->query); ?>" />
<!--
<select name="mode">
<option value="1" selected><?php printMLText("search_mode_and");?>
<option value="0"><?php printMLText("search_mode_or");?>
</select>
-->
</td>
</tr>
<?php if(!isset($facets['owner'])) { ?>
<tr>
<td><?php printMLText("owner");?>:</td>
<td>
<select class="chzn-select" name="owner[]" data-allow-clear="true" data-placeholder="<?php printMLText('select_users'); ?>" data-no_results_text="<?php printMLText('unknown_owner'); ?>">
<option value=""></option>
<?php <?php
foreach ($allUsers as $userObj) { $this->contentContainerStart();
if ($userObj->isGuest() || ($userObj->isHidden() && $userObj->getID() != $user->getID() && !$user->isAdmin())) $this->formField(
continue; getMLText("search_query"),
print "<option value=\"".$userObj->getLogin()."\" ".(in_array($userObj->getLogin(), $owner) ? "selected" : "").">" . htmlspecialchars($userObj->getLogin()." - ".$userObj->getFullName()) . "</option>\n"; array(
'element'=>'input',
'name'=>'query',
'value'=>htmlspecialchars($this->query)
)
);
$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() && (!$currObj->isHidden() || $currObj->getID() == $user->getID())))
$options[] = array($currUser->getID(), htmlspecialchars($currUser->getLogin()), in_array($currUser->getID(), $owner), array(array('data-subtitle', htmlspecialchars($currUser->getFullName()))));
} }
?> $this->formField(
</select> getMLText("owner"),
</td> array(
</tr> 'element'=>'select',
<?php } ?> 'name'=>'owner[]',
<?php if(!isset($facets['category'])) { ?> 'class'=>'chzn-select',
<tr> 'multiple'=>true,
<td><?php printMLText("category_filter");?>:</td> 'options'=>$options
<td> )
<select class="chzn-select" name="categoryids[]" multiple="multiple" data-placeholder="<?php printMLText('select_category'); ?>" data-no_results_text="<?php printMLText('unknown_document_category'); ?>"> );
<!-- }
<option value="-1"><?php printMLText("all_categories");?> if(!isset($facets['category'])) {
-->
<?php
$tmpcatids = array(); $tmpcatids = array();
foreach($categories as $tmpcat) foreach($categories as $tmpcat)
$tmpcatids[] = $tmpcat->getID(); $tmpcatids[] = $tmpcat->getID();
foreach ($allCats as $catObj) { $options = array();
print "<option value=\"".$catObj->getID()."\" ".(in_array($catObj->getID(), $tmpcatids) ? "selected" : "").">" . htmlspecialchars($catObj->getName()) . "\n"; $allcategories = $dms->getDocumentCategories();
foreach($allcategories as $category) {
$options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids));
} }
?> $this->formField(
</select> getMLText("category_filter"),
</td> array(
</tr> 'element'=>'select',
<?php } ?> 'class'=>'chzn-select',
<tr> 'name'=>'category[]',
<td><?php printMLText("status");?>:</td> 'multiple'=>true,
<td> 'attributes'=>array(array('data-placeholder', getMLText('select_category'), array('data-no_results_text', getMLText('unknown_document_category')))),
<?php if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { ?> 'options'=>$options
<?php if($workflowmode == 'traditional') { ?> )
<label class="checkbox" for='pendingReview'><input type="checkbox" id="pendingReview" name="pendingReview" value="1" <?php echo in_array(S_DRAFT_REV, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_DRAFT_REV);?></label> );
<?php } ?> }
<label class="checkbox" for='pendingApproval'><input type="checkbox" id="pendingApproval" name="pendingApproval" value="1" <?php echo in_array(S_DRAFT_APP, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_DRAFT_APP);?></label> $options = array();
<?php } elseif($workflowmode == 'advanced') { ?> if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') {
<label class="checkbox" for='inWorkflow'><input type="checkbox" id="inWorkflow" name="inWorkflow" value="1" <?php echo in_array(S_IN_WORKFLOW, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_IN_WORKFLOW);?></label> if($workflowmode == 'traditional') {
<?php } ?> $options[] = array(S_DRAFT_REV, getOverallStatusText(S_DRAFT_REV), in_array(S_DRAFT_REV, $status));
<label class="checkbox" for='released'><input type="checkbox" id="released" name="released" value="1" <?php echo in_array(S_RELEASED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_RELEASED);?></label> }
<label class="checkbox" for='rejected'><input type="checkbox" id="rejected" name="rejected" value="1" <?php echo in_array(S_REJECTED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_REJECTED);?></label> } elseif($workflowmode == 'advanced') {
<label class="checkbox" for='obsolete'><input type="checkbox" id="obsolete" name="obsolete" value="1" <?php echo in_array(S_OBSOLETE, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_OBSOLETE);?></label> $options[] = array(S_IN_WORKFLOW, getOverallStatusText(S_IN_WORKFLOW), in_array(S_IN_WORKFLOW, $status));
<label class="checkbox" for='expired'><input type="checkbox" id="expired" name="expired" value="1" <?php echo in_array(S_EXPIRED, $status) ? "checked" : ""; ?>><?php printOverallStatusText(S_EXPIRED);?></label> }
</td> $options[] = array(S_DRAFT_APP, getOverallStatusText(S_DRAFT_APP), in_array(S_DRAFT_APP, $status));
</tr> $options[] = array(S_RELEASED, getOverallStatusText(S_RELEASED), in_array(S_RELEASED, $status));
<?php if($facets) { $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) { foreach($facets as $facetname=>$values) {
?>
<tr>
<td><?= getMLText($facetname);?>:</td>
<td>
<?php
$options = array(); $options = array();
foreach($values as $v=>$c) { foreach($values as $v=>$c) {
$option = array($v, $v.' ('.$c.')'); $option = array($v, $v.' ('.$c.')');
@ -557,7 +491,7 @@ foreach($facets as $facetname=>$values) {
$options[] = $option; $options[] = $option;
} }
$this->formField( $this->formField(
null, getMLText($facetname),
array( array(
'element'=>'select', 'element'=>'select',
'id'=>$facetname, 'id'=>$facetname,
@ -568,18 +502,13 @@ foreach($facets as $facetname=>$values) {
'multiple'=>true 'multiple'=>true
) )
); );
}
}
$this->contentContainerEnd();
$this->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
?> ?>
</td>
</tr>
<?php }} ?>
<tr>
<td></td><td><button type="submit" class="btn btn-primary"><i class="fa fa-search"></i> <?php printMLText("search"); ?></button></td>
</tr>
</table>
</form> </form>
<?php <?php
$this->contentContainerEnd();
echo "</div>\n"; echo "</div>\n";
} }
?> ?>
@ -599,7 +528,7 @@ foreach($facets as $facetname=>$values) {
} }
} }
*/ */
print "<div class=\"alert alert-info\">".getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime))."</div>"; echo $this->infoMsg(getMLText("search_report", array("doccount" => $totaldocs, "foldercount" => $totalfolders, 'searchtime'=>$searchTime)));
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); $this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart(); // $this->contentContainerStart();
@ -609,7 +538,7 @@ foreach($facets as $facetname=>$values) {
else { else {
parse_str($_SERVER['QUERY_STRING'], $tmp); parse_str($_SERVER['QUERY_STRING'], $tmp);
$tmp['orderby'] = $orderby=="n"||$orderby=="na)"?"nd":"n"; $tmp['orderby'] = $orderby=="n"||$orderby=="na)"?"nd":"n";
print "<table class=\"table table-hover\">"; print "<table class=\"table table-condensed table-sm table-hover\">";
print "<thead>\n<tr>\n"; print "<thead>\n<tr>\n";
print "<th></th>\n"; print "<th></th>\n";
print "<th>".getMLText("name"); print "<th>".getMLText("name");
@ -646,7 +575,7 @@ foreach($facets as $facetname=>$values) {
$lcattributes = $lc ? $lc->getAttributes() : null; $lcattributes = $lc ? $lc->getAttributes() : null;
$attrstr = ''; $attrstr = '';
if($lcattributes) { if($lcattributes) {
$attrstr .= "<table class=\"table table-condensed\">\n"; $attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>"; $attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($lcattributes as $lcattribute) { foreach($lcattributes as $lcattribute) {
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute); $arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
@ -668,7 +597,7 @@ foreach($facets as $facetname=>$values) {
} }
$docattributes = $document->getAttributes(); $docattributes = $document->getAttributes();
if($docattributes) { if($docattributes) {
$attrstr .= "<table class=\"table table-condensed\">\n"; $attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>"; $attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($docattributes as $docattribute) { foreach($docattributes as $docattribute) {
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute); $arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
@ -689,7 +618,7 @@ foreach($facets as $facetname=>$values) {
$extracontent = array(); $extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($document); $extracontent['below_title'] = $this->getListRowPath($document);
if($attrstr) if($attrstr)
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true); $extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
print $this->documentListRow($document, $previewer, false, 0, $extracontent); print $this->documentListRow($document, $previewer, false, 0, $extracontent);
} }
} elseif($entry->isType('folder')) { } elseif($entry->isType('folder')) {
@ -708,7 +637,7 @@ foreach($facets as $facetname=>$values) {
$attrstr = ''; $attrstr = '';
$folderattributes = $folder->getAttributes(); $folderattributes = $folder->getAttributes();
if($folderattributes) { if($folderattributes) {
$attrstr .= "<table class=\"table table-condensed\">\n"; $attrstr .= "<table class=\"table table-condensed table-sm\">\n";
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>"; $attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
foreach($folderattributes as $folderattribute) { foreach($folderattributes as $folderattribute) {
$attrdef = $folderattribute->getAttributeDefinition(); $attrdef = $folderattribute->getAttributeDefinition();
@ -719,7 +648,7 @@ foreach($facets as $facetname=>$values) {
$extracontent = array(); $extracontent = array();
$extracontent['below_title'] = $this->getListRowPath($folder); $extracontent['below_title'] = $this->getListRowPath($folder);
if($attrstr) if($attrstr)
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true); $extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
print $this->folderListRow($folder, false, $extracontent); print $this->folderListRow($folder, false, $extracontent);
} }
} }
@ -730,7 +659,7 @@ foreach($facets as $facetname=>$values) {
} else { } else {
$numResults = $totaldocs + $totalfolders; $numResults = $totaldocs + $totalfolders;
if ($numResults == 0) { if ($numResults == 0) {
print "<div class=\"alert alert-error\">".getMLText("search_no_results")."</div>"; echo $this->warningMsg(getMLText("search_no_results"));
} }
} }
// }}} // }}}