forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 1
/
admin.js
44 lines (44 loc) · 1.27 KB
/
admin.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
YAHOO.util.Event.onDOMReady(init);
function init() {
var select_all = document.getElementById('comment_select_all');
select_all.onclick = function() {
var comments = document.getElementsByName('comments');
var checked = false;
for (var i in comments) {
if (comments[i].checked) {
checked=true;
}
}
for (var i in comments) {
comments[i].checked = !checked;
}
this.checked = !checked;
}
var comments_delete = document.getElementById('comments_delete');
comments_delete.onclick = function() {
delete_comments();
}
}
function delete_comments() {
var url = moodle_cfg.wwwroot + '/comment/index.php';
var cb = {
success:function(o) {
if (o.responseText == 'yes') {
location.reload();
}
}
}
var comments = document.getElementsByName('comments');
var list = '';
for (var i in comments) {
if (comments[i].checked) {
list += (comments[i].value + '-');
}
}
var data = {
'commentids': list,
'sesskey': moodle_cfg.sesskey
}
var trans = YAHOO.util.Connect.asyncRequest('POST',
url+'?action=delete', cb, build_querystring(data));
}