[aur-dev] [PATCH v4 2/4] Split pkg_comment_form.php so the outer box is not always included

Marcel Korpel marcel.korpel at gmail.com
Tue Jul 21 20:53:55 UTC 2015


For use in the new RPC interface to edit comments, the form shouldn't
always print a header. Create a new template pkg_comment_box.php that
prints form and box, change template pkg_comment_form.php to only
print the form.

Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
---
 web/html/commentedit.php          | 2 +-
 web/lib/pkgbasefuncs.inc.php      | 2 +-
 web/lib/pkgfuncs.inc.php          | 2 +-
 web/template/pkg_comment_box.php  | 4 ++++
 web/template/pkg_comment_form.php | 4 ----
 5 files changed, 7 insertions(+), 7 deletions(-)
 create mode 100644 web/template/pkg_comment_box.php

diff --git a/web/html/commentedit.php b/web/html/commentedit.php
index 83d86dd..2a0628e 100644
--- a/web/html/commentedit.php
+++ b/web/html/commentedit.php
@@ -17,5 +17,5 @@ if (!isset($base_id) || !has_credential(CRED_COMMENT_EDIT, array($user_id)) || i
 }
 
 html_header(__("Edit comment"));
-include('pkg_comment_form.php');
+include('pkg_comment_box.php');
 html_footer(AURWEB_VERSION);
diff --git a/web/lib/pkgbasefuncs.inc.php b/web/lib/pkgbasefuncs.inc.php
index 6057d10..3a72c24 100644
--- a/web/lib/pkgbasefuncs.inc.php
+++ b/web/lib/pkgbasefuncs.inc.php
@@ -187,7 +187,7 @@ function pkgbase_display_details($base_id, $row, $SID="") {
 		include('pkgbase_details.php');
 
 		if ($SID) {
-			include('pkg_comment_form.php');
+			include('pkg_comment_box.php');
 		}
 
 		$limit = isset($_GET['comments']) ? 0 : 10;
diff --git a/web/lib/pkgfuncs.inc.php b/web/lib/pkgfuncs.inc.php
index de57c3e..d329eaf 100644
--- a/web/lib/pkgfuncs.inc.php
+++ b/web/lib/pkgfuncs.inc.php
@@ -481,7 +481,7 @@ function pkg_display_details($id=0, $row, $SID="") {
 		include('pkg_details.php');
 
 		if ($SID) {
-			include('pkg_comment_form.php');
+			include('pkg_comment_box.php');
 		}
 
 		$limit = isset($_GET['comments']) ? 0 : 10;
diff --git a/web/template/pkg_comment_box.php b/web/template/pkg_comment_box.php
new file mode 100644
index 0000000..22f90d4
--- /dev/null
+++ b/web/template/pkg_comment_box.php
@@ -0,0 +1,4 @@
+<div id="generic-form" class="box">
+	<h2><?= (isset($comment_id)) ? __('Edit comment for: %s', htmlspecialchars($pkgbase_name)) : __("Add Comment"); ?></h2>
+	<?php include 'pkg_comment_form.php' ?>
+</div>
diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php
index 16a92b1..7c16eb7 100644
--- a/web/template/pkg_comment_form.php
+++ b/web/template/pkg_comment_form.php
@@ -1,5 +1,3 @@
-<div id="generic-form" class="box">
-	<h2><?= (isset($comment_id)) ? __('Edit comment for: %s', htmlspecialchars($pkgbase_name)) : __("Add Comment"); ?></h2>
 	<form action="<?= get_pkgbase_uri($pkgbase_name) ?>" method="post">
 		<fieldset>
 <?php
@@ -23,5 +21,3 @@ if (isset($_REQUEST['comment']) && check_token()) {
 			</p>
 		</fieldset>
 	</form>
-</div>
-
-- 
2.4.6


More information about the aur-dev mailing list