Index: wp-includes/link-template.php
===================================================================
--- wp-includes/link-template.php	(revision 6630)
+++ wp-includes/link-template.php	(working copy)
@@ -43,7 +43,7 @@
 }
 
 
-function get_permalink($id = 0) {
+function get_permalink($id = 0, $leavename=false) {
 	$rewritecode = array(
 		'%year%',
 		'%monthnum%',
@@ -51,11 +51,11 @@
 		'%hour%',
 		'%minute%',
 		'%second%',
-		'%postname%',
+		$leavename? '' : '%postname%',
 		'%post_id%',
 		'%category%',
 		'%author%',
-		'%pagename%'
+		$leavename? '' : '%pagename%',
 	);
 
 	$post = &get_post($id);
Index: wp-includes/script-loader.php
===================================================================
--- wp-includes/script-loader.php	(revision 6630)
+++ wp-includes/script-loader.php	(working copy)
@@ -114,6 +114,8 @@
 				'add' => attribute_escape(__('Add')),
 				'addTag' => attribute_escape(__('Add new tag')),
 				'separate' => __('Separate tags with commas'),
+				'save' => __('Save'),
+				'cancel' => __('Cancel'),
 				'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
 			) );
 			$this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
Index: wp-admin/admin-ajax.php
===================================================================
--- wp-admin/admin-ajax.php	(revision 6630)
+++ wp-admin/admin-ajax.php	(working copy)
@@ -476,6 +476,11 @@
 	$current_user = wp_get_current_user();
 	update_usermeta($current_user->ID, 'closedpostboxes', $closed);
 break;
+case 'sample-permalink':
+	check_ajax_referer( $action );
+	$post_id = isset($_POST['post_id'])? intval($_POST['post_id']) : 0;
+	die(get_sample_permalink_html($post_id, $_POST['new_slug']));
+break;
 default :
 	do_action( 'wp_ajax_' . $_POST['action'] );
 	die('0');
Index: wp-admin/wp-admin.css
===================================================================
--- wp-admin/wp-admin.css	(revision 6630)
+++ wp-admin/wp-admin.css	(working copy)
@@ -1178,6 +1178,19 @@
 	padding: 4px 3px;
 	width: 98%;
 }
+#edit-slug-box {
+	margin-top: 8px;
+	color: #999;
+}
+#edit-slug-box strong {color: #777;}
+#editable-post-name {background-color: #FFFBCC;}
+#editable-post-name input {width: 16em;}
+#edit-slug-buttons a.save {
+	background-color: #ebebeb;
+	-moz-border-raduis: 5px;
+	padding: 6px;
+}
+#edit-slug-buttons a.cancel {font-size: 80%;}
 
 #poststuff #editor-toolbar {
 	position: relative;
Index: wp-admin/includes/post.php
===================================================================
--- wp-admin/includes/post.php	(revision 6630)
+++ wp-admin/includes/post.php	(working copy)
@@ -524,4 +524,40 @@
 	}
 }
 
+function get_sample_permalink($id, $name = null) {
+	$post = &get_post($id);
+	$original_status = $post->post_status;
+	$original_date = $post->post_date;
+	$original_name = $post->post_name;
+	if (in_array($post->post_status, array('draft', 'pending'))) {
+		$post->post_status = 'publish';
+		$post->post_date = date('Y-m-d H:i:s');
+		$post->post_name = sanitize_title($post->post_name? $post->post_name : $post->post_title, $post->ID);
+	}
+	if (!is_null($name)) {
+		$post->post_name = sanitize_title($name, $post->ID); 
+	}
+	$permalink = get_permalink($post, true);
+	$permalink = array($permalink, $post->post_name);
+	$post->post_status = $original_status;
+	$post->post_date = $original_date;
+	$post->post_name = $original_name;
+	return $permalink;
+}
+
+function get_sample_permalink_html($id, $new_slug=null) {
+	$post = &get_post($id);
+	list($permalink, $post_name) = get_sample_permalink($post->ID, $new_slug);
+	if (false === strpos($permalink, '%postname%')) {
+		return '';
+	}
+	$title = __('You can edit this part of the permalink using the Edit button on the right');
+	if (strlen($post_name) > 30) {
+		$post_name = substr($post_name, 0, 14). '&hellip;' . substr($post_name, -14);
+	}
+	$post_name_html = '<span id="editable-post-name" title="'.$title.'">'.$post_name.'</span>';
+	$display_link = str_replace('%postname%', $post_name_html, $permalink);
+	return $display_link;
+} 
+
 ?>
Index: wp-admin/js/post.js
===================================================================
--- wp-admin/js/post.js	(revision 6630)
+++ wp-admin/js/post.js	(working copy)
@@ -65,6 +65,42 @@
 		cookie: document.cookie});
 }
 
+function edit_permalink(post_id) {
+	var e = jQuery('#editable-post-name');
+	var revert_e = e.html();	
+	var real_slug = jQuery('#post_name');
+	var b = jQuery('#edit-slug-buttons');
+	var revert_b = b.html();
+	var old_slug = e.children('span').html();
+
+	b.html('<a href="" class="save">'+postL10n.save+'</a> <a class="cancel" href="">'+postL10n.cancel+'</a>');
+	b.children('.save').click(function() {
+		var new_slug = e.children('input').attr('value');
+		jQuery.post(postL10n.requestFile, {
+			action: 'sample-permalink',
+			post_id: post_id,
+			new_slug: new_slug,
+			cookie: document.cookie}, function(data) {
+				jQuery('#sample-permalink').html(data);
+				b.html(revert_b);
+				real_slug.attr('value', new_slug);	
+			});
+		return false;
+	});
+	jQuery('#edit-slug-buttons .cancel').click(function() {
+		e.html(revert_e);
+		b.html(revert_b);
+		real_slug.attr('value', revert_e);
+		return false;
+	});
+	e.html('<input type="text" id="new-post-slug" value="" />').children('input').keypress(function(e){
+		var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;
+		// on enter, just save the new slug, don't save the post
+		if (13 == key) {b.children('.save').click();return false;}
+		if (27 == key) {b.children('.cancel').click();return false;}
+		real_slug.attr('value', this.value)}).focus();
+}
+
 addLoadEvent( function() {
 	jQuery('#tags-input').hide();
 	tag_update_quickclicks();
@@ -136,4 +172,6 @@
 		return false;
 	} );
 	jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change();
+
+	jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});
 });
Index: wp-admin/edit-form-advanced.php
===================================================================
--- wp-admin/edit-form-advanced.php	(revision 6630)
+++ wp-admin/edit-form-advanced.php	(working copy)
@@ -70,8 +70,22 @@
 
 <div id="titlediv">
 <h3><?php _e('Title') ?></h3>
-<div class="inside"><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /></div>
+<div class="inside">
+	<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" />
+<?php
+	$sample_permalink_html = get_sample_permalink_html($post->ID);
+	if ($post->ID && $sample_permalink_html):
+?>
+	<div id="edit-slug-box" style="display: <?php echo $post->ID? 'block' : 'none';?>">
+		<strong><?php _e('Permalink:'); ?></strong>
+		<span id="sample-permalink"><?php echo $sample_permalink_html; ?></span>
+		<span id="edit-slug-buttons"><a href="#post_name" class="edit-slug" onclick="edit_permalink(<?php echo $post->ID; ?>);return false;"><?php _e('Edit');?></a></span>
+	</div>
+<?php
+	endif;
+	?>
 </div>
+</div>
 
 <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
 <h3><?php _e('Post') ?></h3>
@@ -126,7 +140,7 @@
 </div>
 
 <p class="submit">
-<input type="submit" name="submit" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
+<input type="submit" name="save" value="<?php _e('Save'); ?>" style="font-weight: bold;" tabindex="4" />
 <?php
 if ( !in_array( $post->post_status, array('publish', 'future') ) || 0 == $post_ID ) {
 ?>
