Browse Source

Fix JShint errors and remove deprecated call to checkall/checknone

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
6225e4bd1f
  1. 24
      calendar.js
  2. 10
      module.js
  3. 2
      renderer.php

24
calendar.js

@ -13,7 +13,17 @@ YUI().use('yui2-container', 'yui2-calendar', function(Y) {
Event.on(showBtn, "click", function() { Event.on(showBtn, "click", function() {
// Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners, until the first time the button is clicked. function resetHandler() {
calendar.cfg.setProperty("pagedate", calendar.today);
calendar.render();
}
function closeHandler() {
dialog.hide();
}
// Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners,
// until the first time the button is clicked.
if (!dialog) { if (!dialog) {
// Hide Calendar if we click anywhere in the document other than the calendar // Hide Calendar if we click anywhere in the document other than the calendar
@ -25,19 +35,11 @@ YUI().use('yui2-container', 'yui2-calendar', function(Y) {
} }
}); });
function resetHandler() {
calendar.cfg.setProperty("pagedate", calendar.today);
calendar.render();
}
function closeHandler() {
dialog.hide();
}
dialog = new YAHOO.widget.Dialog("attcalendarcontainer", { dialog = new YAHOO.widget.Dialog("attcalendarcontainer", {
visible:false, visible:false,
context:["show", "tl", "bl"], context:["show", "tl", "bl"],
buttons:[{text: M.str.attendance.caltoday, handler: resetHandler, isDefault:true}, {text: M.str.attendance.calclose, handler: closeHandler}], buttons:[{text: M.str.attendance.caltoday, handler: resetHandler, isDefault:true},
{text: M.str.attendance.calclose, handler: closeHandler}],
draggable:false, draggable:false,
close:false close:false
}); });

10
module.js

@ -1,12 +1,16 @@
M.mod_attendance = {} M.mod_attendance = {};
M.mod_attendance.init_manage = function(Y) { M.mod_attendance.init_manage = function(Y) {
Y.on('click', function(e) { Y.on('click', function(e) {
if (e.target.get('checked')) { if (e.target.get('checked')) {
checkall(); Y.all('input.attendancesesscheckbox').each(function() {
this.set('checked', 'checked');
});
} else { } else {
checknone(); Y.all('input.attendancesesscheckbox').each(function() {
this.set('checked', '');
});
} }
}, '#cb_selector' ); }, '#cb_selector' );
}; };

2
renderer.php

@ -237,7 +237,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$table->data[$sess->id][] = $dta['time']; $table->data[$sess->id][] = $dta['time'];
$table->data[$sess->id][] = $sess->description; $table->data[$sess->id][] = $sess->description;
$table->data[$sess->id][] = $dta['actions']; $table->data[$sess->id][] = $dta['actions'];
$table->data[$sess->id][] = html_writer::checkbox('sessid[]', $sess->id, false); $table->data[$sess->id][] = html_writer::checkbox('sessid[]', $sess->id, false, '', array('class' => 'attendancesesscheckbox'));
} }
return html_writer::table($table); return html_writer::table($table);

Loading…
Cancel
Save