mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-12-11 10:02:48 +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'];
|
$user = $this->params['user'];
|
||||||
$query = $this->params['query'];
|
$query = $this->params['query'];
|
||||||
$entries = $this->params['searchhits'];
|
$entries = $this->params['searchhits'];
|
||||||
|
$terms = $this->params['terms'];
|
||||||
$recs = array();
|
$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) {
|
if($entries) {
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if($entry->isType('document')) {
|
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, '/')));
|
$recs[] = array('type'=>'D', 'id'=>$entry->getId(), 'name'=>htmlspecialchars($entry->getName()), 'path'=>htmlspecialchars($entry->getParent()->getFolderPathPlain(true, '/')));
|
||||||
} elseif($entry->isType('folder')) {
|
} 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, '/')));
|
$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');
|
header('Content-Type: application/json');
|
||||||
echo json_encode($recs);
|
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) {
|
if($facets) {
|
||||||
foreach($facets as $facetname=>$values) {
|
foreach($facets as $facetname=>$values) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user