From bd85441cf66b39d887f01654913da58ef313d14c Mon Sep 17 00:00:00 2001 From: Marcel Korpel Date: Tue, 19 Jan 2016 14:49:50 +0100 Subject: Add comment undeletion functionality Only Developers and Trusted Users can undelete comments. Signed-off-by: Marcel Korpel Signed-off-by: Lukas Fleischer --- web/html/css/aurweb.css | 6 +++--- web/html/images/action-undo.min.svg | 3 +++ web/html/images/action-undo.svg | 32 ++++++++++++++++++++++++++++++++ web/html/index.php | 1 + web/html/pkgbase.php | 5 +++++ 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 web/html/images/action-undo.min.svg create mode 100644 web/html/images/action-undo.svg (limited to 'web/html') diff --git a/web/html/css/aurweb.css b/web/html/css/aurweb.css index 92ff8989..4c3fbe53 100644 --- a/web/html/css/aurweb.css +++ b/web/html/css/aurweb.css @@ -101,7 +101,7 @@ color: #999; } -.delete-comment-form, .pin-comment-form, .edit-comment { +.delete-comment-form, .undelete-comment-form, .pin-comment-form, .edit-comment { float: right; margin-left: 8px; } @@ -112,13 +112,13 @@ top: 1px; } -.delete-comment, .edit-comment, .pin-comment { +.delete-comment, .undelete-comment, .edit-comment, .pin-comment { -webkit-filter: grayscale(100%); filter: grayscale(100%); opacity: 0.6; } -.delete-comment:hover, .edit-comment:hover, .pin-comment:hover { +.delete-comment:hover, .undelete-comment:hover, .edit-comment:hover, .pin-comment:hover { -webkit-filter: none; filter: none; opacity: 1; diff --git a/web/html/images/action-undo.min.svg b/web/html/images/action-undo.min.svg new file mode 100644 index 00000000..eb47bc47 --- /dev/null +++ b/web/html/images/action-undo.min.svg @@ -0,0 +1,3 @@ + + + diff --git a/web/html/images/action-undo.svg b/web/html/images/action-undo.svg new file mode 100644 index 00000000..b93ebb78 --- /dev/null +++ b/web/html/images/action-undo.svg @@ -0,0 +1,32 @@ + + + + + + image/svg+xml + + + + + + + + diff --git a/web/html/index.php b/web/html/index.php index 0a9fd05d..3787d4e4 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -180,6 +180,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) { readfile("./$path"); break; case "/images/x.min.svg": + case "/images/action-undo.min.svg": case "/images/pencil.min.svg": case "/images/pin.min.svg": case "/images/unpin.min.svg": diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php index 45b8084b..11fdf74a 100644 --- a/web/html/pkgbase.php +++ b/web/html/pkgbase.php @@ -99,6 +99,11 @@ if (check_token()) { list($ret, $output) = pkgbase_notify($ids, false); } elseif (current_action("do_DeleteComment")) { list($ret, $output) = pkgbase_delete_comment(); + } elseif (current_action("do_UndeleteComment")) { + list($ret, $output) = pkgbase_delete_comment(true); + if ($ret && isset($_POST["comment_id"])) { + $fragment = '#comment-' . intval($_POST["comment_id"]); + } } elseif (current_action("do_PinComment")) { list($ret, $output) = pkgbase_pin_comment(); } elseif (current_action("do_UnpinComment")) { -- cgit v1.2.3-24-g4f1b