diff --git a/enrol/manual/amd/build/form-potential-user-selector.min.js b/enrol/manual/amd/build/form-potential-user-selector.min.js index 3ec5e2c32c3..d5262fbc291 100644 --- a/enrol/manual/amd/build/form-potential-user-selector.min.js +++ b/enrol/manual/amd/build/form-potential-user-selector.min.js @@ -1,2 +1,2 @@ -define ("enrol_manual/form-potential-user-selector",["jquery","core/ajax","core/templates","core/str"],function(a,b,c,d){return{processResults:function processResults(b,c){var d=[];if(a.isArray(c)){a.each(c,function(a,b){d.push({value:b.id,label:b._label})});return d}else{return c}},transport:function transport(e,f,g,h){var i,j=a(e).attr("courseid"),k=a(e).attr("userfields").split(",");if("undefined"==typeof j){j="1"}var l=a(e).attr("enrolid");if("undefined"==typeof l){l=""}i=b.call([{methodname:"core_enrol_get_potential_users",args:{courseid:j,enrolid:l,search:f,searchanywhere:!0,page:0,perpage:101}}]);i[0].then(function(b){var e=[],f=0;if(b.length<=100){a.each(b,function(b,d){var f=d,g=[];a.each(k,function(a,b){if("undefined"!=typeof d[b]&&""!==d[b]){f.hasidentity=!0;g.push(d[b])}});f.identity=g.join(", ");e.push(c.render("enrol_manual/form-user-selector-suggestion",f))});return a.when.apply(a.when,e).then(function(){var c=arguments;a.each(b,function(a,b){b._label=c[f];f++});g(b)})}else{return d.get_string("toomanyuserstoshow","core",">100").then(function(a){g(a)})}}).fail(h)}}}); +define ("enrol_manual/form-potential-user-selector",["jquery","core/ajax","core/templates","core/str"],function(a,b,c,d){return{processResults:function processResults(b,c){var d=[];if(a.isArray(c)){a.each(c,function(a,b){d.push({value:b.id,label:b._label})});return d}else{return c}},transport:function transport(e,f,g,h){var i,j=a(e).attr("courseid"),k=a(e).attr("userfields").split(",");if("undefined"==typeof j){j="1"}var l=a(e).attr("enrolid");if("undefined"==typeof l){l=""}var m=a(e).attr("perpage");if("undefined"==typeof m){m=100}i=b.call([{methodname:"core_enrol_get_potential_users",args:{courseid:j,enrolid:l,search:f,searchanywhere:!0,page:0,perpage:m+1}}]);i[0].then(function(b){var e=[],f=0;if(b.length<=m){a.each(b,function(b,d){var f=d,g=[];a.each(k,function(a,b){if("undefined"!=typeof d[b]&&""!==d[b]){f.hasidentity=!0;g.push(d[b])}});f.identity=g.join(", ");e.push(c.render("enrol_manual/form-user-selector-suggestion",f))});return a.when.apply(a.when,e).then(function(){var c=arguments;a.each(b,function(a,b){b._label=c[f];f++});g(b)})}else{return d.get_string("toomanyuserstoshow","core",">"+m).then(function(a){g(a)})}}).fail(h)}}}); //# sourceMappingURL=form-potential-user-selector.min.js.map diff --git a/enrol/manual/amd/build/form-potential-user-selector.min.js.map b/enrol/manual/amd/build/form-potential-user-selector.min.js.map index d4a96f390bb..6b9b32d5236 100644 --- a/enrol/manual/amd/build/form-potential-user-selector.min.js.map +++ b/enrol/manual/amd/build/form-potential-user-selector.min.js.map @@ -1 +1 @@ -{"version":3,"sources":["../src/form-potential-user-selector.js"],"names":["define","$","Ajax","Templates","Str","processResults","selector","results","users","isArray","each","index","user","push","value","id","label","_label","transport","query","success","failure","promise","courseid","attr","userfields","split","enrolid","call","methodname","args","search","searchanywhere","page","perpage","then","promises","i","length","ctx","identity","k","hasidentity","join","render","when","apply","arguments","get_string","toomanyuserstoshow","fail"],"mappings":"AAyBAA,OAAM,6CAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAA0C,UAA1C,CAAD,CAAwD,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6BC,CAA7B,CAAkC,CAK5F,MAAsE,CAElEC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAK,CAAG,EAAZ,CACA,GAAIP,CAAC,CAACQ,OAAF,CAAUF,CAAV,CAAJ,CAAwB,CACpBN,CAAC,CAACS,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAsB,CAClCJ,CAAK,CAACK,IAAN,CAAW,CACPC,KAAK,CAAEF,CAAI,CAACG,EADL,CAEPC,KA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AG,CAAG3B,CAAV,CACI4B,CAAQ,CAAG,EADf,CAEAvC,CAAC,CAACS,IAAF,CAAOe,CAAP,CAAmB,SAASY,CAAT,CAAYI,CAAZ,CAAe,CAC9B,GAAuB,WAAnB,QAAO7B,CAAAA,CAAI,CAAC6B,CAAD,CAAX,EAA8C,EAAZ,GAAA7B,CAAI,CAAC6B,CAAD,CAA1C,CAAsD,CAClDF,CAAG,CAACG,WAAJ,IACAF,CAAQ,CAAC3B,IAAT,CAAcD,CAAI,CAAC6B,CAAD,CAAlB,CACH,CACJ,CALD,EAMAF,CAAG,CAACC,QAAJ,CAAeA,CAAQ,CAACG,IAAT,CAAc,IAAd,CAAf,CACAP,CAAQ,CAACvB,IAAT,CAAcV,CAAS,CAACyC,MAAV,CAAiB,4CAAjB,CAA+DL,CAA/D,CAAd,CACH,CAXD,EAcA,MAAOtC,CAAAA,CAAC,CAAC4C,IAAF,CAAOC,KAAP,CAAa7C,CAAC,CAAC4C,IAAf,CAAqBT,CAArB,EAA+BD,IAA/B,CAAoC,UAAW,CAClD,GAAIL,CAAAA,CAAI,CAAGiB,SAAX,CACA9C,CAAC,CAACS,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAsB,CAClCA,CAAI,CAACK,MAAL,CAAca,CAAI,CAACO,CAAD,CAAlB,CACAA,CAAC,EACJ,CAHD,EAIAjB,CAAO,CAACb,CAAD,CAEV,CARM,CAUV,CA1BD,IA0BO,CACH,MAAOH,CAAAA,CAAG,CAAC4C,UAAJ,CAAe,oBAAf,CAAqC,MAArC,SAA6Db,IAA7D,CAAkE,SAASc,CAAT,CAA6B,CAClG7B,CAAO,CAAC6B,CAAD,CAEV,CAHM,CAIV,CAEJ,CArCD,EAqCGC,IArCH,CAqCQ7B,CArCR,CAsCH,CAhFiE,CAoFzE,CAzFK,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 .\n\n/**\n * Potential user selector module.\n *\n * @module enrol_manual/form-potential-user-selector\n * @class form-potential-user-selector\n * @package enrol_manual\n * @copyright 2016 Damyon Wiese\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, Templates, Str) {\n\n /** @var {Number} Maximum number of users to show. */\n var MAXUSERS = 100;\n\n return /** @alias module:enrol_manual/form-potential-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n if ($.isArray(results)) {\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n var courseid = $(selector).attr('courseid');\n var userfields = $(selector).attr('userfields').split(',');\n if (typeof courseid === \"undefined\") {\n courseid = '1';\n }\n var enrolid = $(selector).attr('enrolid');\n if (typeof enrolid === \"undefined\") {\n enrolid = '';\n }\n\n promise = Ajax.call([{\n methodname: 'core_enrol_get_potential_users',\n args: {\n courseid: courseid,\n enrolid: enrolid,\n search: query,\n searchanywhere: true,\n page: 0,\n perpage: MAXUSERS + 1\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n if (results.length <= MAXUSERS) {\n // Render the label.\n $.each(results, function(index, user) {\n var ctx = user,\n identity = [];\n $.each(userfields, function(i, k) {\n if (typeof user[k] !== 'undefined' && user[k] !== '') {\n ctx.hasidentity = true;\n identity.push(user[k]);\n }\n });\n ctx.identity = identity.join(', ');\n promises.push(Templates.render('enrol_manual/form-user-selector-suggestion', ctx));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n } else {\n return Str.get_string('toomanyuserstoshow', 'core', '>' + MAXUSERS).then(function(toomanyuserstoshow) {\n success(toomanyuserstoshow);\n return;\n });\n }\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"file":"form-potential-user-selector.min.js"} \ No newline at end of file +{"version":3,"sources":["../src/form-potential-user-selector.js"],"names":["define","$","Ajax","Templates","Str","processResults","selector","results","users","isArray","each","index","user","push","value","id","label","_label","transport","query","success","failure","promise","courseid","attr","userfields","split","enrolid","perpage","call","methodname","args","search","searchanywhere","page","then","promises","i","length","ctx","identity","k","hasidentity","join","render","when","apply","arguments","get_string","toomanyuserstoshow","fail"],"mappings":"AAyBAA,OAAM,6CAAC,CAAC,QAAD,CAAW,WAAX,CAAwB,gBAAxB,CAA0C,UAA1C,CAAD,CAAwD,SAASC,CAAT,CAAYC,CAAZ,CAAkBC,CAAlB,CAA6BC,CAA7B,CAAkC,CAE5F,MAAsE,CAElEC,cAAc,CAAE,wBAASC,CAAT,CAAmBC,CAAnB,CAA4B,CACxC,GAAIC,CAAAA,CAAK,CAAG,EAAZ,CACA,GAAIP,CAAC,CAACQ,OAAF,CAAUF,CAAV,CAAJ,CAAwB,CACpBN,CAAC,CAACS,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAsB,CAClCJ,CAAK,CAACK,IAAN,CAAW,CACPC,KAAK,CAAEF,CAAI,CAACG,EADL,CAEPC,KAAK,CAAEJ,CAAI,CAACK,MAFL,CAAX,CAIH,CALD,EAMA,MAAOT,CAAAA,CAEV,CATD,IASO,CACH,MAAOD,CAAAA,CACV,CACJ,CAhBiE,CAkBlEW,SAAS,CAAE,mBAASZ,CAAT,CAAmBa,CAAnB,CAA0BC,CAA1B,CAAmCC,CAAnC,CAA4C,IAC/CC,CAAAA,CAD+C,CAE/CC,CAAQ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CAACS,IAAF,CAAOe,CAAP,CAAmB,SAASY,CAAT,CAAYI,CAAZ,CAAe,CAC9B,GAAuB,WAAnB,QAAO7B,CAAAA,CAAI,CAAC6B,CAAD,CAAX,EAA8C,EAAZ,GAAA7B,CAAI,CAAC6B,CAAD,CAA1C,CAAsD,CAClDF,CAAG,CAACG,WAAJ,IACAF,CAAQ,CAAC3B,IAAT,CAAcD,CAAI,CAAC6B,CAAD,CAAlB,CACH,CACJ,CALD,EAMAF,CAAG,CAACC,QAAJ,CAAeA,CAAQ,CAACG,IAAT,CAAc,IAAd,CAAf,CACAP,CAAQ,CAACvB,IAAT,CAAcV,CAAS,CAACyC,MAAV,CAAiB,4CAAjB,CAA+DL,CAA/D,CAAd,CACH,CAXD,EAcA,MAAOtC,CAAAA,CAAC,CAAC4C,IAAF,CAAOC,KAAP,CAAa7C,CAAC,CAAC4C,IAAf,CAAqBT,CAArB,EAA+BD,IAA/B,CAAoC,UAAW,CAClD,GAAIJ,CAAAA,CAAI,CAAGgB,SAAX,CACA9C,CAAC,CAACS,IAAF,CAAOH,CAAP,CAAgB,SAASI,CAAT,CAAgBC,CAAhB,CAAsB,CAClCA,CAAI,CAACK,MAAL,CAAcc,CAAI,CAACM,CAAD,CAAlB,CACAA,CAAC,EACJ,CAHD,EAIAjB,CAAO,CAACb,CAAD,CAEV,CARM,CAUV,CA1BD,IA0BO,CACH,MAAOH,CAAAA,CAAG,CAAC4C,UAAJ,CAAe,oBAAf,CAAqC,MAArC,CAA6C,IAAMpB,CAAnD,EAA4DO,IAA5D,CAAiE,SAASc,CAAT,CAA6B,CACjG7B,CAAO,CAAC6B,CAAD,CAEV,CAHM,CAIV,CAEJ,CArCD,EAqCGC,IArCH,CAqCQ7B,CArCR,CAsCH,CApFiE,CAwFzE,CA1FK,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 .\n\n/**\n * Potential user selector module.\n *\n * @module enrol_manual/form-potential-user-selector\n * @class form-potential-user-selector\n * @package enrol_manual\n * @copyright 2016 Damyon Wiese\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\n\ndefine(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, Templates, Str) {\n\n return /** @alias module:enrol_manual/form-potential-user-selector */ {\n\n processResults: function(selector, results) {\n var users = [];\n if ($.isArray(results)) {\n $.each(results, function(index, user) {\n users.push({\n value: user.id,\n label: user._label\n });\n });\n return users;\n\n } else {\n return results;\n }\n },\n\n transport: function(selector, query, success, failure) {\n var promise;\n var courseid = $(selector).attr('courseid');\n var userfields = $(selector).attr('userfields').split(',');\n if (typeof courseid === \"undefined\") {\n courseid = '1';\n }\n var enrolid = $(selector).attr('enrolid');\n if (typeof enrolid === \"undefined\") {\n enrolid = '';\n }\n var perpage = $(selector).attr('perpage');\n if (typeof perpage === \"undefined\") {\n perpage = 100;\n }\n\n promise = Ajax.call([{\n methodname: 'core_enrol_get_potential_users',\n args: {\n courseid: courseid,\n enrolid: enrolid,\n search: query,\n searchanywhere: true,\n page: 0,\n perpage: perpage + 1\n }\n }]);\n\n promise[0].then(function(results) {\n var promises = [],\n i = 0;\n\n if (results.length <= perpage) {\n // Render the label.\n $.each(results, function(index, user) {\n var ctx = user,\n identity = [];\n $.each(userfields, function(i, k) {\n if (typeof user[k] !== 'undefined' && user[k] !== '') {\n ctx.hasidentity = true;\n identity.push(user[k]);\n }\n });\n ctx.identity = identity.join(', ');\n promises.push(Templates.render('enrol_manual/form-user-selector-suggestion', ctx));\n });\n\n // Apply the label to the results.\n return $.when.apply($.when, promises).then(function() {\n var args = arguments;\n $.each(results, function(index, user) {\n user._label = args[i];\n i++;\n });\n success(results);\n return;\n });\n\n } else {\n return Str.get_string('toomanyuserstoshow', 'core', '>' + perpage).then(function(toomanyuserstoshow) {\n success(toomanyuserstoshow);\n return;\n });\n }\n\n }).fail(failure);\n }\n\n };\n\n});\n"],"file":"form-potential-user-selector.min.js"} \ No newline at end of file diff --git a/enrol/manual/amd/src/form-potential-user-selector.js b/enrol/manual/amd/src/form-potential-user-selector.js index 7fac602a91a..ab38b1ebb28 100644 --- a/enrol/manual/amd/src/form-potential-user-selector.js +++ b/enrol/manual/amd/src/form-potential-user-selector.js @@ -25,9 +25,6 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, Templates, Str) { - /** @var {Number} Maximum number of users to show. */ - var MAXUSERS = 100; - return /** @alias module:enrol_manual/form-potential-user-selector */ { processResults: function(selector, results) { @@ -57,6 +54,10 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, if (typeof enrolid === "undefined") { enrolid = ''; } + var perpage = $(selector).attr('perpage'); + if (typeof perpage === "undefined") { + perpage = 100; + } promise = Ajax.call([{ methodname: 'core_enrol_get_potential_users', @@ -66,7 +67,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, search: query, searchanywhere: true, page: 0, - perpage: MAXUSERS + 1 + perpage: perpage + 1 } }]); @@ -74,7 +75,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, var promises = [], i = 0; - if (results.length <= MAXUSERS) { + if (results.length <= perpage) { // Render the label. $.each(results, function(index, user) { var ctx = user, @@ -101,7 +102,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'], function($, Ajax, }); } else { - return Str.get_string('toomanyuserstoshow', 'core', '>' + MAXUSERS).then(function(toomanyuserstoshow) { + return Str.get_string('toomanyuserstoshow', 'core', '>' + perpage).then(function(toomanyuserstoshow) { success(toomanyuserstoshow); return; }); diff --git a/enrol/manual/classes/enrol_users_form.php b/enrol/manual/classes/enrol_users_form.php index b7fa663bba7..171aa261d25 100644 --- a/enrol/manual/classes/enrol_users_form.php +++ b/enrol/manual/classes/enrol_users_form.php @@ -92,6 +92,7 @@ class enrol_manual_enrol_users_form extends moodleform { 'multiple' => true, 'courseid' => $course->id, 'enrolid' => $instance->id, + 'perpage' => $CFG->maxusersperpage, 'userfields' => implode(',', get_extra_user_fields($context)) ); $mform->addElement('autocomplete', 'userlist', get_string('selectusers', 'enrol_manual'), array(), $options); diff --git a/enrol/manual/tests/behat/quickenrolment.feature b/enrol/manual/tests/behat/quickenrolment.feature index e44169e7c98..2208c7ca6ff 100644 --- a/enrol/manual/tests/behat/quickenrolment.feature +++ b/enrol/manual/tests/behat/quickenrolment.feature @@ -154,6 +154,16 @@ Feature: Teacher can search and enrol users one by one into the course And I click on ".form-autocomplete-downarrow" "css_element" in the "Select users" "form_row" Then I should see "Too many users (>100) to show" + @javascript + Scenario: Changing the Maximum users per page setting affects the enrolment pop-up. + Given the following config values are set as admin: + | maxusersperpage | 5 | + And I navigate to course participants + And I press "Enrol users" + When I set the field "Select users" to "student00" + And I click on ".form-autocomplete-downarrow" "css_element" in the "Select users" "form_row" + Then I should see "Too many users (>5) to show" + @javascript Scenario: Change the Show user identity setting affects the enrolment pop-up. Given I log out