From 8d9d2b64334b8fcbe8dafd4324f5df0d2891f187 Mon Sep 17 00:00:00 2001 From: calzoneman Date: Sat, 13 Jul 2013 13:23:32 -0400 Subject: [PATCH] Clear individual rows from action log --- acp.js | 5 +++++ actionlog.js | 18 ++++++++++++++++++ www/acp.html | 1 + www/assets/js/acp.js | 10 ++++++++++ 4 files changed, 34 insertions(+) diff --git a/acp.js b/acp.js index ea556c9e..a639d8a8 100644 --- a/acp.js +++ b/acp.js @@ -152,5 +152,10 @@ module.exports = { ActionLog.clear(data); ActionLog.record(user.ip, user.name, "acp-actionlog-clear", data); }); + + user.socket.on("acp-actionlog-clear-one", function(data) { + ActionLog.clearOne(data); + ActionLog.record(user.ip, user.name, "acp-actionlog-clear-one", data); + }); } } diff --git a/actionlog.js b/actionlog.js index 7fc2c870..e5c18df4 100644 --- a/actionlog.js +++ b/actionlog.js @@ -65,6 +65,24 @@ exports.clear = function(actions) { return result; } +exports.clearOne = function(e) { + var db = Database.getConnection(); + if(!db) + return false; + + var query = Database.createQuery( + "DELETE FROM actionlog WHERE ip=? AND time=?", + [e.ip, e.time] + ); + + var result = db.querySync(query); + if(!result) { + Logger.errlog.log("! Failed to clear action log"); + } + + return result; +} + exports.tooManyRegistrations = function (ip) { var db = Database.getConnection(); if(!db) diff --git a/www/acp.html b/www/acp.html index 119db195..c686532c 100644 --- a/www/acp.html +++ b/www/acp.html @@ -187,6 +187,7 @@ + diff --git a/www/assets/js/acp.js b/www/assets/js/acp.js index b430692b..186d1cbc 100644 --- a/www/assets/js/acp.js +++ b/www/assets/js/acp.js @@ -157,6 +157,16 @@ function getActionLog() { tbl.data("allentries", entries); tbl.data("generator", function(e) { var tr = $("").appendTo($("#actionlog table")); + var rem = $("
Remove IP Address Name Action
").appendTo(tr); + $("").text(e.ip).appendTo(tr); $("").text(e.name).appendTo(tr); $("").text(e.action).appendTo(tr);