<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[12702] trunk/wp-admin: Merge page-new.php into post-new.php.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/12702">12702</a></dd>
<dt>Author</dt> <dd>ryan</dd>
<dt>Date</dt> <dd>2010-01-12 00:14:27 +0000 (Tue, 12 Jan 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Merge page-new.php into post-new.php. Start abstracting column headers and prefs. see <a href="http://trac.wordpress.org/ticket/9674">#9674</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminheaderphp">trunk/wp-admin/admin-header.php</a></li>
<li><a href="#trunkwpadmineditpagesphp">trunk/wp-admin/edit-pages.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpadminpagephp">trunk/wp-admin/page.php</a></li>
<li><a href="#trunkwpadminpostnewphp">trunk/wp-admin/post-new.php</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkwpadminpagenewphp">trunk/wp-admin/page-new.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-header.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-header.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/admin-header.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> </script>
</span><span class="cx"> <?php
</span><span class="cx">
</span><del>-if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
</del><ins>+if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php') ) ) {
</ins><span class="cx">         add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
</span><span class="cx">         wp_enqueue_script('quicktags');
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadmineditpagesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit-pages.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit-pages.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/edit-pages.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -18,7 +18,7 @@
</span><span class="cx">         $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() );
</span><span class="cx">
</span><span class="cx">         if ( strpos($sendback, 'page.php') !== false )
</span><del>-                $sendback = admin_url('page-new.php');
</del><ins>+                $sendback = admin_url('post-new.php?post_type=page');
</ins><span class="cx">
</span><span class="cx">         if ( isset($_GET['delete_all']) || isset($_GET['delete_all2']) ) {
</span><span class="cx">                 $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_GET['post_status']);
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">
</span><span class="cx"> <div class="wrap">
</span><span class="cx"> <?php screen_icon(); ?>
</span><del>-<h2><?php echo esc_html( $title ); ?> <a href="page-new.php" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a> <?php
</del><ins>+<h2><?php echo esc_html( $title ); ?> <a href="post-new.php?post_type=page" class="button add-new-h2"><?php echo esc_html_x('Add New', 'page'); ?></a> <?php
</ins><span class="cx"> if ( isset($_GET['s']) && $_GET['s'] )
</span><span class="cx">         printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', esc_html( get_search_query() ) ); ?>
</span><span class="cx"> </h2>
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/includes/post.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -324,9 +324,10 @@
</span><span class="cx"> *
</span><span class="cx"> * @since unknown
</span><span class="cx"> *
</span><ins>+ *@param string A post type string, defaults to 'post'.
</ins><span class="cx"> * @return object stdClass object containing all the default post data as attributes
</span><span class="cx"> */
</span><del>-function get_default_post_to_edit() {
</del><ins>+function get_default_post_to_edit( $post_type = 'post' ) {
</ins><span class="cx">
</span><span class="cx">         $post_title = '';
</span><span class="cx">         if ( !empty( $_REQUEST['post_title'] ) )
</span><span class="lines">@@ -347,7 +348,7 @@
</span><span class="cx">         $post->post_date_gmt = '';
</span><span class="cx">         $post->post_password = '';
</span><span class="cx">         $post->post_status = 'draft';
</span><del>-        $post->post_type = 'post';
</del><ins>+        $post->post_type = $post_type;
</ins><span class="cx">         $post->to_ping = '';
</span><span class="cx">         $post->pinged = '';
</span><span class="cx">         $post->comment_status = get_option( 'default_comment_status' );
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/includes/template.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -748,15 +748,19 @@
</span><span class="cx"> * @return unknown
</span><span class="cx"> */
</span><span class="cx"> function wp_manage_posts_columns() {
</span><ins>+        global $typenow;
+
</ins><span class="cx">         $posts_columns = array();
</span><span class="cx">         $posts_columns['cb'] = '<input type="checkbox" />';
</span><span class="cx">         /* translators: manage posts column name */
</span><span class="cx">         $posts_columns['title'] = _x('Post', 'column name');
</span><span class="cx">         $posts_columns['author'] = __('Author');
</span><del>-        $posts_columns['categories'] = __('Categories');
-        $posts_columns['tags'] = __('Tags');
</del><ins>+        if ( empty($typenow) || is_object_in_taxonomy($typenow, 'category') )
+                $posts_columns['categories'] = __('Categories');
+        if ( empty($typenow) || is_object_in_taxonomy($typenow, 'category') )
+                $posts_columns['tags'] = __('Tags');
</ins><span class="cx">         $post_status = !empty($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'all';
</span><del>-        if ( !in_array( $post_status, array('pending', 'draft', 'future') ) )
</del><ins>+        if ( !in_array( $post_status, array('pending', 'draft', 'future') ) && ( empty($typenow) || post_type_supports($typenow, 'comments') ) )
</ins><span class="cx">                 $posts_columns['comments'] = '<div class="vers"><img alt="Comments" src="images/comment-grey-bubble.png" /></div>';
</span><span class="cx">         $posts_columns['date'] = __('Date');
</span><span class="cx">         $posts_columns = apply_filters('manage_posts_columns', $posts_columns);
</span><span class="lines">@@ -826,11 +830,16 @@
</span><span class="cx">         if ( !isset($_wp_column_headers) )
</span><span class="cx">                 $_wp_column_headers = array();
</span><span class="cx">
</span><ins>+        $map_screen = $page;
+        $type = str_replace('edit-', '', $map_screen);
+        if ( in_array($type, get_post_types()) )
+                $map_screen = 'edit';
+
</ins><span class="cx">         // Store in static to avoid running filters on each call
</span><span class="cx">         if ( isset($_wp_column_headers[$page]) )
</span><span class="cx">                 return $_wp_column_headers[$page];
</span><span class="cx">
</span><del>-        switch ($page) {
</del><ins>+        switch ($map_screen) {
</ins><span class="cx">                 case 'edit':
</span><span class="cx">                          $_wp_column_headers[$page] = wp_manage_posts_columns();
</span><span class="cx">                          break;
</span><span class="lines">@@ -924,10 +933,6 @@
</span><span class="cx">         $columns = get_column_headers( $type );
</span><span class="cx">         $hidden = get_hidden_columns($type);
</span><span class="cx">         $styles = array();
</span><del>-//        $styles['tag']['posts'] = 'width: 90px;';
-//        $styles['link-category']['links'] = 'width: 90px;';
-//        $styles['category']['posts'] = 'width: 90px;';
-//        $styles['link']['visible'] = 'text-align: center;';
</del><span class="cx">
</span><span class="cx">         foreach ( $columns as $column_key => $column_display_name ) {
</span><span class="cx">                 $class = ' class="manage-column';
</span><span class="lines">@@ -3494,6 +3499,10 @@
</span><span class="cx">                 if ( !empty($typenow) )
</span><span class="cx">                         $screen = $typenow;
</span><span class="cx">         }
</span><ins>+        if ( 'edit' == $screen ) {
+                if ( !empty($typenow) )
+                        $screen = 'edit-' . $typenow;
+        }
</ins><span class="cx">
</span><span class="cx">         if ( isset($meta_screens[$screen]) )
</span><span class="cx">                 $screen = $meta_screens[$screen];
</span><span class="lines">@@ -3707,7 +3716,12 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function screen_options($screen) {
</span><del>-        switch ( $screen ) {
</del><ins>+        $map_screen = $screen;
+        $type = str_replace('edit-', '', $map_screen);
+        if ( in_array($type, get_post_types()) )
+                $map_screen = 'edit';
+
+        switch ( $map_screen ) {
</ins><span class="cx">                 case 'edit':
</span><span class="cx">                         $per_page_label = __('Posts per page:');
</span><span class="cx">                         break;
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/menu.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -71,7 +71,7 @@
</span><span class="cx"> $menu[20] = array( __('Pages'), 'edit_pages', 'edit-pages.php', '', 'menu-top', 'menu-pages', 'div' );
</span><span class="cx">         $submenu['edit-pages.php'][5] = array( __('Edit'), 'edit_pages', 'edit-pages.php' );
</span><span class="cx">         /* translators: add new page */
</span><del>-        $submenu['edit-pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'page-new.php' );
</del><ins>+        $submenu['edit-pages.php'][10] = array( _x('Add New', 'page'), 'edit_pages', 'post-new.php?post_type=page' );
</ins><span class="cx">
</span><span class="cx"> $menu[25] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top', 'menu-comments', 'div' );
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminpagenewphp"></a>
<div class="delfile"><h4>Deleted: trunk/wp-admin/page-new.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/page-new.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/page-new.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -1,34 +0,0 @@
</span><del>-<?php
-/**
- * New page administration panel.
- *
- * @package WordPress
- * @subpackage Administration
- */
-
-/** WordPress Administration Bootstrap */
-require_once('admin.php');
-
-$post_type = 'page';
-
-$title = __('Add New Page');
-$parent_file = 'edit-pages.php';
-$editing = true;
-wp_enqueue_script('autosave');
-wp_enqueue_script('post');
-if ( user_can_richedit() )
-        wp_enqueue_script('editor');
-add_thickbox();
-wp_enqueue_script('media-upload');
-wp_enqueue_script('word-count');
-
-if ( current_user_can('edit_pages') ) {
-        $action = 'post';
-        $post = get_default_page_to_edit();
-
-        include('edit-form-advanced.php');
-}
-
-include('admin-footer.php');
-
-?>
</del></span></pre></div>
<a id="trunkwpadminpagephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/page.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/page.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/page.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">         $action = 'preview';
</span><span class="cx">
</span><span class="cx"> $sendback = wp_get_referer();
</span><del>-if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'page-new.php') !== false )
</del><ins>+if ( strpos($sendback, 'page.php') !== false || strpos($sendback, 'post-new.php') !== false )
</ins><span class="cx">         $sendback = admin_url('edit-pages.php');
</span><span class="cx"> else
</span><span class="cx">         $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
</span></span></pre></div>
<a id="trunkwpadminpostnewphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post-new.php (12701 => 12702)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post-new.php        2010-01-11 22:33:28 UTC (rev 12701)
+++ trunk/wp-admin/post-new.php        2010-01-12 00:14:27 UTC (rev 12702)
</span><span class="lines">@@ -9,7 +9,7 @@
</span><span class="cx"> /** Load WordPress Administration Bootstrap */
</span><span class="cx"> require_once('admin.php');
</span><span class="cx">
</span><del>-if ( isset($_GET['post_type']) && in_array( $_GET['post_type'], get_post_types( array('_show' => true) ) ) )
</del><ins>+if ( isset($_GET['post_type']) && ( in_array( $_GET['post_type'], get_post_types( array('_show' => true ) ) ) || in_array( $_GET['post_type'], get_post_types( array('_builtin' => true ) ) ) ) )
</ins><span class="cx">         $post_type = $_GET['post_type'];
</span><span class="cx"> else
</span><span class="cx">         $post_type = 'post';
</span><span class="lines">@@ -17,6 +17,8 @@
</span><span class="cx"> if ( 'post' != $post_type ) {
</span><span class="cx">         $parent_file = "edit.php?post_type=$post_type";
</span><span class="cx">         $submenu_file = "post-new.php?post_type=$post_type";
</span><ins>+        if ( 'page' == $post_type )
+                $parent_file = 'edit-pages.php';
</ins><span class="cx"> } else {
</span><span class="cx">         $parent_file = 'edit.php';
</span><span class="cx">         $submenu_file = 'post-new.php';
</span><span class="lines">@@ -35,7 +37,7 @@
</span><span class="cx"> wp_enqueue_script('media-upload');
</span><span class="cx"> wp_enqueue_script('word-count');
</span><span class="cx">
</span><del>-if ( ! current_user_can('edit_posts') ) {
</del><ins>+if ( 'post' == $post_type && !current_user_can('edit_posts') ) {
</ins><span class="cx">         require_once ('./admin-header.php'); ?>
</span><span class="cx"> <div class="wrap">
</span><span class="cx"> <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br />
</span><span class="lines">@@ -49,9 +51,10 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Show post form.
</span><del>-$post = get_default_post_to_edit();
-$post->post_type = $post_type;
-include('edit-form-advanced.php');
</del><ins>+if ( current_user_can('edit_' . $post_type_object->capability_type . 's') ) {
+        $post = get_default_post_to_edit( $post_type );
+        include('edit-form-advanced.php');
+}
</ins><span class="cx">
</span><span class="cx"> include('admin-footer.php');
</span><span class="cx"> ?>
</span></span></pre>
</div>
</div>
</body>
</html>