first commit

This commit is contained in:
CHIEFSOFT\ameye
2024-09-30 18:11:26 -04:00
commit e592ca6823
27270 changed files with 5002257 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/**
* Search user selector module.
*
* @module core_search/form-search-user-selector
* @copyright 2017 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define("core_search/form-search-user-selector",["jquery","core/ajax","core/templates"],(function($,Ajax,Templates){return{processResults:function(selector,results){var users=[];return $.each(results,(function(index,user){users.push({value:user.id,label:user._label})})),users},transport:function(selector,query,success,failure){var args={query:query},courseid=$(selector).attr("withincourseid");void 0!==courseid&&""!==$("#id_searchwithin").val()?args.courseid=courseid:args.courseid=0,Ajax.call([{methodname:"core_search_get_relevant_users",args:args}])[0].then((function(results){var promises=[];return $.each(results,(function(index,user){promises.push(Templates.render("core_search/form-user-selector-suggestion",user))})),$.when.apply($.when,promises).then((function(){var args=arguments,i=0;$.each(results,(function(index,user){user._label=args[i++]})),success(results)}))})).fail(failure)}}}));
//# sourceMappingURL=form-search-user-selector.min.js.map
@@ -0,0 +1 @@
{"version":3,"file":"form-search-user-selector.min.js","sources":["../src/form-search-user-selector.js"],"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 * @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"],"names":["define","$","Ajax","Templates","processResults","selector","results","users","each","index","user","push","value","id","label","_label","transport","query","success","failure","args","courseid","attr","val","call","methodname","then","promises","render","when","apply","arguments","i","fail"],"mappings":";;;;;;;AAuBAA,+CAAO,CAAC,SAAU,YAAa,mBAAmB,SAASC,EAAGC,KAAMC,iBAEE,CAE9DC,eAAgB,SAASC,SAAUC,aAC3BC,MAAQ,UACZN,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BH,MAAMI,KAAK,CACPC,MAAOF,KAAKG,GACZC,MAAOJ,KAAKK,YAGbR,OAGXS,UAAW,SAASX,SAAUY,MAAOC,QAASC,aAKtCC,KAAO,CAACH,MAAOA,OACfI,SAAWpB,EAAEI,UAAUiB,KAAK,uBACR,IAAbD,UAA4D,KAAhCpB,EAAE,oBAAoBsB,MACzDH,KAAKC,SAAWA,SAEhBD,KAAKC,SAAW,EAIVnB,KAAKsB,KAAK,CAAC,CAACC,WAAY,iCAAkCL,KAAMA,QAGlE,GAAGM,MAAK,SAASpB,aACjBqB,SAAW,UAGf1B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BiB,SAAShB,KAAKR,UAAUyB,OAAO,4CAA6ClB,UAIzET,EAAE4B,KAAKC,MAAM7B,EAAE4B,KAAMF,UAAUD,MAAK,eACnCN,KAAOW,UACPC,EAAI,EACR/B,EAAEO,KAAKF,SAAS,SAASG,MAAOC,MAC5BA,KAAKK,OAASK,KAAKY,QAEvBd,QAAQZ,eAIb2B,KAAKd"}
@@ -0,0 +1,80 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Search user selector module.
*
* @module core_search/form-search-user-selector
* @copyright 2017 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/ajax', 'core/templates'], function($, Ajax, Templates) {
return /** @alias module:core_search/form-search-user-selector */ {
processResults: function(selector, results) {
var users = [];
$.each(results, function(index, user) {
users.push({
value: user.id,
label: user._label
});
});
return users;
},
transport: function(selector, query, success, failure) {
var promise;
// Search within specific course if known and if the 'search within' dropdown is set
// to search within course or activity.
var args = {query: query};
var courseid = $(selector).attr('withincourseid');
if (typeof courseid !== "undefined" && $('#id_searchwithin').val() !== '') {
args.courseid = courseid;
} else {
args.courseid = 0;
}
// Call AJAX request.
promise = Ajax.call([{methodname: 'core_search_get_relevant_users', args: args}]);
// When AJAX request returns, handle the results.
promise[0].then(function(results) {
var promises = [];
// Render label with user name and picture.
$.each(results, function(index, user) {
promises.push(Templates.render('core_search/form-user-selector-suggestion', user));
});
// Apply the label to the results.
return $.when.apply($.when, promises).then(function() {
var args = arguments;
var i = 0;
$.each(results, function(index, user) {
user._label = args[i++];
});
success(results);
return;
});
}).fail(failure);
}
};
});