Ticket #5303: 5303_pages.diff
File 5303_pages.diff, 5.7 KB (added by , 17 years ago) |
---|
-
C:/xampp/htdocs/wordpress_trunk/wp-includes/query.php
1120 1120 if ( 'menu_order' != $orderby ) 1121 1121 $orderby = 'post_' . $orderby; 1122 1122 if ( in_array($orderby_array[$i], $allowed_keys) ) 1123 $q['orderby'] .= (($i == 0) ? '' : ',') . "$orderby {$q['order']}";1123 $q['orderby'] .= (($i == 0) ? '' : ',') . $orderby; 1124 1124 } 1125 // append ASC or DESC at the end 1126 if ( !empty( $q['orderby'] ) ) 1127 $q['orderby'] .= " {$q['order']}"; 1128 1125 1129 if ( empty($q['orderby']) ) 1126 1130 $q['orderby'] = 'post_date '.$q['order']; 1127 1131 } -
C:/xampp/htdocs/wordpress_trunk/wp-admin/includes/template.php
225 225 return $posts_columns; 226 226 } 227 227 228 function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { 228 /* 229 * display one row if the page doesn't have any children 230 * otherwise, display the row and its children in subsequent rows 231 */ 232 function display_page_row( $page, &$children_pages, $level=0 ) { 229 233 global $class, $post; 234 235 $post = $page; 236 setup_postdata( $page ); 237 238 $page->post_title = wp_specialchars( $page->post_title ); 239 $pad = str_repeat( '— ', $level ); 240 $id = (int) $page->ID; 241 $class = ('alternate' == $class ) ? '' : 'alternate'; 230 242 231 if (!$pages )232 $pages = get_pages( 'sort_column=menu_order' );233 234 if (! $pages )235 return false;236 237 foreach ( $pages as $post) {238 setup_postdata( $post);239 if ( $hierarchy && ($post->post_parent != $parent) )240 continue;241 242 $post->post_title = wp_specialchars( $post->post_title );243 $pad = str_repeat( '— ', $level );244 $id = (int) $post->ID;245 $class = ('alternate' == $class ) ? '' : 'alternate';246 243 ?> 247 244 <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'> 248 <th scope="row" style="text-align: center"><?php echo $p ost->ID; ?></th>245 <th scope="row" style="text-align: center"><?php echo $page->ID; ?></th> 249 246 <td> 250 <?php echo $pad; ?><?php the_title() ?>247 <?php echo $pad; ?><?php the_title(); ?> 251 248 </td> 252 249 <td><?php the_author() ?></td> 253 <td><?php if ( '0000-00-00 00:00:00' == $post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td>250 <td><?php if ( '0000-00-00 00:00:00' == $page->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $page->post_modified ); ?></td> 254 251 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td> 255 252 <td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td> 256 253 <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&post=$id", 'delete-page_' . $id ) . "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td> 257 254 </tr> 258 255 259 256 <?php 260 if ( $hierarchy ) 261 page_rows( $id, $level + 1, $pages ); 257 258 if ( !$children_pages ) 259 return true; 260 261 for ( $i = 0; $i < sizeof( $children_pages ); $i++ ) { 262 $child = $children_pages[$i]; 263 264 if ( $child->post_parent == $id ) { 265 array_splice( $children_pages, $i, 1 ); 266 display_page_row( $child, $children_pages, $level + 1 ); 267 $i--; 268 } 262 269 } 263 270 } 264 271 272 /* 273 * displays pages in hierarchical order 274 */ 275 function page_rows( $pages ) { 276 global $class; 277 278 if ( !$pages ) 279 $pages = get_pages( 'sort_column=menu_order' ); 280 281 if ( !$pages ) 282 return false; 283 284 /* splice pages into two parts: those without parent and those with parent */ 285 286 $top_level_pages = array(); 287 $children_pages = array(); 288 289 foreach ( $pages as $page ) { 290 if ( 0 == $page->post_parent ) 291 $top_level_pages[] = $page; 292 else 293 $children_pages[] = $page; 294 } 295 296 foreach ( $top_level_pages as $page ) 297 display_page_row( $page, $children_pages, 0 ); 298 299 300 /* 301 * display the remaining children_pages which are orphans 302 * having orphan requires parental attention 303 */ 304 if ( sizeof( $children_pages ) > 0 ) { 305 $class = ( 'alternate' == $class ) ? '' : 'alternate'; 306 ?> 307 <tr class='<?php echo $class; ?>'> 308 <th colspan='7'><?php echo _e('Orphaned Pages') ?></th> 309 </tr> 310 <?php 311 $empty_array = array(); 312 foreach ( $children_pages as $orphan_page ) 313 display_page_row( $orphan_page, $empty_array, 0 ); 314 } 315 } 316 265 317 function user_row( $user_object, $style = '' ) { 266 318 if ( !(is_object( $user_object) && is_a( $user_object, 'WP_User' ) ) ) 267 319 $user_object = new WP_User( (int) $user_object ); -
C:/xampp/htdocs/wordpress_trunk/wp-admin/edit-pages.php
68 68 <br style="clear:both;" /> 69 69 70 70 <?php 71 wp( "post_type=page&orderby=menu_order&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc");71 wp( "post_type=page&orderby=menu_order title&what_to_show=posts$post_status_q&posts_per_page=-1&posts_per_archive_page=-1&order=asc" ); 72 72 73 73 $all = !( $h2_search || $post_status_q ); 74 74 … … 85 85 </tr> 86 86 </thead> 87 87 <tbody id="the-list" class="list:page"> 88 <?php page_rows(0, 0, $posts, $all); ?> 88 <?php page_rows( $posts ); ?> 89 89 </tbody> 90 90 </table> 91 91