Load the menu folded (if set), load the editor earlier
git-svn-id: https://develop.svn.wordpress.org/trunk@11118 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
61f7821b34
commit
4a911beaf3
@ -39,7 +39,7 @@ var pagenow = '<?php echo substr($pagenow, 0, -4); ?>';
|
||||
<?php
|
||||
|
||||
if ( in_array( $pagenow, array('post.php', 'post-new.php', 'page.php', 'page-new.php') ) ) {
|
||||
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
|
||||
add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 5 );
|
||||
wp_enqueue_script('quicktags');
|
||||
}
|
||||
|
||||
@ -60,6 +60,9 @@ do_action("admin_head-$hook_suffix");
|
||||
do_action('admin_head');
|
||||
|
||||
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
|
||||
if ( get_user_setting('mfold') ) {
|
||||
$admin_body_class .= ' folded';
|
||||
}
|
||||
|
||||
if ( $is_iphone ) { ?>
|
||||
<style type="text/css">.row-actions{visibility:visible;}</style>
|
||||
@ -71,9 +74,6 @@ if ( $is_iphone ) { ?>
|
||||
(function(){
|
||||
var c = document.body.className;
|
||||
c = c.replace(/no-js/, 'js');
|
||||
<?php if ( get_user_setting('mfold') == 'f' ) { ?>
|
||||
c += ' folded';
|
||||
<?php } ?>
|
||||
document.body.className = c;
|
||||
})();
|
||||
//]]>
|
||||
|
@ -362,3 +362,12 @@ function set_screen_options() {
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
add_action( 'admin_init', 'wp_menu_unfold' );
|
||||
function wp_menu_unfold() {
|
||||
if ( isset($_GET['unfoldmenu']) && $user = get_current_user() ) {
|
||||
delete_user_setting('mfold');
|
||||
wp_redirect( remove_query_arg( 'unfoldmenu', stripslashes($_SERVER['REQUEST_URI']) ) );
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
@ -13,20 +13,21 @@ adminMenu = {
|
||||
$('#adminmenu li.menu-top .wp-menu-image').click( function() { window.location = $(this).siblings('a.menu-top')[0].href; } );
|
||||
this.favorites();
|
||||
|
||||
$('.wp-menu-separator').click(function(){
|
||||
$('a.separator').click(function(){
|
||||
if ( $('body').hasClass('folded') ) {
|
||||
adminMenu.fold(1);
|
||||
setUserSetting( 'mfold', 'o' );
|
||||
deleteUserSetting( 'mfold' );
|
||||
} else {
|
||||
adminMenu.fold();
|
||||
setUserSetting( 'mfold', 'f' );
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
if ( 'f' != getUserSetting( 'mfold' ) ) {
|
||||
this.restoreMenuState();
|
||||
} else {
|
||||
if ( $('body').hasClass('folded') ) {
|
||||
this.fold();
|
||||
} else {
|
||||
this.restoreMenuState();
|
||||
}
|
||||
},
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -61,32 +61,32 @@ function _wp_menu_output( $menu, $submenu, $submenu_as_parent = true ) {
|
||||
$img = '';
|
||||
if ( isset($item[6]) && ! empty($item[6]) ) {
|
||||
if ( 'div' === $item[6] )
|
||||
$img = '<div class="wp-menu-image"><br /></div>';
|
||||
$img = '<br />';
|
||||
else
|
||||
$img = '<img class="wp-menu-image" src="' . $item[6] . '" alt="" />';
|
||||
$img = '<img src="' . $item[6] . '" alt="" />';
|
||||
}
|
||||
$toggle = '<div class="wp-menu-toggle"><br /></div>';
|
||||
|
||||
echo "\n\t<li$class$id>";
|
||||
|
||||
if ( false !== strpos($class, 'wp-menu-separator') ) {
|
||||
echo '<br />';
|
||||
echo '<a class="separator" href="?unfoldmenu=1"><br /></a>';
|
||||
} elseif ( $submenu_as_parent && !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( ( ('index.php' != $submenu[$item[2]][0][2]) && file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") ) || !empty($menu_hook)) {
|
||||
$admin_is_parent = true;
|
||||
echo "$img$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
|
||||
echo "<div class='wp-menu-image'><a href='admin.php?page={$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
|
||||
} else {
|
||||
echo "\n\t$img$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
|
||||
echo "\n\t<div class='wp-menu-image'><a href='{$submenu[$item[2]][0][2]}'>$img</a></div>$toggle<a href='{$submenu[$item[2]][0][2]}'$class$tabindex>{$item[0]}</a>";
|
||||
}
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
|
||||
if ( ('index.php' != $item[2]) && file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) ) {
|
||||
$admin_is_parent = true;
|
||||
echo "\n\t$img$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
|
||||
echo "\n\t<div class='wp-menu-image'><a href='admin.php?page={$item[2]}'>$img</a></div>$toggle<a href='admin.php?page={$item[2]}'$class$tabindex>{$item[0]}</a>";
|
||||
} else {
|
||||
echo "\n\t$img$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
|
||||
echo "\n\t<div class='wp-menu-image'><a href='{$item[2]}'>$img</a></div>$toggle<a href='{$item[2]}'$class$tabindex>{$item[0]}</a>";
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,4 +144,4 @@ _wp_menu_output( $menu, $submenu );
|
||||
do_action( 'adminmenu' );
|
||||
|
||||
?>
|
||||
</ul>
|
||||
</ul>
|
||||
|
@ -1038,7 +1038,12 @@ div.comment-item:hover .row-actions {
|
||||
height: 21px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
#adminmenu a.separator {
|
||||
cursor: w-resize;
|
||||
height: 20px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.folded #adminmenu li.wp-menu-separator {
|
||||
@ -1102,6 +1107,15 @@ div.comment-item:hover .row-actions {
|
||||
border-bottom-width: 1px;
|
||||
border-bottom-style: solid;
|
||||
}
|
||||
|
||||
#adminmenu .wp-menu-image a {
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
#adminmenu .wp-menu-image img {
|
||||
padding: 6px 0 0 1px;
|
||||
}
|
||||
|
||||
/* end side admin menu */
|
||||
|
||||
/* comments/plugins bubble in menu */
|
||||
|
@ -826,7 +826,7 @@ function delete_user_setting( $names ) {
|
||||
$settings = rtrim($settings, '&');
|
||||
|
||||
update_user_option( $current_user->ID, 'user-settings', $settings );
|
||||
setcookie('wp-settings-'.$current_user->ID, $settings, time() + 31536000, SITECOOKIEPATH);
|
||||
setcookie('wp-settings-' . $current_user->ID, $settings, time() + 31536000, SITECOOKIEPATH);
|
||||
}
|
||||
}
|
||||
|
||||
@ -843,16 +843,18 @@ function get_all_user_settings() {
|
||||
if ( ! $user = wp_get_current_user() )
|
||||
return array();
|
||||
|
||||
if ( isset($_COOKIE['wp-settings-'.$user->ID]) ) {
|
||||
$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-'.$user->ID] );
|
||||
$arr = array();
|
||||
if ( isset($_COOKIE['wp-settings-' . $user->ID]) ) {
|
||||
$cookie = preg_replace( '/[^A-Za-z0-9=&_]/', '', $_COOKIE['wp-settings-' . $user->ID] );
|
||||
|
||||
if ( $cookie && strpos($cookie, '=') ) { // the '=' cannot be 1st char
|
||||
if ( $cookie && strpos($cookie, '=') ) // the '=' cannot be 1st char
|
||||
parse_str($cookie, $arr);
|
||||
return $arr;
|
||||
}
|
||||
|
||||
} elseif ( isset($user->wp_usersettings) && is_string($user->wp_usersettings) ) {
|
||||
parse_str( $user->wp_usersettings, $arr );
|
||||
}
|
||||
|
||||
return array();
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
|
||||
$scripts->add( 'utils', "/wp-admin/js/utils$suffix.js", false, '20090102' );
|
||||
|
||||
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090416' );
|
||||
$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), '20090428' );
|
||||
$scripts->add_data( 'common', 'group', 1 );
|
||||
$scripts->localize( 'common', 'commonL10n', array(
|
||||
'warnDelete' => __("You are about to delete the selected items.\n 'Cancel' to stop, 'OK' to delete."),
|
||||
@ -418,7 +418,7 @@ function wp_default_styles( &$styles ) {
|
||||
|
||||
$rtl_styles = array( 'global', 'colors', 'dashboard', 'ie', 'install', 'login', 'media', 'theme-editor', 'upload', 'widgets', 'press-this', 'plugin-install', 'farbtastic' );
|
||||
|
||||
$styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090415' );
|
||||
$styles->add( 'wp-admin', '/wp-admin/wp-admin.css', array(), '20090428' );
|
||||
$styles->add_data( 'wp-admin', 'rtl', '/wp-admin/rtl.css' );
|
||||
|
||||
$styles->add( 'ie', '/wp-admin/css/ie.css', array(), '20090415' );
|
||||
|
Loading…
Reference in New Issue
Block a user