Petr Skoda 17a14fbd01 MDL-29509 move spamcleaner to admin tools
Why? Because this tool does not support contexts, allows data modifications and is intended only for admins. It is still linked from admin reports for now, we will move it elsewhere once we know where to add general new reports.

AMOS BEGIN
 MOV [pluginname,report_spamcleaner],[pluginname,tool_spamcleaner]
 MOV [spamauto,report_spamcleaner],[spamauto,tool_spamcleaner]
 MOV [spamcannotdelete,report_spamcleaner],[spamcannotdelete,tool_spamcleaner]
 MOV [spamcannotfinduser,report_spamcleaner],[spamcannotfinduser,tool_spamcleaner]
 MOV [spamcleanerintro,report_spamcleaner],[spamcleanerintro,tool_spamcleaner]
 MOV [spamdeleteall,report_spamcleaner],[spamdeleteall,tool_spamcleaner]
 MOV [spamdeleteallconfirm,report_spamcleaner],[spamdeleteallconfirm,tool_spamcleaner]
 MOV [spamdeleteconfirm,report_spamcleaner],[spamdeleteconfirm,tool_spamcleaner]
 MOV [spamdesc,report_spamcleaner],[spamdesc,tool_spamcleaner]
 MOV [spameg,report_spamcleaner],[spameg,tool_spamcleaner]
 MOV [spamfromblog,report_spamcleaner],[spamfromblog,tool_spamcleaner]
 MOV [spaminvalidresult,report_spamcleaner],[spaminvalidresult,tool_spamcleaner]
 MOV [spamoperation,report_spamcleaner],[spamoperation,tool_spamcleaner]
 MOV [spamresult,report_spamcleaner],[spamresult,tool_spamcleaner]
 MOV [spamsearch,report_spamcleaner],[spamsearch,tool_spamcleaner]
AMOS END
2011-09-27 00:39:20 +02:00

116 lines
3.7 KiB
JavaScript

M.tool_spamcleaner = {
Y: null,
row: null,
me: null,
del_all: function() {
var context = M.tool_spamcleaner;
var yes = confirm(M.str.tool_spamcleaner.spamdeleteallconfirm);
if (yes) {
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
return;
}
if (resp == true) {
window.location.href=window.location.href;
}
}
}
};
context.Y.io(context.me+'?delall=yes&sesskey='+M.cfg.sesskey, cfg);
}
},
del_user: function(obj, id) {
var context = M.tool_spamcleaner;
if (context.Y == null) {
// not initialised yet
return;
}
var yes = confirm(M.str.tool_spamcleaner.spamdeleteconfirm);
if (yes) {
context.row = obj;
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
return;
}
if (context.row) {
if (resp == true) {
while(context.row.tagName != 'TR') {
context.row = context.row.parentNode;
}
context.row.parentNode.removeChild(context.row);
context.row = null;
} else {
alert(M.str.tool_spamcleaner.spamcannotdelete);
}
}
}
}
}
context.Y.io(context.me+'?del=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
}
},
ignore_user: function(obj, id) {
var context = M.tool_spamcleaner;
if (context.Y == null) {
// not initilised yet
return;
}
context.row = obj;
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
var resp = context.Y.JSON.parse(o.responseText);
} catch(e) {
alert(M.str.tool_spamcleaner.spaminvalidresult);
return;
}
if (context.row) {
if (resp == true){
while(context.row.tagName != 'TR') {
context.row = context.row.parentNode;
}
context.row.parentNode.removeChild(context.row);
context.row = null;
}
}
}
}
}
context.Y.io(context.me+'?ignore=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
},
init: function(Y, me) {
var context = M.tool_spamcleaner;
Y.use('json', 'io-base', function (Y) {
context.Y = Y;
context.me = me;
if (Y.one("#removeall_btn")) {
Y.on("click", context.del_all, "#removeall_btn");
}
});
}
}