Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2020-12-01 12:42:48 +01:00
commit 104952d644
3 changed files with 43 additions and 7 deletions

View File

@ -1493,7 +1493,17 @@ class RestapiController { /* {{{ */
$searchin = array(); $searchin = array();
if(!isset($params['objects']) || !$objects = $params['objects']) if(!isset($params['objects']) || !$objects = $params['objects'])
$objects = 0x3; $objects = 0x3;
$resArr = $dms->search($querystr, $limit, $offset, 'AND', $searchin, null, null, array(), array(), array(), array(), array(), array(), array(), $objects); $sparams = array(
'query'=>$querystr,
'limit'=>$limit,
'offset'=>$offset,
'logicalmode'=>'AND',
'searchin'=>$searchin,
'mode'=>$objects,
// 'creationstartdate'=>array('hour'=>1, 'minute'=>0, 'second'=>0, 'year'=>date('Y')-1, 'month'=>date('m'), 'day'=>date('d')),
);
$resArr = $dms->search($sparams);
// $resArr = $dms->search($querystr, $limit, $offset, 'AND', $searchin, null, null, array(), array('hour'=>1, 'minute'=>0, 'second'=>0, 'year'=>date('Y')-1, 'month'=>date('m'), 'day'=>date('d')), array(), array(), array(), array(), array(), $objects);
if($resArr === false) { if($resArr === false) {
return $response->withJson(array(), 200); return $response->withJson(array(), 200);
} }

View File

@ -12,8 +12,8 @@ chzn_template_func = function (state) {
if($(state.element).data('warning')) if($(state.element).data('warning'))
warning = $(state.element).data('warning')+''; /* make sure it is a string */ warning = $(state.element).data('warning')+''; /* make sure it is a string */
var html = '<span>'; var html = '<span>';
if($(state.element).data('fa fa-before')) if($(state.element).data('icon-before'))
html += '<i class="fa fa-'+$(state.element).data('fa fa-before')+'"></i> '; html += '<i class="fa fa-'+$(state.element).data('icon-before')+'"></i> ';
html += state.text.replace(/</g, '&lt;')+''; html += state.text.replace(/</g, '&lt;')+'';
if(subtitle) if(subtitle)
html += '<br /><i>'+subtitle.replace(/</g, '&lt;')+'</i>'; html += '<br /><i>'+subtitle.replace(/</g, '&lt;')+'</i>';
@ -100,7 +100,13 @@ $(document).ready( function() {
$("#searchfield").typeahead({ /* {{{ */ $("#searchfield").typeahead({ /* {{{ */
minLength: 3, minLength: 3,
source: function(query, process) { source: function(query, process) {
var d = new Date();
var pastYear = d.getFullYear() - 1;
d.setFullYear(pastYear);
console.log(d.toISOString().split('T')[0]);
$.get('../restapi/index.php/search', { query: query, limit: 8, mode: 'typeahead' }, function(data) { $.get('../restapi/index.php/search', { query: query, limit: 8, mode: 'typeahead' }, function(data) {
// $.get('../out/out.Search.php', { query: query, limit: 8, creationdate: 1, createstart: d.toISOString().split('T')[0], action: 'typeahead' }, function(data) {
process(data); process(data);
}); });
}, },

View File

@ -112,6 +112,26 @@ $(document).ready( function() {
unlink($filename); unlink($filename);
} /* }}} */ } /* }}} */
function typeahead() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$query = $this->params['query'];
$entries = $this->params['searchhits'];
$recs = array();
if($entries) {
foreach ($entries as $entry) {
if($entry->isType('document')) {
$recs[] = 'D'.$entry->getName();
} elseif($entry->isType('folder')) {
$recs[] = 'F'.$entry->getName();
}
}
}
array_unshift($recs, ' '.$query);
header('Content-Type: application/json');
echo json_encode($recs);
} /* }}} */
function show() { /* {{{ */ function show() { /* {{{ */
$dms = $this->params['dms']; $dms = $this->params['dms'];
$user = $this->params['user']; $user = $this->params['user'];
@ -626,7 +646,7 @@ foreach($facets as $facetname=>$values) {
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams); $this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart(); // $this->contentContainerStart();
$txt = $this->callHook('searchListHeader'); $txt = $this->callHook('searchListHeader', $orderby, $orderdir);
if(is_string($txt)) if(is_string($txt))
echo $txt; echo $txt;
else { else {
@ -637,9 +657,9 @@ foreach($facets as $facetname=>$values) {
print "<th></th>\n"; print "<th></th>\n";
print "<th>".getMLText("name"); print "<th>".getMLText("name");
if(!$fullsearch) { if(!$fullsearch) {
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($orderby=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>"; print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
$tmp['orderby'] = $orderby=="d"||$orderby=="da)"?"dd":"d"; $tmp['orderby'] = $orderby=="d"||$orderby=="da)"?"dd":"d";
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="icon-sort-by-attributes selected"></i>':($orderby=="dd"?' <i class="icon-sort-by-attributes-alt selected"></i>':' <i class="icon-sort-by-attributes"></i>'))."</a>"; print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
} }
print "</th>\n"; print "</th>\n";
//print "<th>".getMLText("attributes")."</th>\n"; //print "<th>".getMLText("attributes")."</th>\n";