Merge branch 'MDL-63293' of https://github.com/paulholden/moodle
This commit is contained in:
@@ -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
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -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;
|
||||
});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user