<!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>[13473] trunk: more menu improvements, props ptahdunbar, see #11817</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.wordpress.org/changeset/13473">13473</a></dd>
<dt>Author</dt> <dd>wpmuguru</dd>
<dt>Date</dt> <dd>2010-02-27 23:06:56 +0000 (Sat, 27 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>more menu improvements, props ptahdunbar, see <a href="http://trac.wordpress.org/ticket/11817">#11817</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminadminajaxphp">trunk/wp-admin/admin-ajax.php</a></li>
<li><a href="#trunkwpadmincssnavmenucss">trunk/wp-admin/css/nav-menu.css</a></li>
<li><a href="#trunkwpadmincssnavmenudevcss">trunk/wp-admin/css/nav-menu.dev.css</a></li>
<li><a href="#trunkwpadminincludesnavmenuphp">trunk/wp-admin/includes/nav-menu.php</a></li>
<li><a href="#trunkwpadminjsnavmenudefaultitemsdevjs">trunk/wp-admin/js/nav-menu-default-items.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenudefaultitemsjs">trunk/wp-admin/js/nav-menu-default-items.js</a></li>
<li><a href="#trunkwpadminjsnavmenudynamicfunctionsdevjs">trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js</a></li>
<li><a href="#trunkwpadminjsnavmenudynamicfunctionsjs">trunk/wp-admin/js/nav-menu-dynamic-functions.js</a></li>
<li><a href="#trunkwpadminnavmenusphp">trunk/wp-admin/nav-menus.php</a></li>
<li><a href="#trunkwpincludesdefaultwidgetsphp">trunk/wp-includes/default-widgets.php</a></li>
<li><a href="#trunkwpincludesnavmenutemplatephp">trunk/wp-includes/nav-menu-template.php</a></li>
<li><a href="#trunkwpincludesnavmenuphp">trunk/wp-includes/nav-menu.php</a></li>
<li><a href="#trunkwpincludesscriptloaderphp">trunk/wp-includes/script-loader.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminadminajaxphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/admin-ajax.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/admin-ajax.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/admin-ajax.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -477,6 +477,26 @@
</span><span class="cx">         _wp_ajax_delete_comment_response( $comment->comment_ID );
</span><span class="cx">         die( '0' );
</span><span class="cx">         break;
</span><ins>+case 'add-menu-link':
+        if ( !current_user_can( 'manage_links' ) )
+                die('-1');
+        
+        $link_url = isset($_POST['link_url']) ? $_POST['link_url'] : false;        
+        $link_name = isset($_POST['link_name']) ? $_POST['link_name'] : false;
+        
+        if ( !$link_url || !$link_name )
+                die('-1');
+        
+        $post = array( 'post_type' => 'nav_menu_item', 'post_title' => $link_name, 'ping_status' => false, 'post_excerpt' => '', 'post_content' => '' );
+        $db_id = wp_insert_post( $post );
+
+        update_post_meta( $db_id, 'menu_type', 'custom' );
+        update_post_meta( $db_id, 'object_id', '' );
+        update_post_meta( $db_id, 'menu_new_window', 0 );
+        update_post_meta( $db_id, 'menu_link', esc_url_raw( $link_url ) );
+        
+        echo $db_id;
+        break;
</ins><span class="cx"> case 'add-link-category' : // On the Fly
</span><span class="cx">         check_ajax_referer( $action );
</span><span class="cx">         if ( !current_user_can( 'manage_categories' ) )
</span></span></pre></div>
<a id="trunkwpadmincssnavmenucss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/nav-menu.css (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.css        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/css/nav-menu.css        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -1 +1 @@
</span><del>-.maintitle{margin:0 0 20px 0!important;}.logo{vertical-align:middle;margin:0 10px 0 0;}h2.heading{margin:32px 0 10px 0;}.checkboxes{float:right;margin:10px 12px 0 0;}#menus-container{clear:both;}#nav-container .inside{padding:0 10px 10px;}#menus-container .submit{padding:0;}#menu-settings-column .inside{padding:10px;}#custom-nav ul{width:100%;}#custom-nav li{margin:0;}.ui-draggable-dragging{width:500px;}#custom-nav li dl dt{-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-top-left-radius:6px;-webkit-border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-topleft:6px;-moz-border-radius-topright:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}#custom-nav li dl dt:hover{cursor:move;}#custom-nav li dl dt .controls{position:absolute;right:15px;top:-1px;}#custom-nav li dl dt img{vertical-align:middle;}#custom-nav li .title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}#custom-nav li ul li{margin-left:20px;opacity:.7;}#custom-nav li ul li ul li{opacity:.9;}#custom-nav li ul li ul li ul li{opacity:.9;}#custom-nav li ul li ul li ul li ul li{opacity:.95;}#add-custom-link .howto{font-size:11px;}#add-custom-link .widefat{width:85%;margin-right:5px;}.list-container{max-height:203px;overflow-y:auto;padding-left:2px;padding-right:5px;}.list{zoom:1;}.list li{margin:0;}.list dt{display:none;margin:0;border-bottom:1px solid #e3e3e3;overflow:hidden;}.list dt{background:url(../images/ico-add.png) no-repeat right;}.list li .title{cursor:pointer;display:block;width:95%;padding:5px 0;}.list li .title{background:url(../images/ico-arrow.png) no-repeat 4px 13px;background-position:center left;padding-left:5%;}.list li ul li .title{margin-left:14px;}.list li ul li ul li .title{margin-left:28px;}.list li ul li ul li ul li .title{margin-left:42px;}.list li ul li ul li ul li ul li .title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:112px;}img.remove,img.edit{cursor:pointer;margin:0 5px 0 0;}.dropzone{height:7px;margin:3px 0 3px 0;}.hide{display:none;}.type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}#menu_select{width:170px;}#dialog-confirm label{padding-left:10px;}.ui-dialog{background:#fff;border:1px solid #555;-moz-box-shadow:0 4px 30px #000;}.ui-dialog-titlebar{color:#CFCFCF;font-family:"Lucida Grande",Verdana,Arial,sans-serif;padding:6px 10px 6px;background-color:#222!important;border:none!important;-moz-border-radius:none!important;}#dialog-confirm{height:168px!important;padding:20px 10px 10px;}#dialog-confirm input{margin:0 0 15px 0;width:280px;}#dialog-confirm select{margin:0 0 15px 0;}.ui-dialog-buttonpane{padding:10px;}.ui-dialog-buttonpane button{margin:0 10px 0 0;background:#F2F2F2;text-shadow:0 1px 0 #FFF;border-color:#BBB;color:#464646;-moz-border-radius-bottomleft:11px;-moz-border-radius-bottomright:11px;-moz-border-radius-topleft:11px;-moz-border-radius-topright:11px;border-style:solid;border-width:1px;cursor:pointer;font-size:11px!important;line-height:14px;padding:2px 8px;text-decoration:none;}.ui-dialog-buttonpane button:hover{color:#000;border-color:#666;}.ui-icon{display:none;}.ui-widget-overlay{position:absolute;top:0;left:0;width:100%;height:100%;}.ui-widget-overlay{background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.60;filter:Alpha(Opacity=60);}.ui-widget-shadow{margin:-8px 0 0 -8px;padding:8px;background:#aaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x;opacity:.60;filter:Alpha(Opacity=60);-moz-border-radius:8px;-webkit-border-radius:8px;}
</del><span class="cx">\ No newline at end of file
</span><ins>+#menu-management{clear:both;}#menu-management .inside{padding:0 10px;}#menu-container .submit{margin:0 0 10px;padding:0;}.submitdelete{color:#f00;text-decoration:underline;font-size:11px;float:left;margin-top:5px;}.submitdelete:hover{background-color:#F00;color:#fff;}.save{float:right;}.button-controls{float:left;}.add-to-menu{float:right;}#create-menu-name{width:159px;}#available-links{margin:15px 0 0;}#available-links dt{display:block;}#add-custom-link .howto{font-size:11px;}#add-custom-link label span{display:block;float:left;margin-top:5px;padding-right:5px;}#menu-item-url,#menu-item-name{float:right;width:220px;}.show-all,.hide-all{cursor:pointer;}.hide-all{display:none;}.quick-search{width:190px;}.list-wrap{display:none;clear:both;}.list-container{max-height:200px;overflow-y:auto;padding:10px 10px 5px;border:1px solid #DFDFDF;-moz-border-radius:4px;}.postbox p.submit{margin-bottom:0;}.list li{margin:0;}.list dt{display:none;margin:0;overflow:hidden;margin-bottom:5px;}.list li .item-title{cursor:pointer;display:block;}.list li .item-title input{margin-right:3px;margin-top:-3px;}.list li ul li .item-title{margin-left:14px;}.list li ul li ul li .item-title{margin-left:28px;}.list li ul li ul li ul li .item-title{margin-left:42px;}.list li ul li ul li ul li ul li .item-title{margin-left:56px;}.list li ul li ul li ul li ul li ul li .item-title{margin-left:70px;}.list li ul li ul li ul li ul li ul li ul li .item-title{margin-left:84px;}.list li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:98px;}.list li ul li ul li ul li ul li ul li ul li ul li ul li .item-title{margin-left:112px;}#menu-container .inside{padding-bottom:10px;}#menu ul{width:100%;}#menu li{margin:0;}#menu li dl dt{-webkit-border-bottom-left-radius:6px;-webkit-border-bottom-right-radius:6px;-webkit-border-top-left-radius:6px;-webkit-border-top-right-radius:6px;border-bottom-left-radius:6px;border-bottom-right-radius:6px;border-top-left-radius:6px;border-top-right-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-bottomright:6px;-moz-border-radius-topleft:6px;-moz-border-radius-topright:6px;border:1px solid #E6E6E6;position:relative;padding-left:10px;background-color:#f1f1f1;height:35px;line-height:35px;}#menu li dl dt:hover{cursor:move;}#menu li .item-title{background:url(../images/ico-arrow.png) no-repeat 4px 5px;background-position:center left;padding-left:15px;}#menu li ul li{margin-left:20px;opacity:.7;}#menu li ul li ul li{opacity:.9;}#menu li ul li ul li ul li{opacity:.9;}#menu li ul li ul li ul li ul li{opacity:.95;}.dropzone{height:7px;margin:3px 0 3px 0;}.ui-draggable-dragging{width:600px;}.item-type{text-transform:uppercase;font-size:11px;color:#999;padding-right:10px;}.item-controls{font-size:11px;position:absolute;right:15px;top:-1px;}.item-controls a{text-decoration:none;}.item-controls a:hover{cursor:pointer;}.item-controls .item-delete:hover{color:#f00;}#menu-item-settings{display:none;}#cancel-save{cursor:pointer;}#cancel-save:hover{color:#fff!important;}#update-menu-item{color:#fff!important;}#update-menu-item:hover,#update-menu-item:active,#update-menu-item:focus{color:#eaf2fa!important;border-color:#13455b!important;}.hide{display:none;}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadmincssnavmenudevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/nav-menu.dev.css (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/nav-menu.dev.css        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/css/nav-menu.dev.css        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -2,80 +2,100 @@
</span><span class="cx"> * WordPress Administration Custom Navigation
</span><span class="cx"> * Interface CSS
</span><span class="cx"> *
</span><del>- * @version 1.1.0
</del><ins>+ * @version 2.0.0
</ins><span class="cx"> *
</span><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Administration
</span><span class="cx"> */
</span><span class="cx">
</span><del>-.maintitle { margin: 0 0 20px 0!important;}
-.logo { vertical-align: middle; margin: 0 10px 0 0; }
-h2.heading { margin: 32px 0 10px 0; }
-.checkboxes { float: right; margin: 10px 12px 0 0; }
</del><ins>+/* Menu Container */
+#menu-management { clear: both; }
+#menu-management .inside { padding: 0 10px; }
</ins><span class="cx">
</span><del>-#menus-container { clear: both; }
-#nav-container .inside { padding: 0px 10px 10px; }
-#menus-container .submit { padding: 0px; }
-#menu-settings-column .inside { padding: 10px; }
</del><ins>+/* Button Primary Actions */
+#menu-container .submit { margin: 0px 0px 10px; padding: 0px; }
+.submitdelete { color: #ff0000; text-decoration: underline; font-size: 11px; float: left; margin-top: 5px; }
+.submitdelete:hover { background-color: #FF0000; color: #fff; }
+.save { float: right; }
</ins><span class="cx">
</span><del>-#custom-nav ul { width: 100%; }
-#custom-nav li { margin: 0; }
-.ui-draggable-dragging { width: 500px; }
-#custom-nav li dl dt { -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; border: 1px solid #E6E6E6;position: relative; padding-left:10px; background-color: #f1f1f1; height: 35px; line-height: 35px; }
-#custom-nav li dl dt:hover { cursor: move; }
-#custom-nav li dl dt .controls { position: absolute; right: 15px; top: -1px; }
-#custom-nav li dl dt img { vertical-align: middle; }
-#custom-nav li dl dt a {}
-#custom-nav li .title { background:url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; }
-#custom-nav li ul li { margin-left: 20px; opacity: .7;}
-#custom-nav li ul li ul li { opacity: .9;}
-#custom-nav li ul li ul li ul li { opacity: .9;}
-#custom-nav li ul li ul li ul li ul li { opacity: .95; }
</del><ins>+/* Button Secondary Actions */
+.button-controls { float: left; }
+.add-to-menu { float: right; }
</ins><span class="cx">
</span><ins>+/* CSS for switching the columns *//*
+#menu-settings-column { clear: none; float: left; }
+#menu-management #post-body { float: right; margin-left: -340px; margin-right: 0px; }
+#menu-management #post-body-content { margin-left: 300px; margin-right: 0px; }
+*/
+
+/* Create Menu */
+#create-menu-name { width: 159px; }
+
+/* Custom Links */
+#available-links { margin: 15px 0px 0px; }
+#available-links dt { display: block; }
</ins><span class="cx"> #add-custom-link .howto { font-size: 11px; }
</span><del>-#add-custom-link .widefat { width: 85%; margin-right: 5px; }
</del><ins>+#add-custom-link label span { display: block; float: left; margin-top: 5px; padding-right: 5px; }
+#menu-item-url, #menu-item-name { float: right; width: 220px; }
</ins><span class="cx">
</span><del>-.list-container { max-height: 203px; overflow-y: auto; padding-left: 2px; padding-right: 5px; }
</del><ins>+/* Pages/Categories */
+.show-all, .hide-all { cursor: pointer; }
+.hide-all { display: none; }
</ins><span class="cx">
</span><del>-.list { zoom: 1; }
</del><ins>+.quick-search { width: 190px; }
+.list-wrap { display: none; clear: both; }
+.list-container { max-height: 200px; overflow-y: auto; padding: 10px 10px 5px; border: 1px solid #DFDFDF; -moz-border-radius: 4px; }
+.postbox p.submit { margin-bottom: 0; }
+
+/* Listings */
</ins><span class="cx"> .list li { margin: 0; }
</span><del>-.list dt { display: none; margin: 0; border-bottom: 1px solid #e3e3e3; overflow: hidden; }
-.list dt { background: url(../images/ico-add.png) no-repeat right; }
</del><ins>+.list dt { display: none; margin: 0; overflow: hidden; margin-bottom: 5px; }
</ins><span class="cx">
</span><del>-.list li .title { cursor: pointer; display: block; width: 95%; padding: 5px 0px; }
-.list li .title { background: url(../images/ico-arrow.png) no-repeat 4px 13px; background-position: center left; padding-left: 5%; }
</del><ins>+.list li .item-title { cursor: pointer; display: block; }
+.list li .item-title input { margin-right: 3px; margin-top: -3px; }
</ins><span class="cx">
</span><del>-/* Visually shows the menu item hierarchy. */
-.list li ul li .title { margin-left: 14px; }
-.list li ul li ul li .title { margin-left: 28px; }
-.list li ul li ul li ul li .title { margin-left: 42px; }
-.list li ul li ul li ul li ul li .title { margin-left: 56px; }
-.list li ul li ul li ul li ul li ul li .title { margin-left: 70px; }
-.list li ul li ul li ul li ul li ul li ul li .title { margin-left: 84px; }
-.list li ul li ul li ul li ul li ul li ul li ul li .title { margin-left: 98px; }
-.list li ul li ul li ul li ul li ul li ul li ul li ul li .title { margin-left: 112px; }
</del><ins>+.list li ul li .item-title { margin-left: 14px; }
+.list li ul li ul li .item-title { margin-left: 28px; }
+.list li ul li ul li ul li .item-title { margin-left: 42px; }
+.list li ul li ul li ul li ul li .item-title { margin-left: 56px; }
+.list li ul li ul li ul li ul li ul li .item-title { margin-left: 70px; }
+.list li ul li ul li ul li ul li ul li ul li .item-title { margin-left: 84px; }
+.list li ul li ul li ul li ul li ul li ul li ul li .item-title { margin-left: 98px; }
+.list li ul li ul li ul li ul li ul li ul li ul li ul li .item-title { margin-left: 112px; }
</ins><span class="cx">
</span><del>-img.remove, img.edit { cursor: pointer; margin: 0 5px 0 0; }
</del><ins>+/* Menu */
+#menu-container .inside { padding-bottom: 10px; }
+
+#menu ul { width: 100%; }
+#menu li { margin: 0; }
+#menu li dl dt { -webkit-border-bottom-left-radius: 6px; -webkit-border-bottom-right-radius: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; border-bottom-left-radius: 6px; border-bottom-right-radius: 6px; border-top-left-radius: 6px; border-top-right-radius: 6px; -moz-border-radius-bottomleft: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; border: 1px solid #E6E6E6;position: relative; padding-left:10px; background-color: #f1f1f1; height: 35px; line-height: 35px; }
+#menu li dl dt:hover { cursor: move; }
+
+#menu li .item-title { background: url(../images/ico-arrow.png) no-repeat 4px 5px; background-position: center left; padding-left: 15px; }
+#menu li ul li { margin-left: 20px; opacity: .7;}
+#menu li ul li ul li { opacity: .9;}
+#menu li ul li ul li ul li { opacity: .9;}
+#menu li ul li ul li ul li ul li { opacity: .95; }
+
+/* Drag and Drop */
</ins><span class="cx"> .dropzone { height: 7px; margin: 3px 0 3px 0; }
</span><del>-#custom-nav li dl { }
-.hide { display: none; }
-.type { text-transform: uppercase; font-size: 11px; color: #999999; padding-right: 10px; }
</del><ins>+.ui-draggable-dragging { width: 600px; }
</ins><span class="cx">
</span><del>-#menu_select { width: 170px; }
-#dialog-confirm label { padding-left: 10px; }
</del><ins>+/* Menu Controls */
+.item-type { text-transform: uppercase; font-size: 11px; color: #999999; padding-right: 10px; }
+.item-controls { font-size: 11px; position: absolute; right: 15px; top: -1px; }
+.item-controls a { text-decoration: none; }
+.item-controls a:hover { cursor: pointer; }
+.item-controls .item-delete:hover { color: #ff0000; }
</ins><span class="cx">
</span><del>-/* EDIT LINK BOX */
-.ui-dialog { background: #fff; border: 1px solid #555555; -moz-box-shadow:0 4px 30px #000000; }
-.ui-dialog-titlebar { color: #CFCFCF; font-family: "Lucida Grande", Verdana, Arial, sans-serif; padding: 6px 10px 6px; background-color: #222222 !important; border: none !important; -moz-border-radius: none !important; }
-#dialog-confirm { height: 168px !important; padding: 20px 10px 10px; }
-#dialog-confirm input { margin: 0 0 15px 0; width: 280px; }
-#dialog-confirm select { margin: 0 0 15px 0; }
-.ui-dialog-buttonpane { padding: 10px; }
-.ui-dialog-buttonpane button { margin: 0 10px 0 0; background: #F2F2F2; text-shadow: 0 1px 0 #FFFFFF; border-color: #BBBBBB; color: #464646; -moz-border-radius-bottomleft: 11px; -moz-border-radius-bottomright: 11px; -moz-border-radius-topleft: 11px; -moz-border-radius-topright: 11px; border-style: solid; border-width: 1px; cursor: pointer; font-size: 11px !important; line-height: 14px; padding: 2px 8px; text-decoration: none; }
-.ui-dialog-buttonpane button:hover { color: #000; border-color: #666; }
-.ui-icon { display: none; }
</del><ins>+/* Thickbox */
+#menu-item-settings { display: none; }
+#cancel-save { cursor: pointer; }
+#cancel-save:hover { color: #fff !important; }
+#update-menu-item { color: #fff !important; }
+#update-menu-item:hover,
+#update-menu-item:active,
+#update-menu-item:focus { color: #eaf2fa !important; border-color: #13455b !important; }
</ins><span class="cx">
</span><del>-/* Overlays */
-.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
-.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60; filter:Alpha(Opacity=60); }
-.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60; filter: Alpha(Opacity=60); -moz-border-radius: 8px; -webkit-border-radius: 8px; }
</del><span class="cx">\ No newline at end of file
</span><ins>+/* Misc */
+.hide { display: none; }
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/nav-menu.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/nav-menu.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/includes/nav-menu.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -175,7 +175,7 @@
</span><span class="cx">
</span><span class="cx">         if ( $sub_array ) {
</span><span class="cx">                 ?>
</span><del>-                <ul id="sub-custom-nav-<?php echo $type ?>">
</del><ins>+                <ul id="sub-menu-<?php echo $type ?>">
</ins><span class="cx">
</span><span class="cx">                 <?php
</span><span class="cx">                 // Display Loop
</span><span class="lines">@@ -221,7 +221,7 @@
</span><span class="cx">         // Custom Navigation Menu Setup
</span><span class="cx">
</span><span class="cx">         // Override for menu descriptions
</span><del>-        update_option('wp_settings_custom_nav_advanced_options', 'yes');
</del><ins>+        update_option('wp_settings_nav_menu_advanced_options', 'yes');
</ins><span class="cx">
</span><span class="cx">         $menus = wp_get_nav_menus();
</span><span class="cx">         if ( !empty( $menus ) ) {
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudefaultitemsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-default-items.dev.js (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-default-items.dev.js        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/js/nav-menu-default-items.dev.js        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -1,146 +1,190 @@
</span><span class="cx"> /**
</span><span class="cx"> * WordPress Administration Custom Navigation
</span><del>- * Interface JQuery functions
</del><ins>+ * Interface $ functions
</ins><span class="cx"> *
</span><del>- * @version 1.1.0
</del><ins>+ * @version 2.0.0
</ins><span class="cx"> *
</span><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Administration
</span><span class="cx"> */
</span><span class="cx">
</span><del>-/*
</del><ins>+/**
</ins><span class="cx"> * Init Functions
</span><del>-*/
-jQuery(function($)
-        {
-                //Makes dialog box
-                $("#dialog-confirm").dialog({
-                        autoOpen: false,
-                        resizable: false,
-                        height: 210,
-                        width: 400,
-                        modal: true,
-                        buttons: {
-                                'Save': function() {
</del><ins>+ */
+jQuery(document).ready(function($){
+        
+        // Handle Save Button Clicks
+        $('#save_menu').click(function(){
+                wp_update_post_data();
+        });
+                
+        // Clear the quick search textbox
+        $('.quick-search').click(function(){
+                $(this).attr( 'value', '' );
+        });
+        
+        // Quick Search submit
+        $('.quick-search-submit').click(function(){
+                $(this).siblings('.quick-search').search();
+        });
+        
+        // Edit menu item
+        $('#menu-container .item-edit').click(function(){
+                wp_edit_menu_item( $(this).attr('value') );
+        });
+        
+        // Delete menu item
+        $('#menu-container .item-delete').live( 'click', function(){
+                wp_remove_menu_item( $(this).attr('value') );
+        });
+        
+        // Update menu item settings (thickbox)
+        $('#update-menu-item').click(function(){
+                wp_update_menu_item();
+                tb_remove();
+                
+                // Give feedback to the user
+                var id = $('#edit-item-id').val();
+                $('#menu-' + id + ' dt:first').animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
+        });
+        
+        // Close thickbox
+        $('#cancel-save').click(function(){
+                tb_remove();
+        });
+        
+        // Show All Button
+        $('.show-all').click(function(){
+                $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 10px;' );
+                $(this).offsetParent().find('.list-wrap').css( 'display','block' );
+                $(this).siblings('.quick-search').attr( 'value', '' );                
+                $(this).offsetParent().find('.list-wrap dt').css( 'display', 'block' );
+                $(this).hide();
+                $(this).siblings('.hide-all').show();
+        });
+        
+        // Hide All Button
+        $('.hide-all').click(function(){
+                $(this).offsetParent().find('#add-buttons-actions').attr( 'style','margin-bottom: 0px;' );
+                $(this).offsetParent().find('.list-wrap').css( 'display','none' );
+                $(this).siblings('.quick-search').attr( 'value', 'Search' );
+                $(this).offsetParent().find('.list-wrap dt').css( 'display', 'none' );
+                $(this).hide();
+                $(this).siblings('.show-all').show();
+        });
+        
+        // Add queued menu items into the menu
+        $('.enqueue a').click(function(){
+                wp_add_queued_items_to_menu(this);
+        });
+        
+        // Create the link, add it to the menu + available links section
+        $('#add-custom-link .add-to-menu a').click(function(){
+                var link_url = $(this).offsetParent().find('#menu-item-url').val();
+                var link_name = $(this).offsetParent().find('#menu-item-name').val();
+                var links = $(this).offsetParent().find('#available-links input:checked');
+                
+                // If links are checked in the available links section, add them to the menu
+                if ( links ) {
+                        for (var i = 0; i < links.length; i++) {
+                                wp_add_item_to_menu( 'Custom', links[i].name, links[i].value, links[i].id.substring( 5, links[i].id.length ), 0, '' );
+                        };
+                        
+                        // Reset the checkboxes;
+                        $(links).attr('checked', false);
+                };
+                                
+                // Don't save the link if it was left with it's default settings
+                if ( 'http://' == link_url || 'Menu Item' == link_name )
+                        return;
+                
+                // Parameters to send off
+                params = {
+                        action: 'add-menu-link',
+                        link_url: link_url,
+                        link_name: link_name,
+                };
+                
+                // save the link
+                $.post( ajaxurl, params, function(response) {
+                        if ( null == response || '-1' == response )
+                                return false;
+                        
+                        params.link_id = response;
+                        
+                        // add it to the available links section
+                        // wp_update_links_list( params );
+                        
+                        // and update the Menu with the new link
+                        wp_add_item_to_menu( 'Custom', params.link_name, params.link_url, params.link_id, 0, '' );
+                }, 'json');
+        });
+        
+        // Add dropzones
+ $('#menu li').prepend('<div class="dropzone"></div>');
</ins><span class="cx">
</span><del>-                                        titletosave = $('#edittitle').attr('value');
-                                        linktosave = $('#editlink').attr('value');
-                                        anchortitletosave = $('#editanchortitle').attr('value');
-                                        newwindowtosave = $('#editnewwindow').attr('value');
-                                        desctosave = $('#editdescription').attr('value');
</del><ins>+        // Make menu items draggable
+        $('#menu li').draggable({
+                 handle: ' > dl',
+                 opacity: .8,
+                 addClasses: false,
+                 helper: 'clone',
+                 zIndex: 100
+        });
</ins><span class="cx">
</span><del>-                                        $('#title' + $(this).dialog('option', 'itemID')).attr('value',titletosave);
-                                        $('#linkurl' + $(this).dialog('option', 'itemID')).attr('value',linktosave);
-                                        $('#anchortitle' + $(this).dialog('option', 'itemID')).attr('value',anchortitletosave);
-                                        $('#newwindow' + $(this).dialog('option', 'itemID')).attr('value',newwindowtosave);
-                                        $('#description' + $(this).dialog('option', 'itemID')).attr('value',desctosave);
</del><ins>+        // Make items droppable
+        $('#menu dl, #menu .dropzone').droppable({
+                accept: '#menu li',
+                tolerance: 'pointer',
+                
+                drop: function(e, ui) {
+                        var li = $(this).parent();
+                        var child = !$(this).hasClass('dropzone');
+                        
+                        // Add UL to first child
+         if ( child && li.children('ul').length == 0 ) {
+         li.append('<ul id="sub-menu" />');
+         }
+         // Make it draggable
+         if ( child ) {
+         li.children('ul').append( ui.draggable );
+         } else {
+         li.before( ui.draggable );
+         }
</ins><span class="cx">
</span><del>-                                        $('#menu-' + $(this).dialog('option', 'itemID') + ' > dl > dt > span.title').text(titletosave);
</del><ins>+         li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });
</ins><span class="cx">
</span><del>-                                        $('#view' + + $(this).dialog('option', 'itemID')).attr('href', linktosave);
-
-                                        $(this).dialog('close');
-
-                                },
-                                Cancel: function() {
-                                        $(this).dialog('close');
-                                }
-                        }
-                });
-
-                // $('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ $(this).remove();});
-
-                //Add dropzone
-         $('#custom-nav li').prepend('<div class="dropzone"></div>');
-
-                //Make li items draggable
-                $('#custom-nav li').draggable({
-                         handle: ' > dl',
-                         opacity: .8,
-                         addClasses: false,
-                         helper: 'clone',
-                         zIndex: 100
-                });
-
-                //Make items droppable
-                $('#custom-nav dl, #custom-nav .dropzone').droppable(
-                {
-                 accept: '#custom-nav li',
-                 tolerance: 'pointer',
-                 drop: function(e, ui)
-                 {
-                 var li = $(this).parent();
-                 var child = !$(this).hasClass('dropzone');
-                 //Add UL to first child
-                 if (child && li.children('ul').length == 0)
-                 {
-                 li.append('<ul id="sub-menu" />');
-                 }
-                 //Make it draggable
-                 if (child)
-                 {
-                 li.children('ul').append(ui.draggable);
-                 }
-                 else
-                 {
-                 li.before(ui.draggable);
-                 }
-
-                 li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });
-
-                 var draggablevalue = ui.draggable.attr('value');
-                 var droppablevalue = li.attr('value');
-                 li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
-                 $(this).parent().find("dt").removeAttr('style');
-                 $(this).parent().find("div:first").removeAttr('style');
-
-
-                 },
-                 over: function()
-                 {
-                         //Add child
-                         if ($(this).attr('class') == 'dropzone ui-droppable')
-                         {
-                                 $(this).parent().find("div:first").css('background', 'none').css('height', '50px');
-                         }
-                         //Add above
-                         else if ($(this).attr('class') == 'ui-droppable')
-                         {
-                                 $(this).parent().find("dt:first").css('background', '#d8d8d8');
-                         }
-                         //do nothing
-                         else {
-
-                         }
-                         var parentid = $(this).parent().attr('id');
-
-                 },
-                 out: function()
-                 {
-                 $(this).parent().find("dt").removeAttr('style');
-                 $(this).parent().find("div:first").removeAttr('style');
-                 $(this).filter('.dropzone').css({ borderColor: '' });
-                 },
-                 deactivate: function()
-                 {
-
-
-                 }
-
-
-                });
-
-                //Handle Save Button Clicks
-                $('#save_top').click(function()
-                {
-                        updatepostdata();
-                });
-                $('#save_bottom').click(function()
-                {
-                        updatepostdata();
-                });
-
-
</del><ins>+                        var draggablevalue = ui.draggable.attr('value');
+                        var droppablevalue = li.attr('value');
+                        
+         li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
+                        $(this).parent().find('dt').removeAttr('style');
+                        
+                        $(this).parent().find('div:first').removeAttr('style');
+         },
+         
+                over: function() {
+                 
+                 if ( 'dropzone ui-droppable' == $(this).attr('class') ) {
+                                // Add child
+                         $(this).parent().find('dt:first').css('background', 'none').css('height', '50px');
+                                
+                 } else if ($(this).attr('class') == 'ui-droppable') {
+                                // Add above
+                         $(this).parent().find('dt:first').css('background', '#d8d8d8');
+                                
+                 } else {
+                                // do nothing
+                 }
+                 var parentid = $(this).parent().attr('id');
+         },
+         out: function() {
+         $(this).parent().find('dt').removeAttr('style');
+         $(this).parent().find('div:first').removeAttr('style');
+         $(this).filter('.dropzone').css({ borderColor: '' });
+         },
+         deactivate: function() {
+                        //
+         }
</ins><span class="cx">         });
</span><del>-
-
</del><ins>+});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudefaultitemsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-default-items.js (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-default-items.js        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/js/nav-menu-default-items.js        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -1 +1 @@
</span><del>-jQuery(function($){$("#dialog-confirm").dialog({autoOpen:false,resizable:false,height:210,width:400,modal:true,buttons:{Save:function(){titletosave=$("#edittitle").attr("value");linktosave=$("#editlink").attr("value");anchortitletosave=$("#editanchortitle").attr("value");newwindowtosave=$("#editnewwindow").attr("value");desctosave=$("#editdescription").attr("value");$("#title"+$(this).dialog("option","itemID")).attr("value",titletosave);$("#linkurl"+$(this).dialog("option","itemID")).attr("value",linktosave);$("#anchortitle"+$(this).dialog("option","itemID")).attr("value",anchortitletosave);$("#newwindow"+$(this).dialog("option","itemID")).attr("value",newwindowtosave);$("#description"+$(this).dialog("option","itemID")).attr("value",desctosave);$("#menu-"+$(this).dialog("option","itemID")+" > dl > dt > span.title").text(titletosave);$("#view"+ +$(this).dialog("option","itemID")).attr("href",linktosave);$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}});$("#custom-nav li").prepend('<div class="dropzone"></div>');$("#custom-nav li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#custom-nav dl, #custom-nav .dropzone").droppable({accept:"#custom-nav li",tolerance:"pointer",drop:function(e,ui){var li=$(this).parent();var child=!$(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append('<ul id="sub-menu" />')}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if($(this).attr("class")=="dropzone ui-droppable"){$(this).parent().find("div:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}});$("#save_top").click(function(){updatepostdata()});$("#save_bottom").click(function(){updatepostdata()})});
</del><span class="cx">\ No newline at end of file
</span><ins>+jQuery(document).ready(function($){$("#save_menu").click(function(){wp_update_post_data()});$(".quick-search").click(function(){$(this).attr("value","")});$(".quick-search-submit").click(function(){$(this).siblings(".quick-search").search()});$("#menu-container .item-edit").click(function(){wp_edit_menu_item($(this).attr("value"))});$("#menu-container .item-delete").live("click",function(){wp_remove_menu_item($(this).attr("value"))});$("#update-menu-item").click(function(){wp_update_menu_item();tb_remove();var id=$("#edit-item-id").val();$("#menu-"+id+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});$("#cancel-save").click(function(){tb_remove()});$(".show-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 10px;");$(this).offsetParent().find(".list-wrap").css("display","block");$(this).siblings(".quick-search").attr("value","");$(this).offsetParent().find(".list-wrap dt").css("display","block");$(this).hide();$(this).siblings(".hide-all").show()});$(".hide-all").click(function(){$(this).offsetParent().find("#add-buttons-actions").attr("style","margin-bottom: 0px;");$(this).offsetParent().find(".list-wrap").css("display","none");$(this).siblings(".quick-search").attr("value","Search");$(this).offsetParent().find(".list-wrap dt").css("display","none");$(this).hide();$(this).siblings(".show-all").show()});$(".enqueue a").click(function(){wp_add_queued_items_to_menu(this)});$("#add-custom-link .add-to-menu a").click(function(){var link_url=$(this).offsetParent().find("#menu-item-url").val();var link_name=$(this).offsetParent().find("#menu-item-name").val();var links=$(this).offsetParent().find("#available-links input:checked");if(links){for(var i=0;i<links.length;i++){wp_add_item_to_menu("Custom",links[i].name,links[i].value,links[i].id.substring(5,links[i].id.length),0,"")}$(links).attr("checked",false)}if("http://"==link_url||"Menu Item"==link_name){return}params={action:"add-menu-link",link_url:link_url,link_name:link_name,};$.post(ajaxurl,params,function(response){if(null==response||"-1"==response){return false}params.link_id=response;wp_add_item_to_menu("Custom",params.link_name,params.link_url,params.link_id,0,"")},"json")});$("#menu li").prepend('<div class="dropzone"></div>');$("#menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#menu dl, #menu .dropzone").droppable({accept:"#menu li",tolerance:"pointer",drop:function(e,ui){var li=$(this).parent();var child=!$(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append('<ul id="sub-menu" />')}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if("dropzone ui-droppable"==$(this).attr("class")){$(this).parent().find("dt:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}})});
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudynamicfunctionsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/js/nav-menu-dynamic-functions.dev.js        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -8,62 +8,104 @@
</span><span class="cx"> * @subpackage Administration
</span><span class="cx"> */
</span><span class="cx">
</span><del>-/*
- * Removes menu items from current menu
</del><ins>+/**
+ * Adds a link to the available links section
+ *
+ * @param object e - An object recieved via ajax
+ */
+function wp_update_links_list(e) {
+        var link = '<li><dl><dt><label class="item-title"><input type="checkbox" id="link-'+ e.link_id +'" name="'+ e.link_name +'" value="'+ e.link_url +'" />'+ e.link_name +'</label></dt></dl></li>';
+                
+        // Prepend the link to the available links section
+        jQuery('#available-links .list').prepend( link );
+        
+        // Give feedback to the user
+        jQuery('#available-links .list #link-' + e.link_id).parent().animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
+}
+
+/**
+ * Removes a menu item from current menu
+ *
</ins><span class="cx"> * @param int o - the id of the menu li to remove.
</span><del>-*/
-function removeitem(o)
-{
-
</del><ins>+ */
+function wp_remove_menu_item( o ) {
</ins><span class="cx">         var todelete = document.getElementById('menu-' + o);
</span><del>-
-        if (todelete)
-        {
-                var parenttodelete = document.getElementById('menu-' + o).parentNode;
- throwaway_node = parenttodelete.removeChild(todelete);
</del><ins>+        
+        if ( todelete ) {
+                // Give some feedback to the user
+                jQuery( todelete ).find('dt').each(function(){
+                        jQuery(this).animate( { backgroundColor: '#FF3333' }, { duration: 'normal', complete: function() { jQuery(this).parent().parent().remove() } } );
+                });
+                
+                wp_update_post_data();
</ins><span class="cx">         }
</span><del>-
-        updatepostdata();
</del><span class="cx"> };
</span><span class="cx">
</span><del>-/*
- * Loads dialog window to edit menu items from current menu
</del><ins>+/**
+ * Populate the thickbox window with the selected menu items
+ *
</ins><span class="cx"> * @param int o - the id of the menu li to edit.
</span><del>-*/
-function edititem(o)
-{
</del><ins>+ */
+function wp_edit_menu_item( id ) {
+        console.log('wp_edit_menu_item');
+        
+        var itemTitle = jQuery('#item-title' + id).val();
+        var itemURL = jQuery('#item-url' + id).val();
+        var itemAttrTitle = jQuery('#item-attr-title' + id).val();
+        var itemTarget = jQuery('#item-target' + id).val();
+        var itemDesc = jQuery('#item-description' + id).val();
+        
+        console.log(id);
+        console.log(itemTitle);
+        console.log(itemURL);
+        console.log(itemAttrTitle);
+        console.log(itemTarget);
+        console.log(itemDesc);
+        
+        // Populate the fields for thickbox
+        jQuery( '#edit-item-id' ).val(id);
+        jQuery( '#edit-item-title' ).val(itemTitle);
+        jQuery( '#edit-item-url' ).val(itemURL);
+        jQuery( '#edit-item-attr-title' ).val(itemAttrTitle);
+        jQuery( '#edit-item-target' ).val(itemTarget);
+        jQuery( "#edit-item-target option[value='" + itemTarget + "']" ).attr('selected', 'selected');
+        jQuery( '#edit-item-description' ).val(itemDesc);
+};
</ins><span class="cx">
</span><del>-                itemTitle = jQuery('#title' + o).val();
-                itemURL = jQuery('#linkurl' + o).val();
-                itemAnchorTitle = jQuery('#anchortitle' + o).val();
-                itemNewWindow = jQuery('#newwindow' + o).val();
-                itemDesc = jQuery('#description' + o).val();
</del><ins>+/**
+ * Update the values for the menu item being editing
+ */
+function wp_update_menu_item() {
+        var id = jQuery('#edit-item-id').val();
+        var itemTitle = jQuery('#edit-item-title').val();
+        var itemURL = jQuery('#edit-item-url').val();
+        var itemAttrTitle = jQuery('#edit-item-attr-title').val();
+        var itemTarget = jQuery('#edit-item-target').val();
+        var itemDesc = jQuery('#edit-item-description').val();
+        
+        console.log(id);
+        console.log(itemTitle);
+        console.log(itemURL);
+        console.log(itemAttrTitle);
+        console.log(itemTarget);
+        console.log(itemDesc);
+        
+        // update menu item settings        
+        jQuery('#menu-' + id).find('.item-title:first').html(itemTitle);
+        jQuery('#item-title' + id).val(itemTitle);
+        jQuery('#item-url' + id).val(itemURL);
+        jQuery('#item-attr-title' + id).val(itemAttrTitle);
+        jQuery('#item-target' + id).val(itemTarget);
+        jQuery('#item-description' + id).val(itemDesc);
+}
</ins><span class="cx">
</span><del>-                jQuery('#dialog-confirm').dialog( 'option' , 'itemID' , o )
-
-                jQuery('#dialog-confirm').dialog('open');
-
-                jQuery('#edittitle').val( itemTitle );
-                if ( 'custom' == jQuery( '#linktype' + o ).val() ) {
-                        jQuery( '#editlink-wrap' ).css( 'display', 'inline' );
-                } else {
-                        jQuery( '#editlink-wrap' ).css( 'display', 'none' );
-                }
-                jQuery('#editlink').val( itemURL );
-                jQuery('#editanchortitle').val( itemAnchorTitle );
-                jQuery("#editnewwindow option[value='" + itemNewWindow + "']").attr('selected', 'selected');
-                jQuery('#editdescription').val( itemDesc );
-
-};
-
-/*
</del><ins>+/**
</ins><span class="cx"> * Prepares menu items for POST
</span><del>-*/
-function updatepostdata()
-{
-
</del><ins>+ */
+function wp_update_post_data() {
</ins><span class="cx">         var i = 0;
</span><del>-         jQuery("#custom-nav").find("li").each(function(i) {
</del><ins>+        
+         jQuery('#menu li').each(function(i) {
</ins><span class="cx">                 i = i + 1;
</span><span class="cx">         var j = jQuery(this).attr('value');
</span><span class="cx">
</span><span class="lines">@@ -79,57 +121,86 @@
</span><span class="cx">
</span><span class="cx">         var p = jQuery(this).find('#parent' + j).parent().parent().parent().attr('value');
</span><span class="cx">
</span><del>-         jQuery(this).find('#parent' + j).attr('name','parent' + i);
-         jQuery(this).find('#parent' + j).attr('id','parent' + i);
-         if (p) {
-                 //Do nothing
-         }
-         else {
-                 //reset p to be top level
-                 p = 0;
-         }
</del><ins>+                jQuery(this).find('#parent' + j).attr('name','parent' + i);
+                jQuery(this).find('#parent' + j).attr('id','parent' + i);
+                
+                if (p) {
+                        // Do nothing
+                } else {
+                        // reset p to be top level
+                        p = 0;
+                }
</ins><span class="cx">
</span><del>-         jQuery(this).find('#parent' + j).attr('value', p);
</del><ins>+                jQuery(this).find('#parent' + j).attr('value', p);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#title' + j).attr('name','title' + i);
-         jQuery(this).find('#title' + j).attr('id','title' + i);
</del><ins>+                jQuery(this).find('#item-title' + j).attr('name','item-title' + i);
+                jQuery(this).find('#item-title' + j).attr('id','item-title' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#linkurl' + j).attr('name','linkurl' + i);
-         jQuery(this).find('#linkurl' + j).attr('id','linkurl' + i);
</del><ins>+                jQuery(this).find('#item-url' + j).attr('name','item-url' + i);
+                jQuery(this).find('#item-url' + j).attr('id','item-url' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#description' + j).attr('name','description' + i);
-         jQuery(this).find('#description' + j).attr('id','description' + i);
</del><ins>+                jQuery(this).find('#item-description' + j).attr('name','item-description' + i);
+                jQuery(this).find('#item-description' + j).attr('id','item-description' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#icon' + j).attr('name','icon' + i);
-         jQuery(this).find('#icon' + j).attr('id','icon' + i);
</del><ins>+                jQuery(this).find('#item-attr-title' + j).attr('name','item-attr-title' + i);
+                jQuery(this).find('#item-attr-title' + j).attr('id','item-attr-title' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#position' + j).attr('name','position' + i);
-         jQuery(this).find('#position' + j).attr('id','position' + i);
</del><ins>+                jQuery(this).find('#item-target' + j).attr('name','item-target' + i);
+                jQuery(this).find('#item-target' + j).attr('id','item-target' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#linktype' + j).attr('name','linktype' + i);
-         jQuery(this).find('#linktype' + j).attr('id','linktype' + i);
</del><ins>+                jQuery(this).find('#position' + j).attr('name', 'position' + i);
+                jQuery(this).find('#position' + j).attr('id', 'position' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#anchortitle' + j).attr('name','anchortitle' + i);
-         jQuery(this).find('#anchortitle' + j).attr('id','anchortitle' + i);
</del><ins>+                jQuery(this).find('#linktype' + j).attr('name', 'linktype' + i);
+                jQuery(this).find('#linktype' + j).attr('id', 'linktype' + i);
</ins><span class="cx">
</span><del>-         jQuery(this).find('#newwindow' + j).attr('name','newwindow' + i);
-         jQuery(this).find('#newwindow' + j).attr('id','newwindow' + i);
-
-         jQuery(this).find('dl > dt > span > #remove' + j).attr('value', i);
-         jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
-         jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
-
-         jQuery('#li-count').attr('value',i);
-
</del><ins>+                jQuery('#li-count').attr( 'value', i );
</ins><span class="cx"> });
</span><ins>+};
</ins><span class="cx">
</span><ins>+/**
+ * Adds the item to the menu
+ *
+ * @param string id - The menu item's id
+ * @param string additemtype - Page, Category, or Custom.
+ * @param string itemtext - menu text.
+ * @param string itemurl - url of the menu.
+ * @param int itemid - menu id.
+ * @param int itemparentid - default 0.
+ * @param string itemdescription - the description of the menu item.
+ */
+function wp_add_item_to_menu( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) {
+        var inputvaluevarname = '';
+        var inputvaluevarurl = '';
+        var inputitemid = '';
+        var inputparentid= '';
+        var inputdescription = '';
+        var randomnumber = wp_get_unique_menu_id();
</ins><span class="cx">
</span><del>-
</del><ins>+        inputvaluevarname = htmlentities(itemtext.toString());
+        inputvaluevarurl = itemurl.toString();
+        inputitemid = itemid;
+        inputparentid = itemparentid;
+        inputlinktype = 'custom';
+        inputdescription = htmlentities(itemdescription.toString());
+        
+        // Adds the item in the queue
+        jQuery('#menu').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + inputvaluevarname + '</span><span class="item-controls"><span class="item-type">' + additemtype + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /></li>');
+        
+        // Give some feedback to the user
+        jQuery( '#menu #menu-' + randomnumber + ' dt:first' ).animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
+        
+        // Enable drag-n-drop
+        wp_drag_and_drop();
+        
+        // Reload thickbox
+        tb_init('a.thickbox, area.thickbox, input.thickbox');
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> /*
</span><del>- * Adds item from Page, Category, or Custom options menu
- * @param string templatedir - directory of the add, edit, view images.
</del><ins>+ * Queues items in perperation for appendToList
+ *
+ * @param string id - The menu item's id
</ins><span class="cx"> * @param string additemtype - Page, Category, or Custom.
</span><span class="cx"> * @param string itemtext - menu text.
</span><span class="cx"> * @param string itemurl - url of the menu.
</span><span class="lines">@@ -137,26 +208,15 @@
</span><span class="cx"> * @param int itemparentid - default 0.
</span><span class="cx"> * @param string itemdescription - the description of the menu item.
</span><span class="cx"> */
</span><del>-function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription)
-{
</del><ins>+function wp_update_queue( additemtype, itemtext, itemurl, itemid, itemparentid, itemdescription ) {
</ins><span class="cx">         var inputvaluevarname = '';
</span><span class="cx">         var inputvaluevarurl = '';
</span><span class="cx">         var inputitemid = '';
</span><span class="cx">         var inputparentid= '';
</span><span class="cx">         var inputdescription = '';
</span><del>-        var inputicon = '';
</del><ins>+        var randomnumber = wp_get_unique_menu_id();
</ins><span class="cx">
</span><del>-        if (additemtype == navMenuL10n.custom)
-        {
-                inputvaluevarname = document.getElementById('custom-menu-item-name').value;
-                inputvaluevarurl = document.getElementById('custom-menu-item-url').value;
-                inputitemid = '';
-                inputparentid = '';
-                inputlinktype = 'custom';
-                inputdescription = '';
-        }
-        else if (additemtype == navMenuL10n.page)
-        {
</del><ins>+        if ( additemtype == navMenuL10n.page ) {
</ins><span class="cx">                 inputvaluevarname = htmlentities(itemtext.toString());
</span><span class="cx">                 inputvaluevarurl = itemurl.toString();
</span><span class="cx">                 inputitemid = itemid.toString();
</span><span class="lines">@@ -164,9 +224,7 @@
</span><span class="cx">                 inputlinktype = 'page';
</span><span class="cx">                 inputdescription = htmlentities(itemdescription.toString());
</span><span class="cx">
</span><del>-        }
-        else if (additemtype == navMenuL10n.category)
-        {
</del><ins>+        } else if ( additemtype == navMenuL10n.category ) {
</ins><span class="cx">                 inputvaluevarname = htmlentities(itemtext.toString());
</span><span class="cx">                 inputvaluevarurl = itemurl.toString();
</span><span class="cx">                 inputitemid = itemid.toString();
</span><span class="lines">@@ -174,55 +232,64 @@
</span><span class="cx">                 inputlinktype = 'category';
</span><span class="cx">                 inputdescription = htmlentities(itemdescription.toString());
</span><span class="cx">         }
</span><del>-        else
-        {
-                inputvaluevarname = '';
-                inputvaluevarname = '';
-                inputitemid = '';
-                inputparentid = '';
-                inputlinktype = 'custom';
-                inputdescription = '';
-        }
</del><ins>+                        
+        // Adds or removes the item from the queue
+        if ( jQuery(menu_item_id = '#menu-item-' + inputitemid).attr('checked') ) {
+                
+                // Add menu item to the queue
+                jQuery('#queue').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">' + inputvaluevarname + '</span><span class="item-controls"><span class="item-type">' + additemtype + '</span><a class="item-edit thickbox" id="edit' + randomnumber + '" value="' + randomnumber +'" onClick="wp_edit_menu_item('+ randomnumber +')" title="' + navMenuL10n.thickbox + '" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">' + navMenuL10n.edit + '</a> | <a class="item-delete" id="delete' + randomnumber + '" value="' + randomnumber +'">Delete</a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="item-title' + randomnumber + '" id="item-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-url' + randomnumber + '" id="item-url' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="item-description' + randomnumber + '" id="item-description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="item-attr-title' + randomnumber + '" id="item-attr-title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="item-target' + randomnumber + '" id="item-target' + randomnumber + '" value="0" /></li>');
+        } else {
+                
+                // Get the item in the queue
+                for ( var i = 0; i < jQuery('#queue li input[name^="postmenu"]').length; i++ ) {
+                        if ( itemid == jQuery('#queue li input[name^="postmenu"]')[i].value ) {
+                                var menu_queue_id = jQuery('#queue li input[name^="postmenu"]')[i].name.substring( 8, jQuery('#queue li input[name^="postmenu"]')[i].name.length );
+                        };
+                };
+                
+                // Removes the item from the queue
+                jQuery('#queue li#menu-' + menu_queue_id).remove();
+        };
+};
</ins><span class="cx">
</span><del>-        var count=document.getElementById('custom-nav').getElementsByTagName('li').length + 1;
</del><ins>+/**
+ * Grabs items from the queue and adds them to the menu.
+ *
+ * @param string button - a reference of the button that was clicked
+ */
+function wp_add_queued_items_to_menu( button ) {        
+        // Grab items in queue
+        var items = jQuery('#queue').children();
+        
+        // Empty Queue
+        jQuery('#queue').empty();
+                
+        // Appends HTML to the menu
+        jQuery('#menu').append( items );
</ins><span class="cx">
</span><del>-        var randomnumber = count;
</del><ins>+        // Give some feedback to the user
+        jQuery(items).each(function(){
+                jQuery(this).find('dt').animate( { backgroundColor: '#FFFF33' }, { duration: 'normal', complete: function() { jQuery(this).css( 'backgroundColor', '' ); }});
+        });
+        
+        // Uncheck the checkboxes in the list
+        jQuery(button).offsetParent().find('.list-container input').attr('checked', false);
+        
+        wp_update_post_data();
+        
+        // Enable drag-n-drop
+        wp_drag_and_drop();
+        
+        // Reload thickbox
+        tb_init('a.thickbox, area.thickbox, input.thickbox');
+};
</ins><span class="cx">
</span><del>-        var validatetest = 0;
-
-        try
-        {
-                var test=document.getElementById("menu-" + randomnumber.toString()).value;
-        }
-        catch (err)
-        {
-                validatetest = 1;
-        }
-
-        while (validatetest == 0)
-        {
-                randomnumber = randomnumber + 1;
-
-                try
-                {
-                        var test2=document.getElementById("menu-" + randomnumber.toString()).value;
-                }
-                catch (err)
-                {
-                        validatetest = 1;
-                }
-        }
-
-        //Notification Message
-        jQuery('.maintitle').after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');
-        jQuery('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ jQuery(this).remove();});
-
-        //Appends HTML to the menu
-        jQuery('#custom-nav').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">' + inputvaluevarname + '</span><span class="controls"><span class="type">' + additemtype + '</span><a id="edit' + randomnumber + '" onclick="edititem(' + randomnumber + ')" value="' + randomnumber +'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="' + templatedir + '/wp-admin/images/ico-edit.png" /></a> <a id="remove' + randomnumber + '" onclick="removeitem(' + randomnumber + ')" value="' + randomnumber +'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="' + templatedir + '/wp-admin/images/ico-close.png" /></a> <a href="' + inputvaluevarurl + '" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="' + templatedir + '/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="title' + randomnumber + '" id="title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="linkurl' + randomnumber + '" id="linkurl' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="description' + randomnumber + '" id="description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="icon' + randomnumber + '" id="icon' + randomnumber + '" value="' + inputicon + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="anchortitle' + randomnumber + '" id="anchortitle' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="newwindow' + randomnumber + '" id="newwindow' + randomnumber + '" value="0" /></li>');
-
-        //make menu item draggable
-        jQuery('#menu-' + randomnumber + '').draggable(
-        {
</del><ins>+/**
+ * Allow the items in the Menu to be dragged and dropped.
+ */
+function wp_drag_and_drop() {
+        // make menu item draggable
+        jQuery('#menu li').draggable({
</ins><span class="cx">                 handle: ' > dl',
</span><span class="cx">                 opacity: .8,
</span><span class="cx">                 addClasses: false,
</span><span class="lines">@@ -230,64 +297,81 @@
</span><span class="cx">                 zIndex: 100
</span><span class="cx">         });
</span><span class="cx">
</span><del>-        //make menu item droppable
-        jQuery('#menu-' + randomnumber + ' dl, #menu-' + randomnumber + ' .dropzone').droppable({
-                accept: '#' + randomnumber + ', #custom-nav li',
</del><ins>+        // make menu item droppable
+        jQuery('#menu li dl, #menu li .dropzone').droppable({
+                accept: '#menu li',
</ins><span class="cx">                 tolerance: 'pointer',
</span><del>-                drop: function(e, ui)
-                {
</del><ins>+                drop: function(e, ui) {
</ins><span class="cx">                         var li = jQuery(this).parent();
</span><span class="cx">                         var child = !jQuery(this).hasClass('dropzone');
</span><del>-                        //Append UL to first child
-                        if (child && li.children('ul').length == 0)
-                        {
-                                li.append('<ul/>');
</del><ins>+                        
+                        // Append UL to first child
+                        if ( child && li.children('ul').length == 0 ) {
+                                li.append( '<ul/>' );
</ins><span class="cx">                         }
</span><del>-                        //Make it draggable
-                        if (child)
-                        {
-                                li.children('ul').append(ui.draggable);
</del><ins>+                        // Make it draggable
+                        if ( child ) {
+                                li.children('ul').append( ui.draggable );
+                        } else {
+                                li.before( ui.draggable );
</ins><span class="cx">                         }
</span><del>-                        else
-                        {
-                                li.before(ui.draggable);
-                        }
</del><span class="cx">
</span><span class="cx">                         li.find('dl,.dropzone').css({ backgroundColor: '', borderColor: '' });
</span><span class="cx">
</span><span class="cx">                         var draggablevalue = ui.draggable.attr('value');
</span><del>-                 var droppablevalue = li.attr('value');
-                 li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
-         jQuery(this).parent().find("dt").removeAttr('style');
-         jQuery(this).parent().find("div:first").removeAttr('style');
</del><ins>+                        var droppablevalue = li.attr('value');
+                        
+                        li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
+                        jQuery(this).parent().find("dt").removeAttr('style');
+                        jQuery(this).parent().find("div:first").removeAttr('style');
</ins><span class="cx">
</span><span class="cx">                 },
</span><del>-                over: function()
-                 {
-                         //Add child
-                         if (jQuery(this).attr('class') == 'dropzone ui-droppable')
-                         {
</del><ins>+                over: function() {
+                         // Add child
+                         if ( jQuery(this).attr('class') == 'dropzone ui-droppable' ) {
</ins><span class="cx">                                  jQuery(this).parent().find("div:first").css('background', 'none').css('height', '50px');
</span><span class="cx">                          }
</span><del>-                         //Add above
-                         else if (jQuery(this).attr('class') == 'ui-droppable')
-                         {
</del><ins>+                         // Add above
+                         else if ( jQuery(this).attr('class') == 'ui-droppable' ) {
</ins><span class="cx">                                  jQuery(this).parent().find("dt:first").css('background', '#d8d8d8');
</span><ins>+                         } else {
+                                        // do nothing
</ins><span class="cx">                          }
</span><del>-                         //do nothing
-                         else {
-
-                         }
</del><span class="cx">                          var parentid = jQuery(this).parent().attr('id');
</span><span class="cx">
</span><span class="cx">                  },
</span><del>-                 out: function()
-                 {
</del><ins>+                 out: function() {
</ins><span class="cx">                  jQuery(this).parent().find("dt").removeAttr('style');
</span><span class="cx">                  jQuery(this).parent().find("div:first").removeAttr('style');
</span><span class="cx">                  jQuery(this).filter('.dropzone').css({ borderColor: '' });
</span><span class="cx">                  }
</span><del>-        });
</del><ins>+                }
+        );
+}
</ins><span class="cx">
</span><del>-        updatepostdata();
-};
</del><span class="cx">\ No newline at end of file
</span><ins>+/**
+ * Gets a unique number based on how many items are in the menu
+ */
+function wp_get_unique_menu_id() {
+        var count = document.getElementById('menu').getElementsByTagName('li').length + 1;
+        var randomnumber = count;
+        var validatetest = 0;
+
+        try {
+                var test = document.getElementById( 'menu-' + randomnumber.toString() ).value;
+        }
+        catch ( err ) {
+                validatetest = 1;
+        }
+
+        while ( validatetest == 0 ) {
+                randomnumber = randomnumber + 1;
+                try {
+                        var test2 = document.getElementById( 'menu-' + randomnumber.toString() ).value;
+                }
+                catch ( err ) {
+                        validatetest = 1;
+                }
+        }
+        return randomnumber;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpadminjsnavmenudynamicfunctionsjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/nav-menu-dynamic-functions.js (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/nav-menu-dynamic-functions.js        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/js/nav-menu-dynamic-functions.js        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -1 +1 @@
</span><del>-function removeitem(c){var b=document.getElementById("menu-"+c);if(b){var a=document.getElementById("menu-"+c).parentNode;throwaway_node=a.removeChild(b)}updatepostdata()}function edititem(a){itemTitle=jQuery("#title"+a).attr("value");itemURL=jQuery("#linkurl"+a).attr("value");itemAnchorTitle=jQuery("#anchortitle"+a).attr("value");itemNewWindow=jQuery("#newwindow"+a).attr("value");itemDesc=jQuery("#description"+a).attr("value");jQuery("#dialog-confirm").dialog("option","itemID",a);jQuery("#dialog-confirm").dialog("open");jQuery("#edittitle").attr("value",itemTitle);jQuery("#editlink").attr("value",itemURL);jQuery("#editanchortitle").attr("value",itemAnchorTitle);jQuery("#editnewwindow option[value='"+itemNewWindow+"']").attr("selected","selected");jQuery("#editdescription").attr("value",itemDesc)}function updatepostdata(){var a=0;jQuery("#custom-nav").find("li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#position"+b).attr("value",c);jQuery(this).attr("id","menu-"+c);jQuery(this).attr("value",c);jQuery(this).find("#dbid"+b).attr("name","dbid"+c);jQuery(this).find("#dbid"+b).attr("id","dbid"+c);jQuery(this).find("#postmenu"+b).attr("name","postmenu"+c);jQuery(this).find("#postmenu"+b).attr("id","postmenu"+c);var d=jQuery(this).find("#parent"+b).parent().parent().parent().attr("value");jQuery(this).find("#parent"+b).attr("name","parent"+c);jQuery(this).find("#parent"+b).attr("id","parent"+c);if(d){}else{d=0}jQuery(this).find("#parent"+b).attr("value",d);jQuery(this).find("#title"+b).attr("name","title"+c);jQuery(this).find("#title"+b).attr("id","title"+c);jQuery(this).find("#linkurl"+b).attr("name","linkurl"+c);jQuery(this).find("#linkurl"+b).attr("id","linkurl"+c);jQuery(this).find("#description"+b).attr("name","description"+c);jQuery(this).find("#description"+b).attr("id","description"+c);jQuery(this).find("#icon"+b).attr("name","icon"+c);jQuery(this).find("#icon"+b).attr("id","icon"+c);jQuery(this).find("#position"+b).attr("name","position"+c);jQuery(this).find("#position"+b).attr("id","position"+c);jQuery(this).find("#linktype"+b).attr("name","linktype"+c);jQuery(this).find("#linktype"+b).attr("id","linktype"+c);jQuery(this).find("#anchortitle"+b).attr("name","anchortitle"+c);jQuery(this).find("#anchortitle"+b).attr("id","anchortitle"+c);jQuery(this).find("#newwindow"+b).attr("name","newwindow"+c);jQuery(this).find("#newwindow"+b).attr("id","newwindow"+c);jQuery(this).find("dl > dt > span > #remove"+b).attr("value",c);jQuery(this).find("dl > dt > span > #remove"+b).attr("onClick","removeitem("+c+")");jQuery(this).find("dl > dt > span > #remove"+b).attr("id","remove"+c);jQuery("#li-count").attr("value",c)})}function appendToList(b,s,d,n,h,l,e){var k="";var c="";var r="";var o="";var i="";var a="";if(s==navMenuL10n.custom){k=document.getElementById("custom-menu-item-name").value;c=document.getElementById("custom-menu-item-url").value;r="";o="";inputlinktype="custom";i=""}else{if(s==navMenuL10n.page){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="page";i=htmlentities(e.toString())}else{if(s==navMenuL10n.category){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="category";i=htmlentities(e.toString())}else{k="";k="";r="";o="";inputlinktype="custom";i=""}}}var g=document.getElementById("custom-nav").getElementsByTagName("li").length+1;var p=g;var m=0;try{var q=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}while(m==0){p=p+1;try{var j=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}}jQuery(".maintitle").after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');jQuery("#message").animate({opacity:1},2000).fadeOut(300,function(){jQuery(this).remove()});jQuery("#custom-nav").append('<li id="menu-'+p+'" value="'+p+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">'+k+'</span><span class="controls"><span class="type">'+s+'</span><a id="edit'+p+'" onclick="edititem('+p+')" value="'+p+'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="'+b+'/wp-admin/images/ico-edit.png" /></a> <a id="remove'+p+'" onclick="removeitem('+p+')" value="'+p+'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="'+b+'/wp-admin/images/ico-close.png" /></a> <a href="'+c+'" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="'+b+'/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="'+c+'">'+k+'</a><input type="hidden" name="postmenu'+p+'" id="postmenu'+p+'" value="'+r+'" /><input type="hidden" name="parent'+p+'" id="parent'+p+'" value="'+o+'" /><input type="hidden" name="title'+p+'" id="title'+p+'" value="'+k+'" /><input type="hidden" name="linkurl'+p+'" id="linkurl'+p+'" value="'+c+'" /><input type="hidden" name="description'+p+'" id="description'+p+'" value="'+i+'" /><input type="hidden" name="icon'+p+'" id="icon'+p+'" value="'+a+'" /><input type="hidden" name="position'+p+'" id="position'+p+'" value="'+p+'" /><input type="hidden" name="linktype'+p+'" id="linktype'+p+'" value="'+inputlinktype+'" /><input type="hidden" name="anchortitle'+p+'" id="anchortitle'+p+'" value="'+k+'" /><input type="hidden" name="newwindow'+p+'" id="newwindow'+p+'" value="0" /></li>');jQuery("#menu-"+p+"").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery("#menu-"+p+" dl, #menu-"+p+" .dropzone").droppable({accept:"#"+p+", #custom-nav li",tolerance:"pointer",drop:function(x,w){var t=jQuery(this).parent();var y=!jQuery(this).hasClass("dropzone");if(y&&t.children("ul").length==0){t.append("<ul/>")}if(y){t.children("ul").append(w.draggable)}else{t.before(w.draggable)}t.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var v=w.draggable.attr("value");var u=t.attr("value");t.find("#menu-"+v).find("#parent"+v).val(u);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var t=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}});updatepostdata()};
</del><span class="cx">\ No newline at end of file
</span><ins>+function wp_update_links_list(e){var link='<li><dl><dt><label class="item-title"><input type="checkbox" id="link-'+e.link_id+'" name="'+e.link_name+'" value="'+e.link_url+'" />'+e.link_name+"</label></dt></dl></li>";jQuery("#available-links .list").prepend(link);jQuery("#available-links .list #link-"+e.link_id).parent().animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})}function wp_remove_menu_item(o){var todelete=document.getElementById("menu-"+o);if(todelete){jQuery(todelete).find("dt").each(function(){jQuery(this).animate({backgroundColor:"#FF3333"},{duration:"normal",complete:function(){jQuery(this).parent().parent().remove()}})});wp_update_post_data()}}function wp_edit_menu_item(id){console.log("wp_edit_menu_item");var itemTitle=jQuery("#item-title"+id).val();var itemURL=jQuery("#item-url"+id).val();var itemAttrTitle=jQuery("#item-attr-title"+id).val();var itemTarget=jQuery("#item-target"+id).val();var itemDesc=jQuery("#item-description"+id).val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery("#edit-item-id").val(id);jQuery("#edit-item-title").val(itemTitle);jQuery("#edit-item-url").val(itemURL);jQuery("#edit-item-attr-title").val(itemAttrTitle);jQuery("#edit-item-target").val(itemTarget);jQuery("#edit-item-target option[value='"+itemTarget+"']").attr("selected","selected");jQuery("#edit-item-description").val(itemDesc)}function wp_update_menu_item(){var id=jQuery("#edit-item-id").val();var itemTitle=jQuery("#edit-item-title").val();var itemURL=jQuery("#edit-item-url").val();var itemAttrTitle=jQuery("#edit-item-attr-title").val();var itemTarget=jQuery("#edit-item-target").val();var itemDesc=jQuery("#edit-item-description").val();console.log(id);console.log(itemTitle);console.log(itemURL);console.log(itemAttrTitle);console.log(itemTarget);console.log(itemDesc);jQuery("#menu-"+id).find(".item-title:first").html(itemTitle);jQuery("#item-title"+id).val(itemTitle);jQuery("#item-url"+id).val(itemURL);jQuery("#item-attr-title"+id).val(itemAttrTitle);jQuery("#item-target"+id).val(itemTarget);jQuery("#item-description"+id).val(itemDesc)}function wp_update_post_data(){var i=0;jQuery("#menu li").each(function(i){i=i+1;var j=jQuery(this).attr("value");jQuery(this).find("#position"+j).attr("value",i);jQuery(this).attr("id","menu-"+i);jQuery(this).attr("value",i);jQuery(this).find("#dbid"+j).attr("name","dbid"+i);jQuery(this).find("#dbid"+j).attr("id","dbid"+i);jQuery(this).find("#postmenu"+j).attr("name","postmenu"+i);jQuery(this).find("#postmenu"+j).attr("id","postmenu"+i);var p=jQuery(this).find("#parent"+j).parent().parent().parent().attr("value");jQuery(this).find("#parent"+j).attr("name","parent"+i);jQuery(this).find("#parent"+j).attr("id","parent"+i);if(p){}else{p=0}jQuery(this).find("#parent"+j).attr("value",p);jQuery(this).find("#item-title"+j).attr("name","item-title"+i);jQuery(this).find("#item-title"+j).attr("id","item-title"+i);jQuery(this).find("#item-url"+j).attr("name","item-url"+i);jQuery(this).find("#item-url"+j).attr("id","item-url"+i);jQuery(this).find("#item-description"+j).attr("name","item-description"+i);jQuery(this).find("#item-description"+j).attr("id","item-description"+i);jQuery(this).find("#item-attr-title"+j).attr("name","item-attr-title"+i);jQuery(this).find("#item-attr-title"+j).attr("id","item-attr-title"+i);jQuery(this).find("#item-target"+j).attr("name","item-target"+i);jQuery(this).find("#item-target"+j).attr("id","item-target"+i);jQuery(this).find("#position"+j).attr("name","position"+i);jQuery(this).find("#position"+j).attr("id","position"+i);jQuery(this).find("#linktype"+j).attr("name","linktype"+i);jQuery(this).find("#linktype"+j).attr("id","linktype"+i);jQuery("#li-count").attr("value",i)})}function wp_add_item_to_menu(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname="";var inputvaluevarurl="";var inputitemid="";var inputparentid="";var inputdescription="";var randomnumber=wp_get_unique_menu_id();inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid;inputparentid=itemparentid;inputlinktype="custom";inputdescription=htmlentities(itemdescription.toString());jQuery("#menu").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+inputvaluevarname+'</span><span class="item-controls"><span class="item-type">'+additemtype+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><a class="hide" href="'+inputvaluevarurl+'">'+inputvaluevarname+'</a><input type="hidden" name="postmenu'+randomnumber+'" id="postmenu'+randomnumber+'" value="'+inputitemid+'" /><input type="hidden" name="parent'+randomnumber+'" id="parent'+randomnumber+'" value="'+inputparentid+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+inputvaluevarurl+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+inputdescription+'" /><input type="hidden" name="position'+randomnumber+'" id="position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="linktype'+randomnumber+'" id="linktype'+randomnumber+'" value="'+inputlinktype+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /></li>');jQuery("#menu #menu-"+randomnumber+" dt:first").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}});wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_update_queue(additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname="";var inputvaluevarurl="";var inputitemid="";var inputparentid="";var inputdescription="";var randomnumber=wp_get_unique_menu_id();if(additemtype==navMenuL10n.page){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="page";inputdescription=htmlentities(itemdescription.toString())}else{if(additemtype==navMenuL10n.category){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="category";inputdescription=htmlentities(itemdescription.toString())}}if(jQuery(menu_item_id="#menu-item-"+inputitemid).attr("checked")){jQuery("#queue").append('<li id="menu-'+randomnumber+'" value="'+randomnumber+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="item-title">'+inputvaluevarname+'</span><span class="item-controls"><span class="item-type">'+additemtype+'</span><a class="item-edit thickbox" id="edit'+randomnumber+'" value="'+randomnumber+'" onClick="wp_edit_menu_item('+randomnumber+')" title="'+navMenuL10n.thickbox+'" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings">'+navMenuL10n.edit+'</a> | <a class="item-delete" id="delete'+randomnumber+'" value="'+randomnumber+'">Delete</a></span></dt></dl><a class="hide" href="'+inputvaluevarurl+'">'+inputvaluevarname+'</a><input type="hidden" name="postmenu'+randomnumber+'" id="postmenu'+randomnumber+'" value="'+inputitemid+'" /><input type="hidden" name="parent'+randomnumber+'" id="parent'+randomnumber+'" value="'+inputparentid+'" /><input type="hidden" name="item-title'+randomnumber+'" id="item-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-url'+randomnumber+'" id="item-url'+randomnumber+'" value="'+inputvaluevarurl+'" /><input type="hidden" name="item-description'+randomnumber+'" id="item-description'+randomnumber+'" value="'+inputdescription+'" /><input type="hidden" name="position'+randomnumber+'" id="position'+randomnumber+'" value="'+randomnumber+'" /><input type="hidden" name="linktype'+randomnumber+'" id="linktype'+randomnumber+'" value="'+inputlinktype+'" /><input type="hidden" name="item-attr-title'+randomnumber+'" id="item-attr-title'+randomnumber+'" value="'+inputvaluevarname+'" /><input type="hidden" name="item-target'+randomnumber+'" id="item-target'+randomnumber+'" value="0" /></li>')}else{for(var i=0;i<jQuery('#queue li input[name^="postmenu"]').length;i++){if(itemid==jQuery('#queue li input[name^="postmenu"]')[i].value){var menu_queue_id=jQuery('#queue li input[name^="postmenu"]')[i].name.substring(8,jQuery('#queue li input[name^="postmenu"]')[i].name.length)}}jQuery("#queue li#menu-"+menu_queue_id).remove()}}function wp_add_queued_items_to_menu(button){var items=jQuery("#queue").children();jQuery("#queue").empty();jQuery("#menu").append(items);jQuery(items).each(function(){jQuery(this).find("dt").animate({backgroundColor:"#FFFF33"},{duration:"normal",complete:function(){jQuery(this).css("backgroundColor","")}})});jQuery(button).offsetParent().find(".list-container input").attr("checked",false);wp_update_post_data();wp_drag_and_drop();tb_init("a.thickbox, area.thickbox, input.thickbox")}function wp_drag_and_drop(){jQuery("#menu li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery("#menu li dl, #menu li .dropzone").droppable({accept:"#menu li",tolerance:"pointer",drop:function(e,ui){var li=jQuery(this).parent();var child=!jQuery(this).hasClass("dropzone");if(child&&li.children("ul").length==0){li.append("<ul/>")}if(child){li.children("ul").append(ui.draggable)}else{li.before(ui.draggable)}li.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var draggablevalue=ui.draggable.attr("value");var droppablevalue=li.attr("value");li.find("#menu-"+draggablevalue).find("#parent"+draggablevalue).val(droppablevalue);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var parentid=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}})}function wp_get_unique_menu_id(){var count=document.getElementById("menu").getElementsByTagName("li").length+1;var randomnumber=count;var validatetest=0;try{var test=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}while(validatetest==0){randomnumber=randomnumber+1;try{var test2=document.getElementById("menu-"+randomnumber.toString()).value}catch(err){validatetest=1}}return randomnumber};
</ins><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 (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/nav-menus.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-admin/nav-menus.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> * WordPress Administration for Navigation Menus
</span><span class="cx"> * Interface functions
</span><span class="cx"> *
</span><del>- * @version 1.1.0
</del><ins>+ * @version 2.0.0
</ins><span class="cx"> *
</span><span class="cx"> * @package WordPress
</span><span class="cx"> * @subpackage Administration
</span><span class="lines">@@ -11,6 +11,10 @@
</span><span class="cx">
</span><span class="cx"> require_once('admin.php');
</span><span class="cx">
</span><ins>+/*
+TODO
+        Add caps: edit_menus, delete_menus
+*/
</ins><span class="cx"> if ( ! current_user_can('switch_themes') )
</span><span class="cx">         wp_die( __( 'Cheatin&#8217; uh?' ));
</span><span class="cx">
</span><span class="lines">@@ -24,6 +28,7 @@
</span><span class="cx"> wp_enqueue_script( 'nav-menu-default-items' );
</span><span class="cx"> wp_enqueue_script( 'jquery-autocomplete' );
</span><span class="cx"> wp_enqueue_script( 'nav-menu-php-functions' );
</span><ins>+add_thickbox();
</ins><span class="cx">
</span><span class="cx"> require_once( 'admin-header.php' );
</span><span class="cx"> require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
</span><span class="lines">@@ -38,6 +43,9 @@
</span><span class="cx"> $updated = false;
</span><span class="cx"> $advanced_option_descriptions = 'no';
</span><span class="cx">
</span><ins>+// Get all menu link items
+$available_links = new WP_Query( array( 'post_status' => 'any', 'post_type' => 'nav_menu_item', 'meta_key' => 'menu_type', 'meta_value' => 'custom' ) );
+
</ins><span class="cx"> // Check which menu is selected and if menu is in edit already
</span><span class="cx"> if ( isset( $_GET['edit-menu'] ) ) {
</span><span class="cx">         $menu_selected_id = (int) $_GET['edit-menu'];
</span><span class="lines">@@ -48,28 +56,39 @@
</span><span class="cx">         $menu_selected_id = 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-if ( isset( $_POST[ 'delete-menu' ] ) && $menu_selected_id > 0 ) {
-        wp_delete_nav_menu( $menu_selected_id );
</del><ins>+// Delete a menu
+if ( isset($_GET['delete-menu']) && $_GET['delete-menu'] > 0 ) {
+        // if ( ! current_user_can('delete_menus') )
+        //         wp_die( __( 'Cheatin&#8217; uh?' ));
+        
+        $menu_id = (int) $_GET['delete-menu'];
+        check_admin_referer( 'delete_menu-' . $menu_id );
+        
+        wp_delete_nav_menu( $menu_id );
+        $messages_div = '<div id="message" class="updated fade below-h2"><p>' . __('Menu successfully deleted.') . '</p></div>';
</ins><span class="cx">         $menu_selected_id = 0;
</span><span class="cx">         $updated = true;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // Default Menu to show
</span><del>-$custom_menus = wp_get_nav_menus();
</del><ins>+$menus = wp_get_nav_menus();
</ins><span class="cx">
</span><del>-if ( empty($custom_menus) && empty($_POST) ) {
</del><ins>+if ( empty($menus) && empty($_POST) ) {
</ins><span class="cx">         wp_create_default_nav_menu();
</span><del>-        $custom_menus = wp_get_nav_menus();
</del><ins>+        $menus = wp_get_nav_menus();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-if ( ! $menu_selected_id && ! empty( $custom_menus ) )
-        $menu_selected_id = $custom_menus[0]->term_id;
</del><ins>+if ( ! $menu_selected_id && ! empty($menus) )
+        $menu_selected_id = $menus[0]->term_id;
</ins><span class="cx">
</span><ins>+// Get the name of the current Menu
</ins><span class="cx"> $menu_title = '';
</span><ins>+$valid_menu = false;
</ins><span class="cx"> if ( $menu_selected_id > 0 ) {
</span><del>-        foreach ( $custom_menus as $menu ) {
</del><ins>+        foreach ( $menus as $menu ) {
</ins><span class="cx">                 if ( $menu->term_id == $menu_selected_id ) {
</span><span class="cx">                         $menu_title = $menu->name;
</span><ins>+                        $valid_menu = true;
</ins><span class="cx">                         break;
</span><span class="cx">                 }
</span><span class="cx">         }
</span><span class="lines">@@ -81,15 +100,15 @@
</span><span class="cx">         $post_counter = 0;
</span><span class="cx">
</span><span class="cx"> // Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
</span><del>-if ( isset( $_POST['add-menu'] ) && ! $updated ) {
-        $insert_menu_name = $_POST['add-menu-name'];
</del><ins>+if ( isset( $_POST['create-menu'] ) && ! $updated ) {
+        $insert_menu_name = $_POST['create-menu-name'];
</ins><span class="cx">
</span><span class="cx">         if ( $insert_menu_name ) {
</span><span class="cx">                 $menu = wp_create_nav_menu( $insert_menu_name );
</span><span class="cx">                 if ( is_wp_error( $menu ) ) {
</span><span class="cx">                         $messages_div = '<div id="message" class="error fade below-h2"><p>' . $menu->get_error_message() . '</p></div>';
</span><span class="cx">                 } else {
</span><del>-                        $custom_menus[$menu->term_id] = $menu;
</del><ins>+                        $menus[$menu->term_id] = $menu;
</ins><span class="cx">                         $menu_selected_id = $menu->term_id;
</span><span class="cx">                         $menu_id_in_edit = $menu_selected_id;
</span><span class="cx">                         $menu_title = $menu->name;
</span><span class="lines">@@ -105,21 +124,21 @@
</span><span class="cx"> if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) {
</span><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><del>-
</del><ins>+        
</ins><span class="cx">         // Loop through all POST variables
</span><span class="cx">         for ( $k = 1; $k <= $post_counter; $k++ ) {
</span><span class="cx">                 $db_id = isset( $_POST['dbid'.$k] )? $_POST['dbid'.$k] : 0;
</span><span class="cx">                 $object_id = isset( $_POST['postmenu'.$k] )? $_POST['postmenu'.$k] : 0;
</span><span class="cx">                 $parent_id = isset( $_POST['parent'.$k] )? $_POST['parent'.$k] : 0;
</span><del>-                $custom_title = isset( $_POST['title'.$k] )? $_POST['title'.$k] : '';
-                $custom_linkurl = ( isset( $_POST['linkurl'.$k] ) && 'custom' == $_POST['linktype'.$k] ) ? $_POST['linkurl'.$k] : '';
-                $custom_description = isset( $_POST['description'.$k] )? $_POST['description'.$k] : '';
</del><ins>+                $custom_title = isset( $_POST['item-title'.$k] )? $_POST['item-title'.$k] : '';
+                $custom_linkurl = ( isset( $_POST['item-url'.$k] ) && 'custom' == $_POST['linktype'.$k] ) ? $_POST['item-url'.$k] : '';
+                $custom_description = isset( $_POST['item-description'.$k] )? $_POST['item-description'.$k] : '';
</ins><span class="cx">                 // doesn't seem to be used by UI
</span><span class="cx">                 $icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0;
</span><span class="cx">                 $position = isset( $_POST['position'.$k] )? $_POST['position'.$k] : 0;
</span><span class="cx">                 $linktype = isset( $_POST['linktype'.$k] )? $_POST['linktype'.$k] : 'custom';
</span><del>-                $custom_anchor_title = isset( $_POST['anchortitle'.$k] )? $_POST['anchortitle'.$k] : $custom_title;
-                $new_window = isset( $_POST['newwindow'.$k] )? $_POST['newwindow'.$k] : 0;
</del><ins>+                $custom_anchor_title = isset( $_POST['item-attr-title'.$k] )? $_POST['item-attr-title'.$k] : $custom_title;
+                $new_window = isset( $_POST['item-target'.$k] )? $_POST['item-target'.$k] : 0;
</ins><span class="cx">
</span><span class="cx">                 $post = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID,
</span><span class="cx">                         'ping_status' => 0, 'post_parent' => 0, 'menu_order' => $position,
</span><span class="lines">@@ -128,7 +147,7 @@
</span><span class="cx">
</span><span class="cx">                 if ( $parent_id > 0 && isset( $parent_menu_ids[$parent_id] ) )
</span><span class="cx">                         $post['post_parent'] = $parent_menu_ids[$parent_id];
</span><del>-
</del><ins>+                
</ins><span class="cx">                 // New menu item
</span><span class="cx">                 if ( $db_id == 0 ) {
</span><span class="cx">                         $db_id = wp_insert_post( $post );
</span><span class="lines">@@ -160,17 +179,16 @@
</span><span class="cx"> ?>
</span><span class="cx"> <div class="wrap">
</span><span class="cx">         <?php screen_icon(); ?>
</span><del>-        <h2><?php esc_html_e('Menus') ?></h2>
</del><ins>+        <h2><?php esc_html_e('Menus'); ?></h2>
</ins><span class="cx">         <?php echo $messages_div; ?>
</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">         
</span><del>-        
-        <form onsubmit="updatepostdata()" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
-                <?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ) : ?>
</del><ins>+        <form onsubmit="wp_update_post_data();" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data">
+                <?php if ( !empty($menus) && count($menus) > 1 ) : ?>
</ins><span class="cx">                 <ul class="subsubsub">
</span><span class="cx">                         <?php
</span><del>-                                foreach ( $custom_menus as $menu ) {
-                                        $sep = end( $custom_menus ) == $menu ? '' : ' | ';
</del><ins>+                                foreach ( $menus as $menu ) {
+                                        $sep = end( $menus ) == $menu ? '' : ' | ';
</ins><span class="cx">                                         if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) ) { ?>
</span><span class="cx">                                                 <li><a href='nav-menus.php?edit-menu=<?php echo esc_attr($menu->term_id); ?>' class="current"><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>
</span><span class="cx">                         <?php        } else { ?>
</span><span class="lines">@@ -181,67 +199,116 @@
</span><span class="cx">                 </ul>
</span><span class="cx">                 <?php endif; ?>
</span><span class="cx">                 
</span><del>-                <div id="menus-container" class="metabox-holder has-right-sidebar">
</del><ins>+                <div id="menu-management" class="metabox-holder has-right-sidebar">
+                        <div id="post-body">
+                                <div id="post-body-content">
+                                        <div id="normal-sortables" class="meta-box-sortables ui-sortable">
+                                        <?php if ( $valid_menu and ! empty( $menus ) ) : ?>
+                                                <div id="menu-container" class="postbox">        
+                                                        <h3 class="hndle"><?php echo esc_html( $menu_title ); ?></h3>
+                                                        <div class="inside">
+                                                                <input type="hidden" name="li-count" id="li-count" value="0" />
+                                                                <input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" />
+
+                                                                <ul id="menu">
+                                                                <?php
+                                                                if ( $menu_selected_id > 0 ) {
+                                                                        wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) );
+                                                                }
+                                                                ?>
+                                                                </ul><!-- /#menu-->
+                                                                
+                                                                <div id="queue" class="hide">
+                                                                </div><!--/#queue-->
+                                                        </div><!-- /.inside -->
+                                                <!-- /#nav-menu-canvas .postbox-->
+                                                </div>
+                                                <p>
+                                                        <script type="text/javascript">
+                                                                wp_update_post_data();
+                                                        </script>
+                                                        <a class="submitdelete deletion" href="<?php echo wp_nonce_url( admin_url('nav-menus.php?delete-menu=' . $menu_selected_id), 'delete_menu-' . $menu_selected_id ); ?>"><?php _e('Delete Menu'); ?></a>
+                                                        <input class="button-primary save" name="save_menu" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" />
+                                                        <br class="clear" />
+                                                </p>
+                                        <?php endif; ?>
+                                        </div><!-- /#normal-sortables-->
+                                </div><!-- /#post-body-content-->
+                        </div><!--- /#post-body -->
</ins><span class="cx">                         <div id="menu-settings-column" class="inner-sidebar">
</span><span class="cx">                                 <div id="side-sortables" class="meta-box-sortables ui-sortable">
</span><span class="cx">                                         
</span><del>-                                        <div id="add-menu" class="postbox">
-                                                <div class="handlediv" title="Click to toggle"><br /></div>
-                                                <h3 class="hndle"><?php esc_html_e('Add Menu'); ?></h3>
</del><ins>+                                        <div id="create-menu" class="postbox">
+                                                <h3 class="hndle"><?php esc_html_e('Create Menu'); ?></h3>
</ins><span class="cx">                                                 <div class="inside">
</span><del>-                                                        <span>
-                                                                <input id="add-menu-name" name="add-menu-name" type="text" class="regular-text" value="" />
-                                                                <input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" />
-                                                        </span>
</del><ins>+                                                        <p>
+                                                                <input type="text" name="create-menu-name" id="create-menu-name" class="regular-text" value="" />
+                                                                <input type="submit" name="create-menu" id="create-menu" class="button" value="<?php esc_attr_e('Create Menu'); ?>" />
+                                                        </p>
</ins><span class="cx">                                                 </div><!-- /.inside-->
</span><del>-                                        </div><!--END #add-menu-->
</del><ins>+                                        </div><!--END #create-menu-->
</ins><span class="cx">                                         
</span><span class="cx">                                         <div id="add-custom-link" class="postbox">
</span><del>-                                                <div class="handlediv" title="Click to toggle"><br /></div>
</del><span class="cx">                                                 <h3 class="hndle"><?php esc_html_e('Add a Custom Link'); ?></h3>
</span><del>-                                                <div class="inside">
</del><ins>+                                                <div class="inside">                                                        
+                                                        <p id="menu-item-url-wrap">
+                                                                <label class="howto" for="menu-item-url">
+                                                                        <span><?php _e('URL'); ?></span>
+                                                                        <input id="menu-item-url" name="menu-item-url" type="text" class="code" value="http://" />
+                                                                </label>
+                                                        </p>
+                                                        <br class="clear" />
+                                                        <p id="menu-item-name-wrap">
+                                                                <label class="howto" for="custom-menu-item-name">
+                                                                        <span><?php _e('Text'); ?></span>
+                                                                        <input id="menu-item-name" type="text" class="regular-text" value="<?php echo esc_attr( __('Menu Item') ); ?>" />
+                                                                </label>
+                                                        </p>
</ins><span class="cx">                                                         
</span><del>-                                                        <p class="howto"><label for="custom-menu-item-url"><input id="custom-menu-item-url" type="text" class="widefat code" value="http://" /><?php _e('URL'); ?></label></p>
-                                                        
-                                                        <?php $template_dir = get_bloginfo('url'); ?>
-                                                        <input type="hidden" id="template-dir" value="<?php echo esc_attr($template_dir); ?>" />
-                                                        
-                                                        <p class="howto"><label for="custom-menu-item-name"><input id="custom-menu-item-name" type="text" class="widefat regular-text" value="<?php echo esc_attr( __('Menu Item') ); ?>" /><?php _e('Text'); ?></label></p>
-                                                        
-                                                        <label class="howto" for="custom_menu_item_description" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>>
-                                                                <input id="custom_menu_item_description" type="text" class="widefat regular-text" value="<?php esc_attr_e('A description'); ?>" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> onfocus="jQuery('#custom_menu_item_description').attr('value','');" />
-                                                                <?php _e('Description'); ?>
-                                                        </label>
-                                                        
-                                                        <?php if ( 'no' != $advanced_option_descriptions ) { echo '<br />'; } ?>
-                                                        
-                                                        <a class="addtomenu button" onclick="appendToList('<?php echo $template_dir; ?>','<?php echo esc_js( _x('Custom', 'menu nav item type') ); ?>','','','','0','');jQuery('#custom-menu-item-name').attr('value','<?php echo esc_js( __('Menu Item') ); ?>');jQuery('#custom_menu_item_description').attr('value','<?php echo esc_js( __('A description') ); ?>');"><?php _e('Add Link'); ?></a>
</del><ins>+                                        <?php if ( $available_links->posts ) : ?>
+                                                        <p class="button-controls">
+                                                                <a class="show-all button"><?php _e('View All'); ?></a>
+                                                                <a class="hide-all button"><?php _e('Hide All'); ?></a>
+                                                        </p>
+                                                        <div id="available-links" class="list-wrap">
+                                                                <div class="list-container">
+                                                                        <ul class="list">
+                                                                        <?php
+                                                                        foreach ( $available_links->posts as $link ) :
+                                                                        $url = get_post_meta( $link->ID, 'menu_link' );
+                                                                        ?>
+                                                                                <li>
+                                                                                        <dl>
+                                                                                                <dt>
+                                                                                                        <label class="item-title"><input type="checkbox" id="link-<?php echo esc_attr($link->ID); ?>" name="<?php echo esc_attr($link->post_title); ?>" value="<?php echo esc_attr($url[0]); ?>" /><?php echo esc_html($link->post_title); ?></label>
+                                                                                                </dt>
+                                                                                        </dl>
+                                                                                </li>
+                                                                        <?php
+                                                                        endforeach;
+                                                                        ?>
+                                                                        </ul>
+                                                                </div><!-- /.list-container-->
+                                                        </div><!-- /#available-links-->
+                                        <?php endif; ?>
+                                                        <p class="add-to-menu">
+                                                                <a class="button"><?php _e('Add to Menu'); ?></a>
+                                                        </p>
</ins><span class="cx">                                                         <br class="clear" />
</span><span class="cx">                                                 </div><!-- /.inside-->
</span><span class="cx">                                         </div><!-- /#add-custom-link-->
</span><span class="cx">                                         
</span><span class="cx">                                         <div id="add-pages" class="postbox">
</span><del>-                                                <div class="handlediv" title="Click to toggle"><br /></div>
</del><span class="cx">                                                 <h3 class="hndle"><?php esc_html_e('Add an Existing Page'); ?></h3>
</span><span class="cx">                                                 <div class="inside">
</span><span class="cx">                                                         <?php
</span><span class="cx">                                                                 $pages_args = array(
</span><del>-                                                                        'child_of' => 0,
-                                                                        'sort_order' => 'ASC',
-                                                                        'sort_column' => 'post_title',
-                                                                        'hierarchical' => 1,
-                                                                        'exclude' => '',
-                                                                        'include' => '',
-                                                                        'meta_key' => '',
-                                                                        'meta_value' => '',
-                                                                        'authors' => '',
-                                                                        'parent' => -1,
-                                                                        'exclude_tree' => '',
-                                                                        'number' => '',
-                                                                        'offset' => 0
</del><ins>+                                                                        'child_of' => 0, 'sort_order' => 'ASC', 'sort_column' => 'post_title', 'hierarchical' => 1,
+                                                                        'exclude' => '', 'include' => '', 'meta_key' => '', 'meta_value' => '', 'authors' => '',
+                                                                        'parent' => -1, 'exclude_tree' => '', 'number' => '', 'offset' => 0
</ins><span class="cx">                                                                 );
</span><span class="cx">                                                                 $page_name = '';
</span><del>-                                                                $pages_array = get_pages($pages_args);
</del><ins>+                                                                $pages_array = get_pages( $pages_args );
</ins><span class="cx">                                                                 if ( $pages_array ) {
</span><span class="cx">                                                                         foreach ( $pages_array as $post ) {
</span><span class="cx">                                                                                 $page_name .= $post->post_title . '|';
</span><span class="lines">@@ -252,38 +319,43 @@
</span><span class="cx">                                                         ?>
</span><span class="cx">                                                         <script type="text/javascript" charset="<?php bloginfo('charset'); ?>">
</span><span class="cx">                                                                 jQuery(document).ready(function(){
</span><del>-                                                                        var posts = "<?php echo esc_js( $page_name ); ?>".split("|");
-                                                                        jQuery("#page-search").autocomplete(posts);
-                                                                        jQuery("#page-search").result(function(event, data, formatted) {
-                                                                                jQuery('#existing-pages').css('display','block');
-                                                                                jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block");
-                                                                                jQuery('#show-pages').hide();
-                                                                                jQuery('#hide-pages').show();
</del><ins>+                                                                        var posts = "<?php echo esc_js( $page_name ); ?>".split('|');
+                                                                        jQuery('#add-pages .quick-search').autocomplete(posts);
+                                                                        
+                                                                        
+                                                                        jQuery('#add-pages .quick-search').result(function(event, data, formatted) {
+                                                                                jQuery('#add-pages .list-wrap').css('display','block');
+                                                                                jQuery("#add-pages .list-wrap dt:contains('" + data + "')").css('display','block');
+                                                                                jQuery('#add-pages .show-all').hide();
+                                                                                jQuery('#add-pages .hide-all').show();
</ins><span class="cx">                                                                         });
</span><del>-                                                                        jQuery('#existing-pages').css('display','none');
</del><span class="cx">                                                                 });
</span><span class="cx">                                                         </script>
</span><del>-                                                        <input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" class="regular-text" value="<?php esc_attr_e('Search Pages'); ?>" />
-
-                                                        <a id="show-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','block');jQuery('#page-search').attr('value','');jQuery('#existing-pages dt').css('display','block');jQuery('#show-pages').hide();jQuery('#hide-pages').show();"><?php _e('View All'); ?></a>
-                                                        <a id="hide-pages" style="cursor:pointer;" onclick="jQuery('#existing-pages').css('display','none');jQuery('#page-search').attr('value','Search Pages');jQuery('#existing-pages dt').css('display','none');jQuery('#show-pages').show();jQuery('#hide-pages').hide();"><?php _e('Hide All'); ?></a>
-
-                                                        <script type="text/javascript">
-                                                                jQuery('#hide-pages').hide();
-                                                        </script>
</del><ins>+                                                        <p>
+                                                                <input type="text" class="quick-search regular-text" value="" />
+                                                                <a class="quick-search-submit button"><?php _e('Search'); ?></a>
+                                                        </p>
</ins><span class="cx">                                                         
</span><ins>+                                                        <p class="button-controls">
+                                                                <a class="show-all button"><?php _e('View All'); ?></a>
+                                                                <a class="hide-all button"><?php _e('Hide All'); ?></a>
+                                                        </p>
</ins><span class="cx">                                                         
</span><del>-                                                        <div id="existing-pages" class="list-container">
-                                                                <ul class="list">
-                                                                <?php $items_counter = wp_nav_menu_get_pages( 0,'default' ); ?>
-                                                                </ul>
-                                                        </div><!-- /.list-container-->
</del><ins>+                                                        <div id="existing-pages" class="list-wrap">
+                                                                <div class="list-container">
+                                                                        <ul class="list">
+                                                                        <?php $items_counter = wp_nav_menu_get_pages( 0, 'default' ); ?>
+                                                                        </ul>
+                                                                </div><!-- /.list-container-->
+                                                        </div><!-- /#existing-pages-->
+                                                        <p class="add-to-menu enqueue">
+                                                                <a class="button"><?php _e('Add to Menu'); ?></a>
+                                                        </p>
</ins><span class="cx">                                                         <br class="clear" />
</span><span class="cx">                                                 </div><!-- /.inside-->
</span><span class="cx">                                         </div><!--END #add-pages-->
</span><span class="cx">                                         
</span><span class="cx">                                         <div id="add-categories" class="postbox">
</span><del>-                                                <div class="handlediv" title="Click to toggle"><br /></div>
</del><span class="cx">                                                 <h3 class="hndle"><?php esc_html_e('Add an Existing Category'); ?></h3>
</span><span class="cx">                                                 <div class="inside">
</span><span class="cx">                                                         <?php
</span><span class="lines">@@ -311,92 +383,85 @@
</span><span class="cx">                                                         ?>
</span><span class="cx">                                                         <script type="text/javascript" charset="<?php bloginfo('charset'); ?>">
</span><span class="cx">                                                                 jQuery(document).ready(function(){
</span><del>-                                                                        var categories = "<?php echo esc_js($cat_name); ?>".split("|");
-                                                                        jQuery("#cat-search").autocomplete(categories);
-                                                                        jQuery("#cat-search").result(function(event, data, formatted) {
-                                                                                jQuery('#existing-categories').css('display','block');
-                                                                                jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block");
-                                                                                jQuery('#show-cats').hide();
-                                                                                jQuery('#hide-cats').show();
</del><ins>+                                                                        var categories = "<?php echo esc_js($cat_name); ?>".split('|');
+                                                                        jQuery('#add-categories .quick-search').autocomplete(categories);
+                                                                        jQuery('#add-categories .quick-search').result(function(event, data, formatted) {
+                                                                                jQuery('#add-categories .list-wrap').css('display','block');
+                                                                                jQuery("#add-categories .list-wrap dt:contains('" + data + "')").css('display','block');
+                                                                                jQuery('#add-categories .show-all').hide();
+                                                                                jQuery('#add-categories .hide-all').show();
</ins><span class="cx">                                                                         });
</span><del>-                                                                        jQuery('#existing-categories').css('display','none');
</del><span class="cx">                                                                 });
</span><span class="cx">                                                         </script>
</span><del>-
-                                                        <input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" class="regular-text" value="<?php esc_attr_e('Search Categories'); ?>" />
-
-                                                        <a id="show-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','block');jQuery('#cat-search').attr('value','');jQuery('#existing-categories dt').css('display','block');jQuery('#show-cats').hide();jQuery('#hide-cats').show();"><?php _e('View All'); ?></a>
-                                                        <a id="hide-cats" style="cursor:pointer;" onclick="jQuery('#existing-categories').css('display','none');jQuery('#cat-search').attr('value','Search Categories');jQuery('#existing-categories dt').css('display','none');jQuery('#show-cats').show();jQuery('#hide-cats').hide();"><?php _e('Hide All'); ?></a>
-
-                                                        <script type="text/javascript">
-                                                                jQuery('#hide-cats').hide();
-                                                        </script>
-
-                                                        <div id="existing-categories" class="list-container">
-                                                                <ul class="list">
-                                                                        <?php $items_counter = wp_nav_menu_get_categories( $items_counter, 'default' ); ?>
-                                                                </ul>
-                                                        </div><!-- /.list-container-->
</del><ins>+                                                        <p>
+                                                                <input type="text" class="quick-search regular-text" value="" />
+                                                                <a class="quick-search-submit button"><?php _e('Search'); ?></a>
+                                                        </p>
+                                                        
+                                                        <p class="button-controls">
+                                                                <a class="show-all button"><?php _e('View All'); ?></a>
+                                                                <a class="hide-all button"><?php _e('Hide All'); ?></a>
+                                                        </p>
+                                                        
+                                                        <div id="existing-categories" class="list-wrap">
+                                                                <div class="list-container">
+                                                                        <ul class="list">
+                                                                                <?php $items_counter = wp_nav_menu_get_categories( $items_counter, 'default' ); ?>
+                                                                        </ul>
+                                                                </div><!-- /.list-container-->
+                                                        </div><!-- /#existing-categories-->
+                                                        <p class="add-to-menu enqueue">
+                                                                <a class="button"><?php _e('Add to Menu'); ?></a>
+                                                        </p>
</ins><span class="cx">                                                         <br class="clear" />
</span><span class="cx">                                                 </div><!-- /.inside-->
</span><span class="cx">                                         </div><!--END #add-categories-->
</span><span class="cx">                                 </div><!-- /#side-sortables-->
</span><span class="cx">                         </div><!-- /#menu-settings-column -->
</span><del>-
-                        <div id="post-body">
-                                <div id="post-body-content">
-                                        <div id="normal-sortables" class="meta-box-sortables ui-sortable">
-                                        
-                                        <?php if ( ! empty( $custom_menus ) ) : ?>
-                                                <div id="nav-container" class="postbox">        
-                                                        <h3 class="hndle"><?php echo esc_html( $menu_title ); ?></h3>
-                                                        <div class="inside">
-                                                                <input type="hidden" name="li-count" id="li-count" value="0" />
-                                                                <input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" />
-
-                                                                <ul id="custom-nav">
-                                                                <?php
-                                                                if ( $menu_selected_id > 0 ) {
-                                                                        wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) );
-                                                                }
-                                                                ?>
-                                                                </ul><!-- /#custom-nav-->
-                                                        </div><!-- /.inside -->
-                                                <!-- /#nav-menu-canvas .postbox-->
-                                                </div>
-                                                <p class="submit">
-                                                        <script type="text/javascript">
-                                                                updatepostdata();
-                                                        </script>
-                                                        <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"><p><?php _e( 'Add a menu to start editing!' ); ?></p></div>
-                                        <?php endif; ?>
-                                        </div><!-- /#normal-sortables-->
-                                </div><!-- /#post-body-content-->
-                        </div><!--- /#post-body -->
</del><span class="cx">                         <br class="clear" />
</span><span class="cx">                 </div><!-- /.metabox-holder has-right-sidebar-->
</span><span class="cx">         </form>
</span><span class="cx"> </div><!-- /.wrap-->
</span><span class="cx">
</span><del>-<div id="dialog-confirm" style="display:none;" title="<?php esc_attr_e('Edit Menu Item'); ?>">
-        <span id="edittitle-wrap"><input id="edittitle" type="text" name="edittitle" value="" /><label class="editlabel" for="edittitle"><?php _e('Menu Title'); ?></label><br /></span>
-        <span id="editlink-wrap"><input id="editlink" type="text" name="editlink" value="" /><label class="editlabel" for="editlink"><?php _e('URL'); ?></label><br /></span>
-        <span id="editanchortitle-wrap"><input id="editanchortitle" type="text" name="editanchortitle" value="" /><label class="editlabel" for="editanchortitle"><?php _e('Link Title'); ?></label><br /></span>
-        <span id="editnewwindow-wrap">
-        <select id="editnewwindow" name="editnewwindow">
-                <option value="1"><?php _e('Yes'); ?></option>
-                <option value="0"><?php _e('No'); ?></option>
-        </select><label class="editlabel" for="editnewwindow"><?php _e('Open Link in a new window'); ?></label>
-        </span>
-        <span id="editdescription-wrap">
-        <input id="editdescription" type="text" name="editdescription" value="" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> /><label class="editlabel" for="editdescription" <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label><br /></span>
-</div>
</del><ins>+<div id="menu-item-settings">
+        <p class="description">
+                <label for="edit-item-title">
+                        <?php _e( 'Menu Title' ); ?><br />
+                        <input type="text" id="edit-item-title" class="widefat" name="edit-item-title" value="" tabindex="1" />
+                </label>
+        </p>
+        <p class="description">
+                <label for="edit-item-url">
+                        <?php _e( 'URL' ); ?><br />
+                        <input type="text" id="edit-item-url" class="widefat code" name="edit-item-url" value="" tabindex="2" />
+                </label>
+        </p>
+        <p class="description">
+                <label for="edit-item-attr-title">
+                        <?php _e( 'Attribute Title' ); ?><br />
+                        <input type="text" id="edit-item-attr-title" class="widefat" name="edit-item-attr-title" value="" tabindex="3" />
+                </label>
+        </p>
+        <p class="description">
+                <label for="edit-item-target">
+                        <?php _e( 'Open Link in a new window' ); ?><br />
+                        <select id="edit-item-target" class="widefat" name="edit-item-target">
+                                <option value="1">Yes</option>
+                                <option value="0">No</option>
+                        </select>
+                </label>
+        </p>
+        <p class="description">
+                <label for="edit-item-description">
+                        <?php _e( 'Description' ); ?><br />
+                        <textarea id="edit-item-description" class="widefat" rows="3" name="edit-item-description" tabindex="4" /></textarea>
+                </label>
+        </p>
+        <p>
+                <a id="cancel-save" class="submitdelete deletion"><?php _e('Cancel'); ?></a>
+                <a id="update-menu-item" class="save button-primary" tabindex="5"><?php _e('Save Changes'); ?></a>
+        </p>
+        <input type="hidden" id="edit-item-id" name="edit-item-id" value="" />
+</div><!-- /#menu-item-settings-->
</ins><span class="cx">
</span><del>-<?php
-
-include( 'admin-footer.php' );
</del><ins>+<?php include( 'admin-footer.php' ); ?>
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesdefaultwidgetsphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/default-widgets.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/default-widgets.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-includes/default-widgets.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -1045,7 +1045,7 @@
</span><span class="cx">
</span><span class="cx">         function WP_Nav_Menu_Widget() {
</span><span class="cx">                 $widget_ops = array('description' => __('Use this widget to add one of your navigation menus as a widget.') );
</span><del>-                parent::WP_Widget(false, __('Navigation Menu'), $widget_ops);
</del><ins>+                parent::WP_Widget( false, __('Navigation Menu'), $widget_ops );
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function widget($args, $instance) {
</span><span class="lines">@@ -1060,7 +1060,7 @@
</span><span class="cx">                 $navulclass = $instance['navulclass'];
</span><span class="cx">
</span><span class="cx">                 // Override for menu descriptions
</span><del>-                $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
</del><ins>+                $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
</ins><span class="cx">                 if ( $advanced_option_descriptions == 'no' ) {
</span><span class="cx">                         $navwidgetdescription = 2;
</span><span class="cx">                 } else {
</span><span class="lines">@@ -1104,19 +1104,19 @@
</span><span class="cx">                         } else {
</span><span class="cx">                                 // DISPLAY default UL
</span><span class="cx">                                 ?>
</span><del>-                                <ul class="custom-nav">
</del><ins>+                                <ul class="menu">
</ins><span class="cx">                                 <?php
</span><span class="cx">                         }
</span><span class="cx">                         wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') );
</span><span class="cx">                         if ( $navdeveloper == 'yes' ) {
</span><del>-                                //DISPLAY Custom UL
</del><ins>+                                // DISPLAY Custom UL
</ins><span class="cx">                                 if ( $navul == 'yes' ) {
</span><span class="cx">                                         ?>
</span><span class="cx">                                         </ul>
</span><span class="cx">                                         <?php
</span><span class="cx">                                 }
</span><span class="cx">                         } else {
</span><del>-                                //DISPLAY default UL
</del><ins>+                                // DISPLAY default UL
</ins><span class="cx">                                 ?>
</span><span class="cx">                                 </ul>
</span><span class="cx">                                 <?php
</span><span class="lines">@@ -1257,7 +1257,7 @@
</span><span class="cx">                         </p>
</span><span class="cx">                 <?php
</span><span class="cx">                 }
</span><del>-                $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
</del><ins>+                $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
</ins><span class="cx">                 ?>
</span><span class="cx">                 <p <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?>>
</span><span class="cx">                  <?php $checked = strtolower($navwidgetdescription); ?>
</span></span></pre></div>
<a id="trunkwpincludesnavmenutemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu-template.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu-template.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-includes/nav-menu-template.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -3,20 +3,35 @@
</span><span class="cx"> /**
</span><span class="cx"> * Outputs a navigation menu.
</span><span class="cx"> *
</span><ins>+ * Optional $args contents:
+ *
+ * id - The menu id. Defaults to blank.
+ * slug - The menu slug. Defaults to blank.
+ * menu_class - CSS class to use for the div container of the menu list. Defaults to 'menu'.
+ * format - Whether to format the ul. Defaults to 'div'.
+ * fallback_cb - If the menu doesn't exists, a callback function will fire. Defaults to 'wp_page_menu'.
+ *
+ * TODO:
+ * show_home - If you set this argument, then it will display the link to the home page. The show_home argument really just needs to be set to the value of the text of the link.
+ * link_before - Text before show_home argument text.
+ * link_after - Text after show_home argument text.
+ * echo - Whether to echo the menu or return it. Defaults to echo.
+ *
</ins><span class="cx"> * @since 3.0.0
</span><span class="cx"> *
</span><span class="cx"> * @param array $args Arguments
</span><span class="cx"> */
</span><span class="cx"> function wp_nav_menu( $args = array() ) {
</span><del>-        $defaults = array('id' => '', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div', 'fallback_cb' => 'wp_page_menu');
-        $args = wp_parse_args($args, $defaults);
</del><ins>+        $defaults = array( 'id' => '', 'slug' => '', 'menu_class' => 'menu', 'format' => 'div', 'fallback_cb' => 'wp_page_menu', 'echo' => true, 'link_before' => '', 'link_after' => '' );
+        $args = wp_parse_args( $args, $defaults );
</ins><span class="cx">         $args = (object) $args;
</span><del>-
</del><ins>+        
+        // Get the menu
</ins><span class="cx">         $menu = null;
</span><span class="cx">         if ( !empty($args->id) ) {
</span><span class="cx">                 $menu = wp_get_nav_menu( $args->id );
</span><span class="cx">         } elseif ( !empty($args->slug) ) {
</span><del>-                $menu = get_term_by('slug', $args->slug, 'nav_menu');
</del><ins>+                $menu = get_term_by( 'slug', $args->slug, 'nav_menu' );
</ins><span class="cx">         } else {
</span><span class="cx">                 $menus = wp_get_nav_menus();
</span><span class="cx">                 foreach ( $menus as $menu_maybe ) {
</span><span class="lines">@@ -26,7 +41,8 @@
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">         }
</span><del>-
</del><ins>+        
+        // If the menu doesn't exists, call the fallback_cb
</ins><span class="cx">         if ( !$menu || is_wp_error($menu) )
</span><span class="cx">                 return call_user_func($args->fallback_cb, $args );
</span><span class="cx">
</span><span class="lines">@@ -85,19 +101,18 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function wp_print_nav_menu_item($menu_item, $context, $args = array() ) {
</del><ins>+function wp_print_nav_menu_item( $menu_item, $context, $args = array() ) {
</ins><span class="cx">         switch ( $context ) {
</span><span class="cx">                 case 'backend':
</span><span class="cx">                 case 'menu':
</span><span class="cx"> ?>
</span><span class="cx">                                                 <dl>
</span><span class="cx">                                                         <dt>
</span><del>-                                                                <span class="title"><?php echo esc_html($menu_item->title); ?></span>
-                                                                <span class="controls">
-                                                                <span class="type"><?php echo esc_html($menu_item->type); ?></span>
-                                                                <a id="edit<?php echo esc_attr( $menu_item->menu_order ); ?>" onclick="edititem(<?php echo esc_attr( $menu_item->menu_order ); ?>)" value="<?php echo esc_attr( $menu_item->menu_order ); ?>"><img class="edit" alt="<?php esc_attr_e('Edit Menu Item'); ?>" title="<?php esc_attr_e('Edit Menu Item'); ?>" src="<?php echo admin_url('images/ico-edit.png'); ?>" /></a>
-                                                                <a id="remove<?php echo esc_attr( $menu_item->menu_order ); ?>" onclick="removeitem(<?php echo esc_attr( $menu_item->menu_order ); ?>)" value="<?php echo esc_attr( $menu_item->menu_order ); ?>"><img class="remove" alt="<?php esc_attr_e('Remove from Menu'); ?>" title="<?php esc_attr_e('Remove from Menu'); ?>" src="<?php echo admin_url('images/ico-close.png'); ?>" /></a>
-                                                                <a id="view<?php echo esc_attr( $menu_item->menu_order ); ?>" target="_blank" href="<?php echo $menu_item->link; ?>"><img alt="<?php esc_attr_e('View Page'); ?>" title="<?php esc_attr_e('View Page'); ?>" src="<?php echo admin_url('images/ico-viewpage.png'); ?>" /></a>
</del><ins>+                                                                <span class="item-title"><?php echo esc_html($menu_item->title); ?></span>
+                                                                <span class="item-controls">
+                                                                        <span class="item-type"><?php echo esc_html($menu_item->type); ?></span>
+                                                                        <a class="item-edit thickbox" id="edit<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" title="<?php _e('Edit Menu Item'); ?>" href="#TB_inline?height=380&width=300&inlineId=menu-item-settings"><?php _e('Edit'); ?></a> |
+                                                                        <a class="item-delete" id="delete<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>"><?php _e('Delete'); ?></a>
</ins><span class="cx">                                                                 </span>
</span><span class="cx">                                                         </dt>
</span><span class="cx">                                                 </dl>
</span><span class="lines">@@ -109,20 +124,20 @@
</span><span class="cx">                                                 <input type="hidden" name="dbid<?php echo esc_attr( $menu_item->menu_order ); ?>" id="dbid<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->ID ); ?>" />
</span><span class="cx">                                                 <input type="hidden" name="postmenu<?php echo esc_attr( $menu_item->menu_order ); ?>" id="postmenu<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( get_post_meta( $menu_item->ID, 'object_id', true ) ); ?>" />
</span><span class="cx">                                                 <input type="hidden" name="parent<?php echo esc_attr( $menu_item->menu_order ); ?>" id="parent<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->parent_item ); ?>" />
</span><del>-                                                <input type="hidden" name="title<?php echo esc_attr( $menu_item->menu_order ); ?>" id="title<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->title ); ?>" />
-                                                <input type="hidden" name="linkurl<?php echo esc_attr( $menu_item->menu_order ); ?>" id="linkurl<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>" />
-                                                <input type="hidden" name="description<?php echo esc_attr( $menu_item->menu_order ); ?>" id="description<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->description ); ?>" />
</del><span class="cx">                                                 <input type="hidden" name="icon<?php echo esc_attr( $menu_item->menu_order ); ?>" id="icon<?php echo esc_attr( $menu_item->menu_order ); ?>" value="0" />
</span><span class="cx">                                                 <input type="hidden" name="position<?php echo esc_attr( $menu_item->menu_order ); ?>" id="position<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->menu_order ); ?>" />
</span><span class="cx">                                                 <input type="hidden" name="linktype<?php echo esc_attr( $menu_item->menu_order ); ?>" id="linktype<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( get_post_meta( $menu_item->ID, 'menu_type', true ) ); ?>" />
</span><del>-                                                <input type="hidden" name="anchortitle<?php echo esc_attr( $menu_item->menu_order ); ?>" id="anchortitle<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->post_excerpt ); ?>" />
-                                                <input type="hidden" name="newwindow<?php echo esc_attr( $menu_item->menu_order ); ?>" id="newwindow<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo ( get_post_meta( $menu_item->ID, 'menu_new_window', true ) ? '1' : '0' ); ?>" />
</del><ins>+                                                <input type="hidden" name="item-title<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-title<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->title ); ?>" />
+                                                <input type="hidden" name="item-url<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-url<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>" />
+                                                <input type="hidden" name="item-description<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-description<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->description ); ?>" />
+                                                <input type="hidden" name="item-attr-title<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-attr-title<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo esc_attr( $menu_item->post_excerpt ); ?>" />
+                                                <input type="hidden" name="item-target<?php echo esc_attr( $menu_item->menu_order ); ?>" id="item-target<?php echo esc_attr( $menu_item->menu_order ); ?>" value="<?php echo ( get_post_meta( $menu_item->ID, 'menu_new_window', true ) ? '1' : '0' ); ?>" />
</ins><span class="cx"> <?php
</span><span class="cx">                 break;
</span><span class="cx">
</span><span class="cx">                 case 'frontend':
</span><span class="cx">                         // Override for menu descriptions
</span><del>-                        $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options');
</del><ins>+                        $advanced_option_descriptions = get_option('wp_settings_nav_menu_advanced_options');
</ins><span class="cx">                         if ( $advanced_option_descriptions == 'no' )
</span><span class="cx">                                 $args['desc'] = 2;
</span><span class="cx"> ?>
</span><span class="lines">@@ -148,11 +163,11 @@
</span><span class="cx">                 break;
</span><span class="cx">
</span><span class="cx">                 case 'default':
</span><del>-                        $template_dir = get_bloginfo('url');
</del><ins>+                        $menu_id = 'menu-item-' . $menu_item->ID;
</ins><span class="cx"> ?>
</span><span class="cx">                                         <dl>
</span><span class="cx">                                                 <dt>
</span><del>-                                                        <a class="title" title="<?php esc_attr_e('Add to Menu'); ?>" onclick="appendToList('<?php echo esc_js( esc_url_raw( $template_dir ) ); ?>','<?php echo esc_js( $menu_item->append ); ?>','<?php echo esc_js( $menu_item->title ); ?>','<?php echo esc_js( $menu_item->link ); ?>','<?php echo esc_js( $menu_item->ID ); ?>','<?php echo esc_js( $menu_item->parent_item ); ?>','<?php echo esc_js( $menu_item->description ); ?>')" name="<?php echo esc_attr( $menu_item->title ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>"><?php echo $menu_item->title; ?></a>
</del><ins>+                                                        <label class="item-title"><input type="checkbox" id="<?php echo esc_attr($menu_id); ?>" onclick="wp_update_queue('<?php echo esc_js( $menu_item->append ); ?>','<?php echo esc_js( $menu_item->title ); ?>','<?php echo esc_js( $menu_item->link ); ?>','<?php echo esc_js( $menu_item->ID ); ?>','<?php echo esc_js( $menu_item->parent_item ); ?>','<?php echo esc_js( $menu_item->description ); ?>')" name="<?php echo esc_attr( $menu_item->title ); ?>" value="<?php echo esc_attr( $menu_item->link ); ?>" /><?php echo $menu_item->title; ?></label>
</ins><span class="cx">                                                 </dt>
</span><span class="cx">                                         </dl>
</span><span class="cx"> <?php
</span></span></pre></div>
<a id="trunkwpincludesnavmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/nav-menu.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/nav-menu.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-includes/nav-menu.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -7,6 +7,7 @@
</span><span class="cx"> * @since 3.0.0
</span><span class="cx"> */
</span><span class="cx">
</span><ins>+// Deletes a nav menu
</ins><span class="cx"> function wp_delete_nav_menu( $menu_id ) {
</span><span class="cx">         $menu_id = (int) $menu_id;
</span><span class="cx">         if ( !$menu_id )
</span><span class="lines">@@ -21,11 +22,12 @@
</span><span class="cx">         wp_delete_term( $menu_id, 'nav_menu' );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Creates a new nav menu
</ins><span class="cx"> function wp_create_nav_menu( $menu_name, $args = array() ) {
</span><span class="cx">         $menu_exists = get_term_by( 'name', $menu_name, 'nav_menu' );
</span><span class="cx">
</span><span class="cx">         if ( $menu_exists )
</span><del>-                return new WP_Error('menu_exists', sprintf( __('A menu named &#8220;%s&#8221; already exists; please try another name.'), esc_html( $menu_exists->name ) ) );
</del><ins>+                return new WP_Error( 'menu_exists', sprintf( __('A menu named &#8220;%s&#8221; already exists; please try another name.'), esc_html( $menu_exists->name ) ) );
</ins><span class="cx">
</span><span class="cx">         if ( isset($args['slug']) )
</span><span class="cx">                 $slug = $args['slug'];
</span><span class="lines">@@ -40,8 +42,9 @@
</span><span class="cx">         return get_term( $menu['term_id'], 'nav_menu');
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Creates a default menu if none exists
</ins><span class="cx"> function wp_create_default_nav_menu() {
</span><del>-        $menu = wp_create_nav_menu(__('Main'), array('slug' => 'main'));
</del><ins>+        $menu = wp_create_nav_menu( __('Menu 1'), array('slug' => 'menu-1') );
</ins><span class="cx">
</span><span class="cx">         if ( is_wp_error($menu) )
</span><span class="cx">                 return;
</span><span class="lines">@@ -49,7 +52,7 @@
</span><span class="cx">         $pages = get_pages( array('parent' => 0, 'number' => 15) );
</span><span class="cx">         $counter = 1;
</span><span class="cx">         foreach ( $pages as $page ) {
</span><del>-                $item = array('post_status' => 'publish', 'post_type' => 'nav_menu_item', 'menu_order' => $counter, 'tax_input' => array( 'nav_menu' => $menu->name), 'post_title' => addslashes($page->post_title) );
</del><ins>+                $item = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'menu_order' => $counter, 'tax_input' => array( 'nav_menu' => $menu->name), 'post_title' => addslashes($page->post_title) );
</ins><span class="cx">                 $item_id = wp_insert_post($item, true);
</span><span class="cx">                 update_post_meta( $item_id, 'menu_type', 'page' );
</span><span class="cx">                 update_post_meta( $item_id, 'object_id', $page->ID );
</span><span class="lines">@@ -58,14 +61,17 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Get nav menu by id
</ins><span class="cx"> function wp_get_nav_menu( $menu ) {
</span><del>-        return get_term( (int) $menu, 'nav_menu');
</del><ins>+        return get_term( (int) $menu, 'nav_menu' );
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+// Get all nav menus
</ins><span class="cx"> function wp_get_nav_menus() {
</span><span class="cx">         return get_terms( 'nav_menu', array( 'hide_empty' => false, 'orderby' => 'id' ) );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// Get the nav menu items
</ins><span class="cx"> function wp_get_nav_menu_items( $menu, $args = array() ) {
</span><span class="cx">         $items = get_objects_in_term( (int) $menu, 'nav_menu' );
</span><span class="cx">
</span><span class="lines">@@ -92,6 +98,7 @@
</span><span class="cx">         return $items;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+// wp_setup_nav_menu_item()
</ins><span class="cx"> function wp_setup_nav_menu_item($menu_item, $type = 'item', $position = 0) {
</span><span class="cx">         global $parent_menu_order;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpincludesscriptloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/script-loader.php (13472 => 13473)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/script-loader.php        2010-02-27 22:54:40 UTC (rev 13472)
+++ trunk/wp-includes/script-loader.php        2010-02-27 23:06:56 UTC (rev 13473)
</span><span class="lines">@@ -398,11 +398,13 @@
</span><span class="cx">
</span><span class="cx">                 // Custom Navigation
</span><span class="cx">                 $scripts->add( 'nav-menu-default-items', "/wp-admin/js/nav-menu-default-items$suffix.js", false, '20100223' );
</span><del>-                $scripts->add( 'nav-menu-dynamic-functions', "/wp-admin/js/nav-menu-dynamic-functions$suffix.js", false, '20100224b' );
</del><ins>+                $scripts->add( 'nav-menu-dynamic-functions', "/wp-admin/js/nav-menu-dynamic-functions$suffix.js", false, '20100225b' );
</ins><span class="cx">                 $scripts->localize( 'nav-menu-dynamic-functions', 'navMenuL10n', array(
</span><span class="cx">                         'custom' => _x('Custom', 'menu nav item type'),
</span><span class="cx">                         'page' => _x('Page', 'menu nav item type'),
</span><del>-                        'category' => _x('Category', 'menu nav item type')
</del><ins>+                        'category' => _x('Category', 'menu nav item type'),
+                        'thickbox' => _x('Edit Menu Item', 'Thickbox Title'),
+                        'edit' => _x('Edit', 'menu item edit text'),
</ins><span class="cx">                 ) );
</span><span class="cx">                 
</span><span class="cx">                 $scripts->add( 'nav-menu-php-functions', "/wp-admin/js/nav-menu-php-functions$suffix.js", false, '20100220' );
</span><span class="lines">@@ -474,7 +476,7 @@
</span><span class="cx">         $styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.2' );
</span><span class="cx">         $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' );
</span><span class="cx">         $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' );
</span><del>-        $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100225' );
</del><ins>+        $styles->add( 'nav-menu', "/wp-admin/css/nav-menu$suffix.css", array(), '20100225b' );
</ins><span class="cx">
</span><span class="cx">         foreach ( $rtl_styles as $rtl_style ) {
</span><span class="cx">                 $styles->add_data( $rtl_style, 'rtl', true );
</span></span></pre>
</div>
</div>
</body>
</html>