Index: modules/comment.module =================================================================== RCS file: /cvs/drupal/drupal/modules/comment.module,v retrieving revision 1.371 diff -u -p -r1.371 comment.module --- modules/comment.module 18 Sep 2005 12:04:10 -0000 1.371 +++ modules/comment.module 18 Sep 2005 23:37:37 -0000 @@ -1007,12 +1007,36 @@ function comment_delete($cid) { */ 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 = %d WHERE cid IN (' . str_repeat('%d, ', count($cids_to_publish) - 1) . ' %d)'; + db_query($sql, COMMENT_PUBLISHED, $cids_to_publish); + } + if (!empty($cids_to_unpublish)) { + $sql = 'UPDATE {comments} SET status = %d WHERE cid IN (' . str_repeat('%d, ', count($cids_to_unpublish) - 1) . ' %d)'; + db_query($sql, COMMENT_NOT_PUBLISHED, $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(); @@ -1029,7 +1053,8 @@ function comment_admin_overview($type = ($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) ); } @@ -1041,7 +1066,7 @@ function comment_admin_overview($type = $rows[] = array(array('data' => t('No comments available.'), 'colspan' => '6')); } - return theme('table', $header, $rows); + return form(theme('table', $header, $rows) . form_button(t('Save changes'))); } /**