Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/search/amd/build/
Upload File :
Current File : C:/xampp/htdocs/moodle/search/amd/build/form-search-user-selector.min.js.map

{"version":3,"sources":["../src/form-search-user-selector.js"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","promise","args","courseid","attr","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":"AAyBAA,OAAM,yCAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAAD,CAA4C,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6B,CAE3E,MAAkE,CAE9DC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAK,CAAG,EAAZ,CACAN,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCH,CAAK,CAACI,IAAN,CAAW,CACPC,KAAK,CAAEF,CAAI,CAACG,EADL,CAEPC,KAAK,CAAEJ,CAAI,CAACK,MAFL,CAAX,CAIH,CALD,EAMA,MAAOR,CAAAA,CACV,CAX6D,CAa9DS,SAAS,CAAE,mBAASX,CAAT,CAAmBY,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,IAC/CC,CAAAA,CAD+C,CAK/CC,CAAI,CAAG,CAACJ,KAAK,CAAEA,CAAR,CALwC,CAM/CK,CAAQ,CAAGrB,CAAC,CAACI,CAAD,CAAD,CAAYkB,IAAZ,CAAiB,gBAAjB,CANoC,CAOnD,GAAwB,WAApB,QAAOD,CAAAA,CAAP,EAAmE,EAAhC,GAAArB,CAAC,CAAC,kBAAD,CAAD,CAAsBuB,GAAtB,EAAvC,CAA2E,CACvEH,CAAI,CAACC,QAAL,CAAgBA,CACnB,CAFD,IAEO,CACHD,CAAI,CAACC,QAAL,CAAgB,CACnB,CAGDF,CAAO,CAAGlB,CAAI,CAACuB,IAAL,CAAU,CAAC,CAACC,UAAU,CAAE,gCAAb,CAA+CL,IAAI,CAAEA,CAArD,CAAD,CAAV,CAAV,CAGAD,CAAO,CAAC,CAAD,CAAP,CAAWO,IAAX,CAAgB,SAASrB,CAAT,CAAkB,CAC9B,GAAIsB,CAAAA,CAAQ,CAAG,EAAf,CAGA3B,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCkB,CAAQ,CAACjB,IAAT,CAAcR,CAAS,CAAC0B,MAAV,CAAiB,2CAAjB,CAA8DnB,CAA9D,CAAd,CACH,CAFD,EAKA,MAAOT,CAAAA,CAAC,CAAC6B,IAAF,CAAOC,KAAP,CAAa9B,CAAC,CAAC6B,IAAf,CAAqBF,CAArB,EAA+BD,IAA/B,CAAoC,UAAW,IAC9CN,CAAAA,CAAI,CAAGW,SADuC,CAE9CC,CAAC,CAAG,CAF0C,CAGlDhC,CAAC,CAACO,IAAF,CAAOF,CAAP,CAAgB,SAASG,CAAT,CAAgBC,CAAhB,CAAsB,CAClCA,CAAI,CAACK,MAAL,CAAcM,CAAI,CAACY,CAAC,EAAF,CACrB,CAFD,EAGAf,CAAO,CAACZ,CAAD,CAEV,CARM,CAUV,CAnBD,EAmBG4B,IAnBH,CAmBQf,CAnBR,CAoBH,CAlD6D,CAsDrE,CAxDK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Search user selector module.\n *\n * @module core_search/form-search-user-selector\n * @class form-search-user-selector\n * @package core_search\n * @copyright 2017 The Open University\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {\n\n    return /** @alias module:core_search/form-search-user-selector */ {\n\n        processResults: function(selector, results) {\n            var users = [];\n            $.each(results, function(index, user) {\n                users.push({\n                    value: user.id,\n                    label: user._label\n                });\n            });\n            return users;\n        },\n\n        transport: function(selector, query, success, failure) {\n            var promise;\n\n            // Search within specific course if known and if the 'search within' dropdown is set\n            // to search within course or activity.\n            var args = {query: query};\n            var courseid = $(selector).attr('withincourseid');\n            if (typeof courseid !== \"undefined\" && $('#id_searchwithin').val() !== '') {\n                args.courseid = courseid;\n            } else {\n                args.courseid = 0;\n            }\n\n            // Call AJAX request.\n            promise = Ajax.call([{methodname: 'core_search_get_relevant_users', args: args}]);\n\n            // When AJAX request returns, handle the results.\n            promise[0].then(function(results) {\n                var promises = [];\n\n                // Render label with user name and picture.\n                $.each(results, function(index, user) {\n                    promises.push(Templates.render('core_search/form-user-selector-suggestion', user));\n                });\n\n                // Apply the label to the results.\n                return $.when.apply($.when, promises).then(function() {\n                    var args = arguments;\n                    var i = 0;\n                    $.each(results, function(index, user) {\n                        user._label = args[i++];\n                    });\n                    success(results);\n                    return;\n                });\n\n            }).fail(failure);\n        }\n\n    };\n\n});\n"],"file":"form-search-user-selector.min.js"}