diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-30 16:49:38 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-30 16:49:38 +0000 |
commit | d85d717aedbc7690e2a450e40dab8fcebd94b38c (patch) | |
tree | a7340a14bb1192e977fca4f26beef29869e17579 /wp-admin/edit.php | |
parent | 9817ff2d282c68faaa09232845829b96f207e72b (diff) | |
download | wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.tar.gz wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.tar.xz wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.zip |
Merge with WordPress 2.3.1
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1139 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/edit.php')
-rw-r--r-- | wp-admin/edit.php | 111 |
1 files changed, 90 insertions, 21 deletions
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 6e8d978..ba4cc04 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -3,21 +3,67 @@ require_once('admin.php'); $title = __('Posts'); $parent_file = 'edit.php'; -wp_enqueue_script( 'admin-posts' ); -if ( 1 == $_GET['c'] ) - wp_enqueue_script( 'admin-comments' ); +wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' ); require_once('admin-header.php'); -add_filter( 'post_limits', $limit_filter = create_function( '$a', '$b = split(" ",$a); if ( !isset($b[2]) ) return $a; $start = intval(trim($b[1])) / 20 * 15; if ( !is_int($start) ) return $a; return "LIMIT $start, 20";' ) ); -list($post_stati, $avail_post_stati) = wp_edit_posts_query(); -$wp_query->max_num_pages = ceil( $wp_query->found_posts / 15 ); // We grab 20 but only show 15 ( 5 more for ajax extra ) +$_GET['m'] = (int) $_GET['m']; +$_GET['cat'] = (int) $_GET['cat']; +$post_stati = array( // array( adj, noun ) + 'publish' => array(__('Published'), __('Published posts')), + 'future' => array(__('Scheduled'), __('Scheduled posts')), + 'pending' => array(__('Pending Review'), __('Pending posts')), + 'draft' => array(__('Draft'), _c('Drafts|manage posts header')), + 'private' => array(__('Private'), __('Private posts')) + ); + +$avail_post_stati = $wpdb->get_col("SELECT DISTINCT post_status FROM $wpdb->posts WHERE post_type = 'post'"); + +$post_status_q = ''; +$post_status_label = __('Posts'); +if ( isset($_GET['post_status']) && in_array( $_GET['post_status'], array_keys($post_stati) ) ) { + $post_status_label = $post_stati[$_GET['post_status']][1]; + $post_status_q = '&post_status=' . $_GET['post_status']; +} ?> <div class="wrap"> <?php -$posts_columns = wp_manage_posts_columns(); +if ( 'pending' === $_GET['post_status'] ) { + $order = 'ASC'; + $orderby = 'modified'; +} elseif ( 'draft' === $_GET['post_status'] ) { + $order = 'DESC'; + $orderby = 'modified'; +} else { + $order = 'DESC'; + $orderby = 'date'; +} + +wp("what_to_show=posts$post_status_q&posts_per_page=15&order=$order&orderby=$orderby"); + +// define the columns to display, the syntax is 'internal name' => 'display name' +$posts_columns = array(); +$posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>'; +if ( 'draft' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Modified'); +elseif ( 'pending' === $_GET['post_status'] ) + $posts_columns['modified'] = __('Submitted'); +else + $posts_columns['date'] = __('When'); +$posts_columns['title'] = __('Title'); +$posts_columns['categories'] = __('Categories'); +if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) + $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>'; +$posts_columns['author'] = __('Author'); + +$posts_columns = apply_filters('manage_posts_columns', $posts_columns); + +// you can not edit these at the moment +$posts_columns['control_view'] = ''; +$posts_columns['control_edit'] = ''; +$posts_columns['control_delete'] = ''; ?> @@ -116,10 +162,6 @@ if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ? <?php include( 'edit-post-rows.php' ); ?> -<form action="" method="post" id="get-extra-posts" class="add:the-extra-list:" style="display:none"> - <?php wp_nonce_field( 'add-post', '_ajax_nonce', false ); ?> -</form> - <div id="ajax-response"></div> <div class="navigation"> @@ -133,21 +175,48 @@ if ( 1 == count($posts) ) { $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date"); if ($comments) { - // Make sure comments, post, and post_author are cached update_comment_cache($comments); - $post = get_post($id); - $authordata = get_userdata($post->post_author); ?> <h3 id="comments"><?php _e('Comments') ?></h3> -<ol id="the-comment-list" class="list:comment commentlist"> +<ol id="the-comment-list" class="commentlist"> <?php - $i = 0; - foreach ( $comments as $comment ) { - _wp_comment_list_item( $comment->comment_ID, ++$i ); - } - echo '</ol>'; - } // end if comments +$i = 0; +foreach ($comments as $comment) { + + ++$i; $class = ''; + $post = get_post($comment->comment_post_ID); + $authordata = get_userdata($post->post_author); + $comment_status = wp_get_comment_status($comment->comment_ID); + if ('unapproved' == $comment_status) + $class .= ' unapproved'; + if ($i % 2) + $class .= ' alternate'; + echo "<li id='comment-$comment->comment_ID' class='$class'>"; ?> +<p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="edit-comments.php?s=<?php comment_author_IP() ?>&mode=edit"><?php comment_author_IP() ?></a></p> + +<?php comment_text() ?> + +<p><?php comment_date(__('M j, g:i A')); ?> — [ +<?php +if ( current_user_can('edit_post', $comment->comment_post_ID) ) { + echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; + echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; + if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { + echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>'; + echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; + } + echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> "; +} +?> ] +</p> + </li> + +<?php //end of the loop, don't delete + } // end foreach + echo '</ol>'; + }//end if comments + ?> <?php } ?> </div> |