in enginframe/hydrogen.manage-users.js [249:306]
tagIt: function (divId, className, placeholder, autocompleteOnFocus, autocompleteServiceUri) {
var sdf, namespace, input, uniqueTags, uniqueHostTags;
//The text input
input = jQuery("input" + divId);
// remove the Hydrogen old tagit style
jQuery("link[href*='tagit-stylish-yellow.css']").remove();
input.tagit({
placeholderText: placeholder,
//availableTags: availableTags,
removeConfirmation: true,
caseSensitive: false,
showAutocompleteOnFocus: autocompleteOnFocus,
autocomplete: ({
source: function (request, response) {
jQuery.hydrogen.invokeService({
sdf: '/' + jQuery.enginframe.rootContext + '/applications/applications.admin.xml',
uri: autocompleteServiceUri,
data: {
namespace: 'applications'
},
success: function (xml) {
var data = '';
jQuery(xml).find('ugm\\:group, group').each(function () {
if (data !== '') {
data += '\n';
}
var name = jQuery(this).attr("name");
if (name !== "all-users" && name !== "admin") {
data += name;
}
});
var matcherTag = new RegExp("^" + jQuery.ui.autocomplete.escapeRegex(request.term), "i");
var rawTags = data.split("\n");
var availableTags = [];
uniqueTags = [];
for (var i = 0; i < rawTags.length; i++) {
// Remove duplicates and empty string
if (uniqueTags.indexOf(rawTags[i]) < 0 && rawTags[i]) {
uniqueTags.push(rawTags[i]);
// Match only the beginning of terms
if (matcherTag.test(rawTags[i])) {
availableTags.push(rawTags[i]);
}
}
}
response(availableTags);
},
dataType: 'xml'
});
}
})
}).addClass(className);
},