WordPress.org

Make WordPress Core

Changeset 7146


Ignore:
Timestamp:
03/04/2008 12:05:30 AM (10 years ago)
Author:
ryan
Message:

Post edit collision detection fixes from mdawaffe. fixes #6043

Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r7145 r7146  
    473473    global $current_user;
    474474
    475     $_POST['post_content'] = $_POST['content'];
    476     $_POST['post_excerpt'] = $_POST['excerpt'];
    477475    $_POST['post_status'] = 'draft';
    478476    $_POST['post_category'] = explode(",", $_POST['catslist']);
     
    522520        }
    523521        if ( $do_autosave ) {
    524             $id = wp_update_post($_POST);
     522            $id = edit_post();
    525523            $data = $message;
    526524        } else {
  • trunk/wp-admin/edit-form-advanced.php

    r7145 r7146  
    152152<?php if ($post_ID): ?>
    153153<?php printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); ?>
     154<br class="clear" />
    154155<?php endif; ?>
    155156<span id="autosave"></span>
  • trunk/wp-admin/edit-page-form.php

    r7145 r7146  
    130130<?php if ($post_ID): ?>
    131131<?php printf(__('Last edited on %1$s at %2$s'), mysql2date(get_option('date_format'), $post->post_modified), mysql2date(get_option('time_format'), $post->post_modified)); ?>
     132<br class="clear" />
    132133<?php endif; ?>
    133134<span id="autosave"></span>
  • trunk/wp-admin/includes/post.php

    r7139 r7146  
    113113    // Now that we have an ID we can fix any attachment anchor hrefs
    114114    _fix_attachment_links( $post_ID );
     115
     116    wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
    115117
    116118    return $post_ID;
     
    322324    _fix_attachment_links( $post_ID );
    323325
     326    wp_set_post_lock( $post_ID, $GLOBALS['current_user']->ID );
     327
    324328    return $post_ID;
    325329}
  • trunk/wp-admin/page.php

    r7116 r7146  
    6161        $last_user = get_userdata( $last );
    6262        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
    63         $message = sprintf( __( '%s is currently editing this page' ), wp_specialchars( $last_user_name ) );
     63        $message = sprintf( __( 'Warning: %s is currently editing this page' ), wp_specialchars( $last_user_name ) );
    6464        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
    6565        add_action('admin_notices', create_function( '', "echo '$message';" ) );
  • trunk/wp-admin/post.php

    r7103 r7146  
    7070        $last_user = get_userdata( $last );
    7171        $last_user_name = $last_user ? $last_user->display_name : __('Somebody');
    72         $message = sprintf( __( '%s is currently editing this post' ), wp_specialchars( $last_user_name ) );
     72        $message = sprintf( __( 'Warning: %s is currently editing this post' ), wp_specialchars( $last_user_name ) );
    7373        $message = str_replace( "'", "\'", "<div class='error'><p>$message</p></div>" );
    7474        add_action('admin_notices', create_function( '', "echo '$message';" ) );
  • trunk/wp-admin/wp-admin.css

    r7145 r7146  
    12161216}
    12171217
     1218.submitbox #autosave .error {
     1219    color: #333;
     1220}
     1221
    12181222/* Categories */
    12191223
  • trunk/wp-includes/js/autosave.js

    r7145 r7146  
    11var autosaveLast = '';
    22var autosavePeriodical;
     3var autosaveOldMessage = '';
    34
    45jQuery(function($) {
     
    1819// called when autosaving pre-existing post
    1920function autosave_saved(response) {
    20     var oldMessage = jQuery('#autosave').html();
    2121    var res = wpAjax.parseAjaxResponse(response, 'autosave'); // parse the ajax response
    2222    var message = '';
     
    4040    }
    4141    if ( message ) { jQuery('#autosave').html(message); } // update autosave message
    42     else if ( oldMessage && res ) { jQuery('#autosave').html( oldMessage ); }
     42    else if ( autosaveOldMessage && res ) { jQuery('#autosave').html( autosaveOldMessage ); }
    4343    autosave_enable_buttons(); // re-enable disabled form buttons
    4444    return res;
     
    181181    }
    182182
     183    autosaveOldMessage = jQuery('#autosave').html();
     184
    183185    jQuery.ajax({
    184186        data: post_data,
Note: See TracChangeset for help on using the changeset viewer.