mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
document search show path of items
This commit is contained in:
parent
4e91604d44
commit
88c49363ac
|
@ -114,7 +114,8 @@ switch($command) {
|
|||
$result = array();
|
||||
foreach($hits['docs'] as $hit) {
|
||||
if($hit->getAccessMode($user, 'search') >= M_READ) {
|
||||
$result[] = $hit->getID().'#'.$hit->getName();
|
||||
// $result[] = $hit->getID().'#'.$hit->getName();
|
||||
$result[] = array('type'=>'D', 'id'=>$hit->getId(), 'name'=>htmlspecialchars($hit->getName()), 'path'=>htmlspecialchars($hit->getParent()->getFolderPathPlain(true, '/')));
|
||||
}
|
||||
}
|
||||
header('Content-Type: application/json');
|
||||
|
|
|
@ -186,21 +186,42 @@ function initMost() {
|
|||
});
|
||||
},
|
||||
/* updater is called when the item in the list is clicked. It is
|
||||
* actually provided to update the input field where you type, but here
|
||||
* we use it to update a second input field with the doc id. */
|
||||
* provided to update the input field where you type. */
|
||||
updater: function (item) {
|
||||
strarr = item.value.split("#");
|
||||
target = this.$element.data('target');
|
||||
$('#'+target).attr('value', strarr[0]);
|
||||
return strarr[1];
|
||||
$('#'+target).attr('value', item.id);
|
||||
return item.value;
|
||||
},
|
||||
sorter: function(items) {
|
||||
return items;
|
||||
},
|
||||
/* Set a matcher that allows any returned value */
|
||||
matcher : function (item) {
|
||||
return true;
|
||||
},
|
||||
highlighter : function (item) {
|
||||
strarr = item.split("#");
|
||||
return '<i class="fa fa-file"></i> ' + strarr[1].replace(/</g, '<');
|
||||
return '<i class="fa fa-file"></i> ' + item.name.replace(/</g, '<') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
|
||||
},
|
||||
/* This only works with a modified version of bootstrap typeahead located
|
||||
* in boostrap-typeahead.js Search for 'render'
|
||||
* The line
|
||||
* this.render = this.options.render || this.render
|
||||
* was added to bootstrap-typeahead.js
|
||||
* The following function is a copy of the original render function but
|
||||
* access item.name instead of item
|
||||
*/
|
||||
render : function (items) {
|
||||
var that = this
|
||||
|
||||
items = $(items).map(function (i, item) {
|
||||
i = $(that.options.item).attr('data-value', item.name).attr('data-id', item.id).attr('data-type', item.type);
|
||||
i.find('a').html(that.highlighter(item))
|
||||
return i[0]
|
||||
})
|
||||
|
||||
items.first().addClass('active')
|
||||
this.$menu.html(items)
|
||||
return this
|
||||
}
|
||||
}); /* }}} */
|
||||
|
||||
|
|
|
@ -193,21 +193,42 @@ function initMost() {
|
|||
});
|
||||
},
|
||||
/* updater is called when the item in the list is clicked. It is
|
||||
* actually provided to update the input field where you type, but here
|
||||
* we use it to update a second input field with the doc id. */
|
||||
* provided to update the input field where you type. */
|
||||
updater: function (item) {
|
||||
strarr = item.value.split("#");
|
||||
target = this.$element.data('target');
|
||||
$('#'+target).attr('value', strarr[0]);
|
||||
return strarr[1];
|
||||
$('#'+target).attr('value', item.id);
|
||||
return item.value;
|
||||
},
|
||||
sorter: function(items) {
|
||||
return items;
|
||||
},
|
||||
/* Set a matcher that allows any returned value */
|
||||
matcher : function (item) {
|
||||
return true;
|
||||
},
|
||||
highlighter : function (item) {
|
||||
strarr = item.split("#");
|
||||
return '<i class="fa fa-file"></i> ' + strarr[1].replace(/</g, '<');
|
||||
return '<i class="fa fa-file"></i> ' + item.name.replace(/</g, '<') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
|
||||
},
|
||||
/* This only works with a modified version of bootstrap typeahead located
|
||||
* in boostrap-typeahead.js Search for 'render'
|
||||
* The line
|
||||
* this.render = this.options.render || this.render
|
||||
* was added to bootstrap-typeahead.js
|
||||
* The following function is a copy of the original render function but
|
||||
* access item.name instead of item
|
||||
*/
|
||||
render : function (items) {
|
||||
var that = this
|
||||
|
||||
items = $(items).map(function (i, item) {
|
||||
i = $(that.options.item).attr('data-value', item.name).attr('data-id', item.id).attr('data-type', item.type);
|
||||
i.find('a').html(that.highlighter(item))
|
||||
return i[0]
|
||||
})
|
||||
|
||||
items.first().addClass('active')
|
||||
this.$menu.html(items)
|
||||
return this
|
||||
}
|
||||
}); /* }}} */
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user