Merge branch 'MDL-56530-master' of git://github.com/andrewnicols/moodle
[moodle.git] / report / participation / module.js
blobd3984392c178ce6f54564f501c6f8271c0c76fbe
2 M.report_participation = {};
4 M.report_participation.init = function(Y) {
6     Y.on('submit', function(e) {
7             Y.one('#formactionselect').get('options').each(function() {
8                 if (this.get('selected') && this.get('value') == '') {
9                     // no action selected
10                     e.preventDefault();
11                 }
12             });
13             var ok = false;
14             Y.all('input.usercheckbox').each(function() {
15                 if (this.get('checked')) {
16                     ok = true;
17                 }
18             });
19             if (!ok) {
20                 // no checkbox selected
21                 e.preventDefault();
22             }
23         }, '#studentsform');
25     Y.on('click', function(e) {
26         Y.all('input.usercheckbox').each(function() {
27             this.set('checked', 'checked');
28         });
29     }, '#checkall');
31     Y.on('click', function(e) {
32         Y.all('input.usercheckbox').each(function() {
33             this.set('checked', '');
34         });
35     }, '#checknone');
37     Y.on('click', function(e) {
38         Y.all('input.usercheckbox').each(function() {
39             if (this.get('value') == 0) {
40                 this.set('checked', 'checked');
41             }
42         });
43     }, '#checknos');