diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index d8fa2f6813..b7d3b7941c 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -527,7 +527,7 @@ break; case 'get-permalink': check_ajax_referer( 'getpermalink', 'getpermalinknonce' ); $post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0; - die(get_permalink($post_id)); + die(add_query_arg(array('preview' => 'true'), get_permalink($post_id))); break; case 'sample-permalink': check_ajax_referer( 'samplepermalink', 'samplepermalinknonce' ); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 011016665c..292b20449c 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -71,18 +71,12 @@ addLoadEvent(focusit);

-ID); - if ($post->ID && $sample_permalink_html): -?> -
- - - +ID); ?> +
+ID) && ! empty($sample_permalink_html) ) : + echo $sample_permalink_html; +endif; ?>
-
diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index 5147c64e82..338844c183 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -604,7 +604,9 @@ function get_sample_permalink_html($id, $new_slug=null) { } $post_name_html = ''.$post_name_abridged.''.$post_name.''; $display_link = str_replace('%postname%', $post_name_html, $permalink); - return $display_link; + $return = '' . __('Permalink:') . "\n" . '' . $display_link . "\n"; + $return .= '' . __('Edit') . "\n"; + return $return; } ?> diff --git a/wp-admin/js/slug.js b/wp-admin/js/slug.js index c391198cd9..80f62aa85e 100644 --- a/wp-admin/js/slug.js +++ b/wp-admin/js/slug.js @@ -16,7 +16,7 @@ function edit_permalink(post_id) { post_id: post_id, new_slug: new_slug, samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { - jQuery('#sample-permalink').html(data); + jQuery('#edit-slug-box').html(data); b.html(revert_b); real_slug.attr('value', new_slug); make_slugedit_clickable(); diff --git a/wp-includes/js/autosave.js b/wp-includes/js/autosave.js index 07903cbe6d..cd695a86f1 100644 --- a/wp-includes/js/autosave.js +++ b/wp-includes/js/autosave.js @@ -47,6 +47,7 @@ function autosave_update_post_ID(response) { } jQuery('#autosave').html(message); autosave_update_preview_link(res); + autosave_update_slug(res); autosave_enable_buttons(); } @@ -62,7 +63,19 @@ function autosave_update_preview_link(post_id) { }, function(permalink) { jQuery('#previewview').html(''+previewText+''); }); - + } +} + +function autosave_update_slug(post_id) { + // create slug area only if not already there + if ( 'undefined' != typeof make_slugedit_clickable && ! jQuery('#edit-slug-box > *').get()[0] ) { + jQuery.post(slugL10n.requestFile, { + action: 'sample-permalink', + post_id: post_id, + samplepermalinknonce: jQuery('#samplepermalinknonce').val()}, function(data) { + jQuery('#edit-slug-box').html(data); + make_slugedit_clickable(); + }); } } @@ -81,6 +94,7 @@ function autosave_saved(response) { } jQuery('#autosave').html(message); autosave_update_preview_link(res); + autosave_update_slug(res); autosave_enable_buttons(); } diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index c9bc5575ce..b049db9855 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -42,7 +42,7 @@ class WP_Scripts { $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); - $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080220'); + $this->add( 'autosave', '/wp-includes/js/autosave.js', array('jquery', 'schedule'), '20080221'); $this->localize( 'autosave', 'autosaveL10n', array( 'autosaveInterval' => apply_filters('autosave_interval', '120'), 'errorText' => __('Error: %response%'),