MDL-59204 mod_*: removed redundant activity name from string index
[moodle.git] / user / module.js
blob98c9040280f18df0d7ab11750e04fa39fc4bec3e
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         // Presence of a show all link indicates we should redirect to
25         // a page with all users listed and checked, otherwise just check
26         // those already shown.
27         var showallink = this.getAttribute('data-showallink');
28         if (showallink) {
29             window.location = showallink;
30         }
31         Y.all('input.usercheckbox').each(function() {
32             this.set('checked', 'checked');
33         });
34     }, '#checkall, #checkallonpage');
36     Y.on('click', function(e) {
37         Y.all('input.usercheckbox').each(function() {
38             this.set('checked', '');
39         });
40     }, '#checknone');
43 M.core_user.init_tree = function(Y, expand_all, htmlid) {
44     Y.use('yui2-treeview', function(Y) {
45         var tree = new Y.YUI2.widget.TreeView(htmlid);
47         tree.subscribe("clickEvent", function(node, event) {
48             // we want normal clicking which redirects to url
49             return false;
50         });
52         if (expand_all) {
53             tree.expandAll();
54         }
56         tree.render();
57     });