Show an icon next to the comment deletion icon, which leads to a
comment edit form.
Signed-off-by: Marcel Korpel
---
web/html/commentedit.php | 21 +++++++++++++++
web/html/css/aurweb.css | 13 ++++++---
web/html/images/pencil.min.svg | 3 +++
web/html/images/pencil.svg | 55 +++++++++++++++++++++++++++++++++++++++
web/html/index.php | 4 +++
web/html/pkgbase.php | 4 +--
web/lib/aur.inc.php | 19 ++++++++++++++
web/lib/credentials.inc.php | 2 ++
web/lib/pkgfuncs.inc.php | 14 ++++++++++
web/template/pkg_comment_form.php | 10 ++++---
web/template/pkg_comments.php | 3 +++
11 files changed, 139 insertions(+), 9 deletions(-)
create mode 100644 web/html/commentedit.php
create mode 100644 web/html/images/pencil.min.svg
create mode 100644 web/html/images/pencil.svg
diff --git a/web/html/commentedit.php b/web/html/commentedit.php
new file mode 100644
index 0000000..c7dda63
--- /dev/null
+++ b/web/html/commentedit.php
@@ -0,0 +1,21 @@
+<?php
+
+set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
+
+include_once("aur.inc.php");
+include_once("pkgbasefuncs.inc.php");
+
+set_lang();
+check_sid();
+
+$comment_id = intval($_REQUEST['comment_id']);
+$comment = comment_by_id($comment_id);
+
+if (!isset($base_id) || !has_credential(CRED_COMMENT_EDIT, array(pkgbase_maintainer_uid($base_id))) || is_null($comment)) {
+ header('Location: /');
+ exit();
+}
+
+html_header(__("Edit comment"));
+include('pkg_comment_form.php');
+html_footer(AURWEB_VERSION);
diff --git a/web/html/css/aurweb.css b/web/html/css/aurweb.css
index adc02bb..b5ca1f3 100644
--- a/web/html/css/aurweb.css
+++ b/web/html/css/aurweb.css
@@ -96,17 +96,24 @@
color: #999;
}
-.delete-comment-form {
+.delete-comment-form, .edit-comment {
float: right;
+ margin-left: 8px;
}
-.delete-comment {
+.edit-comment {
+ height: 11px;
+ position: relative;
+ top: 1px;
+}
+
+.delete-comment, .edit-comment {
-webkit-filter: grayscale(100%);
filter: grayscale(100%);
opacity: 0.6;
}
-.delete-comment:hover {
+.delete-comment:hover, .edit-comment:hover {
-webkit-filter: none;
filter: none;
opacity: 1;
diff --git a/web/html/images/pencil.min.svg b/web/html/images/pencil.min.svg
new file mode 100644
index 0000000..06125ae
--- /dev/null
+++ b/web/html/images/pencil.min.svg
@@ -0,0 +1,3 @@
+<svg xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/2000/svg" height="8" width="8" version="1.1" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" viewBox="0 0 8 8">
+<path fill="#36a" d="m6 0l-1 1 2 2 1-1-2-2zm-2 2l-4 4v2h2l4-4-2-2z"/>
+</svg>
diff --git a/web/html/images/pencil.svg b/web/html/images/pencil.svg
new file mode 100644
index 0000000..91f0899
--- /dev/null
+++ b/web/html/images/pencil.svg
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+