mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-10-10 11:02:41 +00:00
categoryids has been replaced by category
This commit is contained in:
parent
b7d5f09e5a
commit
d33eb59b4a
|
@ -72,12 +72,12 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
// category
|
// category
|
||||||
$categories = array();
|
$categories = array();
|
||||||
$categorynames = array();
|
$categorynames = array();
|
||||||
if(isset($_GET['categoryids']) && $_GET['categoryids']) {
|
if(isset($_GET['category']) && $_GET['category']) {
|
||||||
foreach($_GET['categoryids'] as $catid) {
|
foreach($_GET['category'] as $catname) {
|
||||||
if($catid > 0) {
|
if($catname) {
|
||||||
$category = $dms->getDocumentCategory($catid);
|
$cat = $dms->getDocumentCategoryByName($catname);
|
||||||
$categories[] = $category;
|
$categories[] = $cat;
|
||||||
$categorynames[] = $category->getName();
|
$categorynames[] = $cat->getName();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -104,64 +104,123 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
|
|
||||||
// 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 = null;
|
$owner = [];
|
||||||
if (isset($_GET["ownerid"]) && is_numeric($_GET["ownerid"]) && $_GET["ownerid"]!=-1) {
|
if (isset($_GET["owner"])) {
|
||||||
$owner = $dms->getUser($_GET["ownerid"]);
|
if (!is_array($_GET['owner'])) {
|
||||||
if (!is_object($owner)) {
|
if(!empty($_GET['owner']) && $o = $dms->getUserByLogin($_GET['owner']))
|
||||||
UI::exitError(getMLText("search_results"),getMLText("unknown_owner"));
|
$owner[] = $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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$startTime = getTime();
|
// Check to see if the search has been restricted to a particular
|
||||||
if($settings->_enableFullSearch) {
|
// mimetype.
|
||||||
if($settings->_fullSearchEngine == 'lucene') {
|
$mimetype = [];
|
||||||
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
|
if (isset($_GET["mimetype"])) {
|
||||||
|
if (!is_array($_GET['mimetype'])) {
|
||||||
|
if(!empty($_GET['mimetype']))
|
||||||
|
$mimetype[] = $_GET['mimetype'];
|
||||||
|
} else {
|
||||||
|
foreach($_GET["mimetype"] as $l) {
|
||||||
|
if($l)
|
||||||
|
$mimetype[] = $l;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// status
|
||||||
|
$status = 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
$startTime = getTime();
|
||||||
|
if($settings->_fullSearchEngine == 'lucene') {
|
||||||
|
Zend_Search_Lucene_Search_QueryParser::setDefaultEncoding('utf-8');
|
||||||
|
}
|
||||||
|
|
||||||
if(strlen($query) < 4 && strpos($query, '*')) {
|
if(strlen($query) < 4 && strpos($query, '*')) {
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||||
|
$dcount = 0;
|
||||||
$totalPages = 0;
|
$totalPages = 0;
|
||||||
$entries = array();
|
$entries = array();
|
||||||
$searchTime = 0;
|
$searchTime = 0;
|
||||||
} else {
|
} else {
|
||||||
$startTime = getTime();
|
$startTime = getTime();
|
||||||
$index = $fulltextservice->Indexer();
|
$index = $fulltextservice->Indexer();
|
||||||
$lucenesearch = $fulltextservice->Search();
|
if($index) {
|
||||||
$searchresult = $lucenesearch->search($query, $owner ? $owner->getLogin() : '', '', $categorynames, array(), $user->isAdmin() ? [] : [$user->getLogin()]);
|
$lucenesearch = $fulltextservice->Search();
|
||||||
if($searchresult === false) {
|
$searchresult = $lucenesearch->search($query, array('owner'=>$owner, 'status'=>$status, 'category'=>$categorynames, 'user'=>$user->isAdmin() ? [] : [$user->getLogin()], 'mimetype'=>$mimetype));
|
||||||
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
if($searchresult === false) {
|
||||||
$totalPages = 0;
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_searchterm')));
|
||||||
$entries = array();
|
$dcount = 0;
|
||||||
$searchTime = 0;
|
$fcount = 0;
|
||||||
} else {
|
$totalPages = 0;
|
||||||
$entries = array();
|
$entries = array();
|
||||||
$dcount = $searchresult['count']; //0;
|
$facets = array();
|
||||||
$fcount = 0;
|
$searchTime = 0;
|
||||||
if($searchresult) {
|
} else {
|
||||||
foreach($searchresult['hits'] as $hit) {
|
$entries = array();
|
||||||
if($tmp = $dms->getDocument($hit['document_id'])) {
|
$facets = $searchresult['facets'];
|
||||||
if($tmp->getAccessMode($user) >= M_READ) {
|
$dcount = $searchresult['count']; //0;
|
||||||
$tmp->verifyLastestContentExpriry();
|
$fcount = 0;
|
||||||
$entries[] = $tmp;
|
if($searchresult) {
|
||||||
// $dcount++;
|
foreach($searchresult['hits'] as $hit) {
|
||||||
|
if($tmp = $dms->getDocument($hit['document_id'])) {
|
||||||
|
if($tmp->getAccessMode($user) >= M_READ) {
|
||||||
|
$tmp->verifyLastestContentExpriry();
|
||||||
|
$entries[] = $tmp;
|
||||||
|
// $dcount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$limit = 20;
|
||||||
|
if($pageNumber != 'all' && count($entries) > $limit) {
|
||||||
|
$totalPages = (int) (count($entries)/$limit);
|
||||||
|
if(count($entries)%$limit)
|
||||||
|
$totalPages++;
|
||||||
|
if($limit > 0)
|
||||||
|
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
||||||
|
} else {
|
||||||
|
$totalPages = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$limit = 20;
|
$searchTime = getTime() - $startTime;
|
||||||
if($pageNumber != 'all' && count($entries) > $limit) {
|
$searchTime = round($searchTime, 2);
|
||||||
$totalPages = (int) (count($entries)/$limit);
|
} else {
|
||||||
if(count($entries)%$limit)
|
$session->setSplashMsg(array('type'=>'error', 'msg'=>getMLText('splash_invalid_search_service')));
|
||||||
$totalPages++;
|
$dcount = 0;
|
||||||
if($limit > 0)
|
$fcount = 0;
|
||||||
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
$totalPages = 0;
|
||||||
} else {
|
$entries = array();
|
||||||
$totalPages = 1;
|
$facets = array();
|
||||||
}
|
$searchTime = 0;
|
||||||
}
|
}
|
||||||
$searchTime = getTime() - $startTime;
|
|
||||||
$searchTime = round($searchTime, 2);
|
|
||||||
}
|
}
|
||||||
// }}}
|
// }}}
|
||||||
} else {
|
} else {
|
||||||
|
@ -229,11 +288,15 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
|
|
||||||
// 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 = null;
|
$owner = array();
|
||||||
if (isset($_GET["ownerid"]) && is_numeric($_GET["ownerid"]) && $_GET["ownerid"]!=-1) {
|
if (isset($_GET["owner"])) {
|
||||||
$owner = $dms->getUser($_GET["ownerid"]);
|
if (!is_array($_GET['owner'])) {
|
||||||
if (!is_object($owner)) {
|
|
||||||
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
UI::exitError(getMLText("search"),getMLText("unknown_owner"));
|
||||||
|
} else {
|
||||||
|
foreach($_GET["owner"] as $l) {
|
||||||
|
if($o = $dms->getUserByLogin($l))
|
||||||
|
$owner[] = $o;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -331,10 +394,14 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
|
|
||||||
// category
|
// category
|
||||||
$categories = array();
|
$categories = array();
|
||||||
if(isset($_GET['categoryids']) && $_GET['categoryids']) {
|
$categorynames = array();
|
||||||
foreach($_GET['categoryids'] as $catid) {
|
if(isset($_GET['category']) && $_GET['category']) {
|
||||||
if($catid > 0)
|
foreach($_GET['category'] as $catname) {
|
||||||
$categories[] = $dms->getDocumentCategory($catid);
|
if($catname) {
|
||||||
|
$cat = $dms->getDocumentCategoryByName($catname);
|
||||||
|
$categories[] = $cat;
|
||||||
|
$categorynames[] = $cat->getName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -419,6 +486,7 @@ if(isset($_GET["fullsearch"]) && $_GET["fullsearch"] && $settings->_enableFullSe
|
||||||
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
$entries = array_slice($entries, ($pageNumber-1)*$limit, $limit);
|
||||||
} else
|
} else
|
||||||
$totalPages = 1;
|
$totalPages = 1;
|
||||||
|
$facets = array();
|
||||||
// }}}
|
// }}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,6 +505,7 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
||||||
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
|
||||||
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'query'=>$query, 'searchhits'=>$entries, 'totalpages'=>$totalPages, 'pagenumber'=>$pageNumber, 'searchtime'=>$searchTime, 'urlparams'=>$_GET, 'cachedir'=>$settings->_cacheDir));
|
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user, 'query'=>$query, 'searchhits'=>$entries, 'totalpages'=>$totalPages, 'pagenumber'=>$pageNumber, 'searchtime'=>$searchTime, 'urlparams'=>$_GET, 'cachedir'=>$settings->_cacheDir));
|
||||||
if($view) {
|
if($view) {
|
||||||
|
$view->setParam('facets', $facets);
|
||||||
$view->setParam('accessobject', $accessop);
|
$view->setParam('accessobject', $accessop);
|
||||||
$view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax
|
$view->setParam('onepage', $settings->_onePageMode); // do most navigation by reloading areas of pages with ajax
|
||||||
$view->setParam('showtree', showtree());
|
$view->setParam('showtree', showtree());
|
||||||
|
@ -460,6 +529,8 @@ if($settings->_showSingleSearchHit && count($entries) == 1) {
|
||||||
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
|
$view->setParam('expirationdate', isset($expirationdate) ? $expirationdate: '');
|
||||||
$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('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->setParam('attrdefs', $attrdefs);
|
$view->setParam('attrdefs', $attrdefs);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user