<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[13369] trunk/wp-admin: Remove Resetting, remove Enabling, enable deletion,
etc.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13369">13369</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2010-02-24 09:43:09 +0000 (Wed, 24 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Remove Resetting, remove Enabling, enable deletion, etc. see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (13368 => 13369)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-02-24 08:45:26 UTC (rev 13368)
+++ trunk/wp-admin/includes/nav-menu.php        2010-02-24 09:43:09 UTC (rev 13369)
</span><span class="lines">@@ -216,7 +216,7 @@
</span><span class="cx">
</span><span class="cx">         return $counter;
</span><span class="cx"> }
</span><del>-
</del><ins>+/*
</ins><span class="cx"> function wp_nav_menu_setup($override = false) {
</span><span class="cx">         // Custom Navigation Menu Setup
</span><span class="cx">
</span><span class="lines">@@ -232,5 +232,5 @@
</span><span class="cx">
</span><span class="cx">         wp_create_nav_menu( __('Main') );
</span><span class="cx"> }
</span><del>-
</del><ins>+/**/
</ins><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminnavmenusphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/nav-menus.php (13368 => 13369)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-02-24 08:45:26 UTC (rev 13368)
+++ trunk/wp-admin/nav-menus.php        2010-02-24 09:43:09 UTC (rev 13369)
</span><span class="lines">@@ -70,13 +70,6 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if ( isset( $_POST['set_wp_menu'] ) ) {
-        // @todo validate set_wp_menu
-        update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] );
-        $updated = true;
-        $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('Menu has been updated!') . '</p></div>';
-}
-
</del><span class="cx"> if ( isset( $_POST['licount'] ) )
</span><span class="cx">         $postCounter = $_POST['licount'];
</span><span class="cx"> else
</span><span class="lines">@@ -84,6 +77,7 @@
</span><span class="cx">
</span><span class="cx"> // Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
</span><span class="cx"> if ( isset( $_POST['add_menu'] ) && ! $updated ) {
</span><ins>+        update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] ); // Do we need this?
</ins><span class="cx">         $insert_menu_name = $_POST['add_menu_name'];
</span><span class="cx">
</span><span class="cx">         if ( $insert_menu_name != '' ) {
</span><span class="lines">@@ -94,6 +88,7 @@
</span><span class="cx">                         $custom_menus[$menu->term_id] = $menu;
</span><span class="cx">                         $menu_selected_id = $menu->term_id;
</span><span class="cx">                         $menu_id_in_edit = $menu_selected_id;
</span><ins>+                        $menu_title = $menu->name;
</ins><span class="cx">                         $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'), $menu->name ) ) . '</p></div>';
</span><span class="cx">                         $postCounter = 0;
</span><span class="cx">                 }
</span><span class="lines">@@ -103,19 +98,7 @@
</span><span class="cx">         $updated = true;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if ( isset($_POST['reset_wp_menu']) && ! $updated ) {
-        $success = wp_reset_nav_menu();
-        if ( $success ) {
-                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-                $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been reset.') . '</p></div>';
-                // GET reset menu id
-                $custom_menus = array();
-                $menu_selected_id = 0;
-        } else {
-                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
-                $messagesdiv = '<div id="message" class="error fade below-h2"><p>' . __('The menu could not be reset. Please try again.') . '</p></div>';
-        }
-} elseif ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
</del><ins>+if ( $postCounter > 0 && $menu_selected_id > 0 && ! $updated ) {
</ins><span class="cx">         $menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') );
</span><span class="cx">         $parent_menu_ids = array();
</span><span class="cx">
</span><span class="lines">@@ -174,8 +157,9 @@
</span><span class="cx">         <div class="hide-if-js error"><p><?php _e('You do not have JavaScript enabled in your browser. Please enable it to access the Menus functionality.'); ?></p></div>
</span><span class="cx">         <div class="hide-if-no-js">
</span><span class="cx">         <div id="pages-left">
</span><ins>+        <?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ) { ?>
</ins><span class="cx">                 <ul class="subsubsub">
</span><del>-<?php                if ( ! empty( $custom_menus ) ) {
</del><ins>+<?php
</ins><span class="cx">                                 foreach ( $custom_menus as $menu ) {
</span><span class="cx">                                         $sep = end($custom_menus) == $menu ? '' : ' | ';
</span><span class="cx">                                         // $menu_term = get_term( $menu, 'nav_menu' );
</span><span class="lines">@@ -185,28 +169,19 @@
</span><span class="cx">                         <li><a href='nav-menus.php?edit_menu=<?php echo esc_attr($menu->term_id); ?>'><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
</span><span class="cx"> <?php                                }
</span><span class="cx">                                 }
</span><del>-                        } else { ?>
-                        <li><?php _e( 'Default' ); ?></li>
-<?php                } ?>
</del><ins>+?>
</ins><span class="cx">                 </ul>
</span><span class="cx">                 <div class="clear"></div>
</span><ins>+<?php } ?>
+                <form onsubmit="updatepostdata()" action="nav-menus.php" method="post" enctype="multipart/form-data">
</ins><span class="cx">                 <div class="inside">
</span><del>-                <?php
-                        // CHECK if custom menu has been enabled
-                        $enabled_menu = get_option('wp_custom_nav_menu');
-                        $checked = strtolower($enabled_menu);
-
-                        if ( $checked != 'true' )
-                                echo '<div id="message-enabled" class="error fade below-h2"><p><strong>' . __('Menu editing has not been Enabled yet. Please enable it in order to use it -------->') . '</strong></p></div>';
-                ?>
</del><ins>+                <?php if ( ! empty( $custom_menus ) ) : ?>
</ins><span class="cx">                 <?php echo $messagesdiv; ?>
</span><del>-                <form onsubmit="updatepostdata()" action="nav-menus.php" method="post" enctype="multipart/form-data">
</del><span class="cx">
</span><span class="cx">                 <input type="hidden" name="licount" id="licount" value="0" />
</span><span class="cx">                 <input type="hidden" name="menu_id_in_edit" id="menu_id_in_edit" value="<?php echo esc_attr($menu_selected_id); ?>" />
</span><span class="cx">
</span><span class="cx">                 <div class="sidebar-name">
</span><del>-
</del><span class="cx">                         <div class="sidebar-name-arrow">
</span><span class="cx">                                 <br/>
</span><span class="cx">                         </div>
</span><span class="lines">@@ -235,8 +210,13 @@
</span><span class="cx">                 <script type="text/javascript">
</span><span class="cx">                         updatepostdata();
</span><span class="cx">                 </script>
</span><del>-                <!-- <input id="delete_menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> -->
-                <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /></p>
</del><ins>+                <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" />
+                <input id="delete_menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" />
+                </p>
+
+        <?php else : ?>
+                <div class="updated below-h2"><p><?php _e( 'Add a menu to start editing!' ); ?></p></div>
+        <?php endif; ?>
</ins><span class="cx">                 </div><!-- /.inside -->
</span><span class="cx">         </div>
</span><span class="cx">
</span><span class="lines">@@ -244,34 +224,17 @@
</span><span class="cx">                 <div class="widgets-holder-wrap">
</span><span class="cx">                         <div class="sidebar-name">
</span><span class="cx">                                 <div class="sidebar-name-arrow"></div>
</span><del>-                                <h3><?php esc_html_e('Setup Menus'); ?></h3>
</del><ins>+                                <h3><?php esc_html_e('Add Menu'); ?></h3>
</ins><span class="cx">                         </div>
</span><span class="cx">                         <div class="widget-holder">
</span><span class="cx">
</span><del>-                                <?php
-                                // Setup custom menu
-                                $enabled_menu = get_option('wp_custom_nav_menu');
-                                $checked = strtolower($enabled_menu);
-                                ?>
-
-                                <span >
-                                        <label><?php _e('Enable'); ?></label><input type="radio" name="enable_wp_menu" value="true" <?php if ($checked=='true') { echo 'checked="checked"'; } ?> />
-                                        <label><?php _e('Disable'); ?></label><input type="radio" name="enable_wp_menu" value="false" <?php if ($checked=='true') { } else { echo 'checked="checked"'; } ?> />
-                                </span><!-- /.checkboxes -->
-
-                                <input id="set_wp_menu" type="submit" value="<?php esc_attr_e('Set Menu'); ?>" name="set_wp_menu" class="button" /><br />
-
</del><span class="cx">                                 <span>
</span><del>-                                        <label><?php _e('Reset Menu to Default'); ?></label>
-                                        <input id="reset_wp_menu" type="submit" value="Reset" name="reset_wp_menu" class="button" onclick="return confirm('<?php _e('Are you sure you want to reset the menu to its default settings?'); ?>');" />
-                                </span>
-                                <br /><br />
-                                <span>
</del><span class="cx">                                 <input id="add_menu_name" name="add_menu_name" type="text" value="" />
</span><span class="cx">                                 <input id="add_menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add_menu" class="button" />
</span><span class="cx">                                 </span>
</span><span class="cx">                         </div>
</span><span class="cx">                 </div><!-- /.widgets-holder-wrap -->
</span><ins>+<?php /* ?>
</ins><span class="cx">                 <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?>
</span><span class="cx">                 <div class="widgets-holder-wrap" style="display:none;">
</span><span class="cx">                         <div class="sidebar-name">
</span><span class="lines">@@ -309,7 +272,7 @@
</span><span class="cx">                                 <div class="fix"></div>
</span><span class="cx">                         </div>
</span><span class="cx">                 </div><!-- /.widgets-holder-wrap -->
</span><del>-
</del><ins>+<?php */ ?>
</ins><span class="cx">                 <div class="widgets-holder-wrap">
</span><span class="cx">                         <div class="sidebar-name">
</span><span class="cx">                                 <div class="sidebar-name-arrow"></div>
</span></span></pre>
</div>
</div>
</body>
</html>