mirror of
https://git.code.sf.net/p/seeddms/code
synced 2024-11-26 15:32:13 +00:00
typeahead search for folders can search in subfolders
This commit is contained in:
parent
a8dfcd9528
commit
4be72880a8
|
@ -8,6 +8,7 @@
|
|||
- fixed error due to multiple declared function when controller method
|
||||
RemoveFolder::run was called more than once
|
||||
- fix php error setting mandatory workflow when uploading documents via webdav
|
||||
- typeahead search for folders can search in subfolders
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
Changes in version 5.1.22
|
||||
|
|
|
@ -145,6 +145,37 @@ switch($command) {
|
|||
if($user) {
|
||||
$query = $_GET['query'];
|
||||
|
||||
if(false !== ($pos = strpos($query, '/'))) {
|
||||
$subquery = substr($query, 0, $pos);
|
||||
$hits = $dms->search($subquery, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=$dms->getRootFolder(), $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array());
|
||||
if($hits) {
|
||||
if(count($hits['folders']) == 1) {
|
||||
$hit = $hits['folders'][0];
|
||||
$basefolder = $dms->getFolder($hit->getID());
|
||||
if($subquery = substr($query, $pos+1)) {
|
||||
$hits = $dms->search($subquery, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=$basefolder, $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array());
|
||||
if($hits) {
|
||||
$result = array();
|
||||
foreach($hits['folders'] as $hit) {
|
||||
$result[] = $hit->getID().'#'.$basefolder->getName().'/'.$hit->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
$subfolders = $basefolder->getSubFolders();
|
||||
$result = array();
|
||||
foreach($subfolders as $subfolder) {
|
||||
$result[] = $subfolder->getID().'#'.$basefolder->getName().'/'.$subfolder->getName();
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($result);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$hits = $dms->search($query, $limit=0, $offset=0, $logicalmode='AND', $searchin=array(), $startFolder=$dms->getRootFolder(), $owner=null, $status = array(), $creationstartdate=array(), $creationenddate=array(), $modificationstartdate=array(), $modificationenddate=array(), $categories=array(), $attributes=array(), $mode=0x2, $expirationstartdate=array(), $expirationenddate=array());
|
||||
if($hits) {
|
||||
$result = array();
|
||||
|
|
Loading…
Reference in New Issue
Block a user