summaryrefslogtreecommitdiffstats
path: root/web/html
diff options
context:
space:
mode:
authorMarcel Korpel <marcel.korpel@gmail.com>2015-07-10 18:47:31 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-08-08 12:59:23 +0200
commit92e19e95f3c07745e7ba7c6e358921b7789f8abe (patch)
tree33b79d9247d96e25fdbb5cfd960808a7cf67dc5f /web/html
parent8375d212106918b602911f6286d2e4fd172d446e (diff)
downloadaurweb-92e19e95f3c07745e7ba7c6e358921b7789f8abe.tar.xz
Add comment edit icon and form
Show an icon next to the comment deletion icon, which leads to a comment edit form. Signed-off-by: Marcel Korpel <marcel.korpel@gmail.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/html')
-rw-r--r--web/html/commentedit.php21
-rw-r--r--web/html/css/aurweb.css13
-rw-r--r--web/html/images/pencil.min.svg3
-rw-r--r--web/html/images/pencil.svg55
-rw-r--r--web/html/index.php4
-rw-r--r--web/html/pkgbase.php4
6 files changed, 94 insertions, 6 deletions
diff --git a/web/html/commentedit.php b/web/html/commentedit.php
new file mode 100644
index 0000000..83d86dd
--- /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']);
+list($user_id, $comment) = comment_by_id($comment_id);
+
+if (!isset($base_id) || !has_credential(CRED_COMMENT_EDIT, array($user_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"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="8"
+ height="8"
+ viewBox="0 0 8 8"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="pencil-arch.svg">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="659"
+ inkscape:window-height="480"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="29.5"
+ inkscape:cx="4"
+ inkscape:cy="4"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
+ <path
+ d="M6 0l-1 1 2 2 1-1-2-2zm-2 2l-4 4v2h2l4-4-2-2z"
+ id="path4"
+ style="fill:#3366aa;fill-opacity:1" />
+</svg>
diff --git a/web/html/index.php b/web/html/index.php
index 2d5f2a9..175a533 100644
--- a/web/html/index.php
+++ b/web/html/index.php
@@ -89,6 +89,9 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
case "comaintainers":
include('comaintainers.php');
return;
+ case "edit-comment":
+ include('commentedit.php');
+ return;
default:
header("HTTP/1.0 404 Not Found");
include "./404.php";
@@ -174,6 +177,7 @@ if (!empty($tokens[1]) && '/' . $tokens[1] == get_pkg_route()) {
readfile("./$path");
break;
case "/images/x.min.svg":
+ case "/images/pencil.min.svg":
header("Content-Type: image/svg+xml");
readfile("./$path");
break;
diff --git a/web/html/pkgbase.php b/web/html/pkgbase.php
index 5179d0c..f908029 100644
--- a/web/html/pkgbase.php
+++ b/web/html/pkgbase.php
@@ -104,9 +104,7 @@ if (check_token()) {
list($ret, $output) = pkgreq_close($_POST['reqid'], $_POST['reason'], $_POST['comments']);
} elseif (current_action("do_EditComaintainers")) {
list($ret, $output) = pkgbase_set_comaintainers($base_id, explode("\n", $_POST['users']));
- }
-
- if (isset($_REQUEST['comment'])) {
+ } elseif (current_action("do_AddComment")) {
$uid = uid_from_sid($_COOKIE["AURSID"]);
pkgbase_add_comment($base_id, $uid, $_REQUEST['comment']);
$ret = true;