r209: Allow comments to be hidden
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 29 May 2005 21:08:33 +0000 (21:08 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 29 May 2005 21:08:33 +0000 (21:08 +0000)
docs/schema_changes.sql
editcomment.php
showreport.php
templates/default/editcomment.tpl
templates/default/showreport_comment.tpl

index 90efbcb39661e6d4486040168051265b7aa79346..ab76e7ad188e1f39aa4fc1059e2522fe1d0194b7 100644 (file)
@@ -50,4 +50,6 @@ CREATE TABLE `bugvaluefill` (
   PRIMARY KEY (`bugid`)
 );
 
-ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`;
\ No newline at end of file
+ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`;
+
+ALTER TABLE `comment` ADD `hidden` INT(2) UNSIGNED NOT NULL;
\ No newline at end of file
index 97ea40ca411cd498bdbad10c73cee675be91dd41..76573b17a673f62308a6ee1b0b3c9bb74a4c243a 100644 (file)
@@ -82,7 +82,8 @@ if ($_POST['do'] == 'update')
        $db->query("
                UPDATE " . TABLE_PREFIX . "comment
                SET comment = '" . $bugsys->in['comment'] . "',
-                       comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "'
+                       comment_parsed = '" . nl2br($bugsys->in['comment_parsed']) . "',
+                       hidden = " . intval($bugsys->in['hidden']) . "
                WHERE commentid = $comment[commentid]"
        );
        
@@ -93,6 +94,7 @@ if ($_POST['do'] == 'update')
        $log->language = 'log_update_comment';
        $log->arguments = array($comment['commentid']);
        $log->log();
+       $log->log($log->diff('hidden', $comment['hidden'], intval($bugsys->in['hidden'])));
        
        $message->redirect('comment saved', "showreport.php?bugid=$bug[bugid]");
 }
index 6072e1e9b898a3756e3f535b44339e1290e12bcc..a93a24cce795eab18856755c37981fcab70c00fd 100644 (file)
@@ -144,7 +144,8 @@ $comments_fetch = $db->query("
        FROM " . TABLE_PREFIX . "comment AS comment
        LEFT JOIN " . TABLE_PREFIX . "user AS user
                ON (comment.userid = user.userid)
-       WHERE comment.bugid = $bug[bugid]
+       WHERE comment.bugid = $bug[bugid]" . ((!can_perform('canviewhidden')) ? "
+               AND !hidden" : '') . "
        ORDER BY comment.dateline ASC"
 );
 while ($comment = $db->fetch_array($comments_fetch))
index c29e4f79fbce214b8a0c9a60f5cb41b52fec709a..11e7e5cc012df3b7bd5a1ef1726f6bb1e4c079b3 100644 (file)
@@ -5,6 +5,7 @@
 <form name="editcomment" method="post" action="editcomment.php">
 <input type="hidden" name="do" value="update" />
 <input type="hidden" name="commentid" value="$comment[commentid]" />
+<div><strong<if condition="$comment['hidden']"> style="color: red"</if>>Hidden:</strong> <input type="checkbox" name="hidden" value="1"<if condition="$comment['hidden']"> checked="checked"</if> /></div>
 <div><strong>Comment:</strong></div><textarea name="comment" cols="100" rows="35">$comment[comment]</textarea>
 <div><input type="submit" name="submit" value="Save Changes" /></div>
 </form>
index feb811bbba260ad10ea0660f859dcfe88b34a4bb..bc068e3454066e2b8925108cc21afde399940ab9 100644 (file)
@@ -2,6 +2,7 @@
 <tr style="background-color:#EEEEEE">
        <td>
                <span style="float:right">$comment[posttime]</span>
+               <if condition="$comment['hidden']"><span style="color: red">Hidden</span></if>
                $comment[postby]
        </td>
 </tr>