Fix JShint errors and remove deprecated call to checkall/checknone
authorDan Marsden <dan@danmarsden.com>
Thu, 19 Nov 2015 07:31:21 +0000 (20:31 +1300)
committerDan Marsden <dan@danmarsden.com>
Thu, 19 Nov 2015 07:31:21 +0000 (20:31 +1300)
calendar.js
module.js
renderer.php

index b57ebc1..147c1ce 100644 (file)
@@ -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
                 });
index 31a4289..ee83b79 100644 (file)
--- 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' );
 };
index ecc7ec8..b604607 100644 (file)
@@ -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);