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 11:07:43 -0000 @@ -1002,12 +1002,38 @@ */ 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[] = $cid; + } + else { + $cids_to_unpublish[] = $cid; + } + } + if (!empty($cids_to_publish)) { + $sql = "UPDATE {comments} SET status = " . COMMENT_PUBLISHED . " WHERE cid IN (" + . str_repeat("%d, ", count($cids_to_publish) - 1) . " %d)"; + db_query($sql, $cids_to_publish); + } + if (!empty($cids_to_unpublish)) { + $sql = "UPDATE {comments} SET status = " . COMMENT_NOT_PUBLISHED . " WHERE cid IN (" + . str_repeat("%d, ", count($cids_to_unpublish) - 1) . " %d)"; + db_query($sql, $cids_to_unpublish); + } + } + $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 +1050,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 +1063,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")); } /**