Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.369 diff -u -r1.369 comment.module --- modules/comment.module 7 Sep 2005 20:45:53 -0000 1.369 +++ modules/comment.module 15 Sep 2005 01:55:39 -0000 @@ -1002,12 +1002,37 @@ */ function comment_admin_overview($type = 'new') { + $edit = $_POST['edit']; + + if (!empty($edit)) { + $cids_to_publish = array(); + $cids_to_unpublish = array(); + foreach ($edit as $cid => $checked) { + if ($checked) { + $cids_to_publish[] = db_escape_string($cid); + } else { + $cids_to_unpublish[] = db_escape_string($cid); + } + } + if (!empty($cids_to_publish)) { + $sql = "UPDATE {comments} SET status = " . COMMENT_PUBLISHED . " WHERE cid IN (" + . implode(",", $cids_to_publish) . ")"; + db_query($sql); + } + if (!empty($cids_to_unpublish)) { + $sql = "UPDATE {comments} SET status = " . COMMENT_NOT_PUBLISHED . " WHERE cid IN (" + . implode(",", $cids_to_unpublish) . ")"; + db_query($sql); + } + } + $header = array( array('data' => t('Subject'), 'field' => 'subject'), array('data' => t('Author'), 'field' => 'u.name'), array('data' => t('Status'), 'field' => 'status'), array('data' => t('Time'), 'field' => 'c.timestamp', 'sort' => 'desc'), - array('data' => t('Operations'), 'colspan' => '2') + array('data' => t('Operations'), 'colspan' => '2'), + array('data' => t('Approved')) ); $destination = drupal_get_destination(); @@ -1024,7 +1049,8 @@ ($comment->status == COMMENT_PUBLISHED ? t('Published') : t('Not published')), format_date($comment->timestamp, 'small'), l(t('edit'), "comment/edit/$comment->cid", array(), $destination), - l(t('delete'), "comment/delete/$comment->cid", array(), $destination) + l(t('delete'), "comment/delete/$comment->cid", array(), $destination), + form_checkbox("", "$comment->cid", 1, $comment->status == COMMENT_PUBLISHED) ); } @@ -1036,7 +1062,7 @@ $rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6')); } - return theme('table', $header, $rows); + return form(theme('table', $header, $rows) . form_button("Save changes")); } /**