From 6141567b743f0208928e62a5b5d015b9358d9945 Mon Sep 17 00:00:00 2001 From: markjaquith Date: Wed, 24 Feb 2010 22:52:29 +0000 Subject: [PATCH] Hide URL editing UI for page and category menu items. TODO: eliminate all usage of guid. Use custom field instead. see #11817 git-svn-id: http://svn.automattic.com/wordpress/trunk@13390 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- ...custom-navigation-dynamic-functions.dev.js | 23 +++++++++++-------- wp-admin/nav-menus.php | 13 +++++++---- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/wp-admin/js/custom-navigation-dynamic-functions.dev.js b/wp-admin/js/custom-navigation-dynamic-functions.dev.js index 604417db9..e45941385 100644 --- a/wp-admin/js/custom-navigation-dynamic-functions.dev.js +++ b/wp-admin/js/custom-navigation-dynamic-functions.dev.js @@ -33,21 +33,26 @@ function removeitem(o) 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'); + 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(); 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('#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').attr('value', itemDesc); + jQuery('#editdescription').val( itemDesc ); }; diff --git a/wp-admin/nav-menus.php b/wp-admin/nav-menus.php index 1f94c52a4..0ea2b692d 100644 --- a/wp-admin/nav-menus.php +++ b/wp-admin/nav-menus.php @@ -106,7 +106,7 @@ if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) { $object_id = isset( $_POST['postmenu'.$k] )? $_POST['postmenu'.$k] : 0; $parent_id = isset( $_POST['parent'.$k] )? $_POST['parent'.$k] : 0; $custom_title = isset( $_POST['title'.$k] )? $_POST['title'.$k] : ''; - $custom_linkurl = isset( $_POST['linkurl'.$k] )? $_POST['linkurl'.$k] : ''; + $custom_linkurl = ( isset( $_POST['linkurl'.$k] ) && 'custom' == $_POST['linktype'.$k] ) ? $_POST['linkurl'.$k] : ''; $custom_description = isset( $_POST['description'.$k] )? $_POST['description'.$k] : ''; // doesn't seem to be used by UI $icon = isset( $_POST['icon'.$k] )? $_POST['icon'.$k] : 0; @@ -376,14 +376,17 @@ if ( $post_counter > 0 && $menu_selected_id > 0 && ! $updated ) {