source: function()

in enginframe/hydrogen.manage-users.js [264:303]


                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'
                    });
                }