diff --git a/wp-admin/admin-ajax.php b/wp-admin/admin-ajax.php index 25a8221215..d0c87b4d32 100644 --- a/wp-admin/admin-ajax.php +++ b/wp-admin/admin-ajax.php @@ -441,6 +441,13 @@ case 'autosave-generate-nonces' : } die('0'); break; +case 'closed-postboxes' : + check_ajax_referer( $action ); + $closed = explode(',', $_POST['closed']); + if (!is_array($closed)) break; + $current_user = wp_get_current_user(); + update_usermeta($current_user->ID, 'closedpostboxes', $closed); +break; default : do_action( 'wp_ajax_' . $_POST['action'] ); die('0'); diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index a59d3fad43..7e4768eed2 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -110,7 +110,7 @@ else echo clean_url(stripslashes(wp_get_referer())); ?>" />

-
+

@@ -118,7 +118,7 @@ else
-
+

@@ -140,12 +140,12 @@ if (current_user_can('upload_files') && false) {

-
+

-
+

() @@ -156,7 +156,7 @@ if ( ! empty($pings) )
-
+

@@ -177,7 +177,7 @@ list_meta($metadata); -
+

@@ -188,21 +188,21 @@ list_meta($metadata);
-
+

-
+

-
+

@@ -215,7 +215,7 @@ list_meta($metadata);
-
+

@@ -227,7 +227,7 @@ if ( $post->post_author && !in_array($post->post_author, $authors) ) $authors[] = $post->post_author; if ( $authors && count( $authors ) > 1 ) : ?> -
+

$authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?> diff --git a/wp-admin/includes/post.php b/wp-admin/includes/post.php index c8bada430d..ac0f8aadc2 100644 --- a/wp-admin/includes/post.php +++ b/wp-admin/includes/post.php @@ -513,4 +513,11 @@ function wp_edit_posts_query( $q = false ) { return array($post_stati, $avail_post_stati); } +function postbox_classes( $id ) { + $current_user = wp_get_current_user(); + $closed = get_usermeta( $current_user->ID, 'closedpostboxes' ); + if ( !is_array( $closed ) ) return ''; + return in_array( $id, $closed )? 'closed' : ''; +} + ?> diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index 6c8cbfaff2..1b31478fce 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -31,7 +31,7 @@ function tag_update_quickclicks() { } }); if ( shown ) - jQuery( '#tagchecklist' ).prepend( 'Tags used on this post:
' ); + jQuery( '#tagchecklist' ).prepend( ''+postL10n.tagsUsed+'
' ); } function tag_flush_to_text() { @@ -54,30 +54,40 @@ function tag_press_key( e ) { function add_postbox_toggles() { jQuery('.postbox h3').prepend('+ '); - jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); } ); + jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state(); } ); +} + +function save_postboxes_state() { + var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); + jQuery.post(postL10n.requestFile, { + action: 'closed-postboxes', + closed: closed, + cookie: document.cookie}); } addLoadEvent( function() { jQuery('#tags-input').hide(); tag_update_quickclicks(); // add the quickadd form - jQuery('#jaxtag').prepend('Separate tags with commas'); + jQuery('#jaxtag').prepend(''+postL10n.separate+''); jQuery('#tagadd').click( tag_flush_to_text ); // jQuery('#newtag').keydown( tag_press_key ); jQuery('#newtag').focus(function() { - if ( this.value == 'Add new tag' ) { + if ( this.value == postL10n.addTag ) { this.value = ''; this.style.color = '#333'; } }); jQuery('#newtag').blur(function() { if ( this.value == '' ) { - this.value = 'Add new tag'; + this.value = postL10n.addTag; this.style.color = '#999' } }); // auto-suggest stuff jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { onSelect: tag_flush_to_text, delay: 500, minchars: 2 } ); + + // postboxes add_postbox_toggles(); -}); \ No newline at end of file +}); diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index 66485687f9..d5efa37d78 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -108,6 +108,13 @@ class WP_Scripts { $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' ); $this->add( 'post', '/wp-admin/js/post.js', array('suggest'), '20080102' ); + $this->localize( 'post', 'postL10n', array( + 'tagsUsed' => __('Tags used on this post:'), + 'add' => attribute_escape(__('Add')), + 'addTag' => attribute_escape(__('Add new tag')), + 'separate' => __('Separate tags with commas'), + 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', + ) ); $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' ); $this->localize( 'upload', 'uploadL10n', array( 'browseTitle' => attribute_escape(__('Browse your files')),