forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.js
51 lines (43 loc) · 1.22 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
M.core_user = {};
M.core_user.init_participation = function(Y) {
Y.on('change', function() {
var action = Y.one('#formactionid');
if (action.get('value') == '') {
return;
}
var ok = false;
Y.all('input.usercheckbox').each(function() {
if (this.get('checked')) {
ok = true;
}
});
if (!ok) {
// no checkbox selected
return;
}
Y.one('#participantsform').submit();
}, '#formactionid');
Y.on('click', function(e) {
Y.all('input.usercheckbox').each(function() {
this.set('checked', 'checked');
});
}, '#checkall');
Y.on('click', function(e) {
Y.all('input.usercheckbox').each(function() {
this.set('checked', '');
});
}, '#checknone');
};
M.core_user.init_tree = function(Y, expand_all, htmlid) {
Y.use('yui2-treeview', function(Y) {
var tree = new YAHOO.widget.TreeView(htmlid);
tree.subscribe("clickEvent", function(node, event) {
// we want normal clicking which redirects to url
return false;
});
if (expand_all) {
tree.expandAll();
}
tree.render();
});
};