Ticket #23119: 23119.16.diff

File 23119.16.diff, 36.8 KB (added by jkudish, 4 months ago)
Line 
1Index: wp-admin/includes/list-table.php
2===================================================================
3--- wp-admin/includes/list-table.php    (revision 23296)
4+++ wp-admin/includes/list-table.php    (working copy)
5@@ -23,6 +23,7 @@
6                'WP_Posts_List_Table' => 'posts',
7                'WP_Media_List_Table' => 'media',
8                'WP_Terms_List_Table' => 'terms',
9+               'WP_Menus_List_Table' => 'menus',
10                'WP_Users_List_Table' => 'users',
11                'WP_Comments_List_Table' => 'comments',
12                'WP_Post_Comments_List_Table' => 'comments',
13Index: wp-admin/includes/misc.php
14===================================================================
15--- wp-admin/includes/misc.php  (revision 23296)
16+++ wp-admin/includes/misc.php  (working copy)
17@@ -346,6 +346,7 @@
18                        case 'upload_per_page':
19                        case 'edit_tags_per_page':
20                        case 'plugins_per_page':
21+                       case 'nav_menus_per_page':
22                        // Network admin
23                        case 'sites_network_per_page':
24                        case 'users_network_per_page':
25Index: wp-admin/includes/class-wp-menus-list-table.php
26===================================================================
27--- wp-admin/includes/class-wp-menus-list-table.php     (revision 0)
28+++ wp-admin/includes/class-wp-menus-list-table.php     (revision 0)
29@@ -0,0 +1,146 @@
30+<?php
31+
32+/**
33+ * Nav Menus List Table class.
34+ *
35+ * @package WordPress
36+ * @subpackage List_Table
37+ * @since 3.6
38+ * @access private
39+ */
40+class WP_Menus_List_Table extends WP_List_Table {
41+
42+       function __construct( $args = array() ) {
43+
44+               parent::__construct( array(
45+                               'plural' => 'menus',
46+                               'singular' => 'menu',
47+                               'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
48+                       ) );
49+
50+       }
51+
52+       function ajax_user_can() {
53+               return current_user_can( 'edit_theme_options' );
54+       }
55+
56+       function prepare_items() {
57+
58+               $args = array();
59+
60+               // order & orderby
61+               $valid_arg_options = array(
62+                       'orderby' => $this->get_sortable_columns(),
63+                       'order' => array( 'asc', 'desc' ),
64+               );
65+               foreach ( $valid_arg_options as $arg_key => $valid_options ) {
66+                       if ( ! empty( $_REQUEST[$arg_key] ) && in_array( $_REQUEST[$arg_key], $valid_options ) )
67+                               $args[$arg_key] = $_REQUEST[$arg_key];
68+               }
69+
70+               // search
71+               if ( ! empty( $_REQUEST['s'] ) )
72+                       $args['search'] = strip_tags( trim( $_REQUEST['s'] ) );
73+
74+               // pagination
75+               $per_page = apply_filters( 'nav_menus_per_page', $this->get_items_per_page( 'nav_menus_per_page' ) );
76+               $page = $this->get_pagenum();
77+
78+               $defaults = array(
79+                       'orderby' => 'name',
80+                       'order' => 'asc',
81+                       'offset' => ( $page - 1 ) * $per_page,
82+                       'number' => $per_page,
83+               );
84+               $args = wp_parse_args( $args, $defaults );
85+               $args = apply_filters( 'nav_menus_table_list_prepare_items_args', $args );
86+
87+               $_args_to_calc_total_items = $args;
88+               unset( $_args_to_calc_total_items['offset'] );
89+               $_args_to_calc_total_items['fields'] = 'count';
90+               $this->total_items = absint( wp_get_nav_menus( $_args_to_calc_total_items ) );
91+
92+               $this->items = wp_get_nav_menus( $args );
93+
94+               $this->set_pagination_args( array(
95+                       'total_items' => $this->total_items,
96+                       'per_page' => $per_page,
97+               ) );
98+
99+       }
100+
101+       function get_bulk_actions() {
102+               $actions = array();
103+               $actions['delete_menus'] = __( 'Delete' );
104+
105+               return apply_filters( 'nav_menus_bulk_actions', $actions );
106+       }
107+
108+       function get_columns() {
109+               $columns = array(
110+                       'cb'          => '<input type="checkbox" />',
111+                       'name'            => __( 'Menu Name' ),
112+                       'count'       => __( '# of links' ),
113+               );
114+
115+               return $columns;
116+       }
117+
118+       function get_sortable_columns() {
119+               $sortable_columns = array(
120+                       'name'  => 'name',
121+                       'count' => 'count',
122+               );
123+
124+               return $sortable_columns;
125+       }
126+
127+
128+       function single_row( $nav_menu, $level = 0 ) {
129+               static $row_class = '';
130+               $row_class = ( $row_class == '' ? ' class="alternate"' : '' );
131+
132+               echo '<tr id="' . esc_attr( 'menu-' . $nav_menu->term_id  ) . '"' . $row_class . '>';
133+               echo $this->single_row_columns( $nav_menu );
134+               echo '</tr>';
135+       }
136+
137+       function column_default( $nav_menu, $column_name ) {
138+               return apply_filters( 'manage_nav_menu_custom_column', '', $column_name, $nav_menu->term_id );
139+       }
140+
141+
142+       function column_cb( $nav_menu ) {
143+               return '<label class="screen-reader-text" for="' . esc_attr( 'cb-select-' . $nav_menu->term_id . '">' . sprintf( __( 'Select %s' ), $nav_menu->name ) ) . '"></label>' . '<input type="checkbox" name="delete_menus[]" value="' . esc_attr( $nav_menu->term_id ) . '" id="' . esc_attr( 'cb-select-' . $nav_menu->term_id ) . '" />';
144+
145+               return '&nbsp;';
146+       }
147+
148+       function column_name( $nav_menu ) {
149+
150+               $edit_link = esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => absint( $nav_menu->term_id ) ), admin_url( 'nav-menus.php' ) ) );
151+               $delete_link = wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => absint( $nav_menu->term_id ) ), admin_url( 'nav-menus.php' ) ), 'delete-nav_menu-' . $nav_menu->term_id );
152+
153+               $out = '<strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $nav_menu->name ) ) . '">' . $nav_menu->name . '</a></strong><br />';
154+
155+               $actions = array();
156+               $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
157+               $actions['delete'] = "<a class='delete-menu' href='" . $delete_link . "'>" . __( 'Delete' ) . "</a>";
158+
159+
160+               $actions = apply_filters( 'nav_menu_row_actions', $actions, $nav_menu );
161+
162+               $out .= $this->row_actions( $actions );
163+
164+               return $out;
165+       }
166+
167+       function column_count( $nav_menu ) {
168+               return $nav_menu->count;
169+       }
170+
171+       function should_display_search() {
172+               return apply_filters( 'nav_menu_table_list_should_display_search', ( $this->total_items > 20 ) );
173+       }
174+
175+}
176\ No newline at end of file
177Index: wp-admin/includes/nav-menu.php
178===================================================================
179--- wp-admin/includes/nav-menu.php      (revision 23296)
180+++ wp-admin/includes/nav-menu.php      (working copy)
181@@ -81,11 +81,15 @@
182 
183                $title = empty( $item->label ) ? $title : $item->label;
184 
185+               $submenu_text = '';
186+               if (0 == $depth)
187+                       $submenu_text = 'style="display: none;"';
188+
189                ?>
190                <li id="menu-item-<?php echo $item_id; ?>" class="<?php echo implode(' ', $classes ); ?>">
191                        <dl class="menu-item-bar">
192                                <dt class="menu-item-handle">
193-                                       <span class="item-title"><?php echo esc_html( $title ); ?></span>
194+                                       <span class="item-title"><?php echo esc_html( $title ); ?> <span class="is-submenu" <?php echo $submenu_text; ?>><?php _e( 'sub item' ); ?></span></span>
195                                        <span class="item-controls">
196                                                <span class="item-type"><?php echo esc_html( $item->type_label ); ?></span>
197                                                <span class="item-order hide-if-js">
198@@ -382,14 +386,22 @@
199  **/
200 function wp_nav_menu_setup() {
201        // Register meta boxes
202-       if ( wp_get_nav_menus() )
203-               add_meta_box( 'nav-menu-theme-locations', __( 'Theme Locations' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
204-       add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
205-       wp_nav_menu_post_type_meta_boxes();
206-       wp_nav_menu_taxonomy_meta_boxes();
207+       if ( wp_get_nav_menus() && ! isset( $_POST['menu-name'] ) && ! isset( $_GET['action'] ) || isset( $_GET['_wpnonce'] ) )
208+               add_meta_box( 'nav-menu-theme-locations', __( 'Menus within your theme' ), 'wp_nav_menu_locations_meta_box' , 'nav-menus', 'side', 'default' );
209 
210+       $nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
211+
212+       if ( empty( $nav_menus ) || isset( $_POST['menu-name'] ) || isset( $_GET['action'] ) && ! isset( $_GET['_wpnonce'] ) ) {
213+               wp_nav_menu_post_type_meta_boxes();
214+               add_meta_box( 'add-common-links', __('Common Links'), 'wp_nav_menu_item_common_link_meta_box', 'nav-menus', 'side', 'core' );
215+               add_meta_box( 'add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
216+               wp_nav_menu_taxonomy_meta_boxes();
217+       }
218+
219        // Register advanced menu items (columns)
220-       add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
221+       if ( empty( $nav_menus ) || isset( $_POST['menu-name'] ) || isset( $_GET['action'] ) && ! isset( $_GET['_wpnonce'] ) ) {
222+               add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
223+       }
224 
225        // If first time editing, disable advanced items by default.
226        if( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
227@@ -411,7 +423,7 @@
228        if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
229                return;
230 
231-       $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-custom-links', 'add-page', 'add-category' );
232+       $initial_meta_boxes = array( 'nav-menu-theme-locations', 'add-page', 'add-common-links', 'add-custom-links', 'add-category' );
233        $hidden_meta_boxes = array();
234 
235        foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
236@@ -445,7 +457,7 @@
237                $post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
238                if ( $post_type ) {
239                        $id = $post_type->name;
240-                       add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'default', $post_type );
241+                       add_meta_box( "add-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', 'high', $post_type );
242                }
243        }
244 }
245@@ -489,7 +501,7 @@
246        $menu_locations = get_nav_menu_locations();
247        $num_locations = count( array_keys($locations) );
248 
249-       echo '<p class="howto">' . sprintf( _n('Your theme supports %s menu. Select which menu you would like to use.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n($num_locations) ) . '</p>';
250+       echo '<p class="howto">' . _n('Select a menu to use within your theme.', 'Select the menus you will use in your theme.', $num_locations ) . '</p>';
251 
252        foreach ( $locations as $location => $description ) {
253                ?>
254@@ -512,13 +524,61 @@
255        }
256        ?>
257        <p class="button-controls">
258-               <?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false, disabled( $nav_menu_selected_id, 0, false ) ); ?>
259+               <?php submit_button( __( 'Save' ), 'primary right', 'nav-menu-locations', false ); ?>
260                <span class="spinner"></span>
261        </p>
262        <?php
263 }
264 
265 /**
266+ * Displays a metabox for the common links menu item.
267+ *
268+ * @since 3.0.0
269+ */
270+function wp_nav_menu_item_common_link_meta_box() {
271+       global $blog_id, $_nav_menu_placeholder, $nav_menu_selected_id;
272+       $_nav_menu_placeholder = 0 > $_nav_menu_placeholder ? $_nav_menu_placeholder - 1 : -1;
273+
274+       $removed_args = array(
275+               'action',
276+               'customlink-tab',
277+               'edit-menu-item',
278+               'menu-item',
279+               'page-tab',
280+               '_wpnonce',
281+       );
282+
283+       $common_links = array(
284+               array(
285+                       'url' => get_site_url(),
286+                       'text' => __('Home')
287+               ),
288+               array(
289+                       'url' => get_site_url($blog_id, '/wp-login.php'),
290+                       'text' => __('Log in')
291+               )
292+       );
293+       ?>
294+       <div class="commonlinkdiv" id="commonlinkdiv">
295+
296+               <div class="common-links">
297+                       <?php foreach ( $common_links as $link ) { ?>
298+                       <label class="menu-item-title"><input type="checkbox" class="menu-item-checkbox" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-object-id]" value="<?php echo $link['url']; ?>" title="<?php echo $link['text']; ?>"> <?php echo $link['text']; ?></label>
299+                       <?php } ?>
300+               </div>
301+
302+               <p class="button-controls">
303+                       <span class="add-to-menu">
304+                               <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-common-menu-item" id="submit-commonlinkdiv" />
305+                               <span class="spinner"></span>
306+                       </span>
307+               </p>
308+
309+       </div><!-- /.commonlinkdiv -->
310+       <?php
311+}
312+
313+/**
314  * Displays a metabox for the custom links menu item.
315  *
316  * @since 3.0.0
317@@ -554,7 +614,7 @@
318 
319                        <p id="menu-item-name-wrap">
320                                <label class="howto" for="custom-menu-item-name">
321-                                       <span><?php _e('Label'); ?></span>
322+                                       <span><?php _e('Link Text'); ?></span>
323                                        <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Menu Item'); ?>" />
324                                </label>
325                        </p>
326@@ -1086,7 +1146,7 @@
327                $menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') );
328                $result = '<div id="menu-instructions" class="post-body-plain';
329                $result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
330-               $result .= '<p>' . __('Select menu items (pages, categories, links) from the boxes at left to begin building your custom menu.') . '</p>';
331+               $result .= '<p>' . __('Next, add menu items (i.e. pages, links, categories) from the column on the left.') . '</p>';
332                $result .= '</div>';
333 
334                if( empty($menu_items) )
335@@ -1158,5 +1218,32 @@
336        foreach( (array) $menu_items_to_delete as $menu_item_id )
337                wp_delete_post( $menu_item_id, true );
338 }
339+add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
340 
341-add_action('admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items');
342+/**
343+ * Delete nav menus from the nav menu management screen
344+ *
345+ * @access private
346+ * @since 3.6
347+ */
348+function _wp_delete_nav_menu( $nav_menu_id ) {
349+
350+       if ( ! is_nav_menu( $nav_menu_id ) )
351+               return;
352+
353+       $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_id );
354+       $delete_nav_menu = wp_delete_nav_menu( $nav_menu_id );
355+
356+       if ( is_wp_error( $delete_nav_menu ) )
357+               return $delete_nav_menu;
358+
359+       // Remove this menu from any locations.
360+       $locations = get_theme_mod( 'nav_menu_locations' );
361+       foreach ( (array) $locations as $location => $menu_id ) {
362+               if ( $menu_id == $nav_menu_id )
363+                       $locations[ $location ] = 0;
364+       }
365+       set_theme_mod( 'nav_menu_locations', $locations );
366+
367+       return true;
368+}
369\ No newline at end of file
370Index: wp-admin/js/nav-menu.js
371===================================================================
372--- wp-admin/js/nav-menu.js     (revision 23296)
373+++ wp-admin/js/nav-menu.js     (working copy)
374@@ -46,8 +46,8 @@
375                                this.initSortables();
376 
377                        this.initToggles();
378-
379-                       this.initTabManager();
380+                       
381+                       this.messageFadeIn();
382                },
383 
384                jQueryExtensions : function() {
385@@ -222,6 +222,13 @@
386                                }
387                        });
388                },
389+               
390+               messageFadeIn : function() {
391+                       var messages = $('#message');
392+                       
393+                       // Visual change when users save menus multiple times in a row
394+                       messages.slideDown('slow');
395+               },
396 
397                initToggles : function() {
398                        // init postboxes
399@@ -245,6 +252,9 @@
400                                menuEdge = api.menuList.offset().left,
401                                body = $('body'), maxChildDepth,
402                                menuMaxDepth = initialMenuMaxDepth();
403+                               
404+                       if( 0 != $('#menu-to-edit li').length )
405+                               $('.drag-instructions').show();
406 
407                        // Use the right edge if RTL.
408                        menuEdge += api.isRTL ? api.menuList.width() : 0;
409@@ -307,6 +317,13 @@
410 
411                                        // Return child elements to the list
412                                        children = transport.children().insertAfter(ui.item);
413+                                       
414+                                       // Add "sub menu" description
415+                                       var subMenuTitle = ui.item.find('.item-title .is-submenu');
416+                                       if (0 < currentDepth)
417+                                               subMenuTitle.show();
418+                                       else
419+                                               subMenuTitle.hide();
420 
421                                        // Update depth classes
422                                        if( depthChange != 0 ) {
423@@ -327,9 +344,6 @@
424                                                ui.item[0].style.left = 'auto';
425                                                ui.item[0].style.right = 0;
426                                        }
427-
428-                                       // The width of the tab bar might have changed. Just in case.
429-                                       api.refreshMenuTabs( true );
430                                },
431                                change: function(e, ui) {
432                                        // Make sure the placeholder is inside the menu.
433@@ -433,6 +447,10 @@
434                                        $("#submit-customlinkdiv").click();
435                                }
436                        });
437+                       $('#submit-commonlinkdiv').click(function () {
438+                               api.addCommonLink();
439+                               return false;
440+                       });
441                },
442 
443                /**
444@@ -461,6 +479,8 @@
445                                if( '' == $t.val() )
446                                        $t.addClass( name ).val( $t.data(name) );
447                        });
448+                       
449+                       $('.blank-slate .input-with-default-title').focus();
450                },
451 
452                attachThemeLocationsListeners : function() {
453@@ -474,6 +494,7 @@
454                                loc.find('.spinner').show();
455                                $.post( ajaxurl, params, function(r) {
456                                        loc.find('.spinner').hide();
457+                                       $('.menu-location-success').slideDown('slow');
458                                });
459                                return false;
460                        });
461@@ -521,7 +542,23 @@
462                                api.processQuickSearchQueryResponse(menuMarkup, params, panel);
463                        });
464                },
465+               
466+               addCommonLink : function() {
467+                       
468+                       $('#commonlinkdiv input[type="checkbox"]:checked').each(function( index ) {
469+                               var url = $(this).val(),
470+                                       linkText = $(this).prop('title'),
471+                                       processMethod = api.addMenuItemToTop;
472 
473+                               // Show the ajax spinner
474+                               $('.commonlinkdiv .spinner').show();
475+                               api.addLinkToMenu( url, linkText, processMethod, function() {
476+                                       // Remove the ajax spinner
477+                                       $('.commonlinkdiv .spinner').hide();
478+                               });
479+                       });
480+               },
481+
482                addCustomLink : function( processMethod ) {
483                        var url = $('#custom-menu-item-url').val(),
484                                label = $('#custom-menu-item-name').val();
485@@ -572,6 +609,9 @@
486                        $.post( ajaxurl, params, function(menuMarkup) {
487                                var ins = $('#menu-instructions');
488                                processMethod(menuMarkup, params);
489+                               // Make it stand out a bit more visually, by adding a fadeIn
490+                               $('li.pending').hide().fadeIn('slow');
491+                               $('.drag-instructions').show();
492                                if( ! ins.hasClass('menu-instructions-inactive') && ins.siblings().length )
493                                        ins.addClass('menu-instructions-inactive');
494                                callback();
495@@ -604,7 +644,7 @@
496                                };
497                        } else {
498                                // Make the post boxes read-only, as they can't be used yet
499-                               $('#menu-settings-column').find('input,select').prop('disabled', true).end().find('a').attr('href', '#').unbind('click');
500+                               $('#menu-settings-column').find('input,select').end().find('a').attr('href', '#').unbind('click');
501                        }
502                },
503 
504@@ -688,139 +728,6 @@
505                        });
506                },
507 
508-               initTabManager : function() {
509-                       var fixed = $('.nav-tabs-wrapper'),
510-                               fluid = fixed.children('.nav-tabs'),
511-                               active = fluid.children('.nav-tab-active'),
512-                               tabs = fluid.children('.nav-tab'),
513-                               tabsWidth = 0,
514-                               fixedRight, fixedLeft,
515-                               arrowLeft, arrowRight, resizeTimer, css = {},
516-                               marginFluid = api.isRTL ? 'margin-right' : 'margin-left',
517-                               marginFixed = api.isRTL ? 'margin-left' : 'margin-right',
518-                               msPerPx = 2;
519-
520-                       /**
521-                        * Refreshes the menu tabs.
522-                        * Will show and hide arrows where necessary.
523-                        * Scrolls to the active tab by default.
524-                        *
525-                        * @param savePosition {boolean} Optional. Prevents scrolling so
526-                        *                that the current position is maintained. Default false.
527-                        **/
528-                       api.refreshMenuTabs = function( savePosition ) {
529-                               var fixedWidth = fixed.width(),
530-                                       margin = 0, css = {};
531-                               fixedLeft = fixed.offset().left;
532-                               fixedRight = fixedLeft + fixedWidth;
533-
534-                               if( !savePosition )
535-                                       active.makeTabVisible();
536-
537-                               // Prevent space from building up next to the last tab if there's more to show
538-                               if( tabs.last().isTabVisible() ) {
539-                                       margin = fixed.width() - tabsWidth;
540-                                       margin = margin > 0 ? 0 : margin;
541-                                       css[marginFluid] = margin + 'px';
542-                                       fluid.animate( css, 100, "linear" );
543-                               }
544-
545-                               // Show the arrows only when necessary
546-                               if( fixedWidth > tabsWidth )
547-                                       arrowLeft.add( arrowRight ).hide();
548-                               else
549-                                       arrowLeft.add( arrowRight ).show();
550-                       }
551-
552-                       $.fn.extend({
553-                               makeTabVisible : function() {
554-                                       var t = this.eq(0), left, right, css = {}, shift = 0;
555-
556-                                       if( ! t.length ) return this;
557-
558-                                       left = t.offset().left;
559-                                       right = left + t.outerWidth();
560-
561-                                       if( right > fixedRight )
562-                                               shift = fixedRight - right;
563-                                       else if ( left < fixedLeft )
564-                                               shift = fixedLeft - left;
565-
566-                                       if( ! shift ) return this;
567-
568-                                       css[marginFluid] = "+=" + api.negateIfRTL * shift + 'px';
569-                                       fluid.animate( css, Math.abs( shift ) * msPerPx, "linear" );
570-                                       return this;
571-                               },
572-                               isTabVisible : function() {
573-                                       var t = this.eq(0),
574-                                               left = t.offset().left,
575-                                               right = left + t.outerWidth();
576-                                       return ( right <= fixedRight && left >= fixedLeft ) ? true : false;
577-                               }
578-                       });
579-
580-                       // Find the width of all tabs
581-                       tabs.each(function(){
582-                               tabsWidth += $(this).outerWidth(true);
583-                       });
584-
585-                       // Set up fixed margin for overflow, unset padding
586-                       css['padding'] = 0;
587-                       css[marginFixed] = (-1 * tabsWidth) + 'px';
588-                       fluid.css( css );
589-
590-                       // Build tab navigation
591-                       arrowLeft = $('<div class="nav-tabs-arrow nav-tabs-arrow-left"><a>&laquo;</a></div>');
592-                       arrowRight = $('<div class="nav-tabs-arrow nav-tabs-arrow-right"><a>&raquo;</a></div>');
593-                       // Attach to the document
594-                       fixed.wrap('<div class="nav-tabs-nav"/>').parent().prepend( arrowLeft ).append( arrowRight );
595-
596-                       // Set the menu tabs
597-                       api.refreshMenuTabs();
598-                       // Make sure the tabs reset on resize
599-                       $(window).resize(function() {
600-                               if( resizeTimer ) clearTimeout(resizeTimer);
601-                               resizeTimer = setTimeout( api.refreshMenuTabs, 200);
602-                       });
603-
604-                       // Build arrow functions
605-                       $.each([{
606-                                       arrow : arrowLeft,
607-                                       next : "next",
608-                                       last : "first",
609-                                       operator : "+="
610-                               },{
611-                                       arrow : arrowRight,
612-                                       next : "prev",
613-                                       last : "last",
614-                                       operator : "-="
615-                               }], function(){
616-                               var that = this;
617-                               this.arrow.mousedown(function(){
618-                                       var marginFluidVal = Math.abs( parseInt( fluid.css(marginFluid) ) ),
619-                                               shift = marginFluidVal,
620-                                               css = {};
621-
622-                                       if( "-=" == that.operator )
623-                                               shift = Math.abs( tabsWidth - fixed.width() ) - marginFluidVal;
624-
625-                                       if( ! shift ) return;
626-
627-                                       css[marginFluid] = that.operator + shift + 'px';
628-                                       fluid.animate( css, shift * msPerPx, "linear" );
629-                               }).mouseup(function(){
630-                                       var tab, next;
631-                                       fluid.stop(true);
632-                                       tab = tabs[that.last]();
633-                                       while( (next = tab[that.next]()) && next.length && ! next.isTabVisible() ) {
634-                                               tab = next;
635-                                       }
636-                                       tab.makeTabVisible();
637-                               });
638-                       });
639-               },
640-
641                eventOnClickEditLink : function(clickedEl) {
642                        var settings, item,
643                        matchedSection = /#(.*)$/.exec(clickedEl.href);
644@@ -945,8 +852,10 @@
645                                        var ins = $('#menu-instructions');
646                                        el.remove();
647                                        children.shiftDepthClass(-1).updateParentMenuItemDBId();
648-                                       if( ! ins.siblings().length )
649+                                       if( 0 == $('#menu-to-edit li').length ) {
650+                                               $('.drag-instructions').hide();
651                                                ins.removeClass('menu-instructions-inactive');
652+                                       }
653                                });
654                },
655 
656Index: wp-admin/nav-menus.php
657===================================================================
658--- wp-admin/nav-menus.php      (revision 23296)
659+++ wp-admin/nav-menus.php      (working copy)
660@@ -221,43 +221,40 @@
661                if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
662                        $messages[] = '<div id="message" class="updated"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
663                break;
664+
665        case 'delete':
666                check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
667-
668                if ( is_nav_menu( $nav_menu_selected_id ) ) {
669-                       $deleted_nav_menu = wp_get_nav_menu_object( $nav_menu_selected_id );
670-                       $delete_nav_menu = wp_delete_nav_menu( $nav_menu_selected_id );
671-
672-                       if ( is_wp_error($delete_nav_menu) ) {
673-                               $messages[] = '<div id="message" class="error"><p>' . $delete_nav_menu->get_error_message() . '</p></div>';
674-                       } else {
675-                               // Remove this menu from any locations.
676-                               $locations = get_theme_mod( 'nav_menu_locations' );
677-                               foreach ( (array) $locations as $location => $menu_id ) {
678-                                       if ( $menu_id == $nav_menu_selected_id )
679-                                               $locations[ $location ] = 0;
680-                               }
681-                               set_theme_mod( 'nav_menu_locations', $locations );
682-                               $messages[] = '<div id="message" class="updated"><p>' . __('The menu has been successfully deleted.') . '</p></div>';
683-                               // Select the next available menu
684-                               $nav_menu_selected_id = 0;
685-                               $_nav_menus = wp_get_nav_menus( array('orderby' => 'name') );
686-                               foreach( $_nav_menus as $index => $_nav_menu ) {
687-                                       if ( strcmp( $_nav_menu->name, $deleted_nav_menu->name ) >= 0
688-                                        || $index == count( $_nav_menus ) - 1 ) {
689-                                               $nav_menu_selected_id = $_nav_menu->term_id;
690-                                               break;
691-                                       }
692-                               }
693-                       }
694-                       unset( $delete_nav_menu, $deleted_nav_menu, $_nav_menus );
695+                       $deletion = _wp_delete_nav_menu( $nav_menu_selected_id );
696                } else {
697                        // Reset the selected menu
698                        $nav_menu_selected_id = 0;
699                        unset( $_REQUEST['menu'] );
700                }
701+
702+               if ( is_wp_error( $deletion ) )
703+                       $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
704+               else
705+                       $messages[] = '<div id="message" class="updated"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
706                break;
707 
708+       case 'delete_menus':
709+               check_admin_referer( 'nav_menus_bulk_actions' );
710+               foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
711+                       if ( ! is_nav_menu( $menu_id_to_delete ) )
712+                               continue;
713+
714+                       $deletion = _wp_delete_nav_menu( $menu_id_to_delete );
715+                       if ( is_wp_error( $deletion ) ) {
716+                               $messages[] = '<div id="message" class="error"><p>' . $deletion->get_error_message() . '</p></div>';
717+                               $deletion_error = true;
718+                       }
719+               }
720+
721+               if ( empty( $deletion_error ) )
722+                       $messages[] = '<div id="message" class="updated"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
723+               break;
724+
725        case 'update':
726                check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
727 
728@@ -367,7 +364,7 @@
729 
730                                do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
731 
732-                               $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('The <strong>%s</strong> menu has been updated.'), $nav_menu_selected_title ) . '</p></div>';
733+                               $messages[] = '<div id="message" class="updated"><p>' . sprintf( __('<strong>%s</strong> has been updated. Use this menu to <a href="%s">replace your sites main navigation</a>, or <a href="%s">within a widget</a>.'), $nav_menu_selected_title, admin_url( 'nav-menus.php' ), admin_url( 'widgets.php' ) ) . '</p></div>';
734                                unset( $menu_items, $unsorted_menu_items );
735                        }
736                }
737@@ -434,6 +431,8 @@
738 if ( ! current_theme_supports( 'menus' ) && ! wp_get_nav_menus() )
739        $messages[] = '<div id="message" class="updated"><p>' . __('The current theme does not natively support menus, but you can use the &#8220;Custom Menu&#8221; widget to add any menus you create here to the theme&#8217;s sidebar.') . '</p></div>';
740 
741+add_screen_option( 'per_page', array('label' => _x( 'Menus', 'nav menus per page (screen options)' )) );
742+
743 get_current_screen()->add_help_tab( array(
744 'id'           => 'overview',
745 'title'                => __('Overview'),
746@@ -455,20 +454,31 @@
747        '<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
748 );
749 
750+// prep the table view
751+$wp_list_table = _get_list_table( 'WP_Menus_List_Table' );
752+$pagenum = $wp_list_table->get_pagenum();
753+$wp_list_table->prepare_items();
754+
755 // Get the admin header
756 require_once( './admin-header.php' );
757 ?>
758 <div class="wrap">
759        <?php screen_icon(); ?>
760-       <h2><?php esc_html_e('Menus'); ?></h2>
761+       <h2 class="nav-tab-wrapper">
762+               <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_POST['menu-name'] ) && ! isset( $_GET['action'] ) || isset( $_GET['_wpnonce'] ) ) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manage Menus'); ?></a>
763+               <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e('Add Menu'); ?></a>
764+       </h2>
765        <?php
766        foreach( $messages as $message ) :
767                echo $message . "\n";
768        endforeach;
769        ?>
770+       <div class="updated menu-location-success" style="display: none;"><p><?php echo sprintf( __('The menus within your theme have been updated. <a href="%s">Visit your site</a> to preview these changes.'), get_site_url() ); ?></p></div>
771        <div id="nav-menus-frame">
772-       <div id="menu-settings-column" class="metabox-holder<?php if ( !$nav_menu_selected_id ) { echo ' metabox-holder-disabled'; } ?>">
773+       <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] || empty( $nav_menus ) ) { echo ' metabox-holder-disabled'; } ?>">
774 
775+               <div class="clear"></div>
776+
777                <form id="nav-menu-meta" action="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-menu-meta" method="post" enctype="multipart/form-data">
778                        <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
779                        <input type="hidden" name="action" value="add-menu-item" />
780@@ -479,59 +489,31 @@
781        </div><!-- /#menu-settings-column -->
782        <div id="menu-management-liquid">
783                <div id="menu-management">
784-                       <div id="select-nav-menu-container" class="hide-if-js">
785-                               <form id="select-nav-menu" action="">
786-                                       <strong><label for="select-nav-menu"><?php esc_html_e( 'Select Menu:' ); ?></label></strong>
787-                                       <select class="select-nav-menu" name="menu">
788-                                               <?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
789-                                                       <option value="<?php echo esc_attr($_nav_menu->term_id) ?>" <?php selected($nav_menu_selected_id, $_nav_menu->term_id); ?>>
790-                                                               <?php echo esc_html( $_nav_menu->truncated_name ); ?>
791-                                                       </option>
792-                                               <?php endforeach; ?>
793-                                               <option value="0"><?php esc_html_e('Add New Menu'); ?></option>
794-                                       </select>
795-                                       <input type="hidden" name="action" value="edit" />
796-                                       <?php submit_button( __( 'Select' ), 'secondary', 'select_menu', false ); ?>
797+                       <?php if ( ! isset( $_POST['menu-name'] ) && ! empty( $nav_menus ) && ! isset( $_GET['action'] ) || ( isset( $_GET['_wpnonce'] ) && 0 != count( $nav_menus ) ) ) : ?>
798+
799+                               <form id="menu-list-form" action="" method="post">
800+
801+                                       <?php
802+                                       if ( $wp_list_table->should_display_search() )
803+                                               $wp_list_table->search_box( __( 'Search Menus' ), 'menus' );
804+                                       ?>
805+
806+                                       <?php $wp_list_table->display(); ?>
807+
808+                                       <input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" />
809+                                       <input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" />
810+                                       <input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" />
811+                                       <?php wp_nonce_field( 'nav_menus_bulk_actions' ); ?>
812+
813                                </form>
814-                       </div>
815-                       <div class="nav-tabs-wrapper">
816-                       <div class="nav-tabs">
817-                               <?php
818-                               foreach( (array) $nav_menus as $_nav_menu ) :
819-                                       if ( $nav_menu_selected_id == $_nav_menu->term_id ) : ?><span class="nav-tab nav-tab-active">
820-                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
821-                                               </span><?php else : ?><a href="<?php
822-                                                       echo esc_url(add_query_arg(
823-                                                               array(
824-                                                                       'action' => 'edit',
825-                                                                       'menu' => $_nav_menu->term_id,
826-                                                               ),
827-                                                               admin_url( 'nav-menus.php' )
828-                                                       ));
829-                                               ?>" class="nav-tab hide-if-no-js">
830-                                                       <?php echo esc_html( $_nav_menu->truncated_name ); ?>
831-                                               </a><?php endif;
832-                               endforeach;
833-                               if ( 0 == $nav_menu_selected_id ) : ?><span class="nav-tab menu-add-new nav-tab-active">
834-                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
835-                               </span><?php else : ?><a href="<?php
836-                                       echo esc_url(add_query_arg(
837-                                               array(
838-                                                       'action' => 'edit',
839-                                                       'menu' => 0,
840-                                               ),
841-                                               admin_url( 'nav-menus.php' )
842-                                       ));
843-                               ?>" class="nav-tab menu-add-new">
844-                                       <?php printf( '<abbr title="%s">+</abbr>', esc_html__( 'Add menu' ) ); ?>
845-                               </a><?php endif; ?>
846-                       </div>
847-                       </div>
848+
849+
850+                       <?php else : ?>
851                        <div class="menu-edit">
852                                <form id="update-nav-menu" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
853                                        <div id="nav-menu-header">
854                                                <div id="submitpost" class="submitbox">
855-                                                       <div class="major-publishing-actions">
856+                                                       <div class="major-publishing-actions <?php if ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] || empty( $nav_menus ) ) echo 'blank-slate'; ?>">
857                                                                <label class="menu-name-label howto open-label" for="menu-name">
858                                                                        <span><?php _e('Menu Name'); ?></span>
859                                                                        <input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Enter menu name here'); ?>" value="<?php echo esc_attr( $nav_menu_selected_title ); ?>" />
860@@ -551,16 +533,10 @@
861                                                                        <label class="howto"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" value="1" /> <?php printf( __('Automatically add new top-level pages' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label>
862                                                                </div>
863                                                                <?php endif; ?>
864-                                                               <br class="clear" />
865                                                                <div class="publishing-action">
866                                                                        <?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
867                                                                </div><!-- END .publishing-action -->
868 
869-                                                               <?php if ( ! empty( $nav_menu_selected_id ) ) : ?>
870-                                                               <div class="delete-action">
871-                                                                       <a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( admin_url('nav-menus.php?action=delete&amp;menu=' . $nav_menu_selected_id), 'delete-nav_menu-' . $nav_menu_selected_id ) ); ?>"><?php _e('Delete Menu'); ?></a>
872-                                                               </div><!-- END .delete-action -->
873-                                                               <?php endif; ?>
874                                                        </div><!-- END .major-publishing-actions -->
875                                                </div><!-- END #submitpost .submitbox -->
876                                                <?php
877@@ -574,14 +550,20 @@
878                                        <div id="post-body">
879                                                <div id="post-body-content">
880                                                        <?php
881-                                                       if ( isset( $edit_markup ) ) {
882+                                                       $drag_instructions = '';
883+                                                       if ( empty( $ordered_menu_items ) )
884+                                                               $drag_instructions = 'style="display: none;"';
885+                                                       
886+                                                       if ( isset( $edit_markup ) ) {                                                         
887+                                                               echo '<div class="drag-instructions post-body-plain" ' . $drag_instructions . '>';
888+                                                               echo '<p>' . __('Drag each item into the order you prefer. Click an item to reveal additional configuration options.') . '</p>';
889+                                                               echo '</div>';
890+                                                               
891                                                                if ( ! is_wp_error( $edit_markup ) )
892                                                                        echo $edit_markup;
893                                                        } else if ( empty( $nav_menu_selected_id ) ) {
894                                                                echo '<div class="post-body-plain">';
895-                                                               echo '<p>' . __('To create a custom menu, give it a name above and click Create Menu. Then choose items like pages, categories or custom links from the left column to add to this menu.') . '</p>';
896-                                                               echo '<p>' . __('After you have added your items, drag and drop to put them in the order you want. You can also click each item to reveal additional configuration options.') . '</p>';
897-                                                               echo '<p>' . __('When you have finished building your custom menu, make sure you click the Save Menu button.') . '</p>';
898+                                                               echo '<p>' . __('Give your custom menu a name above, then click Create Menu.') . '</p>';
899                                                                echo '</div>';
900                                                        }
901                                                        ?>
902@@ -599,6 +581,7 @@
903                                        </div><!-- /#nav-menu-footer -->
904                                </form><!-- /#update-nav-menu -->
905                        </div><!-- /.menu-edit -->
906+                       <?php endif; ?>
907                </div><!-- /#menu-management -->
908        </div><!-- /#menu-management-liquid -->
909        </div><!-- /#nav-menus-frame -->
910Index: wp-admin/css/wp-admin.css
911===================================================================
912--- wp-admin/css/wp-admin.css   (revision 23296)
913+++ wp-admin/css/wp-admin.css   (working copy)
914@@ -2428,7 +2428,8 @@
915 .fixed .column-categories,
916 .fixed .column-tags,
917 .fixed .column-rel,
918-.fixed .column-role {
919+.fixed .column-role,
920+.fixed .column-count {
921        width: 15%;
922 }
923 
924@@ -6750,8 +6751,17 @@
925 
926 /* nav-menu */
927 
928+.nav-menus-php #message {
929+       display: none;
930+}
931+
932+.nav-menus-php .nav-tab-wrapper {
933+       margin-bottom: 20px;
934+}
935+
936 #nav-menus-frame {
937        margin-left: 300px;
938+       margin-top: 20px;
939 }
940 
941 #wpbody-content #menu-settings-column {
942@@ -6760,7 +6770,7 @@
943        margin-left: -300px;
944        clear: both;
945        float: left;
946-       padding-top: 24px;
947+       padding-top: 0;
948 }
949 
950 .no-js #wpbody-content #menu-settings-column {
951@@ -6785,10 +6795,39 @@
952        position: relative;
953 }
954 
955+.blank-slate br {
956+       display: none;
957+}
958+
959+.blank-slate .menu-name {
960+       height: 2em;
961+}
962+
963+.is-submenu {
964+       color: #999;
965+       font-style: italic;
966+       font-weight: normal;
967+       margin-left: 4px;
968+}
969+
970+.common-links {
971+       background: #fff;
972+       border: 1px solid #dfdfdf;
973+       line-height: 1.4em;
974+       min-height: 42px;
975+       padding: 0.9em;
976+}
977+
978+.common-links label {
979+       display: block;
980+       line-height: 19px;
981+}
982+
983 /* Menu Container */
984 #menu-management-liquid {
985        float: left;
986        min-width: 100%;
987+       margin-top: 3px;
988 }
989 
990 #menu-management {
991@@ -6802,6 +6841,10 @@
992        margin-bottom: 20px;
993 }
994 
995+#menu-management p.search-box {
996+       margin: 5px 0;
997+}
998+
999 .nav-menus-php #post-body {
1000        padding: 10px;
1001        border-width: 1px 0;
1002@@ -6835,55 +6878,6 @@
1003        font-weight:bold;
1004 }
1005 
1006-/* Menu Tabs */
1007-
1008-#menu-management .nav-tabs-nav {
1009-       margin: 0 20px;
1010-}
1011-
1012-#menu-management .nav-tabs-arrow {
1013-       width: 10px;
1014-       padding: 0 5px 4px;
1015-       cursor: pointer;
1016-       position: absolute;
1017-       top: 0;
1018-       line-height: 22px;
1019-       font-size: 18px;
1020-       text-shadow: 0 1px 0 #fff;
1021-}
1022-
1023-#menu-management .nav-tabs-arrow-left {
1024-       left: 0;
1025-}
1026-
1027-#menu-management .nav-tabs-arrow-right {
1028-       right: 0;
1029-       text-align: right;
1030-}
1031-
1032-#menu-management .nav-tabs-wrapper {
1033-       width: 100%;
1034-       height: 28px;
1035-       margin-bottom: -1px;
1036-       overflow: hidden;
1037-}
1038-
1039-#menu-management .nav-tabs {
1040-       padding-left: 20px;
1041-       padding-right: 10px;
1042-}
1043-
1044-.js #menu-management .nav-tabs {
1045-       float: left;
1046-       margin-left: 0px;
1047-       margin-right: -400px;
1048-}
1049-
1050-#menu-management .nav-tab {
1051-       margin-bottom: 0;
1052-       font-size: 14px;
1053-}
1054-
1055 #select-nav-menu-container {
1056        text-align: right;
1057        padding: 0 10px 3px 10px;
1058@@ -7080,7 +7074,7 @@
1059 }
1060 
1061 #menu-to-edit {
1062-       padding: 1em 0;
1063+       padding: 0.1em 0;
1064 }
1065 
1066 .menu ul {
1067@@ -7326,6 +7320,11 @@
1068        margin: 5px 0 1px;
1069 }
1070 
1071+.nav-menus-php .blank-slate .publishing-action {
1072+       float: left;
1073+       margin: 1px 0 0;
1074+}
1075+
1076 .nav-menus-php .major-publishing-actions .delete-action {
1077        vertical-align: middle;
1078        text-align: left;