Changeset 8857 for trunk/wp-admin/includes/template.php
- Timestamp:
- 09/10/2008 10:47:03 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r8855 r8857 351 351 else 352 352 $posts_columns['date'] = __('Date'); 353 //$posts_columns['author'] = __('Author');353 $posts_columns['author'] = __('Author'); 354 354 $posts_columns['categories'] = __('Categories'); 355 355 $posts_columns['tags'] = __('Tags'); … … 407 407 } 408 408 409 function post_rows() { 409 function inline_edit_row( $type ) { 410 global $current_user; 411 412 if ( 'post' == $type ) 413 $post = get_default_post_to_edit(); 414 else 415 $post = get_default_page_to_edit(); 416 417 echo '<tr id="inline-edit" style="display: none">'; 418 $columns = $type == 'post' ? wp_manage_posts_columns() : wp_manage_pages_columns(); 419 foreach($columns as $column_name=>$column_display_name) { 420 421 switch($column_name) { 422 423 case 'cb': ?> 424 <th class="check-column"></th> 425 <?php 426 break; 427 428 case 'modified': 429 case 'date': ?> 430 <td class="date"> 431 <?php touch_time(1, 1, 4, 1); ?> 432 </td> 433 <?php 434 break; 435 436 case 'title': ?> 437 <td class="<?php echo $type ?>-title"> 438 <div class="title"> 439 <input type="text" name="post_title" class="title" value="" /><br /> 440 <label><?php _e('Slug'); ?></label><input type="text" name="post_name" value="" class="slug" /> 441 </div> 442 <?php if($type == 'page'): ?> 443 <div class="other"> 444 <label><?php _e('Parent'); ?></label> 445 <select name="post_parent"> 446 <option value="0"><?php _e('Main Page (no parent)'); ?></option> 447 <?php parent_dropdown(); ?> 448 </select><br /> 449 <label><?php _e('Template'); ?></label> 450 <select name="page_template"> 451 <option value='default'><?php _e('Default Template'); ?></option> 452 <?php page_template_dropdown() ?> 453 </select> 454 </div> 455 <div class="more"> 456 <label><?php _e('Order'); ?></label><input type="text" name="menu_order" value="<?php echo $post->menu_order ?>" /> 457 <label><?php _e('Password'); ?></label><input type="text" name="post_password" value="<?php echo $post->post_password ?>" /> 458 </div> 459 <?php endif; ?> 460 <div class="clear"></div> 461 <?php 462 $actions = array(); 463 $actions['save'] = '<a href="#">' . __('Save') . '</a>'; 464 $actions['cancel'] = '<a href="#">' . __('Cancel') . '</a>'; 465 $action_count = count($actions); 466 $i = 0; 467 foreach ( $actions as $action => $link ) { 468 ++$i; 469 ( $i == $action_count ) ? $sep = '' : $sep = ' | '; 470 echo "<span class='$action'>$link$sep</span>"; 471 } 472 ?> 473 </td> 474 <?php 475 break; 476 477 case 'categories': ?> 478 <td class="categories"> 479 <ul class="categories"> 480 <?php wp_category_checklist() ?> 481 </ul> 482 </td> 483 <?php 484 break; 485 486 case 'tags': ?> 487 <td class="tags"> 488 <textarea name="tags_input"></textarea> 489 </td> 490 <?php 491 break; 492 493 case 'comments': ?> 494 <td class="comments num"> 495 <input title="Allow Comments" type="checkbox" name="comment_status" value="open" /><br /> 496 <input title="Allow Pings" type="checkbox" name="ping_status" value="open" /> 497 </td> 498 <?php 499 break; 500 501 case 'author': ?> 502 <td class="author"> 503 <?php 504 $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM 505 if ( $authors && count( $authors ) > 1 ) { 506 wp_dropdown_users( array('include' => $authors, 'name' => 'post_author', 'class'=> 'author', 'selected' => $post->post_author) ); 507 } else { 508 echo $current_user->user_nicename.'<input type="hidden" value="'.$post->post_author.'" class="author" />'; 509 } 510 ?> 511 </td> 512 <?php 513 break; 514 515 case 'status': ?> 516 <td class="status"> 517 <select name="post_status"> 518 <?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?> 519 <option value='publish'><?php _e('Published') ?></option> 520 <option value='future'><?php _e('Scheduled') ?></option> 521 <?php endif; ?> 522 <option value='pending'><?php _e('Pending Review') ?></option> 523 <option value='draft'><?php _e('Unpublished') ?></option> 524 </select> 525 <?php if($type == 'page'): ?> 526 <br /><label><input type="checkbox" name="page_private" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></p> 527 <?php else: ?> 528 <?php if ( current_user_can( 'edit_others_posts' ) ) : ?> 529 <br /><label><input type="checkbox" name="sticky" value="sticky" /> <?php _e('Sticky') ?></label></p> 530 <?php endif; ?> 531 <?php endif; ?> 532 </td> 533 <?php 534 break; 535 536 case 'control_view': ?> 537 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> 538 <?php 539 break; 540 541 case 'control_edit': ?> 542 <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 543 <?php 544 break; 545 546 case 'control_delete': ?> 547 <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td> 548 <?php 549 break; 550 551 default: ?> 552 <td><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td> 553 <?php 554 break; 555 } 556 } 557 558 echo '</tr>'; 559 } 560 561 function inline_save_row( $data ) { 562 // get the original post content 563 $post = get_post( $data['post_ID'], ARRAY_A ); 564 $data['content'] = $post['post_content']; 565 566 // statuses 567 if ( 'page' == $data['post_type'] && 'private' == $data['page_private'] ) 568 $data['post_status'] = 'private'; 569 if ( empty($data['comment_status']) ) 570 $data['comment_status'] = 'closed'; 571 if ( empty($data['ping_status']) ) 572 $data['ping_status'] = 'closed'; 573 574 // rename 575 $data['user_ID'] = $GLOBALS['user_ID']; 576 $data['excerpt'] = $data['post_excerpt']; 577 $data['trackback_url'] = $data['to_ping']; 578 $data['parent_id'] = $data['post_parent']; 579 580 // update the post 581 $_POST = $data; 582 edit_post(); 583 } 584 585 // outputs XML of the post/page data ready for use in the inline editor 586 // accepts array of post IDs 587 function get_inline_data($posts) { 588 global $post; 589 590 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 591 echo "<?xml version='1.0' ?>\n"; 592 echo "<posts>\n"; 593 594 foreach ($posts as $ID) { 595 $GLOBALS['post'] = get_post($ID); 596 $GLOBALS['post_ID'] = $ID; 597 598 if ( ($post->post_type == 'post' && !current_user_can('edit_post', $ID)) || 599 ($post->post_type == 'page' && !current_user_can('edit_page', $ID)) || 600 ($post->post_type != 'post' && $post->post_type != 'page')) 601 continue; 602 603 echo " <post id='$ID'>\n"; 604 echo " <post_title>" . wp_specialchars($post->post_title, 1) . "</post_title>\n"; 605 echo " <post_name>$post->post_name</post_name>\n"; 606 echo " <post_author>$post->post_author</post_author>\n"; 607 echo " <comment_status>$post->comment_status</comment_status>\n"; 608 echo " <ping_status>$post->ping_status</ping_status>\n"; 609 echo " <post_status>$post->post_status</post_status>\n"; 610 echo " <jj>" . mysql2date( 'd', $post->post_date ) . "</jj>\n"; 611 echo " <mm>" . mysql2date( 'm', $post->post_date ) . "</mm>\n"; 612 echo " <aa>" . mysql2date( 'Y', $post->post_date ) . "</aa>\n"; 613 echo " <hh>" . mysql2date( 'H', $post->post_date ) . "</hh>\n"; 614 echo " <mn>" . mysql2date( 'i', $post->post_date ) . "</mn>\n"; 615 if( $post->post_type == 'post' ) { 616 echo ' <tags_input>' . wp_specialchars(get_tags_to_edit( $post->ID ), 1) . "</tags_input>\n"; 617 echo ' <post_category>' . implode( ',', wp_get_post_categories( $post->ID ) ) . "</post_category>\n"; 618 echo ' <sticky>' . (is_sticky($post->ID) ? 'sticky' : '') . "</sticky>\n"; 619 } 620 if( $post->post_type == 'page' ) { 621 echo " <post_parent>$post->post_parent</post_parent>\n"; 622 echo ' <page_template>' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . "</page_template>\n"; 623 echo " <post_password>" . wp_specialchars($post->post_password, 1) . "</post_password>\n"; 624 echo " <menu_order>$post->menu_order</menu_order>\n"; 625 } 626 echo " </post>\n"; 627 } 628 629 echo '</posts>'; 630 } 631 632 function post_rows( $posts = array() ) { 410 633 global $wp_query, $post, $mode; 411 634 … … 414 637 // Create array of post IDs. 415 638 $post_ids = array(); 416 foreach ( $wp_query->posts as $a_post ) 639 640 if ( empty($posts) ) 641 $posts = &$wp_query->posts; 642 643 foreach ( $posts as $a_post ) 417 644 $post_ids[] = $a_post->ID; 418 645 419 646 $comment_pending_count = get_pending_comments_num($post_ids); 420 if ( empty($comment_pending_count [$post->ID]) )647 if ( empty($comment_pending_count) ) 421 648 $comment_pending_count = array(); 422 649 423 while ( have_posts() ) { 424 the_post(); 425 650 foreach ( $posts as $post ) { 426 651 if ( empty($comment_pending_count[$post->ID]) ) 427 652 $comment_pending_count[$post->ID] = 0; … … 437 662 $global_post = $post; 438 663 $post = $a_post; 664 setup_postdata($post); 439 665 440 666 $class = 'alternate' == $class ? '' : 'alternate'; … … 484 710 485 711 if ( 'excerpt' == $mode ) { ?> 486 <td ><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td>712 <td class="date"><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 487 713 <?php } else { ?> 488 <td ><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td>714 <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) ?></abbr></td> 489 715 <?php } 490 716 break; … … 501 727 $actions = array(); 502 728 $actions['edit'] = '<a href="post.php?action=edit&post=' . $post->ID . '">' . __('Edit') . '</a>'; 729 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 503 730 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 504 731 $action_count = count($actions); … … 516 743 case 'categories': 517 744 ?> 518 <td ><?php745 <td class="categories"><?php 519 746 $categories = get_the_category(); 520 747 if ( !empty( $categories ) ) { … … 532 759 case 'tags': 533 760 ?> 534 <td ><?php761 <td class="tags"><?php 535 762 $tags = get_the_tags(); 536 763 if ( !empty( $tags ) ) { … … 548 775 case 'comments': 549 776 ?> 550 <td class=" num"><div class="post-com-count-wrapper">777 <td class="comments num"><div class="post-com-count-wrapper"> 551 778 <?php 552 779 $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) ); … … 563 790 case 'author': 564 791 ?> 565 <td ><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>792 <td class="author"><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 566 793 <?php 567 794 break; … … 569 796 case 'status': 570 797 ?> 571 <td >798 <td class="status"> 572 799 <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 573 800 <?php … … 655 882 case 'cb': 656 883 ?> 657 <th scope="row" class="check-column"><input type="checkbox" name=" delete[]" value="<?php the_ID(); ?>" /></th>884 <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th> 658 885 <?php 659 886 break; … … 682 909 } 683 910 ?> 684 <td ><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td>911 <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 685 912 <?php 686 913 break; … … 697 924 $actions = array(); 698 925 $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 926 $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 699 927 $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&post=$page->ID", 'delete-page_' . $page->ID) . "' onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $page->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this page '%s'\n 'Cancel' to stop, 'OK' to delete."), $page->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>"; 700 928 $action_count = count($actions); … … 712 940 case 'comments': 713 941 ?> 714 <td class=" num"><div class="post-com-count-wrapper">942 <td class="comments num"><div class="post-com-count-wrapper"> 715 943 <?php 716 944 $left = get_pending_comments_num( $page->ID ); … … 728 956 case 'author': 729 957 ?> 730 <td ><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td>958 <td class="author"><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 731 959 <?php 732 960 break; … … 734 962 case 'status': 735 963 ?> 736 <td >964 <td class="status"> 737 965 <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 738 966 <?php … … 1241 1469 } 1242 1470 1243 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) {1471 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { 1244 1472 global $wp_locale, $post, $comment; 1245 1473 … … 1262 1490 $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); 1263 1491 1264 $month = "<select id=\"mm\"name=\"mm\"$tab_index_attribute>\n";1492 $month = "<select " . ( $multi ? '' : 'id="mm" ' ) . "name=\"mm\"$tab_index_attribute>\n"; 1265 1493 for ( $i = 1; $i < 13; $i = $i +1 ) { 1266 1494 $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"'; … … 1271 1499 $month .= '</select>'; 1272 1500 1273 $day = '<input type="text" id="jj"name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';1274 $year = '<input type="text" id="aa"name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />';1275 $hour = '<input type="text" id="hh"name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';1276 $minute = '<input type="text" id="mn"name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />';1501 $day = '<input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; 1502 $year = '<input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off" />'; 1503 $hour = '<input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; 1504 $minute = '<input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" />'; 1277 1505 printf(_c('%1$s%2$s, %3$s @ %4$s : %5$s|1: month input, 2: day input, 3: year input, 4: hour input, 5: minute input'), $month, $day, $year, $hour, $minute); 1506 1507 if ( $multi ) return; 1508 1278 1509 echo "\n\n"; 1279 1510 foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) … … 1318 1549 $current = ''; 1319 1550 1320 echo "\n\t<option value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>";1551 echo "\n\t<option class='level-$level' value='$item->ID'$current>$pad " . wp_specialchars($item->post_title) . "</option>"; 1321 1552 parent_dropdown( $default, $item->ID, $level +1 ); 1322 1553 }
Note: See TracChangeset
for help on using the changeset viewer.