Changeset 8712
- Timestamp:
- 08/22/2008 06:58:42 PM (16 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r8691 r8712 629 629 $closed = isset( $_POST['closed'] )? $_POST['closed'] : ''; 630 630 $closed = explode( ',', $_POST['closed'] ); 631 $hidden = isset( $_POST['hidden'] )? $_POST['hidden'] : ''; 632 $hidden = explode( ',', $_POST['hidden'] ); 631 633 $page = isset( $_POST['page'] )? $_POST['page'] : ''; 632 634 if ( !preg_match( '/^[a-z-]+$/', $page ) ) { 633 635 die(-1); 634 636 } 635 if (!is_array($closed)) break;636 637 $current_user = wp_get_current_user(); 637 update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed); 638 if ( is_array($closed) ) 639 update_usermeta($current_user->ID, 'closedpostboxes_'.$page, $closed); 640 if ( is_array($hidden) ) 641 update_usermeta($current_user->ID, 'meta-box-hidden_'.$page, $hidden); 638 642 break; 639 643 case 'get-permalink': -
trunk/wp-admin/edit-form-advanced.php
r8700 r8712 405 405 </div> 406 406 407 <a href="#edit_settings" class="edit-settings-link hide-if-no-js"><?php _e('Edit Settings') ?></a> 408 409 <div id="edit-settings" class="hide-if-js hide-if-no-js"> 410 <h5><?php _e('Show on screen') ?></h5> 411 <?php meta_box_prefs('post') ?> 412 </div> 413 407 414 <?php 408 415 -
trunk/wp-admin/includes/template.php
r8699 r8712 1255 1255 do_action('do_meta_boxes', $page, $context, $object); 1256 1256 1257 $hidden = get_user_option( "meta-box-hidden_$page" ); 1258 1257 1259 echo "<div id='$context-sortables' class='meta-box-sortables'>\n"; 1258 1260 … … 1271 1273 break; 1272 1274 1273 1274 1275 foreach ( array('high', 'sorted', 'core', 'default', 'low') as $priority ) { 1275 1276 foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { … … 1277 1278 continue; 1278 1279 $i++; 1279 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n"; 1280 $style = ''; 1281 if ( in_array($box['id'], $hidden) ) 1282 $style = 'style="display:none;"'; 1283 echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '" ' . $style . '>' . "\n"; 1280 1284 echo "<h3><span class='hndle'>{$box['title']}</span></h3>\n"; 1281 1285 echo '<div class="inside">' . "\n"; … … 1316 1320 } 1317 1321 1322 function meta_box_prefs($page) { 1323 global $wp_meta_boxes; 1324 1325 if ( empty($wp_meta_boxes[$page]) ) 1326 return; 1327 1328 $hidden = get_user_option( "meta-box-hidden_$page" ); 1329 1330 echo '<ul class="metabox-prefs">'; 1331 foreach ( array_keys($wp_meta_boxes[$page]) as $context ) { 1332 foreach ( array_keys($wp_meta_boxes[$page][$context]) as $priority ) { 1333 foreach ( $wp_meta_boxes[$page][$context][$priority] as $box ) { 1334 if ( false == $box || ! $box['title'] ) 1335 continue; 1336 $box_id = $box['id']; 1337 echo '<label for="' . $box_id . '-hide">'; 1338 echo '<input class="hide-postbox-tog" name="' . $box_id . '-hide" type="checkbox" id="' . $box_id . '-hide" value="' . $box_id . '"' . (! in_array($box_id, $hidden) ? ' checked="checked"' : '') . ' />'; 1339 echo "{$box['title']}</label>"; 1340 } 1341 } 1342 } 1343 echo '</ul>'; 1344 } 1318 1345 ?> -
trunk/wp-admin/js/post.js
r8691 r8712 186 186 }); 187 187 188 // Edit Settings 189 jQuery('.edit-settings-link').click(function () { 190 if (jQuery('#edit-settings').is(":hidden")) { 191 jQuery('#edit-settings').slideDown("normal"); 192 } else { 193 jQuery('#edit-settings').slideUp("normal"); 194 } 195 return false; 196 }); 197 188 198 // Custom Fields 189 199 jQuery('#the-list').wpList( { addAfter: function( xml, s ) { -
trunk/wp-admin/js/postbox.js
r8691 r8712 5 5 $('.postbox h3').before('<a class="togbox">+</a> '); 6 6 $('.postbox a.togbox').click( function() { $($(this).parent().get(0)).toggleClass('closed'); save_postboxes_state(page); } ); 7 8 $('.hide-postbox-tog').click( function() { 9 var box = jQuery(this).val(); 10 var show = jQuery(this).attr('checked'); 11 if ( show ) { 12 jQuery('#' + box).show(); 13 } else { 14 jQuery('#' + box).hide(); 15 } 16 save_postboxes_state(page); 17 } ); 7 18 8 19 if ( $.browser.msie ) { … … 65 76 function save_postboxes_state(page) { 66 77 var closed = jQuery('.postbox').filter('.closed').map(function() { return this.id; }).get().join(','); 78 var hidden = jQuery('.postbox').filter(':hidden').map(function() { return this.id; }).get().join(','); 67 79 jQuery.post(postboxL10n.requestFile, { 68 80 action: 'closed-postboxes', 69 81 closed: closed, 82 hidden: hidden, 70 83 closedpostboxesnonce: jQuery('#closedpostboxesnonce').val(), 71 84 page: page
Note: See TracChangeset
for help on using the changeset viewer.