]> git.mjollnir.org Git - s9y.git/commitdiff
fixed Bugs #1226439 and 1226440
authorgarvinhicking <garvinhicking>
Mon, 27 Jun 2005 10:26:39 +0000 (10:26 +0000)
committergarvinhicking <garvinhicking>
Mon, 27 Jun 2005 10:26:39 +0000 (10:26 +0000)
comment deletion return to sender, comment type threestate toggle

docs/NEWS
include/admin/comments.inc.php

index dd6474f15389fee93fa19b96600de90a17de0383..0174afc94efd7a87df9c230e47690b6fff89650c 100644 (file)
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,10 @@
 Version 0.9 ()
 ------------------------------------------------------------------------
 
+    * Make comment deletion return to the originating page, allow to
+      display trackbacks and normal comments at once (new default).
+      Bugs #1226440, #1226439 (garvinhicking)
+
     * Fix multi-category selector for Konqueror (garvinhicking)
 
     * Support use of Boolean search mode in MySQL. Is activated when using
index 53a5b0f2142a1be1a10f8e7675f51a66ae94c353..74a9340bc6ef8c53c39a49f37410e317113e6788 100644 (file)
@@ -18,7 +18,6 @@ if ( $serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity[
         serendipity_deleteComment($k, $v);
         echo DONE . ': '. sprintf(COMMENT_DELETED, $k) . '<br />';
     }
-    return true;
 }
 
 
@@ -35,7 +34,6 @@ if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActi
                   entry_id = " . (int)$serendipity['POST']['entry_id'];
     serendipity_db_query($sql);
     echo COMMENT_EDITED;
-    return true;
 }
 
 
@@ -50,19 +48,16 @@ if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminActi
 
     if ($rs === false) {
         echo ERROR .': '. sprintf(COMMENT_ALREADY_APPROVED, $serendipity['GET']['id']);
-        return true;
+    } else {
+        serendipity_approveComment($serendipity['GET']['id'], $rs['entry_id']);
+        echo DONE . ': '. sprintf(COMMENT_APPROVED, $serendipity['GET']['id']);
     }
-
-    serendipity_approveComment($serendipity['GET']['id'], $rs['entry_id']);
-    echo DONE . ': '. sprintf(COMMENT_APPROVED, $serendipity['GET']['id']);
-    return true;
 }
 
 /* We are asked to delete a comment */
 if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminAction'] == 'delete' ) {
     serendipity_deleteComment($serendipity['GET']['id'], $serendipity['GET']['entry_id']);
     echo DONE . ': '. sprintf(COMMENT_DELETED, $serendipity['GET']['id']);
-    return true;
 }
 
 /* We are either in edit mode, or preview mode */
@@ -137,12 +132,15 @@ if ($serendipity['GET']['filter']['show'] == 'approved') {
 if ($serendipity['GET']['filter']['type'] == 'TRACKBACK') {
     $c_type = 'TRACKBACK';
     $searchString .= "&amp;serendipity[filter][type]=TRACKBACK";
-} else {
+} elseif ($serendipity['GET']['filter']['type'] == 'NORMAL') {
     $c_type = 'NORMAL';
+    $searchString .= "&amp;serendipity[filter][type]=NORMAL";
+} else {
+    $c_type = null;
 }
 
 /* Paging */
-$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE c.type = '$c_type' ". $and, true);
+$sql = serendipity_db_query("SELECT COUNT(*) AS total FROM {$serendipity['dbPrefix']}comments c WHERE 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and, true);
 
 $totalComments = $sql['total'];
 $pages = ($commentsPerPage == COMMENTS_FILTER_ALL ? 1 : ceil($totalComments/(int)$commentsPerPage));
@@ -162,9 +160,8 @@ if ($commentsPerPage == COMMENTS_FILTER_ALL) {
 
 $sql = serendipity_db_query("SELECT c.*, e.title FROM {$serendipity['dbPrefix']}comments c
                                 LEFT JOIN {$serendipity['dbPrefix']}entries e ON (e.id = c.entry_id)
-                                WHERE type = '$c_type'
-                                ". $and ."
-                                " . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int)$serendipity['authorid'] : '') . "
+                                WHERE 1 " . ($c_type !== null ? " AND c.type = '$c_type' " : '') . $and
+                                . (!serendipity_checkPermission('adminEntriesMaintainOthers') ? 'AND e.authorid = ' . (int)$serendipity['authorid'] : '') . "
                                 ORDER BY c.id DESC $limit");
 ?>
 <script type="text/javascript">
@@ -242,6 +239,7 @@ function highlightComment(id, checkvalue) {
             </select></td>
         <td><?php echo TYPE; ?></td>
         <td><select name="serendipity[filter][type]">
+                <option value=""><?php echo COMMENTS_FILTER_ALL ?></option>
                 <option value="NORMAL"<?php if ($c_type == 'NORMAL') echo ' selected="selected"' ?>><?php echo COMMENTS; ?></option>
                 <option value="TRACKBACK"<?php if ($c_type == 'TRACKBACK') echo ' selected="selected"' ?>><?php echo TRACKBACKS; ?></option>
             </select></td>