[aur-dev] [PATCH v2 1/3] pkg_comment_form.php: Make printing of header conditional

Marcel Korpel marcel.korpel at gmail.com
Tue Jul 21 15:59:32 UTC 2015


For use in the new RPC interface to edit comments, the form shouldn't
always print a header. Make this conditional.

Signed-off-by: Marcel Korpel <marcel.korpel at gmail.com>
---
Change since v1:
* Include the <form> element in the markup when using the RPC
  interface. This is necessary to use normal form submission to save
  an edited comment.

 web/template/pkg_comment_form.php | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php
index 16a92b1..24eb908 100644
--- a/web/template/pkg_comment_form.php
+++ b/web/template/pkg_comment_form.php
@@ -1,5 +1,8 @@
+<?php /* $no_header will be set when called from aurjson.class.php */
+if (!isset($no_header)): ?>
 <div id="generic-form" class="box">
 	<h2><?= (isset($comment_id)) ? __('Edit comment for: %s', htmlspecialchars($pkgbase_name)) : __("Add Comment"); ?></h2>
+<?php endif; ?>
 	<form action="<?= get_pkgbase_uri($pkgbase_name) ?>" method="post">
 		<fieldset>
 <?php
@@ -23,5 +26,7 @@ if (isset($_REQUEST['comment']) && check_token()) {
 			</p>
 		</fieldset>
 	</form>
+<?php if (isset($no_header)): ?>
 </div>
+<?php endif;
 
-- 
2.4.6


More information about the aur-dev mailing list