mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
Merge branch 'seeddms-5.1.x' into seeddms-6.0.x
This commit is contained in:
commit
104952d644
|
@ -1492,8 +1492,18 @@ class RestapiController { /* {{{ */
|
|||
if(!isset($params['searchin']) || !$searchin = explode(",",$params['searchin']))
|
||||
$searchin = array();
|
||||
if(!isset($params['objects']) || !$objects = $params['objects'])
|
||||
$objects = 0x3;
|
||||
$resArr = $dms->search($querystr, $limit, $offset, 'AND', $searchin, null, null, array(), array(), array(), array(), array(), array(), array(), $objects);
|
||||
$objects = 0x3;
|
||||
$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) {
|
||||
return $response->withJson(array(), 200);
|
||||
}
|
||||
|
|
|
@ -12,8 +12,8 @@ chzn_template_func = function (state) {
|
|||
if($(state.element).data('warning'))
|
||||
warning = $(state.element).data('warning')+''; /* make sure it is a string */
|
||||
var html = '<span>';
|
||||
if($(state.element).data('fa fa-before'))
|
||||
html += '<i class="fa fa-'+$(state.element).data('fa fa-before')+'"></i> ';
|
||||
if($(state.element).data('icon-before'))
|
||||
html += '<i class="fa fa-'+$(state.element).data('icon-before')+'"></i> ';
|
||||
html += state.text.replace(/</g, '<')+'';
|
||||
if(subtitle)
|
||||
html += '<br /><i>'+subtitle.replace(/</g, '<')+'</i>';
|
||||
|
@ -100,7 +100,13 @@ $(document).ready( function() {
|
|||
$("#searchfield").typeahead({ /* {{{ */
|
||||
minLength: 3,
|
||||
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('../out/out.Search.php', { query: query, limit: 8, creationdate: 1, createstart: d.toISOString().split('T')[0], action: 'typeahead' }, function(data) {
|
||||
process(data);
|
||||
});
|
||||
},
|
||||
|
|
|
@ -112,6 +112,26 @@ $(document).ready( function() {
|
|||
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() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -626,7 +646,7 @@ foreach($facets as $facetname=>$values) {
|
|||
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
|
||||
// $this->contentContainerStart();
|
||||
|
||||
$txt = $this->callHook('searchListHeader');
|
||||
$txt = $this->callHook('searchListHeader', $orderby, $orderdir);
|
||||
if(is_string($txt))
|
||||
echo $txt;
|
||||
else {
|
||||
|
@ -637,9 +657,9 @@ foreach($facets as $facetname=>$values) {
|
|||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name");
|
||||
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";
|
||||
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>".getMLText("attributes")."</th>\n";
|
||||
|
|
Loading…
Reference in New Issue
Block a user