web service MDL-13126 little change into create user description (it was not correct...
[moodle.git] / comment / admin.js
CommitLineData
6f5e0852 1YAHOO.util.Event.onDOMReady(init);
1bcb7eb5 2function init() {
3 var select_all = document.getElementById('comment_select_all');
4 select_all.onclick = function() {
5 var comments = document.getElementsByName('comments');
6 var checked = false;
7 for (var i in comments) {
8 if (comments[i].checked) {
9 checked=true;
10 }
11 }
12 for (var i in comments) {
13 comments[i].checked = !checked;
14 }
15 this.checked = !checked;
16 }
17 var comments_delete = document.getElementById('comments_delete');
18 comments_delete.onclick = function() {
19 delete_comments();
20 }
21}
22function delete_comments() {
9598d578 23 var url = M.cfg.wwwroot + '/comment/index.php';
1bcb7eb5 24 var cb = {
25 success:function(o) {
26 if (o.responseText == 'yes') {
27 location.reload();
28 }
29 }
30 }
31 var comments = document.getElementsByName('comments');
32 var list = '';
33 for (var i in comments) {
34 if (comments[i].checked) {
35 list += (comments[i].value + '-');
36 }
37 }
38 var data = {
39 'commentids': list,
9598d578 40 'sesskey': M.cfg.sesskey
1bcb7eb5 41 }
42 var trans = YAHOO.util.Connect.asyncRequest('POST',
43 url+'?action=delete', cb, build_querystring(data));
44}