mirror of
https://github.com/moodle/moodle.git
synced 2025-03-14 12:40:01 +01:00
MDL-21887 fixed borked JS, but still the groups ajax needs a major cleanup
This commit is contained in:
parent
14e23787c0
commit
68dc01ab40
@ -19,7 +19,6 @@ function UpdatableGroupsCombo(wwwRoot, courseId) {
|
||||
if (o.responseText !== undefined) {
|
||||
var groupsComboEl = document.getElementById("groups");
|
||||
var membersComboEl = document.getElementById("members");
|
||||
|
||||
if (membersComboEl) {
|
||||
// Clear the members list box.
|
||||
while (membersComboEl.firstChild) {
|
||||
|
@ -11,8 +11,6 @@
|
||||
require_once('../config.php');
|
||||
require_once('lib.php');
|
||||
|
||||
ini_set('include_path', $CFG->libdir.'/pear'.PATH_SEPARATOR.ini_get('include_path'));
|
||||
|
||||
$PAGE->requires->yui2_lib('connection');
|
||||
$PAGE->requires->js('/group/clientlib.js');
|
||||
|
||||
@ -172,8 +170,8 @@ echo '<tr>'."\n";
|
||||
echo "<td>\n";
|
||||
echo '<p><label for="groups"><span id="groupslabel">'.get_string('groups').':</span><span id="thegrouping"> </span></label></p>'."\n";
|
||||
|
||||
if (ajaxenabled()) {
|
||||
$onchange = 'membersCombo.refreshMembers();';
|
||||
if (ajaxenabled()) { // TODO: move this to JS init!
|
||||
$onchange = 'M.core_group.membersCombo.refreshMembers();';
|
||||
} else {
|
||||
$onchange = '';
|
||||
}
|
||||
@ -263,10 +261,7 @@ echo '</div>'."\n";
|
||||
echo '</form>'."\n";
|
||||
|
||||
if (ajaxenabled()) {
|
||||
$PAGE->requires->js_function_call('var groupsCombo = new UpdatableGroupsCombo',
|
||||
array($CFG->httpswwwroot, $course->id));
|
||||
$PAGE->requires->js_function_call('var membersCombo = new UpdatableMembersCombo',
|
||||
array($CFG->httpswwwroot, $course->id));
|
||||
$PAGE->requires->js_init_call('M.core_group.init_index');
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -40,3 +40,7 @@ M.core_group.init_hover_events = function(Y, events) {
|
||||
}
|
||||
}
|
||||
|
||||
M.core_group.init_index = function(Y) {
|
||||
M.core_group.groupsCombo = new UpdatableGroupsCombo();
|
||||
M.core_group.membersCombo = new UpdatableMembersCombo;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user