Merge branch 'seeddms-5.1.x' into seeddms-6.0.x

This commit is contained in:
Uwe Steinmann 2024-03-30 12:29:37 +01:00
commit 08cac16ecf
5 changed files with 74 additions and 23 deletions

View File

@ -297,6 +297,7 @@
- set default language in login form if language selector is turned off - set default language in login form if language selector is turned off
- do not show full list of notifiers to none admins - do not show full list of notifiers to none admins
- do not list document/folders in sequence selector if its number exceeds 50 - do not list document/folders in sequence selector if its number exceeds 50
- typeahead menu works with arrow keys again, wait 1 sec. before searching
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
Changes in version 5.1.33 Changes in version 5.1.33

View File

@ -152,8 +152,8 @@ switch($command) {
$result = array(); $result = array();
foreach($hits['folders'] as $hit) { foreach($hits['folders'] as $hit) {
if($hit->getAccessMode($user, 'search') >= M_READ) if($hit->getAccessMode($user, 'search') >= M_READ)
//$result[] = $hit->getID().'#'.$basefolder->getName().'/'.$hit->getName(); // $result[] = $hit->getID().'#'.$hit->getFolderPathPlain(true, '/');
$result[] = $hit->getID().'#'.$hit->getFolderPathPlain(true, '/'); $result[] = array('type'=>'F', 'id'=>$hit->getId(), 'name'=>htmlspecialchars($hit->getFolderPathPlain(true, '/')), 'path'=>htmlspecialchars($hit->getParent()->getFolderPathPlain(true, '/')));
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($result); echo json_encode($result);
@ -165,7 +165,8 @@ switch($command) {
$result = array(); $result = array();
foreach($subfolders as $subfolder) { foreach($subfolders as $subfolder) {
//$result[] = $subfolder->getID().'#'.$basefolder->getName().'/'.$subfolder->getName(); //$result[] = $subfolder->getID().'#'.$basefolder->getName().'/'.$subfolder->getName();
$result[] = $subfolder->getID().'#'.$subfolder->getFolderPathPlain(true, '/'); // $result[] = $subfolder->getID().'#'.$subfolder->getFolderPathPlain(true, '/');
$result[] = array('type'=>'F', 'id'=>$subfolder->getId(), 'name'=>htmlspecialchars($subfolder->getFolderPathPlain(true, '/')), 'path'=>htmlspecialchars($subfolder->getParent()->getFolderPathPlain(true, '/')));
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($result); echo json_encode($result);
@ -180,7 +181,8 @@ switch($command) {
$result = array(); $result = array();
foreach($hits['folders'] as $hit) { foreach($hits['folders'] as $hit) {
if($hit->getAccessMode($user, 'search') >= M_READ) if($hit->getAccessMode($user, 'search') >= M_READ)
$result[] = $hit->getID().'#'.$hit->getFolderPathPlain(true, '/'); // $result[] = $hit->getID().'#'.$hit->getFolderPathPlain(true, '/');
$result[] = array('type'=>'F', 'id'=>$hit->getId(), 'name'=>htmlspecialchars($hit->getFolderPathPlain(true, '/')), 'path'=>htmlspecialchars($hit->getParent()->getFolderPathPlain(true, '/')));
} }
header('Content-Type: application/json'); header('Content-Type: application/json');
echo json_encode($result); echo json_encode($result);

View File

@ -38,6 +38,7 @@
this.source = this.options.source this.source = this.options.source
this.$menu = $(this.options.menu) this.$menu = $(this.options.menu)
this.shown = false this.shown = false
this.timeout = null
this.listen() this.listen()
} }
@ -254,7 +255,11 @@
break break
default: default:
this.lookup() clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
this.lookup()
}, 1000);
} }
e.stopPropagation() e.stopPropagation()

View File

@ -238,19 +238,40 @@ function initMost() {
* actually provided to update the input field, but here we use * actually provided to update the input field, but here we use
* it to set the document location. */ * it to set the document location. */
updater: function (item) { updater: function (item) {
strarr = item.value.split("#");
//console.log(this.$element.data('target'));
target = this.$element.data('target'); target = this.$element.data('target');
$('#'+target).attr('value', strarr[0]); $('#'+target).attr('value', item.id);
return strarr[1]; return item.value;
},
sorter: function(items) {
return items;
}, },
/* Set a matcher that allows any returned value */ /* Set a matcher that allows any returned value */
matcher : function (item) { matcher : function (item) {
return true; return true;
}, },
highlighter : function (item) { highlighter : function (item) {
strarr = item.split("#"); return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
return '<i class="fa fa-folder-o"></i> ' + strarr[1].replace(/</g, '&lt;'); },
/* 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
} }
}); /* }}} */ }); /* }}} */
} }

View File

@ -93,8 +93,8 @@ function initMost() {
* for each hit and render could only process strings. * for each hit and render could only process strings.
* */ * */
$("#searchfield").typeahead({ /* {{{ */ $("#searchfield").typeahead({ /* {{{ */
menu: '<div class="typeahead dropdown-menu"></div>', menu: '<div class="typeahead dropdown-menu" style="max-height: 500px; overflow-y: auto;"></div>',
item: '<li><a class="dropdown-item" href="#"></a></li>', item: '<a class="dropdown-item" href="#"></a>',
minLength: 3, minLength: 3,
items: 100, /* the query will limit the number of hits */ items: 100, /* the query will limit the number of hits */
source: function(query, process) { source: function(query, process) {
@ -170,7 +170,8 @@ function initMost() {
items = $(items).map(function (i, item) { 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 = $(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)) /* i is already the 'a' tag, there is no 'li' as used by bootstrap 2 */
i./*find('a').*/html(that.highlighter(item))
return i[0] return i[0]
}) })
@ -184,7 +185,7 @@ function initMost() {
/* Document chooser */ /* Document chooser */
$("[id^=choosedocsearch]").typeahead({ /* {{{ */ $("[id^=choosedocsearch]").typeahead({ /* {{{ */
menu: '<div class="typeahead dropdown-menu"></div>', menu: '<div class="typeahead dropdown-menu"></div>',
item: '<li><a class="dropdown-item" href="#"></a></li>', item: '<a class="dropdown-item" href="#"></a>',
minLength: 3, minLength: 3,
source: function(query, process) { source: function(query, process) {
// console.log(this.options); // console.log(this.options);
@ -222,7 +223,7 @@ function initMost() {
items = $(items).map(function (i, item) { 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 = $(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)) i./*find('a').*/html(that.highlighter(item))
return i[0] return i[0]
}) })
@ -235,7 +236,7 @@ function initMost() {
/* Folder chooser */ /* Folder chooser */
$("[id^=choosefoldersearch]").typeahead({ /* {{{ */ $("[id^=choosefoldersearch]").typeahead({ /* {{{ */
menu: '<div class="typeahead dropdown-menu"></div>', menu: '<div class="typeahead dropdown-menu"></div>',
item: '<li><a class="dropdown-item" href="#"></a></li>', item: '<a class="dropdown-item" href="#"></a>',
minLength: 3, minLength: 3,
source: function(query, process) { source: function(query, process) {
// console.log(this.options); // console.log(this.options);
@ -247,19 +248,40 @@ function initMost() {
* actually provided to update the input field, but here we use * actually provided to update the input field, but here we use
* it to set the document location. */ * it to set the document location. */
updater: function (item) { updater: function (item) {
strarr = item.value.split("#");
//console.log(this.$element.data('target'));
target = this.$element.data('target'); target = this.$element.data('target');
$('#'+target).attr('value', strarr[0]); $('#'+target).attr('value', item.id);
return strarr[1]; return item.value;
},
sorter: function(items) {
return items;
}, },
/* Set a matcher that allows any returned value */ /* Set a matcher that allows any returned value */
matcher : function (item) { matcher : function (item) {
return true; return true;
}, },
highlighter : function (item) { highlighter : function (item) {
strarr = item.split("#"); return '<i class="fa fa-folder-o"></i> ' + item.name.replace(/</g, '&lt;') + (typeof(item.path) != 'undefined' ? '<br /><span class="path">' + item.path + '</span>' : '');
return '<i class="fa fa-folder-o"></i> ' + strarr[1].replace(/</g, '&lt;'); },
/* 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
} }
}); /* }}} */ }); /* }}} */
} }