Changeset 13375
- Timestamp:
- 02/24/2010 06:52:54 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/css/custom-navigation.css
r13372 r13375 1 .fix{clear:both;height:1px;margin:-1px 0 0;overflow:hidden;}.maintitle{margin:0 0 20px 0!important;}.logo{vertical-align:middle;margin:0 10px 0 0;}#pages-left{min-width:650px;max-width:1100px;width:100%;float:left;clear:left;margin-right:-315px;}#pages-left .inside{margin-top:20px;margin-right:315px;}#nav-container{margin-top:-3px;}.sidebar-name{background-color:#AAA;background-image:url(../images/ed-bg.gif);border-color:#DFDFDF;text-shadow:0 1px 0 #FFF;-moz-border-radius-topleft:8px;-moz-border-radius-topright:8px;background-position:0 0;background-repeat:repeat-x;border-style:solid;border-width:1px;cursor:pointer;font-size:13px;}.sidebar-name h3{font-size:13px;height:19px;margin:0;overflow:hidden;padding:5px 12px;white-space:nowrap;}.sidebar-name-arrow{background:transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;float:right;height:29px;width:26px;}#menu-right{width:285px;margin-top:20px;margin-right:10px;margin-left:20px;float:left;clear:right;}h2.heading{margin:32px 0 10px 0;}.widgets-holder-wrap{margin:0 0 20px 0;}.widget-holder{padding:15px 10px;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;border-style:none solid solid;border-width:0 1px 1px;background-color:#F1F1F1;border-color:#DDD;}.checkboxes{float:right;margin:10px 12px 0 0;}.addtomenu{display:block;float:right;margin:10px 0 0 0;text-shadow:0 -1px 0 rgba(0,0,0,0.3);background:#21759B url(../images/button-grad.png) repeat-x scroll left top;border-color:#298CBA!important;color:#FFF!important;font-weight:bold;-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:16px;padding:2px 8px;text-decoration:none;}.list{zoom:1;}.list li{margin:0;}.list dt{display:none;float:left;width:260px;margin:0;padding:0 0 0 5px;line-height:30px;border-bottom:1px solid #e3e3e3;}.list dt span{float:left;}.list dt img{cursor:pointer;float:right;margin:7px 5px 0 0;}#nav-container{padding:0 10px 10px 10px;background-color:#fff;border:1px solid #DFDFDF;border-top:none;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;}#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;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;}#existing-pages li .title{background:url(../images/ico-arrow.png) no-repeat 4px 13px;padding-left:15px;}#existing-pages li ul li .title{margin-left:10px;}#existing-pages li ul li ul li .title{margin-left:20px;}#existing-pages li ul li ul li ul li .title{margin-left:30px;}#existing-pages li ul li ul li ul li ul li .title{margin-left:40px;}#existing-pages li ul li ul li ul li ul li ul li .title{margin-left:50px;}#existing-pages li ul li ul li ul li ul li ul li ul li .title{margin-left:60px;}#existing-pages li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:70px;}#existing-pages li ul li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:80px;}#existing-categories li .title{background:url(../images/ico-arrow.png) no-repeat 4px 13px;padding-left:15px;}#existing-categories li ul li .title{margin-left:10px;}#existing-categories li ul li ul li .title{margin-left:20px;}#existing-categories li ul li ul li ul li .title{margin-left:30px;}#existing-categories li ul li ul li ul li ul li .title{margin-left:40px;}#existing-categories li ul li ul li ul li ul li ul li .title{margin-left:50px;}#existing-categories li ul li ul li ul li ul li ul li ul li .title{margin-left:60px;}#existing-categories li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:70px;}#existing-categories li ul li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:80px;}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;} #reset_wp_menu{background:#c77 none!important;color:white!important;text-shadow:0 1px 0 #555!important;}1 .fix{clear:both;height:1px;margin:-1px 0 0;overflow:hidden;}.maintitle{margin:0 0 20px 0!important;}.logo{vertical-align:middle;margin:0 10px 0 0;}#pages-left{min-width:650px;max-width:1100px;width:100%;float:left;clear:left;margin-right:-315px;}#pages-left .inside{margin-top:20px;margin-right:315px;}#nav-container{margin-top:-3px;}.sidebar-name{background-color:#AAA;background-image:url(../images/ed-bg.gif);border-color:#DFDFDF;text-shadow:0 1px 0 #FFF;-moz-border-radius-topleft:8px;-moz-border-radius-topright:8px;background-position:0 0;background-repeat:repeat-x;border-style:solid;border-width:1px;cursor:pointer;font-size:13px;}.sidebar-name h3{font-size:13px;height:19px;margin:0;overflow:hidden;padding:5px 12px;white-space:nowrap;}.sidebar-name-arrow{background:transparent url(../images/menu-bits.gif) no-repeat scroll left -109px;float:right;height:29px;width:26px;}#menu-right{width:285px;margin-top:20px;margin-right:10px;margin-left:20px;float:left;clear:right;}h2.heading{margin:32px 0 10px 0;}.widgets-holder-wrap{margin:0 0 20px 0;}.widget-holder{padding:15px 10px;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;border-style:none solid solid;border-width:0 1px 1px;background-color:#F1F1F1;border-color:#DDD;}.checkboxes{float:right;margin:10px 12px 0 0;}.addtomenu{display:block;float:right;margin:10px 0 0 0;text-shadow:0 -1px 0 rgba(0,0,0,0.3);background:#21759B url(../images/button-grad.png) repeat-x scroll left top;border-color:#298CBA!important;color:#FFF!important;font-weight:bold;-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:16px;padding:2px 8px;text-decoration:none;}.list{zoom:1;}.list li{margin:0;}.list dt{display:none;float:left;width:260px;margin:0;padding:0 0 0 5px;line-height:30px;border-bottom:1px solid #e3e3e3;}.list dt span{float:left;}.list dt img{cursor:pointer;float:right;margin:7px 5px 0 0;}#nav-container{padding:0 10px 10px 10px;background-color:#fff;border:1px solid #DFDFDF;border-top:none;-moz-border-radius-bottomleft:8px;-moz-border-radius-bottomright:8px;}#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;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;}#existing-pages li .title{background:url(../images/ico-arrow.png) no-repeat 4px 13px;padding-left:15px;}#existing-pages li ul li .title{margin-left:10px;}#existing-pages li ul li ul li .title{margin-left:20px;}#existing-pages li ul li ul li ul li .title{margin-left:30px;}#existing-pages li ul li ul li ul li ul li .title{margin-left:40px;}#existing-pages li ul li ul li ul li ul li ul li .title{margin-left:50px;}#existing-pages li ul li ul li ul li ul li ul li ul li .title{margin-left:60px;}#existing-pages li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:70px;}#existing-pages li ul li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:80px;}#existing-categories li .title{background:url(../images/ico-arrow.png) no-repeat 4px 13px;padding-left:15px;}#existing-categories li ul li .title{margin-left:10px;}#existing-categories li ul li ul li .title{margin-left:20px;}#existing-categories li ul li ul li ul li .title{margin-left:30px;}#existing-categories li ul li ul li ul li ul li .title{margin-left:40px;}#existing-categories li ul li ul li ul li ul li ul li .title{margin-left:50px;}#existing-categories li ul li ul li ul li ul li ul li ul li .title{margin-left:60px;}#existing-categories li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:70px;}#existing-categories li ul li ul li ul li ul li ul li ul li ul li ul li .title{margin-left:80px;}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;} -
trunk/wp-admin/css/custom-navigation.dev.css
r13372 r13375 162 162 .ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .60;filter:Alpha(Opacity=60); } 163 163 .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; } 164 165 166 #reset_wp_menu { background:#c77 none !important;color:white!important;text-shadow:0 1px 0 #555 !important;} -
trunk/wp-admin/includes/nav-menu.php
r13369 r13375 30 30 $pages_array = get_pages($pages_args); 31 31 32 $i ntCounter = $counter;33 $parentli = $i ntCounter;32 $items_counter = $counter; 33 $parentli = $items_counter; 34 34 35 35 if ( !$pages_array ) { 36 echo 'Not Found';37 return $i ntCounter;36 echo __('Not Found'); 37 return $items_counter; 38 38 } 39 39 … … 41 41 foreach ( $pages_array as $post ) { 42 42 if ( $post->post_parent == 0 ) { 43 $post = wp_setup_nav_menu_item($post, 'page', $i ntCounter);43 $post = wp_setup_nav_menu_item($post, 'page', $items_counter); 44 44 if ( $type == 'menu' ) { 45 45 ?> 46 46 47 <li id="menu-<?php echo $i ntCounter; ?>" value="<?php echo $intCounter; ?>">48 <?php 49 wp_print_nav_menu_item($post, 'menu', $i ntCounter);47 <li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>"> 48 <?php 49 wp_print_nav_menu_item($post, 'menu', $items_counter); 50 50 $parentli = $post->ID; 51 $i ntCounter++;52 $i ntCounter = wp_custom_navigation_default_sub_items($post->ID, $intCounter, $parentli, 'pages', 'menu');51 $items_counter++; 52 $items_counter = wp_custom_navigation_default_sub_items($post->ID, $items_counter, $parentli, 'pages', 'menu'); 53 53 ?> 54 54 </li> … … 62 62 wp_print_nav_menu_item($post, 'default'); 63 63 $parentli = $post->ID; 64 $i ntCounter++;65 $i ntCounter = wp_nav_menu_sub_items($post->ID, $intCounter, $parentli, 'pages', 'default');64 $items_counter++; 65 $items_counter = wp_nav_menu_sub_items($post->ID, $items_counter, $parentli, 'pages', 'default'); 66 66 ?> 67 67 </li> … … 72 72 } 73 73 74 return $i ntCounter;74 return $items_counter; 75 75 } 76 76 … … 91 91 'pad_counts' => false ); 92 92 93 $i ntCounter = $counter;93 $items_counter = $counter; 94 94 95 95 // Get all categories … … 98 98 if ( !$categories_array ) { 99 99 _e('Not Found'); 100 return $i ntCounter;100 return $items_counter; 101 101 } 102 102 … … 104 104 foreach ( $categories_array as $cat_item ) { 105 105 if ( $cat_item->parent == 0 ) { 106 $cat_item = wp_setup_nav_menu_item($cat_item, 'category', $i ntCounter);106 $cat_item = wp_setup_nav_menu_item($cat_item, 'category', $items_counter); 107 107 // Custom Menu 108 108 if ( $type == 'menu' ) { 109 109 ?> 110 110 111 <li id="menu-<?php echo $i ntCounter; ?>" value="<?php echo $intCounter; ?>">111 <li id="menu-<?php echo $items_counter; ?>" value="<?php echo $items_counter; ?>"> 112 112 <?php 113 113 wp_print_nav_menu_item($cat_item, 'menu'); 114 114 $parentli = $cat_item->cat_ID; 115 $i ntCounter++;116 $i ntCounter = wp_nav_menu_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'menu');115 $items_counter++; 116 $items_counter = wp_nav_menu_sub_items($cat_item->cat_ID, $items_counter, $parentli, 'categories', 'menu'); 117 117 ?> 118 118 … … 127 127 wp_print_nav_menu_item($cat_item, 'default'); 128 128 $parentli = $cat_item->cat_ID; 129 $i ntCounter++;130 $i ntCounter = wp_nav_menu_sub_items($cat_item->cat_ID, $intCounter, $parentli, 'categories', 'default');129 $items_counter++; 130 $items_counter = wp_nav_menu_sub_items($cat_item->cat_ID, $items_counter, $parentli, 'categories', 'default'); 131 131 ?> 132 132 … … 138 138 } 139 139 140 return $i ntCounter;140 return $items_counter; 141 141 } 142 142 143 143 //RECURSIVE Sub Menu Items of default categories and pages 144 function wp_nav_menu_sub_items($childof, $i ntCounter, $parentli, $type, $output_type) {145 146 $counter = $i ntCounter;144 function wp_nav_menu_sub_items($childof, $items_counter, $parentli, $type, $output_type) { 145 146 $counter = $items_counter; 147 147 148 148 // Custom Menu -
trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js
r13365 r13375 116 116 jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i); 117 117 118 jQuery('#li count').attr('value',i);118 jQuery('#li-count').attr('value',i); 119 119 120 120 }); … … 143 143 var inputicon = ''; 144 144 145 if (additemtype == 'Custom')146 { 147 inputvaluevarname = document.getElementById('custom _menu_item_name').value;148 inputvaluevarurl = document.getElementById('custom _menu_item_url').value;145 if (additemtype == navMenuL10n.custom) 146 { 147 inputvaluevarname = document.getElementById('custom-menu-item-name').value; 148 inputvaluevarurl = document.getElementById('custom-menu-item-url').value; 149 149 inputitemid = ''; 150 150 inputparentid = ''; 151 151 inputlinktype = 'custom'; 152 inputdescription = document.getElementById('custom_menu_item_description').value;153 } 154 else if (additemtype == 'Page')152 inputdescription = ''; 153 } 154 else if (additemtype == navMenuL10n.page) 155 155 { 156 156 inputvaluevarname = htmlentities(itemtext.toString()); … … 162 162 163 163 } 164 else if (additemtype == 'Category')164 else if (additemtype == navMenuL10n.category) 165 165 { 166 166 inputvaluevarname = htmlentities(itemtext.toString()); -
trunk/wp-admin/js/custom-navigation-dynamic-functions.js
r13365 r13375 1 function removeitem( o){var todelete=document.getElementById("menu-"+o);if(todelete){var parenttodelete=document.getElementById("menu-"+o).parentNode;throwaway_node=parenttodelete.removeChild(todelete)}updatepostdata()}function edititem(o){itemTitle=jQuery("#title"+o).attr("value");itemURL=jQuery("#linkurl"+o).attr("value");itemAnchorTitle=jQuery("#anchortitle"+o).attr("value");itemNewWindow=jQuery("#newwindow"+o).attr("value");itemDesc=jQuery("#description"+o).attr("value");jQuery("#dialog-confirm").dialog("option","itemID",o);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 i=0;jQuery("#custom-nav").find("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("#title"+j).attr("name","title"+i);jQuery(this).find("#title"+j).attr("id","title"+i);jQuery(this).find("#linkurl"+j).attr("name","linkurl"+i);jQuery(this).find("#linkurl"+j).attr("id","linkurl"+i);jQuery(this).find("#description"+j).attr("name","description"+i);jQuery(this).find("#description"+j).attr("id","description"+i);jQuery(this).find("#icon"+j).attr("name","icon"+i);jQuery(this).find("#icon"+j).attr("id","icon"+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(this).find("#anchortitle"+j).attr("name","anchortitle"+i);jQuery(this).find("#anchortitle"+j).attr("id","anchortitle"+i);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("#licount").attr("value",i)})}function appendToList(templatedir,additemtype,itemtext,itemurl,itemid,itemparentid,itemdescription){var inputvaluevarname="";var inputvaluevarurl="";var inputitemid="";var inputparentid="";var inputdescription="";var inputicon="";if(additemtype=="Custom"){inputvaluevarname=document.getElementById("custom_menu_item_name").value;inputvaluevarurl=document.getElementById("custom_menu_item_url").value;inputitemid="";inputparentid="";inputlinktype="custom";inputdescription=document.getElementById("custom_menu_item_description").value}else{if(additemtype=="Page"){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="page";inputdescription=htmlentities(itemdescription.toString())}else{if(additemtype=="Category"){inputvaluevarname=htmlentities(itemtext.toString());inputvaluevarurl=itemurl.toString();inputitemid=itemid.toString();inputparentid="0";inputlinktype="category";inputdescription=htmlentities(itemdescription.toString())}else{inputvaluevarname="";inputvaluevarname="";inputitemid="";inputparentid="";inputlinktype="custom";inputdescription=""}}}var count=document.getElementById("custom-nav").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}}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-'+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>');jQuery("#menu-"+randomnumber+"").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery("#menu-"+randomnumber+" dl, #menu-"+randomnumber+" .dropzone").droppable({accept:"#"+randomnumber+", #custom-nav 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:""})}});updatepostdata()};1 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()}; -
trunk/wp-admin/nav-menus.php
r13372 r13375 32 32 function wp_reset_nav_menu() { 33 33 wp_nav_menu_setup(true); 34 35 34 return true; 36 35 } 37 36 38 $messages div = '';37 $messages_div = ''; 39 38 $menu_id_in_edit = 0; 40 39 $updated = false; 40 $advanced_option_descriptions = 'no'; 41 41 42 42 // Check which menu is selected and if menu is in edit already 43 if ( isset( $_GET['edit _menu'] ) ) {44 $menu_selected_id = (int) $_GET['edit _menu'];43 if ( isset( $_GET['edit-menu'] ) ) { 44 $menu_selected_id = (int) $_GET['edit-menu']; 45 45 $updated = true; 46 } elseif ( isset( $_POST[ 'menu _id_in_edit' ] ) ) {47 $menu_selected_id = (int) $_POST[ 'menu _id_in_edit' ];46 } elseif ( isset( $_POST[ 'menu-id-in-edit' ] ) ) { 47 $menu_selected_id = (int) $_POST[ 'menu-id-in-edit' ]; 48 48 } else { 49 49 $menu_selected_id = 0; 50 50 } 51 51 52 if ( isset( $_POST[ 'delete _menu' ] ) && $menu_selected_id > 0 ) {52 if ( isset( $_POST[ 'delete-menu' ] ) && $menu_selected_id > 0 ) { 53 53 wp_delete_nav_menu( $menu_selected_id ); 54 54 $menu_selected_id = 0; … … 71 71 } 72 72 73 if ( isset( $_POST['li count'] ) )74 $post Counter = $_POST['licount'];73 if ( isset( $_POST['li-count'] ) ) 74 $post_counter = $_POST['li-count']; 75 75 else 76 $post Counter = 0;76 $post_counter = 0; 77 77 78 78 // Create a new menu. Menus are stored as terms in the 'menu' taxonomy. 79 if ( isset( $_POST['add_menu'] ) && ! $updated ) { 80 update_option( 'wp_custom_nav_menu', $_POST['enable_wp_menu'] ); // Do we need this? 81 $insert_menu_name = $_POST['add_menu_name']; 82 83 if ( $insert_menu_name != '' ) { 84 $menu = wp_create_nav_menu($insert_menu_name); 85 if ( is_wp_error($menu) ) { 86 $messagesdiv = '<div id="message" class="error fade below-h2"><p>' . esc_html( $menu->get_error_message() ) . '</p></div>'; 79 if ( isset( $_POST['add-menu'] ) && ! $updated ) { 80 $insert_menu_name = $_POST['add-menu-name']; 81 82 if ( $insert_menu_name ) { 83 $menu = wp_create_nav_menu( $insert_menu_name ); 84 if ( is_wp_error( $menu ) ) { 85 $messages_div = '<div id="message" class="error fade below-h2"><p>' . $menu->get_error_message() . '</p></div>'; 87 86 } else { 88 87 $custom_menus[$menu->term_id] = $menu; … … 90 89 $menu_id_in_edit = $menu_selected_id; 91 90 $menu_title = $menu->name; 92 $messages div = '<div id="message" class="updated fade below-h2"><p>' . esc_html( sprintf( __('"%s" menu has been created!'),$menu->name ) ) . '</p></div>';93 $post Counter = 0;91 $messages_div = '<div id="message" class="updated fade below-h2"><p>' . sprintf( __('“%s” menu has been created.'), esc_html( $menu->name ) ) . '</p></div>'; 92 $post_counter = 0; 94 93 } 95 94 } else { 96 $messages div = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>';95 $messages_div = '<div id="message" class="error fade below-h2"><p>' . __('Please enter a valid menu name.') . '</p></div>'; 97 96 } 98 97 $updated = true; 99 98 } 100 99 101 if ( $post Counter > 0 && $menu_selected_id > 0 && ! $updated ) {100 if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) { 102 101 $menu_items = wp_get_nav_menu_items( $menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID') ); 103 102 $parent_menu_ids = array(); 104 103 105 104 // Loop through all POST variables 106 for ( $k = 1; $k <= $post Counter; $k++ ) {107 if (isset($_POST['dbid'.$k])) { $db_id = $_POST['dbid'.$k]; } else { $db_id = 0; }108 if (isset($_POST['postmenu'.$k])) { $object_id = $_POST['postmenu'.$k]; } else { $object_id = 0; }109 if (isset($_POST['parent'.$k])) { $parent_id = $_POST['parent'.$k]; } else { $parent_id = 0; }110 if (isset($_POST['title'.$k])) { $custom_title = $_POST['title'.$k]; } else { $custom_title = ''; }111 if (isset($_POST['linkurl'.$k])) { $custom_linkurl = $_POST['linkurl'.$k]; } else { $custom_linkurl = ''; }112 if (isset($_POST['description'.$k])) { $custom_description = $_POST['description'.$k]; } else { $custom_description = ''; }105 for ( $k = 1; $k <= $post_counter; $k++ ) { 106 $db_id = isset( $_POST['dbid'.$k] )? $_POST['dbid'.$k] : 0; 107 $object_id = isset( $_POST['postmenu'.$k] )? $_POST['postmenu'.$k] : 0; 108 $parent_id = isset( $_POST['parent'.$k] )? $_POST['parent'.$k] : 0; 109 $custom_title = isset( $_POST['title'.$k] )? $_POST['title'.$k] : ''; 110 $custom_linkurl = isset( $_POST['linkurl'.$k] )? $_POST['linkurl'.$k] : ''; 111 $custom_description = isset( $_POST['description'.$k] )? $_POST['description'.$k] : ''; 113 112 // doesn't seem to be used by UI 114 if (isset($_POST['icon'.$k])) { $icon = $_POST['icon'.$k]; } else { $icon = 0; }115 if (isset($_POST['position'.$k])) { $position = $_POST['position'.$k]; } else { $position = 0; }116 if (isset($_POST['linktype'.$k])) { $linktype = $_POST['linktype'.$k]; } else { $linktype = 'custom'; }117 if (isset($_POST['anchortitle'.$k])) { $custom_anchor_title = $_POST['anchortitle'.$k]; } else { $custom_anchor_title = $custom_title; }118 if (isset($_POST['newwindow'.$k])) { $new_window = $_POST['newwindow'.$k]; } else { $new_window = 0; }113 $icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0; 114 $position = isset( $_POST['position'.$k] )? $_POST['position'.$k] : 0; 115 $linktype = isset( $_POST['linktype'.$k] )? $_POST['linktype'.$k] : 'custom'; 116 $custom_anchor_title = isset( $_POST['anchortitle'.$k] )? $_POST['anchortitle'.$k] : $custom_title; 117 $new_window = isset( $_POST['newwindow'.$k] )? $_POST['newwindow'.$k] : 0; 119 118 120 119 $post = array( 'post_status' => 'publish', 'post_type' => 'nav_menu_item', 'post_author' => $user_ID, … … 126 125 else 127 126 $post['post_content_filtered'] = ''; 128 if ( $parent_id > 0 && isset( $parent_menu_ids[ $parent_id] ) )129 $post[ 'post_parent' ] = $parent_menu_ids[ $parent_id];127 if ( $parent_id > 0 && isset( $parent_menu_ids[$parent_id] ) ) 128 $post['post_parent'] = $parent_menu_ids[$parent_id]; 130 129 131 130 // New menu item … … 139 138 $parent_menu_ids[ $k ] = $db_id; 140 139 141 update_post_meta( $db_id, 'menu_type', $linktype);142 update_post_meta( $db_id, 'object_id', $object_id);140 update_post_meta( $db_id, 'menu_type', $linktype ); 141 update_post_meta( $db_id, 'object_id', $object_id ); 143 142 } 144 143 if ( !empty( $menu_items ) ) { … … 147 146 } 148 147 } 149 // DISPLAY SUCCESS MESSAGE IF POST CORRECT 150 $messagesdiv = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>'; 148 $messages_div = '<div id="message" class="updated fade below-h2"><p>' . __('The menu has been updated.') . '</p></div>'; 151 149 } 152 150 … … 156 154 <h2><?php esc_html_e('Menus') ?></h2> 157 155 <form onsubmit="updatepostdata()" action="<?php echo admin_url( 'nav-menus.php' ); ?>" method="post" enctype="multipart/form-data"> 158 <?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ) {?>156 <?php if ( ! empty( $custom_menus ) && count( $custom_menus ) > 1 ): ?> 159 157 <ul class="subsubsub"> 160 158 <?php 161 159 foreach ( $custom_menus as $menu ) { 162 $sep = end($custom_menus) == $menu ? '' : ' | '; 163 // $menu_term = get_term( $menu, 'nav_menu' ); 160 $sep = end( $custom_menus ) == $menu ? '' : ' | '; 164 161 if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) ) { ?> 165 <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>162 <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> 166 163 <?php } else { ?> 167 <li><a href='nav-menus.php?edit _menu=<?php echo esc_attr($menu->term_id); ?>'><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li>164 <li><a href='nav-menus.php?edit-menu=<?php echo esc_attr($menu->term_id); ?>'><?php echo esc_html( $menu->name ); ?></a><?php echo $sep; ?></li> 168 165 <?php } 169 166 } … … 171 168 </ul> 172 169 <div class="clear"></div> 173 <?php }?>170 <?php endif ?> 174 171 175 172 <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> … … 178 175 <div class="inside"> 179 176 <?php if ( ! empty( $custom_menus ) ) : ?> 180 <?php echo $messages div; ?>181 182 <input type="hidden" name="li count" id="licount" value="0" />183 <input type="hidden" name="menu _id_in_edit" id="menu_id_in_edit" value="<?php echo esc_attr($menu_selected_id); ?>" />177 <?php echo $messages_div; ?> 178 179 <input type="hidden" name="li-count" id="li-count" value="0" /> 180 <input type="hidden" name="menu-id-in-edit" id="menu-id-in-edit" value="<?php echo esc_attr( $menu_selected_id ); ?>" /> 184 181 185 182 <div class="sidebar-name"> … … 187 184 <br/> 188 185 </div> 189 <h3><?php echo esc_html( $menu_title); ?></h3>186 <h3><?php echo esc_html( $menu_title ); ?></h3> 190 187 191 188 </div> … … 194 191 <ul id="custom-nav"> 195 192 196 <?php 197 //DISPLAY existing menu 193 <?php 198 194 if ( $menu_selected_id > 0 ) { 199 wp_print_nav_menu( 'type=backend&name='.$menu_title.'&id='.$menu_selected_id ); 200 } 201 ?> 202 195 wp_print_nav_menu( array( 'type' => 'backend', 'name' => $menu_title, 'id' => $menu_selected_id ) ); 196 } 197 ?> 203 198 </ul> 204 199 </div><!-- /#nav-container --> … … 210 205 </script> 211 206 <input id="save_bottom" name="save_bottom" type="submit" value="<?php esc_attr_e('Save All Changes'); ?>" /> 212 <input id="delete _menu" name="delete_menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" />207 <input id="delete-menu" name="delete-menu" type="submit" value="<?php esc_attr_e('Delete This Menu'); ?>" /> 213 208 </p> 214 209 … … 228 223 229 224 <span> 230 <input id="add _menu_name" name="add_menu_name" type="text" value="" />231 <input id="add _menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add_menu" class="button" />225 <input id="add-menu-name" name="add-menu-name" type="text" value="" /> 226 <input id="add-menu" type="submit" value="<?php esc_attr_e('Add Menu'); ?>" name="add-menu" class="button" /> 232 227 </span> 233 228 </div> 234 229 </div><!-- /.widgets-holder-wrap --> 235 <?php /* ?>236 <?php $advanced_option_descriptions = get_option('wp_settings_custom_nav_advanced_options'); ?>237 <div class="widgets-holder-wrap" style="display:none;">238 <div class="sidebar-name">239 <div class="sidebar-name-arrow"></div>240 <h3><?php esc_html_e('Top Level Menu Descriptions'); ?></h3>241 </div>242 <div class="widget-holder">243 <span><?php _e('Display Descriptions in Top Level Menu?'); ?></span>244 245 <?php246 // UPDATE and DISPLAY Menu Description Option247 if ( isset($_POST['menu-descriptions']) ) {248 if ( !isset($_POST['switch_menu']) ) {249 $menu_options_to_edit = $_POST['menu_id_in_edit'];250 update_option('wp_settings_custom_nav_'.$menu_options_to_edit.'_descriptions',$_POST['menu-descriptions']);251 }252 }253 254 if ( $menu_id_in_edit > 0 )255 $checkedraw = get_option('wp_settings_custom_nav_'.$menu_id_in_edit.'_descriptions');256 else257 $checkedraw = get_option('wp_settings_custom_nav_'.$menu_selected_id.'_descriptions');258 259 $checked = strtolower($checkedraw);260 261 if ( $advanced_option_descriptions == 'no' )262 $checked = 'no';263 ?>264 265 <span class="checkboxes">266 <label><?php _e('Yes'); ?></label><input type="radio" name="menu-descriptions" value="yes" <?php if ($checked=='yes') { echo 'checked="checked"'; } ?> />267 <label><?php _e('No'); ?></label><input type="radio" name="menu-descriptions" value="no" <?php if ($checked=='yes') { } else { echo 'checked="checked"'; } ?> />268 </span><!-- /.checkboxes -->269 </form>270 <div class="fix"></div>271 </div>272 </div><!-- /.widgets-holder-wrap -->273 <?php */ ?>274 230 <div class="widgets-holder-wrap"> 275 231 <div class="sidebar-name"> … … 278 234 </div> 279 235 <div class="widget-holder"> 280 281 <?php 282 $pages_args = array( 283 'child_of' => 0, 284 'sort_order' => 'ASC', 285 'sort_column' => 'post_title', 286 'hierarchical' => 1, 287 'exclude' => '', 288 'include' => '', 289 'meta_key' => '', 290 'meta_value' => '', 291 'authors' => '', 292 'parent' => -1, 293 'exclude_tree' => '', 294 'number' => '', 295 'offset' => 0 ); 296 297 //GET all pages 298 $pages_array = get_pages($pages_args); 299 $page_name = ''; 300 //CHECK if pages exist 301 if ( $pages_array ) { 302 foreach ( $pages_array as $post ) { 303 //Add page name to 304 $page_name .= htmlentities($post->post_title).'|'; 305 } 306 } else { 307 $page_name = __('No pages available'); 308 } 309 ?> 310 311 <script> 236 <?php 237 $pages_args = array( 238 'child_of' => 0, 239 'sort_order' => 'ASC', 240 'sort_column' => 'post_title', 241 'hierarchical' => 1, 242 'exclude' => '', 243 'include' => '', 244 'meta_key' => '', 245 'meta_value' => '', 246 'authors' => '', 247 'parent' => -1, 248 'exclude_tree' => '', 249 'number' => '', 250 'offset' => 0 251 ); 252 $page_name = ''; 253 $pages_array = get_pages($pages_args); 254 if ( $pages_array ) { 255 foreach ( $pages_array as $post ) { 256 $page_name .= $post->post_title . '|'; 257 } 258 } else { 259 $page_name = __('No pages available'); 260 } 261 ?> 262 <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> 312 263 jQuery(document).ready(function(){ 313 314 //GET PHP pages 315 var dataposts = "<?php echo esc_js($page_name); ?>".split("|"); 316 317 //Set autocomplete 318 jQuery("#page-search").autocomplete(dataposts); 319 320 //Handle autocomplete result 264 var posts = "<?php echo esc_js( $page_name ); ?>".split("|"); 265 jQuery("#page-search").autocomplete(posts); 321 266 jQuery("#page-search").result(function(event, data, formatted) { 322 267 jQuery('#existing-pages').css('display','block'); 323 268 jQuery("#existing-pages dt:contains('" + data + "')").css("display", "block"); 324 325 269 jQuery('#show-pages').hide(); 326 270 jQuery('#hide-pages').show(); 327 328 271 }); 329 272 jQuery('#existing-pages').css('display','none'); 330 273 }); 331 274 </script> 332 333 275 <input type="text" onfocus="jQuery('#page-search').attr('value','');" id="page-search" value="<?php esc_attr_e('Search Pages'); ?>" /> 334 276 335 <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();"> View All</a>336 <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();"> Hide All</a>277 <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> 278 <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> 337 279 338 280 <script type="text/javascript"> … … 341 283 342 284 <ul id="existing-pages" class="list"> 343 <?php 344 $intCounter = 0; 345 //Get default Pages 346 $intCounter = wp_nav_menu_get_pages($intCounter,'default'); 347 ?> 285 <?php 286 $items_counter = wp_nav_menu_get_pages( 0,'default' ); 287 ?> 348 288 </ul> 349 350 289 <div class="fix"></div> 351 352 290 </div> 353 291 </div><!-- /.widgets-holder-wrap --> … … 360 298 <div class="widget-holder"> 361 299 362 <?php 363 // Custom GET categories query 364 // @todo Use API 365 $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); 366 $cat_name = ''; 367 //CHECK for results 368 if ( $categories ) { 369 foreach ( $categories as $category ) { 370 $cat_id = $category->term_id; 371 372 $cat_args = array( 373 'orderby' => 'name', 374 'include' => $cat_id, 375 'hierarchical' => 1, 376 'order' => 'ASC' 377 ); 378 379 $category_names=get_categories($cat_args); 380 381 if ( isset($category_names[0]->name) ) { 382 // Add category name to data string 383 $cat_name .= htmlentities($category_names[0]->name).'|'; 384 } 385 } 386 } else { 387 $cat_name = __('No categories available'); 388 } 389 ?> 390 391 <script> 300 <?php 301 // Custom GET categories query 302 // @todo Use API 303 $categories = $wpdb->get_results("SELECT term_id FROM $wpdb->term_taxonomy WHERE taxonomy = 'category' ORDER BY term_id ASC"); 304 $cat_name = ''; 305 if ( $categories ) { 306 foreach ( $categories as $category ) { 307 $cat_id = $category->term_id; 308 $cat_args = array( 309 'orderby' => 'name', 310 'include' => $cat_id, 311 'hierarchical' => 1, 312 'order' => 'ASC', 313 ); 314 $category_names = get_categories( $cat_args ); 315 if ( isset( $category_names[0]->name ) ) { 316 $cat_name .= htmlentities( $category_names[0]->name ).'|'; 317 } 318 } 319 } else { 320 $cat_name = __('No categories available'); 321 } 322 ?> 323 <script type="text/javascript" charset="<?php bloginfo('charset'); ?>"> 392 324 jQuery(document).ready(function(){ 393 394 //GET PHP categories 395 var datacats = "<?php echo esc_js($cat_name); ?>".split("|"); 396 397 //Set autocomplete 398 jQuery("#cat-search").autocomplete(datacats); 399 400 //Handle autocomplete result 325 var categories = "<?php echo esc_js($cat_name); ?>".split("|"); 326 jQuery("#cat-search").autocomplete(categories); 401 327 jQuery("#cat-search").result(function(event, data, formatted) { 402 328 jQuery('#existing-categories').css('display','block'); 403 329 jQuery("#existing-categories dt:contains('" + data + "')").css("display", "block"); 404 405 330 jQuery('#show-cats').hide(); 406 331 jQuery('#hide-cats').show(); 407 408 332 }); 409 333 jQuery('#existing-categories').css('display','none'); 410 411 334 }); 412 335 </script> … … 414 337 <input type="text" onfocus="jQuery('#cat-search').attr('value','');" id="cat-search" value="<?php esc_attr_e('Search Categories'); ?>" /> 415 338 416 <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();"> View All</a>417 <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();"> Hide All</a>339 <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> 340 <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> 418 341 419 342 <script type="text/javascript"> … … 422 345 423 346 <ul id="existing-categories" class="list"> 424 <?php 425 // Get default Categories 426 $intCounter = wp_nav_menu_get_categories($intCounter, 'default'); 427 ?> 347 <?php 348 $items_counter = wp_nav_menu_get_categories( $items_counter, 'default' ); 349 ?> 428 350 </ul> 429 351 430 352 <div class="fix"></div> 431 432 353 </div> 433 354 </div><!-- /.widgets-holder-wrap --> … … 439 360 </div> 440 361 <div class="widget-holder"> 441 <input id="custom _menu_item_url" type="text" value="http://" />442 <label ><?php _e('URL'); ?></label><br />443 <?php $template dir = get_bloginfo('url'); ?>444 <input type="hidden" id="template dir" value="<?php echo esc_attr($templatedir); ?>" />445 <input id="custom _menu_item_name" type="text" value="Menu Item" onfocus="jQuery('#custom_menu_item_name').attr('value','');" />446 <label ><?php _e('Menu Text'); ?></label><br />362 <input id="custom-menu-item-url" type="text" value="http://" /> 363 <label for="custom-menu-item-url"><?php _e('URL'); ?></label><br /> 364 <?php $template_dir = get_bloginfo('url'); ?> 365 <input type="hidden" id="template-dir" value="<?php echo esc_attr($template_dir); ?>" /> 366 <input id="custom-menu-item-name" type="text" value="<?php echo esc_attr( __('Menu Item') ); ?>" onfocus="jQuery('#custom-menu-item-name').attr('value','');" /> 367 <label for="custom-menu-item-name"><?php _e('Menu Text'); ?></label><br /> 447 368 <input id="custom_menu_item_description" type="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','');" /> 448 369 <label <?php if ($advanced_option_descriptions == 'no') { ?>style="display:none;"<?php } ?> ><?php _e('Description'); ?></label> 449 <a class="addtomenu" onclick="appendToList('<?php echo $template dir; ?>','Custom','','','','0','');jQuery('#custom_menu_item_name').attr('value','Menu Item');jQuery('#custom_menu_item_description').attr('value','A description');"><?php _e('Add to menu'); ?></a>370 <a class="addtomenu" 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 to menu'); ?></a> 450 371 <div class="fix"></div> 451 372 </div> … … 456 377 457 378 <div id="dialog-confirm" style="display:none;" title="<?php esc_attr_e('Edit Menu Item'); ?>"> 458 < /label><input id="edittitle" type="text" name="edittitle" value="" /><label class="editlabel" for="edittitle"><?php _e('Menu Title'); ?></label><br />379 <input id="edittitle" type="text" name="edittitle" value="" /><label class="editlabel" for="edittitle"><?php _e('Menu Title'); ?></label><br /> 459 380 <input id="editlink" type="text" name="editlink" value="" /><label class="editlabel" for="editlink"><?php _e('URL'); ?></label><br /> 460 381 <input id="editanchortitle" type="text" name="editanchortitle" value="" /><label class="editlabel" for="editanchortitle"><?php _e('Link Title'); ?></label><br /> -
trunk/wp-includes/default-widgets.php
r13368 r13375 1121 1121 <?php 1122 1122 } 1123 1124 ?> 1125 1126 <?php 1127 //DISPLAY custom navigation menu 1128 if ( get_option('wp_custom_nav_menu') == 'true' ) 1129 wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') ); 1130 ?> 1131 1132 <?php 1133 1134 //DEVELOPER settings enabled 1123 wp_nav_menu( array('id' => $navmenu, 'name' => $wp_custom_nav_menu_name, 'desc' => $navwidgetdescription, 'format' => 'widget') ); 1124 //DEVELOPER settings enabled 1135 1125 if ( $navdeveloper == 'yes' ) { 1136 1126 //DISPLAY Custom UL -
trunk/wp-includes/nav-menu-template.php
r13371 r13375 105 105 <a><span class=""></span></a> 106 106 <?php } else { ?> 107 <a class="hide" href="<?php echo $menu_item->link; ?>"><?php echo $menu_item->title; ?></a>107 <a class="hide" href="<?php echo $menu_item->link; ?>"><?php echo esc_html( $menu_item->title ); ?></a> 108 108 <?php } ?> 109 109 <input type="hidden" name="dbid<?php echo $menu_item->menu_order; ?>" id="dbid<?php echo $menu_item->menu_order; ?>" value="<?php echo $menu_item->ID; ?>" /> … … 149 149 150 150 case 'default': 151 $template dir = get_bloginfo('url');151 $template_dir = get_bloginfo('url'); 152 152 ?> 153 153 <dl> 154 <dt> 155 <span class="title"><?php echo $menu_item->title; ?></span> <a onclick="appendToList('<?php echo esc_js( esc_url_raw( $templatedir ) ); ?>','<?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 ); ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> </dt> 154 <dt> 155 <span class="title"><?php echo $menu_item->title; ?></span> 156 <a 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 ); ?>"><img alt="<?php esc_attr_e('Add to Custom Menu'); ?>" title="<?php esc_attr_e('Add to Custom Menu'); ?>" src="<?php echo admin_url('images/ico-add.png'); ?>" /></a> 157 </dt> 156 158 </dl> 157 159 <?php -
trunk/wp-includes/nav-menu.php
r13370 r13375 26 26 27 27 if ( $menu_exists ) 28 return WP_Error('menu_exists', sprintf( __('A menu named "%s" already exists; please try another name.'), $menu_exists->name ));28 return new WP_Error('menu_exists', sprintf( __('A menu named “%s” already exists; please try another name.'), esc_html( $menu_exists->name ) ) ); 29 29 30 30 $menu = wp_insert_term( $menu_name, 'nav_menu' ); … … 98 98 99 99 if ( $menu_item->post_title == '' ) 100 $menu_item->title = htmlentities( get_the_title( $menu_item->object_id ));100 $menu_item->title = get_the_title( $menu_item->object_id ); 101 101 else 102 $menu_item->title = htmlentities( $menu_item->post_title );102 $menu_item->title = $menu_item->post_title; 103 103 104 104 if ( $menu_item->post_content == '' ) 105 $menu_item->description = htmlentities( get_post_meta( $menu_item->ID, 'page-description', true ));105 $menu_item->description = get_post_meta( $menu_item->ID, 'page-description', true ); 106 106 else 107 $menu_item->description = htmlentities( $menu_item->post_content );107 $menu_item->description = $menu_item->post_content; 108 108 $menu_item->target = ''; 109 $menu_item->append = 'Page';109 $menu_item->append = _x('Page', 'menu nav item type'); 110 110 break; 111 111 // Category Menu Item … … 115 115 if ( empty($menu_item->post_title) ) { 116 116 $title_raw = get_category( $menu_item->object_id ); 117 $menu_item->title = htmlentities($title_raw->cat_name);117 $menu_item->title = $title_raw->cat_name; 118 118 } else { 119 $menu_item->title = htmlentities( $menu_item->post_title );119 $menu_item->title = $menu_item->post_title; 120 120 } 121 121 122 122 if ( empty($menu_item->post_content) ) 123 $menu_item->description = htmlentities( strip_tags( category_description( $menu_item->object_id )) );123 $menu_item->description = strip_tags( category_description( $menu_item->object_id ) ); 124 124 else 125 $menu_item->description = htmlentities( $menu_item->post_content );125 $menu_item->description = $menu_item->post_content; 126 126 $menu_item->target = ''; 127 $menu_item->append = 'Category';127 $menu_item->append = _x('Category', 'menu nav item type'); 128 128 break; 129 129 default: 130 130 // Custom Menu Item 131 131 $menu_item->link = $menu_item->guid; 132 $menu_item->title = htmlentities( $menu_item->post_title );133 $menu_item->description = htmlentities( $menu_item->post_content );132 $menu_item->title = $menu_item->post_title; 133 $menu_item->description = $menu_item->post_content; 134 134 $menu_item->target = 'target="_blank"'; 135 $menu_item->append = 'Custom';135 $menu_item->append = _x('Custom', 'menu nav item type'); 136 136 break; 137 137 } … … 147 147 //SET anchor title 148 148 if (isset($wp_custom_nav_menu_items->custom_anchor_title)) { 149 $anchor_title = htmlentities($wp_custom_nav_menu_items->custom_anchor_title);149 $anchor_title = $wp_custom_nav_menu_items->custom_anchor_title; 150 150 } 151 151 else { -
trunk/wp-includes/script-loader.php
r13372 r13375 399 399 // Custom Navigation 400 400 $scripts->add( 'custom-navigation-default-items', "/wp-admin/js/custom-navigation-default-items$suffix.js", false, '20100223' ); 401 $scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100220' ); 401 $scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100224' ); 402 $scripts->localize( 'custom-navigation-dynamic-functions', 'navMenuL10n', array( 403 'custom' => _x('Custom', 'menu nav item type'), 404 'page' => _x('Page', 'menu nav item type'), 405 'category' => _x('Category', 'menu nav item type') 406 ) ); 407 402 408 $scripts->add( 'custom-navigation-php-functions', "/wp-admin/js/custom-navigation-php-functions$suffix.js", false, '20100220' ); 403 409 } … … 469 475 $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.css', array(), '0.9.8' ); 470 476 $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.1' ); 471 $styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '2010022 3' );477 $styles->add( 'custom-navigation', "/wp-admin/css/custom-navigation$suffix.css", array(), '20100224' ); 472 478 473 479 foreach ( $rtl_styles as $rtl_style ) {
Note: See TracChangeset
for help on using the changeset viewer.