On Tue, 21 Jul 2015 at 17:59:32, Marcel Korpel wrote:
> 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 <[email protected]>
> ---
> 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)): ?>
> [...]
$no_header is a bad name for a global variable. Another suggestion:
Remove the <div></div> container and the heading. Add another template
pkg_comment_box.php that looks like this:
<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>
Use that template instead of pkg_comment_form.php everywhere.