Fix two rare regressions: alert when the login has expires and when post is edited by another user, fixes #16928

git-svn-id: http://svn.automattic.com/wordpress/trunk@17640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2011-04-16 02:37:44 +00:00
parent 03c3c94d1e
commit e4bf0a4e78
4 changed files with 18 additions and 17 deletions

View File

@@ -1,4 +1,4 @@
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false, interimLogin = false;
var autosave, autosaveLast = '', autosavePeriodical, autosaveOldMessage = '', autosaveDelayPreview = false, notSaved = true, blockSave = false;
jQuery(document).ready( function($) {
var dotabkey = true;
@@ -83,7 +83,7 @@ jQuery(document).ready( function($) {
});
function autosave_parse_response(response) {
var res = wpAjax.parseAjaxResponse(response, 'autosave'), message = '', postID, sup, url;
var res = wpAjax.parseAjaxResponse(response, 'autosave'), message = '', postID, sup;
if ( res && res.responses && res.responses.length ) {
message = res.responses[0].data; // The saved message or error.
@@ -94,13 +94,13 @@ function autosave_parse_response(response) {
autosave = function() {};
res = { errors: true };
}
if ( sup['session_expired'] && (url = sup['session_expired']) ) {
if ( !interimLogin || interimLogin.closed ) {
interimLogin = window.open(url, 'login', 'width=600,height=450,resizable=yes,scrollbars=yes,status=yes');
interimLogin.focus();
}
delete sup['session_expired'];
if ( sup['alert'] ) {
jQuery('#autosave-alert').remove();
jQuery('#titlediv').after('<div id="autosave-alert" class="error below-h2"><p>' + sup['alert'] + '</p></div>');
alert( jQuery('#autosave-alert').text() );
}
jQuery.each(sup, function(selector, value) {
if ( selector.match(/^replace-/) ) {
jQuery('#'+selector.replace('replace-', '')).val(value);
@@ -131,7 +131,7 @@ function autosave_saved(response) {
// called when autosaving new post
function autosave_saved_new(response) {
blockSave = false;
var res = autosave_parse_response(response), tempID, postID;
var res = autosave_parse_response(response), postID;
if ( res && res.responses.length && !res.errors ) {
// An ID is sent only for real auto-saves, not for autosave=0 "keepalive" saves
postID = parseInt( res.responses[0].id, 10 );

File diff suppressed because one or more lines are too long

View File

@@ -103,7 +103,7 @@ function wp_default_scripts( &$scripts ) {
'l10n_print_after' => 'try{convertEntities(wpAjax);}catch(e){};'
) );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110327' );
$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('schedule', 'wp-ajax-response'), '20110415' );
$scripts->add_data( 'autosave', 'group', 1 );
$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response'), '20101222' );