Changeset 2839

Show
Ignore:
Timestamp:
09/05/05 23:33:10 (3 years ago)
Author:
matt
Message:

Fix menu annoyance. Clean up themes.php code.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r2832 r2839  
    14001400} 
    14011401 
     1402function current_theme_info() { 
     1403    $themes = get_themes(); 
     1404    $current_theme = get_current_theme(); 
     1405    $ct->title = $themes[$current_theme]['Title']; 
     1406    $ct->version = $themes[$current_theme]['Version']; 
     1407    $ct->parent_theme = $themes[$current_theme]['Parent Theme']; 
     1408    $ct->template_dir = $themes[$current_theme]['Template Dir']; 
     1409    $ct->stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; 
     1410    $ct->template = $themes[$current_theme]['Template']; 
     1411    $ct->stylesheet = $themes[$current_theme]['Stylesheet']; 
     1412    $ct->screenshot = $themes[$current_theme]['Screenshot']; 
     1413    $ct->description = $themes[$current_theme]['Description']; 
     1414    $ct->author = $themes[$current_theme]['Author']; 
     1415    return $ct; 
     1416} 
     1417 
    14021418?> 
  • trunk/wp-admin/menu-header.php

    r2755 r2839  
    2727if ( isset($submenu["$parent_file"]) ) : 
    2828?> 
    29 <ul id="adminmenu2"> 
     29<ul id="submenu"> 
    3030<?php  
    3131foreach ($submenu["$parent_file"] as $item) :  
  • trunk/wp-admin/themes.php

    r2763 r2839  
    44if ( isset($_GET['action']) ) { 
    55    check_admin_referer(); 
    6  
     6     
    77    if ('activate' == $_GET['action']) { 
    8       if (isset($_GET['template'])) { 
    9         update_option('template', $_GET['template']); 
    10       } 
    11  
    12       if (isset($_GET['stylesheet'])) { 
    13         update_option('stylesheet', $_GET['stylesheet']); 
    14       } 
    15  
     8        if ( isset($_GET['template']) ) 
     9            update_option('template', $_GET['template']); 
     10         
     11        if ( isset($_GET['stylesheet']) ) 
     12            update_option('stylesheet', $_GET['stylesheet']); 
     13         
    1614        do_action('switch_theme', get_current_theme()); 
    17  
    18       header('Location: themes.php?activated=true'); 
     15         
     16        header('Location: themes.php?activated=true'); 
     17        exit; 
    1918    } 
    20 
     19
    2120 
    2221$title = __('Manage Themes'); 
     
    2423require_once('admin-header.php'); 
    2524?> 
     25 
    2626<?php if ( ! validate_current_theme() ) : ?> 
    2727<div id="message1" class="updated fade"><p><?php _e('The active theme is broken.  Reverting to the default theme.'); ?></p></div> 
    28 <?php elseif ( isset($activated) ) : ?> 
     28<?php elseif ( isset($_GET['activated']) ) : ?> 
    2929<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site &raquo;</a>'), get_bloginfo('home')); ?></p></div> 
    3030<?php endif; ?> 
     
    3232<?php 
    3333$themes = get_themes(); 
    34 $current_theme = get_current_theme(); 
    35 $current_title = $themes[$current_theme]['Title']; 
    36 $current_version = $themes[$current_theme]['Version']; 
    37 $current_parent_theme = $themes[$current_theme]['Parent Theme']; 
    38 $current_template_dir = $themes[$current_theme]['Template Dir']; 
    39 $current_stylesheet_dir = $themes[$current_theme]['Stylesheet Dir']; 
    40 $current_template = $themes[$current_theme]['Template']; 
    41 $current_stylesheet = $themes[$current_theme]['Stylesheet']; 
    42 $current_screenshot = $themes[$current_theme]['Screenshot']; 
     34$ct = current_theme_info(); 
    4335?> 
    4436 
     
    4638<h2><?php _e('Current Theme'); ?></h2> 
    4739<div id="currenttheme"> 
    48 <?php if ( $current_screenshot ) : ?> 
    49 <img src="<?php echo get_option('siteurl') . '/' . $current_stylesheet_dir . '/' . $current_screenshot; ?>" alt="Current theme preview" /> 
     40<?php if ( $ct->screenshot ) : ?> 
     41<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> 
    5042<?php endif; ?> 
    51 <h3><?php printf(__('%1$s %2$s by %3$s'), $current_title, $current_version, $themes[$current_theme]['Author']) ; ?></h3> 
    52 <p><?php echo $themes[$current_theme]['Description']; ?></p> 
    53 <?php if ($current_parent_theme) { ?> 
    54     <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $current_theme, $current_template_dir, $current_stylesheet_dir, $current_theme, $current_parent_theme); ?></p> 
     43<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3> 
     44<p><?php echo $ct->description; ?></p> 
     45<?php if ($ct->parent_theme) { ?> 
     46    <p><?php printf(__('The template files are located in <code>%2$s</code>.  The stylesheet files are located in <code>%3$s</code>.  <strong>%4$s</strong> uses templates from <strong>%5$s</strong>.  Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p> 
    5547<?php } else { ?> 
    56     <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $current_theme, $current_template_dir, $current_stylesheet_dir); ?></p> 
     48    <p><?php printf(__('All of this theme&#8217;s files are located in <code>%2$s</code>.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir); ?></p> 
    5749<?php } ?> 
    5850</div> 
     
    7870    $screenshot = $themes[$theme_name]['Screenshot']; 
    7971    $stylesheet_dir = $themes[$theme_name]['Stylesheet Dir']; 
     72    $activate_link = "themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet"; 
    8073?> 
    8174<div class="available-theme"> 
    82 <h3><a href="<?php echo "themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet"; ?>"><?php echo "$title $version"; ?> 
    83 <span> 
     75<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3> 
     76 
     77<a href="<?php echo $activate_link; ?>" class="screenshot"> 
    8478<?php if ( $screenshot ) : ?> 
    8579<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> 
    8680<?php endif; ?> 
    87 </span
    88 </a></h3> 
     81</a
     82 
    8983<p><?php echo $description; ?></p> 
    9084</div> 
    91 <?php 
    92 /* 
    93         if ($template == $current_template && $stylesheet == $current_stylesheet) { 
    94             $action = '<strong>' . __('Active Theme') . '</strong>'; 
    95             $current = true; 
    96         } else { 
    97             $action = "<a href='' title='" . __('Select this theme') . "' class='edit'>" . __('Select') . '</a>'; 
    98             $current = false; 
    99         } 
     85<?php } // end foreach theme_names ?> 
    10086 
    101         $style = ('class="alternate"' == $style|| 'class="alternate active"' == $style) ? '' : 'alternate'; 
    102         if ($current) $style .= $style == 'alternate' ? ' active' : 'active'; 
    103         if ($style != '') $style = 'class="' . $style . '"'; 
    104  
    105         echo " 
    106       <tr $style>"; 
    107 if ( $current ) 
    108     echo "<td><strong>$title $version</strong></td>"; 
    109 else 
    110     echo "<td></td>"; 
    111 echo " 
    112          <td class=\"auth\">$author</td> 
    113          <td class=\"desc\">$description</td> 
    114          <td class=\"togl\">$action</td> 
    115       </tr>"; 
    116 */ 
    117     } 
    118  
    119 ?> 
    120  
    121 <?php 
    122 
    123 ?> 
     87<?php } ?> 
    12488 
    12589<?php 
    12690// List broken themes, if any. 
    12791$broken_themes = get_broken_themes(); 
    128 if (count($broken_themes)) { 
     92if ( count($broken_themes) ) { 
    12993?> 
    13094 
     
    161125 
    162126<h2><?php _e('Get More Themes'); ?></h2> 
    163 <p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you may activate it on this page.'); ?></p> 
     127<p><?php _e('You can find additional themes for your site in the <a href="http://wordpress.org/extend/themes/">WordPress theme directory</a>. To install a theme you generally just need to upload the theme folder into your <code>wp-content/themes</code> directory. Once a theme is uploaded, you should see it on this page.'); ?></p> 
    164128 
    165129</div> 
    166130 
    167 <?php 
    168 include('admin-footer.php'); 
    169 ?> 
     131<?php require('admin-footer.php'); ?> 
  • trunk/wp-admin/wp-admin.css

    r2813 r2839  
    162162 
    163163.available-theme { 
    164     width: 250px
    165     margin-right: 2.5em; 
     164    width: 30%
     165    margin: 0 1em; 
    166166    float: left; 
    167167    text-align: center; 
    168 
    169  
    170 .available-theme span { 
     168    height: 28em; 
     169    overflow: hidden; 
     170
     171 
     172.available-theme a.screenshot { 
    171173    width: 250px; 
    172     height: 187px; 
     174    height: 200px; 
    173175    display: block; 
    174176    margin: auto; 
    175177    background: #f1f1f1; 
    176178    border: 1px solid #ccc; 
     179    margin-bottom: 10px; 
     180    overflow: hidden; 
     181} 
     182 
     183.available-theme a.screenshot:hover { 
     184    border: 1px solid #666; 
    177185} 
    178186 
     
    302310} 
    303311 
    304 #adminmenu .current, #adminmenu2 .current { 
     312#adminmenu .current, #submenu .current { 
    305313    font-weight: bold; 
    306314} 
     
    320328} 
    321329 
    322 #adminmenu li, #adminmenu2 li { 
     330#adminmenu li, #submenu li { 
    323331    display: inline; 
    324332    line-height: 200%; 
     
    327335} 
    328336 
    329 #adminmenu2
     337#submenu
    330338    background: #0d324f;; 
    331339    border-bottom: none; 
     
    334342} 
    335343 
    336 #adminmenu2 .current { 
     344#submenu .current { 
    337345    background: #ddeaf4; 
    338346    border-top: 1px solid #045290; 
     
    341349} 
    342350 
    343 #adminmenu2 a { 
     351#submenu a { 
    344352    border: none; 
    345353    color: #fff; 
     
    348356} 
    349357 
    350 #adminmenu2 a:hover { 
     358#submenu a:hover { 
    351359    background: #ddeaf4; 
    352360    color: #393939; 
    353361} 
    354362 
    355 #adminmenu2 li { 
     363#submenu li { 
    356364    line-height: 170%; 
    357365}