Ticket #302 (closed enhancement: wontfix)

Opened 1 year ago

Last modified 1 month ago

A Rollover Preview variation to Themes.php

Reported by: dsader Assigned to: donncha
Priority: normal Milestone: WPMU 2.0
Component: component1 Version: 2.0
Severity: normal Keywords: themes, has-patch, 2nd-opinion, tested
Cc: drmike

Description

All themes list in a table with a screenshot on rollover only. Loads quicker with mucho themes.

I have a "if site admin" around the version and author.

<code> <div class="wrap"> <h2><?php _e('Current Theme'); ?></h2> <div id="currenttheme"> <?php if ( $ct->screenshot ) : ?> <img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> <?php endif; ?> <p><?php

$cTheme = get_current_theme(); echo "<p>The currently active theme is <b>$cTheme</b>, "; if (get_option('ut_use_user_theme') == 1 )

echo "from the <b>User Themes</b> library.</p>";

else

echo "from the <b>System Themes</b> library.</p>";

?></p>

</div> <br style="clear: both" /> <h2> </h2> </div> <?php $theme_names = array_keys($themes); natcasesort($theme_names); ?> <div class="wrap"> <form> <table id='the-list-x' width='auto'> <tr style='background-color: #444444; color:#ffffff;'> <td colspan='5'>System Themes <i style='font-size:.8em'>(no editing)</i></td></tr> <?php foreach ($theme_names as $theme_name) {

$template = $themes[$theme_name]Template?; $stylesheet = $themes[$theme_name]Stylesheet?; $title = $themes[$theme_name]Title?; $version = $themes[$theme_name]Version?; $description = $themes[$theme_name]Description?; $author = $themes[$theme_name]Author?; $screenshot = $themes[$theme_name]Screenshot?; $stylesheet_dir = $themes[$theme_name]Stylesheet Dir?;

$alt = $alt == ? 'alternate' : ;

$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=$template&amp;stylesheet=$stylesheet", 'switch-theme_' . $template);

?> <tr class='<?php echo $alt; ?>'><td><a style='text-decoration: none; color: black;' href='<?php echo $activate_link; ?>'<?php echo "onMouseOver=\"preview('" . get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot . "', getTopPosition(this));\"onMouseOut=\"unpreview();\" "; ?>><?php echo "$title"; ?></a></td> <td><?php echo "$description"; ?></td> <?php if( is_site_admin() ) { ?> <td><?php echo "$version"; ?></td> <td><?php echo "$author"; ?></td> <?php } ?> <td><a href='<?php echo $activate_link; ?>'>Activate</a></td> </tr> <?php } ?> </form> </table> </div> <script>

var pendingOpen = 0; var open = 0; var pendingClose = 0; function preview(url, top) {

document.getElementById('previewbox').style.top=top-100 + "px"; document.getElementById('previewimage').src=url; pendingOpen = 1; pendingClose = 0; setTimeout('showpreview()', 1000);

} function unpreview() {

pendingClose = 1; setTimeout('hidepreview()', 400);

} function showpreview() {

if (pendingOpen == 0) { return; } var p = document.getElementById('previewbox'); p.style.visibility='visible';

} function hidepreview() {

if (pendingClose == 0 ) {return;} pendingClose = 0; pendingOpen = 0; var p = document.getElementById('previewbox'); p.style.visibility='hidden';

} function getTopPosition(e) {

p = 0; while (e!=null) {

p += e.offsetTop; e = e.offsetParent;

} return p;

}

</script>

<style>

#previewbox {

visibility: hidden; width: 200px; height: 200px; background-color: white; border: 5px solid #cccccc; position: absolute; left: 220px; top: 300px;

}

</style> <div id='previewbox'>

<img id='previewimage' width='200' height='200' border='0' src='http://www.google.com/intl/en/images/logo.gif'/>

</div>

</code>

Attachments

rollover_themes.txt (6.5 kB) - added by dsader on 05/26/07 01:46:41.
themes.php (12.6 kB) - added by drmike on 05/29/07 20:54:58.
Multipage themes
themes_pagination.patch (5.0 kB) - added by momo360modena on 10/19/07 22:28:51.

Change History

04/07/07 19:13:39 changed by drmike

  • cc set to drmike.
  • type changed from defect to enhancement.

For reference: http://mu.wordpress.org/forums/topic.php?id=3999

+1 on this. I consider this to be a MU issue and not a WP core issue. Most wordpress installs just have a couple themes installed as one only uploads the themes that they want. Most WPMu installs probably have a hundred themes available for their users and, considering most theme designers include a *.png screenshot of hundreds of kbs in size, it's a PITA to load this page, especially over a dial up line.

05/21/07 21:45:15 changed by donncha

Can you attach the above code as a patch against themes.php please? It'll be much easier to integrate and understand. Thanks!

05/26/07 01:46:41 changed by dsader

  • attachment rollover_themes.txt added.

05/29/07 20:54:43 changed by drmike

Well , this one wasn't the one I was thinking off. I prefer the multipage version myself. My end users liked it as well.

Here's the multipage version from our install. r972

05/29/07 20:54:58 changed by drmike

  • attachment themes.php added.

Multipage themes

08/18/07 16:08:41 changed by drmike

  • keywords changed from themes to themes, has-patch, 2nd-opinion, tested.

+1 for the fix I added in there. I'd have to dig for whomever came up with it though in the forums.

10/19/07 22:28:51 changed by momo360modena

  • attachment themes_pagination.patch added.

10/19/07 22:37:26 changed by momo360modena

A true patch for pagination.

Algo improved. Test.

04/24/08 09:07:10 changed by momo360modena

  • owner changed from somebody to donncha.

05/21/08 13:20:30 changed by donncha

  • status changed from new to closed.
  • resolution set to wontfix.

It's a WP issue. Should have closed this ages ago. Lunabyte has added a patch for a paginated themes page too.