Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27260
Modified Files:
NEWS serendipity_admin_comments.inc.php
Log Message:
Allow mass-deletion of comments from within the administration
Index: serendipity_admin_comments.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_admin_comments.inc.php,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- serendipity_admin_comments.inc.php 9 Aug 2004 10:00:22 -0000 1.11
+++ serendipity_admin_comments.inc.php 14 Aug 2004 15:03:46 -0000 1.12
@@ -6,6 +6,15 @@
$commentsPerPage = 10;
$summaryLength = 200;
+if ( $serendipity['POST']['formAction'] == 'multiDelete' && sizeof($serendipity['POST']['delete']) != 0 ) {
+ foreach ( $serendipity['POST']['delete'] as $k => $v ) {
+ serendipity_deleteComment($k, $v);
+ echo DONE . ': '. sprintf(COMMENT_DELETED, $k) . '<br />';
+ }
+ return true;
+}
+
+
/* We are asked to save the edited comment, and we are not in preview mode */
if ( isset($serendipity['GET']['adminAction']) && $serendipity['GET']['adminAction'] == 'doEdit' && !isset($serendipity['POST']['preview']) ) {
$sql = "UPDATE {$serendipity['dbPrefix']}comments
@@ -45,7 +54,7 @@
/* 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']);;
+ echo DONE . ': '. sprintf(COMMENT_DELETED, $serendipity['GET']['id']);
return true;
}
@@ -152,6 +161,15 @@
document.getElementById(id + '_link').innerHTML = '<?php echo HIDE ?>';
}
}
+function invertSelection() {
+ var f = document.formMultiDelete;
+ for (var i = 0; i < f.elements.length; i++) {
+ if( f.elements[i].type == 'checkbox' ) {
+ f.elements[i].checked = !(f.elements[i].checked);
+ }
+ }
+}
+
</script>
<form action="" method="GET" style="margin: 0">
<input type="hidden" name="serendipity[adminModule]" value="comments">
@@ -177,8 +195,8 @@
</tr>
</table>
</form>
-
-<form action="" method="POST">
+<form action="" method="POST" name="formMultiDelete" id="formMultiDelete">
+<input type="hidden" name="serendipity[formAction]" value="multiDelete">
<table width="100%" cellspacing="5" cellpadding="0" border="0" class="serendipity_admin_list">
<tr>
<td align="center">
@@ -225,11 +243,7 @@
<td class="serendipity_admin_list_item <?php echo $class ?>" style="padding: 3px">
<table width="100%" cellspacing="0" cellpadding="2" border="0">
<tr>
- <td rowspan="2" width="20" align="center">
-<?php
- // TODO: Multi-Delete - Tom
- /* <input type="checkbox" name="delete[<?php echo $rs['id'] ?>]"> */
-?> </td>
+ <td rowspan="2" width="20" align="center"><input type="checkbox" name="serendipity[delete][<?php echo $rs['id'] ?>]" value="<?php echo $rs['entry_id'] ?>"></td>
<td width="250"><strong><?php echo AUTHOR ?></strong>: <?php echo $rs['author'] ?></td>
<td><strong><?php echo EMAIL ?></strong>: <?php echo $rs['email'] ?></td>
</tr>
@@ -247,7 +261,7 @@
<?php if ($rs['status'] == 'pending') { ?>
<strong>[<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=approve&serendipity[id]=<?php echo $rs['id'] ?>">Approve</a>]</strong> -
<?php } ?>
- [<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]=<?php echo $rs['id'] ?>&serendipity[entry_id]=<?php echo $rs['entry_id'] ?>"><?php echo DELETE ?></a>]
+ [<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=delete&serendipity[id]=<?php echo $rs['id'] ?>&serendipity[entry_id]=<?php echo $rs['entry_id'] ?>" onclick="return confirm('<?php echo sprintf(COMMENT_DELETE_CONFIRM, $rs['id'], htmlspecialchars($rs['author'])) ?>')"><?php echo DELETE ?></a>]
- [<a href="?serendipity[action]=admin&serendipity[adminModule]=comments&serendipity[adminAction]=edit&serendipity[id]=<?php echo $rs['id'] ?>&serendipity[entry_id]=<?php echo $rs['entry_id'] ?>"><?php echo EDIT ?></a>]
<?php if (strlen($fullBody) > strlen($summary) ) { ?>
- [<a href="#c<?php echo $rs['id'] ?>" onClick="toggle(<?php echo $rs['id'] ?>); return false;" id="<?php echo $rs['id'] ?>_link"><?php echo VIEW ?></a>]
@@ -259,6 +273,9 @@
</tr>
<?php } ?>
<tr>
+ <td><input type="button" name="toggle" value="<?php echo INVERT_SELECTIONS ?>" onclick="invertSelection()"> <input type="submit" name="toggle" value="<?php echo DELETE_SELECTED_COMMENTS ?>" onclick="return confirm('<?php echo COMMENTS_DELETE_CONFIRM ?>')"></td>
+</tr>
+<tr>
<td align="center">
<table width="100%" cellspacing="5" cellpadding="0" border="0">
<tr>
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.200
retrieving revision 1.201
diff -u -d -r1.200 -r1.201
--- NEWS 13 Aug 2004 12:58:04 -0000 1.200
+++ NEWS 14 Aug 2004 15:03:46 -0000 1.201
@@ -90,6 +90,7 @@
* Added ability to moderate comments and trackbacks:
* Moderate by email
* Moderate and view comments from within Authoring Suite
+ * Mass delete of comments from administration
(tomsommer) [DB Layout change - > 0.6.7]
* An entries' LastModified timestamp will get updated if a comment
|