mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-01 22:47:19 +00:00
list terms in auto complete if set
This commit is contained in:
parent
5e48d724ac
commit
707082f6b6
|
@ -362,19 +362,22 @@ function typeahead() { /* {{{ */
|
|||
$user = $this->params['user'];
|
||||
$query = $this->params['query'];
|
||||
$entries = $this->params['searchhits'];
|
||||
$terms = $this->params['terms'];
|
||||
$recs = array();
|
||||
$recs[] = array('type'=>'S', 'name'=>$query, 'occurences'=>'');
|
||||
if($terms) {
|
||||
foreach($terms as $term)
|
||||
$recs[] = array('type'=>'S', 'name'=>$term->text, 'occurences'=>$term->_occurrence);
|
||||
}
|
||||
if($entries) {
|
||||
foreach ($entries as $entry) {
|
||||
if($entry->isType('document')) {
|
||||
// $recs[] = 'D'.$entry->getName();
|
||||
$recs[] = array('type'=>'D', 'id'=>$entry->getId(), 'name'=>htmlspecialchars($entry->getName()), 'path'=>htmlspecialchars($entry->getParent()->getFolderPathPlain(true, '/')));
|
||||
} elseif($entry->isType('folder')) {
|
||||
// $recs[] = 'F'.$entry->getName();
|
||||
$recs[] = array('type'=>'F', 'id'=>$entry->getId(), 'name'=>htmlspecialchars($entry->getName()), 'path'=>htmlspecialchars($entry->getParent()->getFolderPathPlain(true, '/')));
|
||||
}
|
||||
}
|
||||
}
|
||||
array_unshift($recs, array('type'=>'S', 'name'=>$query));
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode($recs);
|
||||
} /* }}} */
|
||||
|
@ -829,6 +832,22 @@ function typeahead() { /* {{{ */
|
|||
)
|
||||
);
|
||||
}
|
||||
if(!isset($facets['record_type'])) {
|
||||
$options = array();
|
||||
$options[] = array('document', getMLText('document'), in_array('document', $record_type));
|
||||
$options[] = array('folder', getMLText('folder'), in_array('folder', $record_type));
|
||||
$this->formField(
|
||||
getMLText("record_type"),
|
||||
array(
|
||||
'element'=>'select',
|
||||
'class'=>'chzn-select',
|
||||
'name'=>'record_type[]',
|
||||
'multiple'=>true,
|
||||
'attributes'=>array(array('data-placeholder', getMLText('select_record_type'))),
|
||||
'options'=>$options
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if($facets) {
|
||||
foreach($facets as $facetname=>$values) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user