Ticket #5799: postboxes-on-all-pages.diff
File postboxes-on-all-pages.diff, 17.2 KB (added by , 17 years ago) |
---|
-
wp-includes/script-loader.php
135 135 $this->localize( 'postbox', 'postboxL10n', array( 136 136 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 137 137 ) ); 138 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox'), '20080128' ); 138 $this->add( 'slug', '/wp-admin/js/slug.js', array('jquery'), '20080208' ); 139 $this->localize( 'slug', 'slugL10n', array( 140 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 141 'save' => __('Save'), 142 'cancel' => __('Cancel'), 143 ) ); 144 $this->add( 'post', '/wp-admin/js/post.js', array('suggest', 'jquery-ui-tabs', 'wp-lists', 'postbox', 'slug'), '20080128' ); 139 145 $this->localize( 'post', 'postL10n', array( 140 146 'tagsUsed' => __('Tags used on this post:'), 141 147 'add' => attribute_escape(__('Add')), 142 148 'addTag' => attribute_escape(__('Add new tag')), 143 149 'separate' => __('Separate tags with commas'), 144 'save' => __('Save'),145 'cancel' => __('Cancel'),146 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',147 150 ) ); 151 $this->add( 'page', '/wp-admin/js/page.js', array('jquery', 'slug', 'postbox'), '20080208' ); 148 152 $this->add( 'link', '/wp-admin/js/link.js', array('jquery-ui-tabs', 'wp-lists', 'postbox'), '20080131' ); 149 153 $this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' ); 150 154 $this->localize( 'upload', 'uploadL10n', array( -
wp-admin/admin-ajax.php
513 513 die('0'); 514 514 break; 515 515 case 'closed-postboxes' : 516 check_ajax_referer( $action ); 517 $closed = explode(',', $_POST['closed']); 516 check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' ); 517 $closed = isset( $_POST['closed'] )? $_POST['closed'] : ''; 518 $closed = explode( ',', $_POST['closed'] ); 519 $page = isset( $_POST['page'] )? $_POST['page'] : ''; 520 if ( !preg_match( '/^[a-z-]+$/', $page ) ) { 521 die(-1); 522 } 518 523 if (!is_array($closed)) break; 519 524 $current_user = wp_get_current_user(); 520 update_usermeta($current_user->ID, 'closedpostboxes ', $closed);525 update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed); 521 526 break; 522 527 case 'sample-permalink': 523 528 check_ajax_referer( $action ); -
wp-admin/includes/post.php
517 517 return array($post_stati, $avail_post_stati); 518 518 } 519 519 520 function postbox_classes( $id ) {520 function postbox_classes( $id, $page ) { 521 521 $current_user = wp_get_current_user(); 522 if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes ') ) {522 if ( $closed = get_usermeta( $current_user->ID, 'closedpostboxes_'.$page ) ) { 523 523 if ( !is_array( $closed ) ) return ''; 524 524 return in_array( $id, $closed )? 'closed' : ''; 525 525 } else { -
wp-admin/js/post.js
52 52 } 53 53 } 54 54 55 function edit_permalink(post_id) {56 var i, c = 0;57 var e = jQuery('#editable-post-name');58 var revert_e = e.html();59 var real_slug = jQuery('#post_name');60 var b = jQuery('#edit-slug-buttons');61 var revert_b = b.html();62 var old_slug = e.children('span').html();63 64 b.html('<a href="" class="save">'+postL10n.save+'</a> <a class="cancel" href="">'+postL10n.cancel+'</a>');65 b.children('.save').click(function() {66 var new_slug = e.children('input').attr('value');67 jQuery.post(postL10n.requestFile, {68 action: 'sample-permalink',69 post_id: post_id,70 new_slug: new_slug,71 cookie: document.cookie}, function(data) {72 jQuery('#sample-permalink').html(data);73 b.html(revert_b);74 real_slug.attr('value', new_slug);75 make_slugedit_clickable();76 });77 return false;78 });79 jQuery('#edit-slug-buttons .cancel').click(function() {80 e.html(revert_e);81 b.html(revert_b);82 real_slug.attr('value', revert_e);83 return false;84 });85 for(i=0; i < revert_e.length; ++i) {86 if ('%' == revert_e.charAt(i)) c++;87 }88 slug_value = (c > revert_e.length/4)? '' : revert_e;89 e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children('input').keypress(function(e){90 var key = e.charCode ? e.charCode : e.keyCode ? e.keyCode : 0;91 // on enter, just save the new slug, don't save the post92 if (13 == key) {b.children('.save').click();return false;}93 if (27 == key) {b.children('.cancel').click();return false;}94 real_slug.attr('value', this.value)}).focus();95 }96 97 function make_slugedit_clickable() {98 jQuery('#editable-post-name').click(function() {jQuery('#edit-slug-buttons').children('.edit-slug').click()});99 }100 101 55 addLoadEvent( function() { 102 56 // postboxes 103 add_postbox_toggles( );57 add_postbox_toggles('post'); 104 58 105 59 // If no tags on the page, skip the tag and category stuff. 106 60 if ( !jQuery('#tags-input').size() ) { -
wp-admin/js/link.js
1 1 addLoadEvent( function() { 2 2 // postboxes 3 add_postbox_toggles( );3 add_postbox_toggles('link'); 4 4 5 5 // category tabs 6 6 var categoryTabs = jQuery('#category-tabs').tabs(); … … 43 43 return false; 44 44 } ); 45 45 jQuery('.categorychecklist :checkbox').change( syncChecks ).filter( ':checked' ).change(); 46 }); 47 No newline at end of file 46 }); -
wp-admin/js/postbox.js
1 function add_postbox_toggles( ) {1 function add_postbox_toggles(page) { 2 2 jQuery('.postbox h3').prepend('<a class="togbox">+</a> '); 3 jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state( ); } );3 jQuery('.togbox').click( function() { jQuery(jQuery(this).parent().parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } ); 4 4 } 5 5 6 function save_postboxes_state( ) {6 function save_postboxes_state(page) { 7 7 var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); 8 8 jQuery.post(postboxL10n.requestFile, { 9 9 action: 'closed-postboxes', 10 10 closed: closed, 11 cookie: document.cookie}); 12 } 13 No newline at end of file 11 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), 12 page: page 13 }); 14 } -
wp-admin/edit-page-form.php
57 57 <h3><?php _e('Page') ?></h3> 58 58 <?php the_editor($post->post_content); ?> 59 59 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 60 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 60 61 </div> 61 62 62 63 <div id="submitpost"> … … 136 137 137 138 <h2><?php _e('Advanced Options'); ?></h2> 138 139 139 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom' ); ?>">140 <div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>"> 140 141 <h3><?php _e('Custom Fields') ?></h3> 141 142 <div class="inside"> 142 143 <div id="postcustomstuff"> … … 155 156 </div> 156 157 </div> 157 158 158 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv' ); ?>">159 <div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>"> 159 160 <h3><?php _e('Discussion') ?></h3> 160 161 <div class="inside"> 161 162 <input name="advanced_view" type="hidden" value="1" /> … … 166 167 </div> 167 168 </div> 168 169 169 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv' ); ?>">170 <div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>"> 170 171 <h3><?php _e('Page Password') ?></h3> 171 172 <div class="inside"> 172 173 <input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /> 173 174 </div> 174 175 </div> 175 176 176 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv' ); ?>">177 <div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>"> 177 178 <h3><?php _e('Page Slug') ?></h3> 178 179 <div class="inside"> 179 180 <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /> 180 181 </div> 181 182 </div> 182 183 183 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv' ); ?>">184 <div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>"> 184 185 <h3><?php _e('Page Parent') ?></h3> 185 186 <div class="inside"> 186 187 <select name="parent_id"> … … 191 192 </div> 192 193 193 194 <?php if ( 0 != count( get_page_templates() ) ) { ?> 194 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv' ); ?>">195 <div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>"> 195 196 <h3><?php _e('Page Template') ?></h3> 196 197 <div class="inside"> 197 198 <select name="page_template"> … … 202 203 </div> 203 204 <?php } ?> 204 205 205 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv' ); ?>">206 <div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>"> 206 207 <h3><?php _e('Page Order') ?></h3> 207 208 <div class="inside"> 208 209 <input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /> … … 215 216 $authors[] = $post->post_author; 216 217 if ( $authors && count( $authors ) > 1 ) : 217 218 ?> 218 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv' ); ?>">219 <div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>"> 219 220 <h3><?php _e('Post Author'); ?></h3> 220 221 <div class="inside"> 221 222 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?> -
wp-admin/edit-link-form.php
32 32 33 33 <?php echo $form ?> 34 34 <?php wp_nonce_field($nonce_action); ?> 35 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 35 36 36 37 <div class="wrap"> 37 38 … … 64 65 </p> 65 66 </div> 66 67 67 <div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv' ); ?>">68 <div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>"> 68 69 <h3><?php _e('Categories') ?></h3> 69 70 <div class="inside"> 70 71 … … 100 101 101 102 <h2><?php _e('Advanced Options'); ?></h2> 102 103 103 <div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv' ); ?>">104 <div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>"> 104 105 <h3><?php _e('Target') ?></h3> 105 106 <div class="inside"> 106 107 <label for="link_target_blank" class="selectit"> … … 115 116 </div> 116 117 </div> 117 118 118 <div id="linkvisiblediv" class="postbox <?php echo postbox_classes('linkvisiblediv' ); ?>">119 <div id="linkvisiblediv" class="postbox <?php echo postbox_classes('linkvisiblediv', 'link'); ?>"> 119 120 <h3><?php _e('Visible') ?></h3> 120 121 <div class="inside"> 121 122 <label for="link_visible_yes" class="selectit"> … … 127 128 </div> 128 129 </div> 129 130 130 <div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv' ); ?>">131 <div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>"> 131 132 <h3><?php _e('Link Relationship (XFN)') ?></h3> 132 133 <div class="inside"> 133 134 <table class="editform" width="100%" cellspacing="2" cellpadding="5"> … … 240 241 </div> 241 242 </div> 242 243 243 <div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv' ); ?>">244 <div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>"> 244 245 <h3><?php _e('Advanced') ?></h3> 245 246 <div class="inside"> 246 247 <table class="editform" width="100%" cellspacing="2" cellpadding="5"> -
wp-admin/edit-form-advanced.php
89 89 <h3><?php _e('Post') ?></h3> 90 90 <?php the_editor($post->post_content); ?> 91 91 <?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?> 92 <?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?> 92 93 </div> 93 94 94 95 <?php echo $form_pingback ?> … … 175 176 echo clean_url(stripslashes(wp_get_referer())); 176 177 ?>" /></p> 177 178 178 <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv' ); ?>">179 <div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>"> 179 180 <h3><?php _e('Tags'); ?></h3> 180 181 <div class="inside"> 181 182 <p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p> … … 183 184 </div> 184 185 </div> 185 186 186 <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv' ); ?>">187 <div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>"> 187 188 <h3><?php _e('Categories') ?></h3> 188 189 <div class="inside"> 189 190 … … 232 233 233 234 <h2><?php _e('Advanced Options'); ?></h2> 234 235 235 <div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt' ); ?>">236 <div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>"> 236 237 <h3><?php _e('Optional Excerpt') ?></h3> 237 238 <div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea></div> 238 239 </div> 239 240 240 <div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv' ); ?>">241 <div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>"> 241 242 <h3><?php _e('Trackbacks') ?></h3> 242 243 <div class="inside"> 243 244 <?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?> (<?php _e('Separate multiple URLs with spaces'); ?>) … … 248 249 </div> 249 250 </div> 250 251 251 <div id="postcustom" class="postbox <?php echo postbox_classes('postcustom' ); ?>">252 <div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>"> 252 253 <h3><?php _e('Custom Fields') ?></h3> 253 254 <div class="inside"> 254 255 <div id="postcustomstuff"> … … 269 270 270 271 <?php do_action('dbx_post_advanced'); ?> 271 272 272 <div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv' ); ?>">273 <div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>"> 273 274 <h3><?php _e('Discussion') ?></h3> 274 275 <div class="inside"> 275 276 <input name="advanced_view" type="hidden" value="1" /> … … 280 281 </div> 281 282 </div> 282 283 283 <div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv' ); ?>">284 <div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>"> 284 285 <h3><?php _e('Post Password') ?></h3> 285 286 <div class="inside"> 286 287 <input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /> 287 288 </div> 288 289 </div> 289 290 290 <div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv' ); ?>">291 <div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>"> 291 292 <h3><?php _e('Post Slug') ?></h3> 292 293 <div class="inside"> 293 294 <input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /> … … 295 296 </div> 296 297 297 298 <?php if ( current_user_can('edit_posts') ) : ?> 298 <div id="posttimestampdiv" class="postbox <?php echo postbox_classes('posttimestampdiv' ); ?>">299 <div id="posttimestampdiv" class="postbox <?php echo postbox_classes('posttimestampdiv', 'post'); ?>"> 299 300 <h3><?php _e('Post Timestamp'); ?></h3> 300 301 <div class="inside"><?php touch_time(($action == 'edit')); ?></div> 301 302 </div> … … 307 308 $authors[] = $post->post_author; 308 309 if ( $authors && count( $authors ) > 1 ) : 309 310 ?> 310 <div id="authordiv" class="postbox <?php echo postbox_classes('authordiv' ); ?>">311 <div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>"> 311 312 <h3><?php _e('Post Author'); ?></h3> 312 313 <div class="inside"> 313 314 <?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?> -
wp-admin/page-new.php
4 4 $parent_file = 'post-new.php'; 5 5 $editing = true; 6 6 wp_enqueue_script('autosave'); 7 wp_enqueue_script('p ost');7 wp_enqueue_script('page'); 8 8 wp_enqueue_script('thickbox'); 9 9 wp_enqueue_script('media-upload'); 10 10 -
wp-admin/page.php
52 52 exit(); 53 53 } 54 54 55 wp_enqueue_script('p ost');55 wp_enqueue_script('page'); 56 56 wp_enqueue_script('thickbox'); 57 57 wp_enqueue_script('media-upload'); 58 58