diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-23 18:28:40 +0000 |
commit | 87bb8cd69cc593fe6bed330fb1791eac9df87167 (patch) | |
tree | 6b2ad252df89d2a1863198fd44b321b59e42ef54 /wp-admin/edit.php | |
parent | 0cbda3349a2571904ea063fdd73e018299919589 (diff) | |
download | wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.gz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.tar.xz wordpress-mu-87bb8cd69cc593fe6bed330fb1791eac9df87167.zip |
Merge with WordPress, rev 6285 and untested
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1125 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/edit.php')
-rw-r--r-- | wp-admin/edit.php | 109 |
1 files changed, 19 insertions, 90 deletions
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index ba4cc04..06ab9ca 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -3,67 +3,21 @@ require_once('admin.php'); $title = __('Posts'); $parent_file = 'edit.php'; -wp_enqueue_script( 1 == $_GET['c'] ? 'admin-comments' : 'listman' ); +wp_enqueue_script( 'admin-posts' ); +if ( 1 == $_GET['c'] ) + wp_enqueue_script( 'admin-comments' ); require_once('admin-header.php'); -$_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']; -} +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 ) ?> <div class="wrap"> <?php -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'] = ''; +$posts_columns = wp_manage_posts_columns(); ?> @@ -154,6 +108,8 @@ if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ? <?php wp_dropdown_categories('show_option_all='.__('All').'&hide_empty=1&hierarchical=1&show_count=1&selected='.$cat);?> </fieldset> <input type="submit" id="post-query-submit" value="<?php _e('Filter »'); ?>" class="button" /> + <?php wp_nonce_field( 'add-post', '_ajax_nonce', false ); ?> + <input type="button" id="get-extra-button" class="add:the-extra-list:searchform" style="display:none" /> </form> <?php do_action('restrict_manage_posts'); ?> @@ -175,48 +131,21 @@ 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="commentlist"> +<ol id="the-comment-list" class="list:comment commentlist"> <?php -$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 + $i = 0; + foreach ( $comments as $comment ) { + _wp_comment_list_item( $comment->comment_ID, ++$i ); + } echo '</ol>'; - }//end if comments - ?> + } // end if comments +?> <?php } ?> </div> |