diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php
index e0bf8d265..ca7de560d 100644
--- a/wp-admin/admin-ajax.php
+++ b/wp-admin/admin-ajax.php
@@ -7,6 +7,19 @@ define('DOING_AJAX', true);
if ( !is_user_logged_in() )
die('-1');
+if ( 'ajax-tag-search' == $_GET['action'] ) {
+ if ( !current_user_can( 'manage_categories' ) )
+ die('-1');
+
+ $s = $_GET['q']; // is this slashed already?
+
+ if ( strstr( $s, ',' ) )
+ die; // it's a multiple tag insert, we won't find anything
+ $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%$s%')" );
+ echo join( $results, "\n" );
+ die;
+}
+
function get_out_now() { exit; }
add_action( 'shutdown', 'get_out_now', -1 );
diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php
index 35726f38b..bcef8b9be 100644
--- a/wp-admin/edit-form-advanced.php
+++ b/wp-admin/edit-form-advanced.php
@@ -157,11 +157,6 @@ if ( $authors && count( $authors ) > 1 ) :
-
-
@@ -200,14 +195,29 @@ if (current_user_can('upload_files')) {
diff --git a/wp-admin/images/xit.gif b/wp-admin/images/xit.gif
new file mode 100644
index 000000000..6f1cc4f4e
Binary files /dev/null and b/wp-admin/images/xit.gif differ
diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js
new file mode 100644
index 000000000..4b549586c
--- /dev/null
+++ b/wp-admin/js/post.js
@@ -0,0 +1,77 @@
+// this file shoudl contain all the scripts used in the post/edit page
+
+function new_tag_remove_tag() {
+ var id = jQuery( this ).attr( 'id' );
+ var num = id.substr( 10 );
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
+ delete current_tags[num];
+ var new_tags = [];
+ jQuery.each( current_tags, function( key, val ) {
+ if ( val && !val.match(/^\s+$/) && '' != val ) {
+ new_tags = new_tags.concat( val );
+ }
+ });
+ jQuery( '#tags-input' ).val( new_tags.join( ',' ).replace( /\s*,+\s*/, ',' ).replace( /,+/, ',' ).replace( /,+\s+,+/, ',' ).replace( /,+\s*$/, '' ).replace( /^\s*,+/, '' ) );
+ tag_update_quickclicks();
+ return false;
+}
+
+function tag_update_quickclicks() {
+ var current_tags = jQuery( '#tags-input' ).val().split(',');
+ jQuery( '#tagchecklist' ).empty();
+ shown = false;
+// jQuery.merge( current_tags, current_tags ); // this doesn't work anymore, need something to array_unique
+ jQuery.each( current_tags, function( key, val ) {
+ val = val.replace( /^\s+/, '' ).replace( /\s+$/, '' ); // trim
+ if ( !val.match(/^\s+$/) && '' != val ) {
+ txt = 'X ' + val + ' ';
+ jQuery( '#tagchecklist' ).append( txt );
+ jQuery( '#tag-check-' + key ).click( new_tag_remove_tag );
+ shown = true;
+ }
+ });
+ if ( shown )
+ jQuery( '#tagchecklist' ).prepend( 'Tags used on this post:
' );
+}
+
+function tag_flush_to_text() {
+ var newtags = jQuery('#tags-input').val() + ',' + jQuery('#newtag').val();
+ // massage
+ newtags = newtags.replace( /\s+,+\s*/g, ',' ).replace( /,+/g, ',' ).replace( /,+\s+,+/g, ',' ).replace( /,+\s*$/g, '' ).replace( /^\s*,+/g, '' );
+ jQuery('#tags-input').val( newtags );
+ tag_update_quickclicks();
+ jQuery('#newtag').val('');
+ jQuery('#newtag').blur();
+ return false;
+}
+
+function tag_press_key( e ) {
+ if ( 13 == e.keyCode ) {
+ tag_flush_to_text();
+ return false;
+ }
+}
+
+addLoadEvent( function() {
+ jQuery('#tags-input').hide();
+ tag_update_quickclicks();
+ // add the quickadd form
+ jQuery('#jaxtag').prepend('Separate tags with commas');
+ jQuery('#tagadd').click( tag_flush_to_text );
+// jQuery('#newtag').keydown( tag_press_key );
+ jQuery('#newtag').focus(function() {
+ if ( this.value == 'Add new tag' ) {
+ this.value = '';
+ this.style.color = '#333';
+ }
+ });
+ jQuery('#newtag').blur(function() {
+ if ( this.value == '' ) {
+ this.value = 'Add new tag';
+ this.style.color = '#999'
+ }
+ });
+
+ // auto-suggest stuff
+ jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { onSelect: tag_flush_to_text } );
+});
\ No newline at end of file
diff --git a/wp-admin/post-new.php b/wp-admin/post-new.php
index e51a4f9a5..e3a950727 100644
--- a/wp-admin/post-new.php
+++ b/wp-admin/post-new.php
@@ -6,6 +6,8 @@ $editing = true;
wp_enqueue_script('prototype');
wp_enqueue_script('jquery');
wp_enqueue_script('autosave');
+wp_enqueue_script('post');
+
require_once ('./admin-header.php');
if ( ! current_user_can('edit_posts') ) { ?>
diff --git a/wp-admin/post.php b/wp-admin/post.php
index 4609bae52..d9d2e6673 100644
--- a/wp-admin/post.php
+++ b/wp-admin/post.php
@@ -58,10 +58,13 @@ case 'edit':
exit();
}
- if($post->post_status == 'draft') {
+ wp_enqueue_script('post');
+
+ if( 'draft' == $post->post_status ) {
wp_enqueue_script('prototype');
wp_enqueue_script('autosave');
}
+
require_once('admin-header.php');
if ( !current_user_can('edit_post', $post_ID) )
diff --git a/wp-admin/wp-admin.css b/wp-admin/wp-admin.css
index da94c4042..5f651b0c8 100644
--- a/wp-admin/wp-admin.css
+++ b/wp-admin/wp-admin.css
@@ -90,7 +90,7 @@ a:hover {
body {
background: #fff;
- color: #000;
+ color: #333;
margin: 0;
padding: 0;
}
@@ -137,11 +137,6 @@ img {
border: 0;
}
-input:focus, textarea:focus, label:focus {
- background: #fff;
- border: 1px solid #686868;
-}
-
.form-invalid {
background-color: #FF9999 !important;
}
@@ -159,9 +154,6 @@ p, li, dl, dd, dt {
}
textarea, input, select {
- background: #f4f4f4;
- border: 1px solid #b2b2b2;
- color: #000;
font: 13px Verdana, Arial, Helvetica, sans-serif;
margin: 1px;
padding: 3px;
@@ -296,10 +288,8 @@ form#upload #post_content {
}
.submit input, .submit input:focus, .button, .button:focus {
- background: url(images/fade-butt.png);
color: #246;
- padding: 0.3em;
- -moz-border-radius: 4px;
+ padding: 2px;
}
.submit, .editform th, #postcustomsubmit {
@@ -387,7 +377,7 @@ input.disabled, textarea.disabled {
border: none;
}
-#postdiv, #titlediv, #guiddiv, #tagdiv {
+#postdiv, #titlediv, #guiddiv {
margin: 0 8px 0 0;
padding: 0;
}
@@ -407,7 +397,7 @@ input.disabled, textarea.disabled {
line-height: 140%;
}
-#titlediv input, #guiddiv input, #tagdiv input {
+#titlediv input, #guiddiv input {
margin: 0;
width: 100%;
}
@@ -1395,4 +1385,71 @@ a.view-comment-post-link {
color: #448abd;
font-weight: bold;
border-bottom: 1px solid #448abd;
-}
\ No newline at end of file
+}
+
+/* Post Screen */
+
+#tagchecklist {
+ margin-left: 5px;
+ font-size: 12px;
+}
+
+#tagchecklist span {
+ margin-right: 15px;
+ display: block;
+ float: left;
+ font-size: 11px;
+}
+
+#tagchecklist span a {
+ margin-top: 5px;
+ cursor: pointer;
+ width: 10px;
+ height: 10px;
+ background: url(images/xit.gif) no-repeat;
+ display: block;
+ float: left;
+ text-indent: -9999px;
+ overflow: hidden;
+}
+#tagchecklist span a:hover {
+ background: url(images/xit.gif) no-repeat -10px 0;
+}
+
+#newtag {
+ color: #999;
+}
+
+.howto {
+ font-style: italic;
+ display: block;
+ color: #999;
+}
+
+.ac_results {
+ border: 1px solid gray;
+ background-color: white;
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ position: absolute;
+ z-index: 10000;
+ display: none;
+}
+
+.ac_results li {
+ padding: 2px 5px;
+ white-space: nowrap;
+ color: #101010;
+ text-align: left;
+}
+
+.ac_over {
+ cursor: pointer;
+ background-color: #F0F0B8;
+}
+
+.ac_match {
+ text-decoration: underline;
+ color: black;
+}
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index e40e8f7f5..997a9bff7 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1285,9 +1285,9 @@ function wp_nonce_ays( $action ) {
$html .= "\t\t\n";
}
$html .= "\t\t\n";
- $html .= "\t\t\n\t\t
" . wp_specialchars( wp_explain_nonce( $action ) ) . "
\n\t\t
" . __( 'No' ) . "
\n\t\t
\n\t\n";
+ $html .= "\t\t\n\t\t
" . wp_specialchars( wp_explain_nonce( $action ) ) . "
\n\t\t
" . __( 'No' ) . "
\n\t\t
\n\t\n";
} else {
- $html .= "\t\n";
+ $html .= "\t\n";
}
$html .= "