>From 2e7dde3312ded07572225977b35028976b3c41cc Mon Sep 17 00:00:00 2001
From: Viktor Leonhardt <psykal@gulli.com>
Date: Mon, 8 Mar 2010 11:48:00 +0100
Subject: [PATCH] fixed FS#12681

added empty() in pkg_comment_form.php, so you can use do_UnNotify without leaving a comment
---
 web/template/actions_form.php     |   12 ------------
 web/template/pkg_comment_form.php |   23 +++++++++++++++++++++--
 2 files changed, 21 insertions(+), 14 deletions(-)
 mode change 100644 => 100755 web/template/actions_form.php
 mode change 100644 => 100755 web/template/pkg_comment_form.php

diff --git a/web/template/actions_form.php b/web/template/actions_form.php
old mode 100644
new mode 100755
index de77645..17ff61e
--- a/web/template/actions_form.php
+++ b/web/template/actions_form.php
@@ -15,18 +15,6 @@
 			echo " value='".__("UnVote")."'> ";
 		}
 
-		# Comment Notify Button
-		#
-		$q = "SELECT * FROM CommentNotify WHERE UserID = ". $uid;
-		$q.= " AND PkgID = ".$row["ID"];
-		if (!mysql_num_rows(db_query($q, $dbh))) {
-			echo "<input type='submit' class='button' name='do_Notify'";
-			echo " value='".__("Notify")."' title='".__("New Comment Notification")."'> ";
-		} else {
-			echo "<input type='submit' class='button' name='do_UnNotify'";
-			echo " value='".__("UnNotify")."' title='".__("No New Comment Notification")."'> ";
-		}
-
 if ($row["OutOfDate"] == 0) {
     echo "<input type='submit' class='button' name='do_Flag'";
     echo " value='".__("Flag Out-of-date")."'>\n";
diff --git a/web/template/pkg_comment_form.php b/web/template/pkg_comment_form.php
old mode 100644
new mode 100755
index 70570da..ceaec04
--- a/web/template/pkg_comment_form.php
+++ b/web/template/pkg_comment_form.php
@@ -1,6 +1,6 @@
 <?php
 # Add a comment to this package
-if (isset($_REQUEST['comment'])) {
+if (isset($_REQUEST['comment']) && !empty($_REQUEST['comment'])) {
 
 	# Insert the comment
 	$dbh = db_connect();
@@ -53,13 +53,32 @@ if (isset($_REQUEST['comment'])) {
 	<form action='<?php echo $_SERVER['PHP_SELF'] . '?ID=' . $_REQUEST['ID'] ?>' method='post'>
 	<div style="padding: 1%">
 <?php
-if (isset($_REQUEST['comment'])) {
+if (isset($_REQUEST['comment']) && !empty($_REQUEST['comment'])) {
 	echo '<b>' . __('Comment has been added.') . '</b>';
 }
 ?>
 	<input type='hidden' name='ID' value="<?php echo $_REQUEST['ID'] ?>">
+	<input type='hidden' name='IDs[<?php echo $_REQUEST['ID'] ?>]' value='1'>
 	<?php echo __('Enter your comment below.') ?><br />
 	<textarea name='comment' rows='10' style="width: 100%"></textarea><br />
+	<?php
+		# Comment Notify Checkbox
+		#
+		$q = "SELECT * FROM CommentNotify WHERE UserID = ". $uid;
+		$q.= " AND PkgID = ".$row["ID"];
+		if (!mysql_num_rows(db_query($q, $dbh))) {
+			echo "<input type='radio' name='action' value='do_Notify' title='". __("Notify") ."'> ";
+			echo __("New Comment Notification")."";
+			echo " <input checked='checked' type='radio' name='action' value='' title='". __("Notify") ."'> ";
+			echo __("No New Comment Notification") ."<br />";
+		} else {
+			echo "<input checked='checked' type='radio' name='action' value='' title='". __("Notify") ."'> ";
+			echo __("New Comment Notification")."";
+			echo " <input type='radio' name='action' value='do_UnNotify' title='". __("Notify") ."'> ";
+			echo __("No New Comment Notification") ."<br />";
+		}
+	?>
+	
 	<input type='submit' value="<?php echo __("Submit") ?>">
 	<input type='reset' value="<?php echo __("Reset") ?>">
 	</div>
-- 
1.7.0.1

