MDL-35622 files: Add support for SMART Notebook MIME types
[moodle.git] / user / module.js
blob324a2af2de66152c1e8e25caed3c51c60e3ee98a
2 M.core_user = {};
4 M.core_user.init_participation = function(Y) {
5         Y.on('change', function() {
6                 var action = Y.one('#formactionid');
7                 if (action.get('value') == '') {
8                         return;
9                 }
10         var ok = false;
11         Y.all('input.usercheckbox').each(function() {
12             if (this.get('checked')) {
13                 ok = true;
14             }
15         });
16         if (!ok) {
17             // no checkbox selected
18             return;
19         }
20         Y.one('#participantsform').submit();
21         }, '#formactionid');
23     Y.on('click', function(e) {
24         Y.all('input.usercheckbox').each(function() {
25             this.set('checked', 'checked');
26         });
27     }, '#checkall');
29     Y.on('click', function(e) {
30         Y.all('input.usercheckbox').each(function() {
31             this.set('checked', '');
32         });
33     }, '#checknone');
36 M.core_user.init_tree = function(Y, expand_all, htmlid) {
37     Y.use('yui2-treeview', function(Y) {
38         var tree = new Y.YUI2.widget.TreeView(htmlid);
40         tree.subscribe("clickEvent", function(node, event) {
41             // we want normal clicking which redirects to url
42             return false;
43         });
45         if (expand_all) {
46             tree.expandAll();
47         }
49         tree.render();
50     });