Ticket #6815: 6815.diff

File 6815.diff, 28.5 KB (added by ryan, 4 years ago)
  • wp-includes/script-loader.php

     
    241241                )); 
    242242 
    243243                $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); 
     244                 
     245                $scripts->add( 'inline-edit', '/wp-admin/js/inline-edit.js', array( 'jquery', 'jquery-form', 'suggest' ), '20080812' ); 
    244246 
    245247                $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' ); 
    246248                $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 
  • wp-admin/admin-ajax.php

     
    715715        $slug = isset($_POST['new_slug'])? $_POST['new_slug'] : ''; 
    716716        die(get_sample_permalink_html($post_id, $title, $slug)); 
    717717break; 
     718case 'inline-data': 
     719        if( !isset( $_POST['posts'] ) )  
     720                break; 
     721        get_edit_data( explode(',', $_POST['posts']) ); 
     722        die(); 
     723break; 
     724case 'inline-save': 
     725        die('1'); 
     726break; 
    718727case 'meta-box-order': 
    719728        check_ajax_referer( 'meta-box-order' ); 
    720729        update_user_option( $GLOBALS['current_user']->ID, "meta-box-order_$_POST[page]", $_POST['order'] ); 
  • wp-admin/wp-admin.css

     
    20852085.metabox-prefs label input { 
    20862086        margin: 0 5px 0 2px; 
    20872087} 
     2088 
     2089 
     2090/* Inline Editor */ 
     2091 
     2092.edit-column { 
     2093        text-align: center; 
     2094} 
     2095 
     2096.inline { 
     2097        font-size: 10px; 
     2098} 
     2099 
     2100.inline td { 
     2101        padding-right: 4px; 
     2102        padding-left: 7px; 
     2103} 
     2104 
     2105.inline input, .inline select, .inline textarea { 
     2106        font-size: 10px !important; 
     2107        padding: 2px; 
     2108        border: 1px solid #ddd; 
     2109} 
     2110 
     2111.inline td.date { 
     2112        width: 87px; 
     2113} 
     2114 
     2115.inline td.page-title { 
     2116        width: 495px; 
     2117} 
     2118 
     2119.inline td.post-title input.title { 
     2120        width: 250px; 
     2121} 
     2122 
     2123.inline td.post-title input.slug { 
     2124        width: 222px; 
     2125        float: right; 
     2126} 
     2127 
     2128.inline div.title { 
     2129        float: left; 
     2130} 
     2131 
     2132.inline div.title input.title { 
     2133        font-size: 12px !important; 
     2134} 
     2135 
     2136.inline div.title label { 
     2137        float: left; 
     2138        margin-top: 4px; 
     2139} 
     2140 
     2141.inline td.page-title input.slug { 
     2142        width: 123px; 
     2143        float: right; 
     2144} 
     2145 
     2146.inline div.other, .inline div.more { 
     2147        width: 190px; 
     2148        float: left; 
     2149        padding-left: 5px; 
     2150} 
     2151 
     2152.inline div.other label, .inline div.more label { 
     2153        display: block; float: left; 
     2154        width: 54px; 
     2155        margin-top: 4px; 
     2156} 
     2157 
     2158.inline div.other select { 
     2159        width: 133px; 
     2160} 
     2161 
     2162.inline div.more { 
     2163        width: 125px; 
     2164} 
     2165 
     2166.inline div.more input { 
     2167        width: 60px; 
     2168} 
     2169 
     2170.inline td.author select { 
     2171        width: 110px; 
     2172} 
     2173 
     2174.inline ul.categories { 
     2175        list-style: none; 
     2176        padding: 0; margin: 0;  
     2177        height: 65px; 
     2178        overflow: auto; 
     2179        font-size: 10px; 
     2180} 
     2181 
     2182.inline ul.categories ul.children { 
     2183        list-style: none; 
     2184        padding-left: 15px; 
     2185} 
     2186 
     2187.inline ul.categories li { 
     2188        margin-bottom: 2px; 
     2189} 
     2190 
     2191.inline ul.categories input { 
     2192        vertical-align: middle; 
     2193        padding: 0; border: 0; 
     2194} 
     2195 
     2196.inline td.tags textarea { 
     2197        height: 58px; width: 100%; 
     2198} 
     2199 
     2200.inline td.comments { 
     2201        padding-left: 0; 
     2202} 
     2203 
     2204.inline td.status select { 
     2205        width: 98px; 
     2206} 
     2207 
     2208.inline td.status input { 
     2209        vertical-align: middle; 
     2210} 
     2211 No newline at end of file 
  • wp-admin/includes/template.php

     
    350350                $posts_columns['modified'] = __('Submitted'); 
    351351        else 
    352352                $posts_columns['date'] = __('Date'); 
    353         //$posts_columns['author'] = __('Author'); 
     353        $posts_columns['author'] = __('Author'); 
    354354        $posts_columns['categories'] = __('Categories'); 
    355355        $posts_columns['tags'] = __('Tags'); 
    356356        if ( !isset($_GET['post_status']) || !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) 
     
    406406        return $posts_columns; 
    407407} 
    408408 
     409function display_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                  <td></td> 
     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" class="title" value="" /><br /> 
     440                                        <label><?php _e('Slug'); ?></label><input type="text" value="" class="slug" /> 
     441                                </div> 
     442                                <?php if($type == 'page'): ?> 
     443                                <div class="other"> 
     444                                        <label><?php _e('Parent'); ?></label> 
     445                                        <select class="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 class="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" class="order" value="<?php echo $post->menu_order ?>" /> 
     457                                        <label><?php _e('Password'); ?></label><input type="text" class="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 class="tags"></textarea> 
     489                        </td> 
     490                        <?php 
     491                        break; 
     492 
     493                case 'comments': ?> 
     494                        <td class="comments num"> 
     495                                <input title="Allow Comments" type="checkbox" class="comment" value="open" /><br /> 
     496                                <input title="Allow Pings" type="checkbox" class="ping" 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' => 'author-'.$post->ID, '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 class="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 class="private" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></p> 
     527                                <?php endif; ?> 
     528                        </td> 
     529                        <?php 
     530                        break; 
     531 
     532                case 'control_view': ?> 
     533                        <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e('View'); ?></a></td> 
     534                        <?php 
     535                        break; 
     536 
     537                case 'control_edit': ?> 
     538                        <td><?php if ( current_user_can('edit_post',$post->ID) ) { echo "<a href='post.php?action=edit&amp;post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 
     539                        <?php 
     540                        break; 
     541 
     542                case 'control_delete': ?> 
     543                        <td><?php if ( current_user_can('delete_post',$post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td> 
     544                        <?php 
     545                        break; 
     546 
     547                default: ?> 
     548                        <td><?php do_action('manage_posts_custom_column', $column_name, $post->ID); ?></td> 
     549                        <?php 
     550                        break; 
     551                } 
     552        } 
     553 
     554        echo '</tr>'; 
     555} 
     556 
     557// outputs XML of the post/page data ready for use in the inline editor 
     558// accepts array of post IDs 
     559function get_edit_data($posts) { 
     560        global $post; 
     561 
     562        header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true); 
     563        echo "<?xml version='1.0' ?>\n"; 
     564        echo "<posts>\n"; 
     565 
     566        foreach ($posts as $post_id) { 
     567                $post_id = (int) $post_id; 
     568                if ( ! $post_id ) 
     569                        continue; 
     570 
     571                $post = get_post($post_id); 
     572 
     573                if ( ($post->post_type == 'post' && !current_user_can('edit_post', $post_id)) ||  
     574                                ($post->post_type == 'page' && !current_user_can('edit_page', $post_id)) ||  
     575                                ($post->post_type != 'post' && $post->post_type != 'page')) 
     576                        continue; 
     577 
     578                echo "  <post id='$post_id'>\n"; 
     579                echo "    <title>" . wp_specialchars($post->post_title, 1) . "</title>\n"; 
     580                echo "    <slug>$post->post_name</slug>\n"; 
     581                echo "    <author>$post->post_author</author>\n"; 
     582                echo "    <comments>$post->comment_status</comments>\n"; 
     583                echo "    <ping>$post->ping_status</ping>\n"; 
     584                echo "    <status>$post->post_status</status>\n"; 
     585                echo "    <jj>" . mysql2date( 'd', $post->post_date ) . "</jj>\n"; 
     586                echo "    <mm>" . mysql2date( 'm', $post->post_date ) . "</mm>\n"; 
     587                echo "    <aa>" . mysql2date( 'Y', $post->post_date ) . "</aa>\n"; 
     588                echo "    <hh>" . mysql2date( 'H', $post->post_date ) . "</hh>\n"; 
     589                echo "    <mn>" . mysql2date( 'i', $post->post_date ) . "</mn>\n"; 
     590                if ( $post->post_type == 'post' ) { 
     591                        echo '    <tags>' . wp_specialchars(get_tags_to_edit( $post->ID ), 1) . "</tags>\n"; 
     592                        echo '    <categories>' . implode( ',', wp_get_post_categories( $post->ID ) ) . "</categories>\n"; 
     593                } elseif ( $post->post_type == 'page' ) { 
     594                        echo "    <parent>$post->post_parent</parent>\n"; 
     595                        echo '    <template>' . wp_specialchars(get_post_meta( $post->ID, '_wp_page_template', true ), 1) . "</template>\n"; 
     596                        echo "    <password>" . wp_specialchars($post->post_password, 1) . "</password>\n"; 
     597                        echo "    <order>$post->menu_order</order>\n"; 
     598                } 
     599                echo "  </post>\n"; 
     600        } 
     601 
     602        echo '</posts>'; 
     603} 
     604 
    409605function post_rows() { 
    410606        global $wp_query, $post, $mode; 
    411607 
     
    483679                        } 
    484680 
    485681                        if ( 'excerpt' == $mode ) { ?> 
    486                 <td><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 
     682                <td class="date"><?php echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode) ?></td> 
    487683                <?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> 
     684                <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> 
    489685                <?php } 
    490686                break; 
    491687 
     
    500696 
    501697                        $actions = array(); 
    502698                        $actions['edit'] = '<a href="post.php?action=edit&amp;post=' . $post->ID . '">' . __('Edit') . '</a>'; 
     699                        $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    503700                        $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("post.php?action=delete&amp;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>"; 
    504701                        $action_count = count($actions); 
    505702                        $i = 0; 
     
    515712 
    516713                case 'categories': 
    517714                ?> 
    518                 <td><?php 
     715                <td class="categories"><?php 
    519716                        $categories = get_the_category(); 
    520717                        if ( !empty( $categories ) ) { 
    521718                                $out = array(); 
     
    531728 
    532729                case 'tags': 
    533730                ?> 
    534                 <td><?php 
     731                <td class="tags"><?php 
    535732                        $tags = get_the_tags(); 
    536733                        if ( !empty( $tags ) ) { 
    537734                                $out = array(); 
     
    547744 
    548745                case 'comments': 
    549746                ?> 
    550                 <td class="num"><div class="post-com-count-wrapper"> 
     747                <td class="comments num"><div class="post-com-count-wrapper"> 
    551748                <?php 
    552749                        $pending_phrase = sprintf( __('%s pending'), number_format( $pending_comments ) ); 
    553750                        if ( $pending_comments ) 
     
    562759 
    563760                case 'author': 
    564761                ?> 
    565                 <td><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
     762                <td class="author"><a href="edit.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
    566763                <?php 
    567764                break; 
    568765 
    569766                case 'status': 
    570767                ?> 
    571                 <td> 
     768                <td class="status"> 
    572769                <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 
    573770                <?php 
    574771                        switch ( $post->post_status ) { 
     
    606803 
    607804                case 'control_delete': 
    608805                ?> 
    609                 <td><?php if ( current_user_can('delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td> 
     806                <td><?php if ( current_user_can('delete_post', $post->ID) ) { echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post=$post_id", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>"; } ?></td> 
    610807                <?php 
    611808                break; 
    612809 
     
    654851 
    655852        case 'cb': 
    656853                ?> 
    657                 <th scope="row" class="check-column"><input type="checkbox" name="delete[]" value="<?php the_ID(); ?>" /></th> 
     854                <th scope="row" class="check-column"><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /></th> 
    658855                <?php 
    659856                break; 
    660857        case 'modified': 
     
    681878                        } 
    682879                } 
    683880                ?> 
    684                 <td><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
     881                <td class="date"><abbr title="<?php echo $t_time ?>"><?php echo $h_time ?></abbr></td> 
    685882                <?php 
    686883                break; 
    687884        case 'title': 
     
    696893 
    697894                $actions = array(); 
    698895                $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>'; 
     896                $actions['inline'] = '<a href="#" class="editinline">' . __('Quick Edit') . '</a>'; 
    699897                $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url("page.php?action=delete&amp;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>"; 
    700898                $action_count = count($actions); 
    701899                $i = 0; 
     
    711909 
    712910        case 'comments': 
    713911                ?> 
    714                 <td class="num"><div class="post-com-count-wrapper"> 
     912                <td class="comments num"><div class="post-com-count-wrapper"> 
    715913                <?php 
    716914                $left = get_pending_comments_num( $page->ID ); 
    717915                $pending_phrase = sprintf( __('%s pending'), number_format( $left ) ); 
     
    727925 
    728926        case 'author': 
    729927                ?> 
    730                 <td><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
     928                <td class="author"><a href="edit-pages.php?author=<?php the_author_ID(); ?>"><?php the_author() ?></a></td> 
    731929                <?php 
    732930                break; 
    733931 
    734932        case 'status': 
    735933                ?> 
    736                 <td> 
     934                <td class="status"> 
    737935                <a href="<?php the_permalink(); ?>" title="<?php echo attribute_escape(sprintf(__('View "%s"'), $title)); ?>" rel="permalink"> 
    738936                <?php 
    739937                switch ( $page->post_status ) { 
     
    12401438 
    12411439} 
    12421440 
    1243 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0 ) { 
     1441function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) { 
    12441442        global $wp_locale, $post, $comment; 
    12451443 
    12461444        if ( $for_post ) 
     
    12501448        if ( (int) $tab_index > 0 ) 
    12511449                $tab_index_attribute = " tabindex=\"$tab_index\""; 
    12521450 
     1451  $identifier = $multi ? 'class' : 'id'; 
     1452 
    12531453        // echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />'; 
    12541454 
    12551455        $time_adj = time() + (get_option( 'gmt_offset' ) * 3600 ); 
     
    12611461        $mn = ($edit) ? mysql2date( 'i', $post_date ) : gmdate( 'i', $time_adj ); 
    12621462        $ss = ($edit) ? mysql2date( 's', $post_date ) : gmdate( 's', $time_adj ); 
    12631463 
    1264         $month = "<select id=\"mm\" name=\"mm\"$tab_index_attribute>\n"; 
     1464        $month = "<select $identifier=\"mm\" name=\"mm\"$tab_index_attribute>\n"; 
    12651465        for ( $i = 1; $i < 13; $i = $i +1 ) { 
    12661466                $month .= "\t\t\t" . '<option value="' . zeroise($i, 2) . '"'; 
    12671467                if ( $i == $mm ) 
     
    12701470        } 
    12711471        $month .= '</select>'; 
    12721472 
    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"  />'; 
     1473        $day = '<input type="text" ' . $identifier . '="jj" name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1474        $year = '<input type="text" ' . $identifier . '="aa" name="aa" value="' . $aa . '" size="4" maxlength="5"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1475        $hour = '<input type="text" ' . $identifier . '="hh" name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
     1476        $minute = '<input type="text" ' . $identifier . '="mn" name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off"  />'; 
    12771477        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); 
     1478 
     1479        if ( $multi ) return; 
     1480         
    12781481        echo "\n\n"; 
    12791482        foreach ( array('mm', 'jj', 'aa', 'hh', 'mn') as $timeunit ) 
    1280                 echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n"; 
     1483                echo '<input type="hidden" ' . $identifier . '="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $$timeunit . '" />' . "\n"; 
    12811484?> 
    12821485 
    1283 <input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> 
     1486<input type="hidden" <?php echo $identifier ?>="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" /> 
    12841487 
    12851488<a href="#edit_timestamp" class="save-timestamp hide-if-no-js button"><?php _e('OK'); ?></a> 
    12861489<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><?php _e('Cancel'); ?></a> 
  • wp-admin/js/forms.js

     
    11function checkAll(jQ) { // use attr( checked, fn ) 
    2         jQuery(jQ).find( 'tbody:visible :checkbox' ).attr( 'checked', function() { 
     2        jQuery(jQ).find( 'tbody:visible .check-column :checkbox' ).attr( 'checked', function() { 
    33                return jQuery(this).attr( 'checked' ) ? '' : 'checked'; 
    44        } ); 
    55} 
    66 
    77jQuery( function($) { 
    88        var lastClicked = false; 
    9         $( 'tbody :checkbox' ).click( function(e) { 
     9        $( 'tbody .check-column :checkbox' ).click( function(e) { 
    1010                if ( 'undefined' == e.shiftKey ) { return true; } 
    1111                if ( e.shiftKey ) { 
    1212                        if ( !lastClicked ) { return true; } 
  • wp-admin/js/inline-edit.js

     
     1var postType = ''; 
     2var multiKey = false; 
     3var postsXml = ''; 
     4 
     5// keep track of the shift key 
     6jQuery(document).keydown(function(e) { if(e.which == 16) multiKey = true; } ); 
     7jQuery(document).keyup(function(e) { if(e.which == 16)   multiKey = false; } ); 
     8 
     9jQuery(document).ready(function() { 
     10        postType = window.location.href.indexOf('edit.php') != -1 ? 'post' : 'page'; 
     11 
     12        // handle edit action 
     13        jQuery('#posts-filter input[name="doaction"]').click(function() {  
     14                if(jQuery('#posts-filter select[name="action"]').val() == 'edit') { 
     15                        editRow(selectedRows()); 
     16                        return false;        
     17                } 
     18                return true; 
     19        }); 
     20 
     21        // get IDs of all editable rows 
     22        var rows = jQuery('table.widefat .check-column :checkbox'); 
     23        var editable = []; 
     24        rows.each(function(i) { editable[i] = this.value; }); 
     25 
     26        // prepare the edit row 
     27        var blankRow = jQuery('#inline-edit'); 
     28        jQuery('ul.categories *', blankRow).removeAttr('id'); 
     29        jQuery('ul.categories label', blankRow).removeAttr('for'); 
     30        jQuery('ul.categories :checkbox').each(function() { 
     31                jQuery(this).addClass('category-'+this.value); 
     32        }); 
     33        blankRow.attr('title', 'Double-click to cancel') 
     34                .dblclick(function() { toggleRow(this); }) 
     35                .keypress(function(event) { if(event.which == 13) return saveRow(this); }); 
     36        jQuery('span.cancel a', blankRow).click(function() { return revertRow(this); }); 
     37        jQuery('span.save a', blankRow).click(function() { return saveRow(this); }); 
     38 
     39        // add events for shift-change functionality 
     40        jQuery('ul.categories input[type="checkbox"], td.comments input[type="checkbox"], input.private', blankRow).click(changeAll); 
     41        jQuery('select.author, select.status, select.mm, select.parent, select.template', blankRow).change(changeAll); 
     42        jQuery('input.password, input.jj, input.aa, input.hh, input.mn, textarea.tags, input.title', blankRow).blur(changeAll); 
     43 
     44        // add events to links and make rows double-clickable 
     45        rows.each(function() { 
     46                var row = jQuery('#'+postType+'-'+this.value); 
     47                jQuery('a.editinline', row).click(function() { editRow(this); return false; }); 
     48                row.dblclick(function() { toggleRow(this); }); 
     49                row.attr('title', 'Double-click to edit'); 
     50        }); 
     51 
     52        // get data for posts 
     53        jQuery.post('admin-ajax.php', { action: 'inline-data', posts: editable.join(',') }, function(xml) { postsXml = xml; }, 'xml'); 
     54}); 
     55 
     56function toggleRow(el) { 
     57        jQuery('#'+postType+'-'+getRowId(el)).css('display') == 'none' ? revertRow(el) : editRow(el); 
     58} 
     59 
     60// ID can be either the row object or a comma separated list of IDs 
     61function editRow(id) { 
     62        if(typeof(id) == 'object') 
     63                id = getRowId(id); 
     64 
     65        var blankRow = jQuery('#inline-edit'); 
     66 
     67        var ids = id.split(','); 
     68        var fields = ['title', 'slug', 'author', 'status', 'jj', 'mm', 'aa', 'hh', 'mn']; 
     69        if(postType == 'page') fields.push('parent', 'order', 'template', 'password'); 
     70        if(postType == 'post') fields.push('tags'); 
     71 
     72        // iterate through the rows 
     73        for(var i = 0; i < ids.length; i++) { 
     74                id = ids[i]; 
     75                 
     76                // add the new blank row 
     77                var editRow = blankRow.clone(true); 
     78                jQuery(editRow).attr('id', 'edit-'+id).addClass('inline').show(); 
     79                if(jQuery('#'+postType+'-'+id).hasClass('alternate')) 
     80                        jQuery(editRow).addClass('alternate'); 
     81                jQuery('#'+postType+'-'+id).hide().after(editRow); 
     82                 
     83                // populate the data 
     84                var rowData = jQuery(postsXml).find('post[id="'+id+'"]'); 
     85                for(var f = 0; f < fields.length; f++) { 
     86                        jQuery(':input.'+fields[f], editRow).val(jQuery(fields[f], rowData).text()); 
     87                } 
     88                 
     89                // ping, comments, and privacy 
     90                if(jQuery('comments', rowData).text() == 'open') 
     91                        jQuery('input.comment', editRow).select(); 
     92                if(jQuery('ping', rowData).text() == 'open') 
     93                        jQuery('input.ping', editRow).select(); 
     94                 
     95                // categories 
     96                var categories = jQuery('categories', rowData).text().split(','); 
     97                jQuery(categories).each(function() { 
     98                        jQuery('ul.categories :checkbox[value="'+this+'"]', editRow).select(); 
     99                }); 
     100                 
     101                // handle the post status 
     102                var status = jQuery('status', rowData).text(); 
     103                if(status != 'future') jQuery('select.status option[value="future"]', editRow).remove(); 
     104                if(status == 'private') jQuery('input.private', editRow).select(); 
     105                 
     106                // remove the current page from the parent dropdown 
     107                jQuery('select.parent option[value="'+id+'"]', editRow).remove(); 
     108                // NEED TO REMOVE CHILD PAGES TOO 
     109        } 
     110 
     111        // enable autocomplete for tags 
     112        if(postType == 'post') { 
     113                jQuery('tr.inline textarea.tags').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } ); 
     114        } 
     115 
     116        return false; 
     117} 
     118 
     119function saveRow(id) { 
     120        if(typeof(id) == 'object') 
     121          id = getRowId(id); 
     122        if(multiKey) 
     123          id = openRows(); 
     124 
     125        var rows = jQuery('table.widefat tr.inline'); 
     126 
     127        alert('Saving is not yet implemented.'); 
     128        return false; 
     129 
     130        // add names to all the fields 
     131        var idArray = id.split(','); 
     132        jQuery(idArray).each(function(i) { 
     133                jQuery('input[type!="button"], select, textarea', jQuery('tr#'+postType+'-'+id)).each(function() { 
     134                        jQuery(this).attr('name', this.className+'-'+idArray[i]); 
     135                }); 
     136        }); 
     137  
     138        var params = 'action=save&post_type='+postType+'&id='+id+'&'; 
     139        params += jQuery('input[type!="button"], select, textarea', rows).fieldSerialize(); 
     140 
     141        // make ajax request 
     142        jQuery.post('admin-ajax.php', params, 
     143                function(html) {  
     144                        //updateRow(id, 'get', html);  
     145                        //var row = jQuery(rowId); 
     146                } 
     147        );   
     148        return false; 
     149} 
     150 
     151function revertRow(id) { 
     152        if(typeof(id) == 'object') id = getRowId(id); 
     153        if(multiKey) id = openRows(); 
     154        id = id.split(','); 
     155 
     156        jQuery(id).each(function() { 
     157                jQuery('#edit-'+this).remove(); 
     158                jQuery('#'+postType+'-'+this).show(); 
     159        }); 
     160 
     161        return false; 
     162} 
     163 
     164function changeAll(event) { 
     165        if(!multiKey) return; 
     166 
     167        switch(this.type) { 
     168                case 'checkbox': 
     169                        var checked = this.checked ? true : false; 
     170                        jQuery('tr.inline input.'+this.className+'[type="checkbox"]').select(checked); 
     171                        break; 
     172                case 'select': 
     173                case 'select-one': 
     174                        jQuery('tr.inline select.'+this.className).val(this.value); 
     175                        break; 
     176                case 'text': 
     177                        jQuery('tr.inline input.'+this.className).val(this.value); 
     178                        break; 
     179                case 'textarea': 
     180                        jQuery('tr.inline textarea.tags').val(this.value); 
     181                        break; 
     182        } 
     183} 
     184 
     185function openRows() { 
     186        var ids = []; 
     187        jQuery('table.widefat tr.inline').each(function(i) { 
     188          ids[i] = this.id.split('-')[1]; 
     189        }); 
     190        return ids.join(','); 
     191} 
     192 
     193function selectedRows() { 
     194        var ids = []; 
     195        jQuery('table.widefat .check-column :checked').each(function(i) { ids[i] = this.value; }); 
     196        return ids.join(','); 
     197} 
     198 
     199function getRowId(obj) { 
     200        var id = obj.tagName == 'TR' ? obj.id : jQuery(obj).parents('tr').attr('id'); 
     201        var parts = id.split('-'); 
     202        return parts[parts.length - 1]; 
     203} 
     204 No newline at end of file 
  • wp-admin/edit-post-rows.php

     
    2727        </tr> 
    2828        </thead> 
    2929        <tbody> 
     30           
     31<?php display_edit_row('post') ?>          
     32 
    3033<?php 
    3134if ( have_posts() ) { 
    3235        post_rows(); 
  • wp-admin/edit.php

     
    5050$title = __('Posts'); 
    5151$parent_file = 'edit.php'; 
    5252wp_enqueue_script('admin-forms'); 
     53wp_enqueue_script('inline-edit'); 
    5354 
     55 
    5456list($post_stati, $avail_post_stati) = wp_edit_posts_query(); 
    5557 
    5658if ( 1 == count($posts) && is_singular() ) { 
     
    168170<div class="alignleft"> 
    169171<select name="action"> 
    170172<option value="" selected><?php _e('Actions'); ?></option> 
     173<option value="edit"><?php _e('Edit'); ?></option> 
    171174<option value="delete"><?php _e('Delete'); ?></option> 
    172 <option value="edit"><?php _e('Edit'); ?></option> 
    173175</select> 
    174176<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 
    175177<?php wp_nonce_field('bulk-posts'); ?> 
  • wp-admin/edit-pages.php

     
    4444$title = __('Pages'); 
    4545$parent_file = 'edit.php'; 
    4646wp_enqueue_script('admin-forms'); 
     47wp_enqueue_script('inline-edit'); 
    4748 
    4849$post_stati  = array(   //      array( adj, noun ) 
    4950                'publish' => array(__('Published'), __('Published pages'), __ngettext_noop('Published (%s)', 'Published (%s)')), 
     
    153154<div class="alignleft"> 
    154155<select name="action"> 
    155156<option value="" selected><?php _e('Actions'); ?></option> 
     157<option value="edit"><?php _e('Edit'); ?></option> 
    156158<option value="delete"><?php _e('Delete'); ?></option> 
    157159</select> 
    158160<input type="submit" value="<?php _e('Apply'); ?>" name="doaction" class="button-secondary action" /> 
     
    187189  </tr> 
    188190  </thead> 
    189191  <tbody> 
     192  <?php display_edit_row('page') ?> 
    190193  <?php page_rows($posts, $pagenum, $per_page); ?> 
    191194  </tbody> 
    192195</table>