From 6225e4bd1fc4049d04c1c4995f260f5176c880e0 Mon Sep 17 00:00:00 2001 From: Dan Marsden Date: Thu, 19 Nov 2015 20:31:21 +1300 Subject: [PATCH] Fix JShint errors and remove deprecated call to checkall/checknone --- calendar.js | 24 +++++++++++++----------- module.js | 10 +++++++--- renderer.php | 2 +- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/calendar.js b/calendar.js index b57ebc1..147c1ce 100644 --- a/calendar.js +++ b/calendar.js @@ -13,7 +13,17 @@ YUI().use('yui2-container', 'yui2-calendar', function(Y) { 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) { // 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", { visible:false, 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, close:false }); diff --git a/module.js b/module.js index 31a4289..ee83b79 100644 --- a/module.js +++ b/module.js @@ -1,12 +1,16 @@ -M.mod_attendance = {} +M.mod_attendance = {}; M.mod_attendance.init_manage = function(Y) { Y.on('click', function(e) { if (e.target.get('checked')) { - checkall(); + Y.all('input.attendancesesscheckbox').each(function() { + this.set('checked', 'checked'); + }); } else { - checknone(); + Y.all('input.attendancesesscheckbox').each(function() { + this.set('checked', ''); + }); } }, '#cb_selector' ); }; diff --git a/renderer.php b/renderer.php index ecc7ec8..b604607 100644 --- a/renderer.php +++ b/renderer.php @@ -237,7 +237,7 @@ class mod_attendance_renderer extends plugin_renderer_base { $table->data[$sess->id][] = $dta['time']; $table->data[$sess->id][] = $sess->description; $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);