Ticket #23770: 23770.3.diff
File 23770.3.diff, 8.1 KB (added by , 12 years ago) |
---|
-
wp-admin/css/wp-admin.css
166 166 padding: 0 7px; 167 167 } 168 168 169 #col-left-locations { 170 width: 40%; 171 } 172 169 173 /* utility classes */ 170 174 .alignleft { 171 175 float: left; … … 2423 2427 width: 8%; 2424 2428 } 2425 2429 2430 .fixed .column-posts, 2426 2431 .fixed .column-date, 2427 2432 .fixed .column-parent, 2428 2433 .fixed .column-links, … … 2439 2444 width: 15%; 2440 2445 } 2441 2446 2447 .fixed .column-slug { 2448 width: 25%; 2449 } 2450 2451 .fixed .column-locations { 2452 width: 35%; 2453 } 2454 2455 .fixed .column-menus { 2456 padding-bottom: 2px; 2457 } 2442 2458 .fixed .column-comments { 2443 2459 width: 4em; 2444 2460 padding: 8px 0; … … 2453 2469 float: left; 2454 2470 } 2455 2471 2456 .fixed .column-slug {2457 width: 25%;2458 }2459 2460 .fixed .column-posts {2461 width: 10%;2462 }2463 2464 2472 .fixed .column-icon { 2465 2473 width: 80px; 2466 2474 } … … 7223 7231 filter: alpha(opacity=50); 7224 7232 } 7225 7233 7234 #menu-locations-wrap { 7235 width: 55%; 7236 } 7237 7226 7238 .metabox-holder-disabled .button-controls .select-all { 7227 7239 display: none; 7228 7240 } … … 7383 7395 margin-top: -2px; 7384 7396 } 7385 7397 7398 .menu-location-title { 7399 position: relative; 7400 top: 10px; 7401 } 7402 7403 #locations-nav-menu-wrapper { 7404 padding: 5px 0; 7405 } 7406 7407 .locations-nav-menu-select select { 7408 float: left; 7409 width: 160px; 7410 margin-right: 5px; 7411 } 7412 7413 #locations-row-links { 7414 display: inline-block; 7415 position: relative; 7416 top: 3px; 7417 } 7418 7419 #locations-edit-menu-link, 7420 #locations-add-menu-link { 7421 margin: 0 2px; 7422 } 7423 7424 #locations-edit-menu-link { 7425 width: 15%; 7426 } 7427 7428 #locations-add-menu-link { 7429 width: 12%; 7430 } 7431 7386 7432 #wpbody .open-label { 7387 7433 display: block; 7388 7434 float:left; -
wp-admin/nav-menus.php
341 341 } 342 342 } 343 343 break; 344 case 'locations': 345 // TODO: Nonce this thing 346 347 // Get existing menu locations assignments 348 $locations = get_registered_nav_menus(); 349 $menu_locations = get_nav_menu_locations(); 350 351 // Merge new and existing menu locations if any new ones are set 352 if ( isset( $_POST['menu-locations'] ) ) { 353 $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); 354 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); 355 // Set menu locations 356 set_theme_mod( 'nav_menu_locations', $menu_locations ); 357 } 358 // TODO: Add a message 359 360 break; 344 361 } 345 362 346 363 // Get all nav menus … … 350 367 // Are we on the add new screen? 351 368 $add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; 352 369 370 $locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false; 371 353 372 // If we have one theme location, and zero menus, we take them right into editing their first menu 354 373 $page_count = wp_count_posts( 'page' ); 355 374 $one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; … … 474 493 ?> 475 494 <div class="wrap"> 476 495 <?php screen_icon(); ?> 477 <h2><?php _e( 'Menus' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ); ?>" class="add-new-h2"><?php _ex( 'Add New', 'menu' ); ?></a></h2> 496 <h2 class="nav-tab-wrapper"> 497 <a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e('Edit Menus'); ?></a> 498 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manage Locations'); ?></a> 499 </h2> 478 500 <?php 479 501 foreach( $messages as $message ) : 480 502 echo $message . "\n"; 481 503 endforeach; 482 504 ?> 505 <?php 506 if ( $locations_screen ) : 507 echo '<p>' . __( 'Some explanatory/howto text should probably go here.' ) . '</p>'; 508 ?> 509 <div id="menu-locations-wrap"> 510 <form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>"> 511 <table class="widefat fixed" cellspacing="0" id="menu-locations-table"> 512 <thead> 513 <tr> 514 <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Locations' ); ?></th> 515 <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menus' ); ?></th> 516 </tr> 517 </thead> 518 <tfoot> 519 <tr> 520 <th scope="col" class="manage-column column-locations"><?php _e( 'Theme Locations' ); ?></th> 521 <th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menus' ); ?></th> 522 </tr> 523 </tfoot> 524 <tbody class="menu-locations"> 525 <?php foreach ( $locations as $_location => $_name ) { ?> 526 <tr id="menu-locations-row"> 527 <td class="menu-location-title"><strong><?php echo $_name; ?></strong></td> 528 <td class="menu-location-menus"> 529 <select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>"> 530 <option value="0"><?php printf( '— %s —', esc_html__( 'Select a Menu' ) ); ?></option> 531 <?php foreach ( $nav_menus as $menu ) : ?> 532 <option<?php selected( isset( $menu_locations[ $_location ] ) && $menu_locations[ $_location ] == $menu->term_id ); ?> 533 value="<?php echo $menu->term_id; ?>"> 534 <?php $truncated_name = wp_html_excerpt( $menu->name, 40 ); 535 echo $truncated_name == $menu->name ? $menu->name : trim( $truncated_name ) . '…'; ?> 536 </option> 537 <?php endforeach; ?> 538 </select> 539 <div id="locations-row-links"> 540 <span id="locations-edit-menu-link"> 541 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu->term_id ), admin_url( 'nav-menus.php' ) ) ); ?>"> 542 <?php _ex( 'Edit', 'menu' ); ?> 543 </a> 544 </span> 545 <span id="locations-add-menu-link"> 546 <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ); ?>"> 547 <?php _ex( 'Add New', 'menu' ); ?> 548 </a> 549 </span> 550 </div><!-- #locations-row-links --> 551 </td><!-- .menu-location-menus --> 552 </tr><!-- #menu-locations-row --> 553 <?php } ?> 554 </tbody> 555 </table> 556 <p class="button-controls"> 557 <?php submit_button( __( 'Save Locations' ), 'primary right', 'nav-menu-locations', false ); ?> 558 </p> 559 <input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> 560 </form> 561 </div><!-- #menu-locations-wrap --> 562 <?php else : ?> 483 563 <div class="manage-menus"> 484 <?php if ( $menu_count < 2 ) : ?>564 <?php if ( $menu_count < 2 ) : ?> 485 565 <span class="add-edit-menu-action"> 486 566 <?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> 487 567 </span><!-- /add-edit-menu-action --> 488 <?php else : ?>489 <form method=" post" action="<?php echo admin_url( 'nav-menus.php' ); ?>">568 <?php else : ?> 569 <form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>"> 490 570 <input type="hidden" name="action" value="edit" /> 491 571 <label for="menu" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> 492 572 <select name="menu" id="menu"> … … 520 600 <?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> 521 601 </span><!-- /add-new-menu-action --> 522 602 </form> 523 <?php endif; ?>603 <?php endif; ?> 524 604 </div><!-- /manage-menus --> 525 605 <div id="nav-menus-frame"> 526 606 <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>"> … … 633 713 </div><!-- /#menu-management --> 634 714 </div><!-- /#menu-management-liquid --> 635 715 </div><!-- /#nav-menus-frame --> 716 <?php endif; ?> 636 717 </div><!-- /.wrap--> 637 718 <?php include( './admin-footer.php' ); ?>