mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
redo the search form
This commit is contained in:
parent
805dbe212a
commit
e870e2071b
|
@ -64,15 +64,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
$categories = array();
|
||||
$categorynames = array();
|
||||
if(isset($_GET['category']) && $_GET['category']) {
|
||||
foreach($_GET['category'] as $catname) {
|
||||
if($catname) {
|
||||
$cat = $dms->getDocumentCategoryByName($catname);
|
||||
$categories[] = $cat;
|
||||
$categorynames[] = $cat->getName();
|
||||
}
|
||||
}
|
||||
} elseif(isset($_GET['categoryids']) && $_GET['categoryids']) {
|
||||
foreach($_GET['categoryids'] as $catid) {
|
||||
foreach($_GET['category'] as $catid) {
|
||||
if($catid) {
|
||||
$cat = $dms->getDocumentCategory($catid);
|
||||
$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
|
||||
// document owner.
|
||||
$owner = [];
|
||||
$ownernames = [];
|
||||
if (isset($_GET["owner"])) {
|
||||
$owner = $_GET['owner'];
|
||||
if (!is_array($_GET['owner'])) {
|
||||
if(!empty($_GET['owner']) && $o = $dms->getUserByLogin($_GET['owner']))
|
||||
$owner[] = $o->getLogin();
|
||||
if(!empty($_GET['owner']) && $o = $dms->getUser($_GET['owner']))
|
||||
$ownernames[] = $o->getLogin();
|
||||
else
|
||||
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
||||
} else {
|
||||
foreach($_GET["owner"] as $l) {
|
||||
if($l && $o = $dms->getUserByLogin($l))
|
||||
$owner[] = $o->getLogin();
|
||||
if($l && $o = $dms->getUser($l))
|
||||
$ownernames[] = $o->getLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,34 +128,16 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
}
|
||||
|
||||
// status
|
||||
$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;
|
||||
}
|
||||
if(isset($_GET['status']))
|
||||
$status = $_GET['status'];
|
||||
else
|
||||
$status = array();
|
||||
|
||||
// Check to see if the search has been restricted to a particular sub-tree in
|
||||
// the folder hierarchy.
|
||||
$startFolder = null;
|
||||
if (isset($_GET["targetid"]) && is_numeric($_GET["targetid"]) && $_GET["targetid"]>0) {
|
||||
$targetid = $_GET["targetid"];
|
||||
if (isset($_GET["folderfullsearchid"]) && is_numeric($_GET["folderfullsearchid"]) && $_GET["folderfullsearchid"]>0) {
|
||||
$targetid = $_GET["folderfullsearchid"];
|
||||
$startFolder = $dms->getFolder($targetid);
|
||||
if (!is_object($startFolder)) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_folder_id"));
|
||||
|
@ -188,7 +164,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
$index = $fulltextservice->Indexer();
|
||||
if($index) {
|
||||
$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) {
|
||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||
$dcount = 0;
|
||||
|
@ -313,105 +289,81 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
$owner = array();
|
||||
$ownerobjs = array();
|
||||
if (isset($_GET["owner"])) {
|
||||
$owner = $_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;
|
||||
$owner = $o->getLogin();
|
||||
} else
|
||||
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
||||
} else {
|
||||
foreach($_GET["owner"] as $l) {
|
||||
if($o = $dms->getUserByLogin($l)) {
|
||||
if($o = $dms->getUser($l)) {
|
||||
$ownerobjs[] = $o;
|
||||
$owner[] = $o->getLogin();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Is the search restricted to documents created between two specific dates?
|
||||
$startdate = array();
|
||||
$stopdate = array();
|
||||
if (isset($_GET["creationdate"]) && $_GET["creationdate"]!=null) {
|
||||
$creationdate = true;
|
||||
} else {
|
||||
$creationdate = false;
|
||||
/* Creation date {{{ */
|
||||
$createstartdate = array();
|
||||
$createenddate = array();
|
||||
if(!empty($_GET["createstart"])) {
|
||||
$createstartts = makeTsFromDate($_GET["createstart"]);
|
||||
$createstartdate = array('year'=>(int)date('Y', $createstartts), 'month'=>(int)date('m', $createstartts), 'day'=>(int)date('d', $createstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
}
|
||||
|
||||
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'])) {
|
||||
if ($createstartdate && !checkdate($createstartdate['month'], $createstartdate['day'], $createstartdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_create_date_end"));
|
||||
}
|
||||
if(isset($_GET["createend"])) {
|
||||
$tmp = explode("-", $_GET["createend"]);
|
||||
$stopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], '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(!empty($_GET["createend"])) {
|
||||
$createendts = makeTsFromDate($_GET["createend"]);
|
||||
$createenddate = array('year'=>(int)date('Y', $createendts), 'month'=>(int)date('m', $createendts), 'day'=>(int)date('d', $createendts), '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"));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Status date {{{ */
|
||||
$statusstartdate = array();
|
||||
$statusstopdate = array();
|
||||
if (isset($_GET["statusdate"]) && $_GET["statusdate"]!=null) {
|
||||
$statusdate = true;
|
||||
} else {
|
||||
$statusdate = false;
|
||||
$statusenddate = array();
|
||||
if(!empty($_GET["statusdatestart"])) {
|
||||
$statusstartts = makeTsFromDate($_GET["statusdatestart"]);
|
||||
$statusstartdate = array('year'=>(int)date('Y', $statusstartts), 'month'=>(int)date('m', $statusstartts), 'day'=>(int)date('d', $statusstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
}
|
||||
|
||||
if(isset($_GET["statusstart"])) {
|
||||
$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'], $statusstartdate['day'], $statusstartdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_status_date_start"));
|
||||
}
|
||||
if ($statusstartdate && !checkdate($statusstartdate['month'], $startdate['day'], $startdate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end"));
|
||||
}
|
||||
if(isset($_GET["statusend"])) {
|
||||
$tmp = explode("-", $_GET["statusend"]);
|
||||
$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'])) {
|
||||
if(!empty($_GET["statusdateend"])) {
|
||||
$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 ($statusenddate && !checkdate($statusenddate['month'], $statusenddate['day'], $statusenddate['year'])) {
|
||||
UI::exitError(getMLText("search"),getMLText("invalid_status_date_end"));
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
/* Expiration date {{{ */
|
||||
$expstartdate = array();
|
||||
$expstopdate = array();
|
||||
if (isset($_GET["expirationdate"]) && $_GET["expirationdate"]!=null) {
|
||||
$expirationdate = true;
|
||||
} else {
|
||||
$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);
|
||||
$expenddate = array();
|
||||
if(!empty($_GET["expirationstart"])) {
|
||||
$expstartts = makeTsFromDate($_GET["expirationstart"]);
|
||||
$expstartdate = array('year'=>(int)date('Y', $expstartts), 'month'=>(int)date('m', $expstartts), 'day'=>(int)date('d', $expstartts), 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
if (!checkdate($expstartdate['month'], $expstartdate['day'], $expstartdate['year'])) {
|
||||
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"]) {
|
||||
$tmp = explode("-", $_GET["expirationend"]);
|
||||
$expstopdate = array('year'=>(int)$tmp[0], 'month'=>(int)$tmp[1], 'day'=>(int)$tmp[2], 'hour'=>0, 'minute'=>0, 'second'=>0);
|
||||
if (!checkdate($expstopdate['month'], $expstopdate['day'], $expstopdate['year'])) {
|
||||
if(!empty($_GET["expirationend"])) {
|
||||
$expendts = makeTsFromDate($_GET["expirationend"]);
|
||||
$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($expenddate['month'], $expenddate['day'], $expenddate['year'])) {
|
||||
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 = isset($_GET['status']) ? $_GET['status'] : array();
|
||||
/*
|
||||
$status = array();
|
||||
if (isset($_GET["pendingReview"])){
|
||||
$status[] = S_DRAFT_REV;
|
||||
|
@ -434,6 +386,7 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
if (isset($_GET["expired"])){
|
||||
$status[] = S_EXPIRED;
|
||||
}
|
||||
*/
|
||||
|
||||
/* Do not search for folders if result shall be filtered by status.
|
||||
* If this is not done, unexplainable results will be delivered.
|
||||
|
@ -446,13 +399,10 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
|
||||
// category
|
||||
$categories = array();
|
||||
$categorynames = array();
|
||||
if(isset($_GET['category']) && $_GET['category']) {
|
||||
foreach($_GET['category'] as $catname) {
|
||||
if($catname) {
|
||||
$cat = $dms->getDocumentCategoryByName($catname);
|
||||
foreach($_GET['category'] as $catid) {
|
||||
if($cat = $dms->getDocumentCategory($catid)) {
|
||||
$categories[] = $cat;
|
||||
$categorynames[] = $cat->getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -513,17 +463,17 @@ if(((!isset($_GET["fullsearch"]) && $settings->_defaultSearchMethod == 'fulltext
|
|||
'startFolder'=>$startFolder,
|
||||
'owner'=>$ownerobjs,
|
||||
'status'=>$status,
|
||||
'creationstartdate'=>$creationdate ? $startdate : array(),
|
||||
'creationenddate'=>$creationdate ? $stopdate : array(),
|
||||
'creationstartdate'=>$createstartdate ? $createstartdate : array(),
|
||||
'creationenddate'=>$createenddate ? $createenddate : array(),
|
||||
'modificationstartdate'=>array(),
|
||||
'modificationenddate'=>array(),
|
||||
'categories'=>$categories,
|
||||
'attributes'=>$attributes,
|
||||
'mode'=>$resultmode,
|
||||
'expirationstartdate'=>$expirationdate ? $expstartdate : array(),
|
||||
'expirationenddate'=>$expirationdate ? $expstopdate : array(),
|
||||
'statusstartdate'=>$statusdate ? $statusstartdate : array(),
|
||||
'statusenddate'=>$statusdate ? $statusstopdate : array(),
|
||||
'expirationstartdate'=>$expstartdate ? $expstartdate : array(),
|
||||
'expirationenddate'=>$expenddate ? $expenddate : array(),
|
||||
'statusstartdate'=>$statusstartdate ? $statusstartdate : array(),
|
||||
'statusenddate'=>$statusenddate ? $statusenddate : array(),
|
||||
'orderby'=>$orderby
|
||||
));
|
||||
$total = $resArr['totalDocs'] + $resArr['totalFolders'];
|
||||
|
@ -593,18 +543,17 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
|||
$view->setParam('searchin', isset($searchin) ? $searchin : array());
|
||||
$view->setParam('startfolder', isset($startFolder) ? $startFolder : null);
|
||||
$view->setParam('owner', $owner);
|
||||
$view->setParam('startdate', isset($startdate) ? $startdate : array());
|
||||
$view->setParam('stopdate', isset($stopdate) ? $stopdate : array());
|
||||
$view->setParam('expstartdate', isset($expstartdate) ? $expstartdate : array());
|
||||
$view->setParam('expstopdate', isset($expstopdate) ? $expstopdate : array());
|
||||
$view->setParam('statusstartdate', isset($statusstartdate) ? $statusstartdate : array());
|
||||
$view->setParam('statusstopdate', isset($statusstopdate) ? $statusstopdate : array());
|
||||
$view->setParam('createstartdate', $createstartdate ? getReadableDate($createstartts) : '');
|
||||
$view->setParam('createenddate', $createenddate ? getReadableDate($createendts) : '');
|
||||
$view->setParam('expstartdate', $expstartdate ? getReadableDate($expstartts) : '');
|
||||
$view->setParam('expenddate', $expenddate ? getReadableDate($expendts) : '');
|
||||
$view->setParam('statusstartdate', $statusstartdate ? getReadableDate($statusstartts) : '');
|
||||
$view->setParam('statusenddate', $statusenddate ? getReadableDate($statusendts) : '');
|
||||
$view->setParam('creationdate', isset($creationdate) ? $creationdate : '');
|
||||
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
|
||||
$view->setParam('statusdate', isset($statusdate) ? $statusdate: '');
|
||||
$view->setParam('status', isset($status) ? $status : array());
|
||||
$view->setParam('categories', isset($categories) ? $categories : '');
|
||||
$view->setParam('category', isset($categorynames) ? $categorynames : '');
|
||||
$view->setParam('mimetype', isset($mimetype) ? $mimetype : '');
|
||||
$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));
|
||||
|
|
|
@ -132,17 +132,16 @@ function typeahead() { /* {{{ */
|
|||
$enablefullsearch = $this->params['enablefullsearch'];
|
||||
$enableclipboard = $this->params['enableclipboard'];
|
||||
$attributes = $this->params['attributes'];
|
||||
$category = $this->params['category'];
|
||||
$categories = $this->params['categories'];
|
||||
$mimetype = $this->params['mimetype'];
|
||||
$owner = $this->params['owner'];
|
||||
$startfolder = $this->params['startfolder'];
|
||||
$startdate = $this->params['startdate'];
|
||||
$stopdate = $this->params['stopdate'];
|
||||
$createstartdate = $this->params['createstartdate'];
|
||||
$createenddate = $this->params['createenddate'];
|
||||
$expstartdate = $this->params['expstartdate'];
|
||||
$expstopdate = $this->params['expstopdate'];
|
||||
$expenddate = $this->params['expenddate'];
|
||||
$statusstartdate = $this->params['statusstartdate'];
|
||||
$statusstopdate = $this->params['statusstopdate'];
|
||||
$statusenddate = $this->params['statusenddate'];
|
||||
$creationdate = $this->params['creationdate'];
|
||||
$expirationdate = $this->params['expirationdate'];
|
||||
$statusdate = $this->params['statusdate'];
|
||||
|
@ -161,8 +160,6 @@ function typeahead() { /* {{{ */
|
|||
$timeout = $this->params['timeout'];
|
||||
$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->globalNavigation();
|
||||
$this->contentStart();
|
||||
|
@ -172,7 +169,7 @@ function typeahead() { /* {{{ */
|
|||
$this->columnStart(4);
|
||||
//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>
|
||||
<?php
|
||||
if($enablefullsearch) {
|
||||
|
@ -184,110 +181,97 @@ function typeahead() { /* {{{ */
|
|||
</ul>
|
||||
<div class="tab-content">
|
||||
<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" />
|
||||
<?php
|
||||
// Database search Form {{{
|
||||
$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>
|
||||
<?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) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$attricon = '';
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
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').' '.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
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<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->formSubmit("<i class=\"fa fa-search\"></i> ".getMLText('search'));
|
||||
$this->contentContainerEnd();
|
||||
|
||||
/* First check if any of the folder filters are set. If it is,
|
||||
|
@ -296,14 +280,13 @@ function typeahead() { /* {{{ */
|
|||
$openfilterdlg = false;
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$attricon = '';
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
|
||||
if(!empty($attributes[$attrdef->getID()]))
|
||||
$openfilterdlg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($category)
|
||||
if($categories)
|
||||
$openfilterdlg = true;
|
||||
if($status)
|
||||
$openfilterdlg = true;
|
||||
|
@ -311,159 +294,109 @@ function typeahead() { /* {{{ */
|
|||
$openfilterdlg = true;
|
||||
if($statusdate)
|
||||
$openfilterdlg = true;
|
||||
?>
|
||||
<div class="accordion" id="accordion2">
|
||||
<div class="accordion-group">
|
||||
<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
|
||||
|
||||
/* Start of fields only applicable to documents */
|
||||
ob_start();
|
||||
$tmpcatids = array();
|
||||
foreach($categories as $tmpcat)
|
||||
$tmpcatids[] = $tmpcat->getID();
|
||||
foreach ($allCats as $catObj) {
|
||||
print "<option value=\"".$catObj->getName()."\" ".(in_array($catObj->getID(), $tmpcatids) ? "selected" : "").">" . htmlspecialchars($catObj->getName()) . "\n";
|
||||
$options = array();
|
||||
$allcategories = $dms->getDocumentCategories();
|
||||
foreach($allcategories as $category) {
|
||||
$options[] = array($category->getID(), $category->getName(), in_array($category->getId(), $tmpcatids));
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php printMLText("status");?>:</td>
|
||||
<td>
|
||||
<?php if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { ?>
|
||||
<?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>
|
||||
<?php } elseif($workflowmode == 'advanced') { ?>
|
||||
<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>
|
||||
<?php } ?>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php printMLText("expires");?>:</td>
|
||||
<td>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" name="expirationdate" value="true" <?php if($expirationdate) echo "checked"; ?>/><?php printMLText("between");?>
|
||||
</label><br />
|
||||
<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()); ?>">
|
||||
<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'); ?>">
|
||||
<span class="add-on"><i class="fa fa-calendar"></i></span>
|
||||
</span>
|
||||
<?php printMLText("and"); ?>
|
||||
<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()); ?>">
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><?php printMLText("status_change");?>:</td>
|
||||
<td>
|
||||
<label class="checkbox inline">
|
||||
<input type="checkbox" name="statusdate" value="true" <?php if($statusdate) echo "checked"; ?>/><?php printMLText("between");?>
|
||||
</label><br />
|
||||
<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()); ?>">
|
||||
<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'); ?>">
|
||||
<span class="add-on"><i class="fa fa-calendar"></i></span>
|
||||
</span>
|
||||
<?php printMLText("and"); ?>
|
||||
<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()); ?>">
|
||||
<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
|
||||
$this->formField(
|
||||
getMLText("categories"),
|
||||
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));
|
||||
}
|
||||
} 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
|
||||
)
|
||||
);
|
||||
$this->formField(
|
||||
getMLText("expires")." (".getMLText('from').")",
|
||||
$this->getDateChooser($expstartdate, "expirationstart", $this->params['session']->getLanguage())
|
||||
);
|
||||
$this->formField(
|
||||
getMLText("expires")." (".getMLText('to').")",
|
||||
$this->getDateChooser($expenddate, "expirationend", $this->params['session']->getLanguage())
|
||||
);
|
||||
$this->formField(
|
||||
getMLText("status_change")." (".getMLText('from').")",
|
||||
$this->getDateChooser($statusstartdate, "statusdatestart", $this->params['session']->getLanguage())
|
||||
);
|
||||
$this->formField(
|
||||
getMLText("status_change")." (".getMLText('to').")",
|
||||
$this->getDateChooser($statusenddate, "statusdateend", $this->params['session']->getLanguage())
|
||||
);
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$attricon = '';
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
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').' '.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
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?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,
|
||||
* open the accordion.
|
||||
*/
|
||||
$openfilterdlg = false;
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$attricon = '';
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
||||
if(!empty($attributes[$attrdef->getID()]))
|
||||
$openfilterdlg = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
<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
|
||||
ob_start();
|
||||
if($attrdefs) {
|
||||
foreach($attrdefs as $attrdef) {
|
||||
$attricon = '';
|
||||
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
|
||||
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '', 'attributes', true) ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$content = ob_get_clean();
|
||||
$this->printAccordion(getMLText('filter_for_folders'), $content);
|
||||
// }}}
|
||||
?>
|
||||
</form>
|
||||
|
@ -471,84 +404,85 @@ function typeahead() { /* {{{ */
|
|||
<?php
|
||||
if($enablefullsearch) {
|
||||
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;">
|
||||
<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
|
||||
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";
|
||||
$this->contentContainerStart();
|
||||
$this->formField(
|
||||
getMLText("search_query"),
|
||||
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()))));
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php if(!isset($facets['category'])) { ?>
|
||||
<tr>
|
||||
<td><?php printMLText("category_filter");?>:</td>
|
||||
<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");?>
|
||||
-->
|
||||
<?php
|
||||
$tmpcatids = array();
|
||||
foreach($categories as $tmpcat)
|
||||
$tmpcatids[] = $tmpcat->getID();
|
||||
foreach ($allCats as $catObj) {
|
||||
print "<option value=\"".$catObj->getID()."\" ".(in_array($catObj->getID(), $tmpcatids) ? "selected" : "").">" . htmlspecialchars($catObj->getName()) . "\n";
|
||||
$this->formField(
|
||||
getMLText("owner"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'name'=>'owner[]',
|
||||
'class'=>'chzn-select',
|
||||
'multiple'=>true,
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td><?php printMLText("status");?>:</td>
|
||||
<td>
|
||||
<?php if($workflowmode == 'traditional' || $workflowmode == 'traditional_only_approval') { ?>
|
||||
<?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>
|
||||
<?php } elseif($workflowmode == 'advanced') { ?>
|
||||
<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>
|
||||
<?php } ?>
|
||||
<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>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<?php if($facets) {
|
||||
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));
|
||||
}
|
||||
$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));
|
||||
}
|
||||
} 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) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?= getMLText($facetname);?>:</td>
|
||||
<td>
|
||||
<?php
|
||||
$options = array();
|
||||
foreach($values as $v=>$c) {
|
||||
$option = array($v, $v.' ('.$c.')');
|
||||
|
@ -557,7 +491,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$options[] = $option;
|
||||
}
|
||||
$this->formField(
|
||||
null,
|
||||
getMLText($facetname),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'id'=>$facetname,
|
||||
|
@ -568,18 +502,13 @@ foreach($facets as $facetname=>$values) {
|
|||
'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>
|
||||
<?php
|
||||
$this->contentContainerEnd();
|
||||
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->contentContainerStart();
|
||||
|
||||
|
@ -609,7 +538,7 @@ foreach($facets as $facetname=>$values) {
|
|||
else {
|
||||
parse_str($_SERVER['QUERY_STRING'], $tmp);
|
||||
$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 "<th></th>\n";
|
||||
print "<th>".getMLText("name");
|
||||
|
@ -646,7 +575,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$lcattributes = $lc ? $lc->getAttributes() : null;
|
||||
$attrstr = '';
|
||||
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>";
|
||||
foreach($lcattributes as $lcattribute) {
|
||||
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
|
||||
|
@ -668,7 +597,7 @@ foreach($facets as $facetname=>$values) {
|
|||
}
|
||||
$docattributes = $document->getAttributes();
|
||||
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>";
|
||||
foreach($docattributes as $docattribute) {
|
||||
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
|
||||
|
@ -689,7 +618,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$extracontent = array();
|
||||
$extracontent['below_title'] = $this->getListRowPath($document);
|
||||
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);
|
||||
}
|
||||
} elseif($entry->isType('folder')) {
|
||||
|
@ -708,7 +637,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$attrstr = '';
|
||||
$folderattributes = $folder->getAttributes();
|
||||
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>";
|
||||
foreach($folderattributes as $folderattribute) {
|
||||
$attrdef = $folderattribute->getAttributeDefinition();
|
||||
|
@ -719,7 +648,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$extracontent = array();
|
||||
$extracontent['below_title'] = $this->getListRowPath($folder);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -730,7 +659,7 @@ foreach($facets as $facetname=>$values) {
|
|||
} else {
|
||||
$numResults = $totaldocs + $totalfolders;
|
||||
if ($numResults == 0) {
|
||||
print "<div class=\"alert alert-error\">".getMLText("search_no_results")."</div>";
|
||||
echo $this->warningMsg(getMLText("search_no_results"));
|
||||
}
|
||||
}
|
||||
// }}}
|
||||
|
|
Loading…
Reference in New Issue
Block a user