116 lines
3.8 KiB
JavaScript
Raw Normal View History

M.report_spamcleaner = {
2010-01-23 18:30:16 +00:00
Y: null,
row: null,
me: null,
2010-01-23 18:30:16 +00:00
del_all: function() {
2010-01-24 18:24:18 +00:00
var context = M.report_spamcleaner;
var yes = confirm(M.str.report_spamcleaner.spamdeleteallconfirm);
if (yes) {
2010-01-23 18:30:16 +00:00
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
2010-01-24 18:24:18 +00:00
var resp = context.Y.JSON.parse(o.responseText);
2010-01-23 18:30:16 +00:00
} catch(e) {
alert(M.str.report_spamcleaner.spaminvalidresult);
2010-01-23 18:30:16 +00:00
return;
}
if (resp == true) {
window.location.href=window.location.href;
}
}
}
2010-02-04 21:40:20 +00:00
};
2010-01-24 18:24:18 +00:00
context.Y.io(context.me+'?delall=yes&sesskey='+M.cfg.sesskey, cfg);
}
2010-01-23 18:30:16 +00:00
},
2010-09-17 10:27:26 +00:00
2010-01-23 18:30:16 +00:00
del_user: function(obj, id) {
2010-01-24 18:24:18 +00:00
var context = M.report_spamcleaner;
if (context.Y == null) {
2010-09-17 10:27:26 +00:00
// not initialised yet
2010-01-24 18:24:18 +00:00
return;
}
var yes = confirm(M.str.report_spamcleaner.spamdeleteconfirm);
2010-01-23 18:30:16 +00:00
if (yes) {
2010-01-24 18:24:18 +00:00
context.row = obj;
2010-01-23 18:30:16 +00:00
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
2010-01-24 18:24:18 +00:00
var resp = context.Y.JSON.parse(o.responseText);
2010-01-23 18:30:16 +00:00
} catch(e) {
alert(M.str.report_spamcleaner.spaminvalidresult);
2010-01-23 18:30:16 +00:00
return;
}
2010-01-24 18:24:18 +00:00
if (context.row) {
2010-01-23 18:30:16 +00:00
if (resp == true) {
2010-01-24 18:24:18 +00:00
while(context.row.tagName != 'TR') {
context.row = context.row.parentNode;
2010-01-23 18:30:16 +00:00
}
2010-01-24 18:24:18 +00:00
context.row.parentNode.removeChild(context.row);
context.row = null;
2010-01-23 18:30:16 +00:00
} else {
alert(M.str.report_spamcleaner.spamcannotdelete);
2010-01-23 18:30:16 +00:00
}
}
}
}
}
2010-01-24 18:24:18 +00:00
context.Y.io(context.me+'?del=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
2010-01-23 18:30:16 +00:00
}
},
2010-01-23 18:30:16 +00:00
ignore_user: function(obj, id) {
2010-01-24 18:24:18 +00:00
var context = M.report_spamcleaner;
if (context.Y == null) {
// not initilised yet
return;
}
context.row = obj;
2010-01-23 18:30:16 +00:00
var cfg = {
method: "POST",
on: {
success : function(id, o, args) {
try {
2010-01-24 18:24:18 +00:00
var resp = context.Y.JSON.parse(o.responseText);
2010-01-23 18:30:16 +00:00
} catch(e) {
alert(M.str.report_spamcleaner.spaminvalidresult);
2010-01-23 18:30:16 +00:00
return;
}
2010-01-24 18:24:18 +00:00
if (context.row) {
2010-01-23 18:30:16 +00:00
if (resp == true){
2010-01-24 18:24:18 +00:00
while(context.row.tagName != 'TR') {
context.row = context.row.parentNode;
2010-01-23 18:30:16 +00:00
}
2010-01-24 18:24:18 +00:00
context.row.parentNode.removeChild(context.row);
context.row = null;
2010-01-23 18:30:16 +00:00
}
2010-09-17 10:27:26 +00:00
}
2010-01-23 18:30:16 +00:00
}
}
}
2010-01-24 18:24:18 +00:00
context.Y.io(context.me+'?ignore=yes&sesskey='+M.cfg.sesskey+'&id='+id, cfg);
2010-01-23 18:30:16 +00:00
},
init: function(Y, me) {
2010-01-24 18:24:18 +00:00
var context = M.report_spamcleaner;
Y.use('json', 'io', function (Y) {
context.Y = Y;
context.me = me;
if (Y.one("#removeall_btn")) {
Y.on("click", context.del_all, "#removeall_btn");
}
});
2010-01-23 18:30:16 +00:00
}
}