diff --git a/restapi/index.php b/restapi/index.php index 9b416b7dc..e402228c9 100644 --- a/restapi/index.php +++ b/restapi/index.php @@ -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); } diff --git a/styles/bootstrap/application.js b/styles/bootstrap/application.js index 147dad2ed..df89f6ff4 100644 --- a/styles/bootstrap/application.js +++ b/styles/bootstrap/application.js @@ -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 = ''; - if($(state.element).data('fa fa-before')) - html += ' '; + if($(state.element).data('icon-before')) + html += ' '; html += state.text.replace(/'+subtitle.replace(/'; @@ -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); }); }, diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index 915d541ff..5f2cc933d 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -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 "