<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[20138] trunk/wp-admin: Theme Customizer: Begin integration into the install process.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/20138">20138</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2012-03-07 17:35:17 +0000 (Wed, 07 Mar 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Theme Customizer: Begin integration into the install process. Combine previews, details, and install into a single workflow. see <a href="http://core.trac.wordpress.org/ticket/19910">#19910</a>.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadmindevcss">trunk/wp-admin/css/wp-admin.dev.css</a></li>
<li><a href="#trunkwpadminincludesclasswpthemeinstalllisttablephp">trunk/wp-admin/includes/class-wp-theme-install-list-table.php</a></li>
<li><a href="#trunkwpadminincludesthemeinstallphp">trunk/wp-admin/includes/theme-install.php</a></li>
<li><a href="#trunkwpadminjsthemedevjs">trunk/wp-admin/js/theme.dev.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkwpadminimagesstarspng">trunk/wp-admin/images/stars.png</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadmindevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.dev.css (20137 => 20138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.dev.css        2012-03-07 17:02:22 UTC (rev 20137)
+++ trunk/wp-admin/css/wp-admin.dev.css        2012-03-07 17:35:17 UTC (rev 20138)
</span><span class="lines">@@ -5224,7 +5224,9 @@
</span><span class="cx">         right: 0;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.wp-full-overlay.collapsed {
</del><ins>+.wp-full-overlay.collapsed,
+.wp-full-overlay.collapsed div.wp-full-overlay-header,
+.wp-full-overlay.collapsed div.wp-full-overlay-footer {
</ins><span class="cx">         left: -302px;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -5248,6 +5250,9 @@
</span><span class="cx">         top: 0;
</span><span class="cx">         bottom: 0;
</span><span class="cx"> }
</span><ins>+.wp-full-overlay.collapsed .wp-full-overlay-main {
+        left: 0;
+}
</ins><span class="cx">
</span><span class="cx"> .wp-full-overlay-sidebar div.wp-full-overlay-header,
</span><span class="cx"> .wp-full-overlay-sidebar div.wp-full-overlay-footer {
</span><span class="lines">@@ -5322,7 +5327,10 @@
</span><span class="cx">
</span><span class="cx"> /* Animations */
</span><span class="cx"> .wp-full-overlay,
</span><del>-.wp-full-overlay .collapse-sidebar {
</del><ins>+.wp-full-overlay .collapse-sidebar,
+.wp-full-overlay-sidebar div.wp-full-overlay-header,
+.wp-full-overlay-sidebar div.wp-full-overlay-footer,
+.wp-full-overlay-main {
</ins><span class="cx">         -moz-transition-property: left, right, top, bottom;
</span><span class="cx">         -webkit-transition-property: left, right, top, bottom;
</span><span class="cx">         -o-transition-property: left, right, top, bottom;
</span><span class="lines">@@ -5347,12 +5355,68 @@
</span><span class="cx">         display: block;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-#customize-container iframe {
</del><ins>+#customize-container iframe,
+#theme-installer iframe {
</ins><span class="cx">         height: 100%;
</span><span class="cx">         width: 100%;
</span><span class="cx">         z-index: 20;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+#theme-installer {
+        display: none;
+}
+
+.install-theme-info {
+        display: none;
+        padding: 45px 20px 15px;
+}
+
+#theme-installer .install-theme-info {
+        display: block;
+}
+
+.install-theme-info .theme-install {
+        float: right;
+        margin-top: 18px;
+}
+
+.install-theme-info .theme-name {
+        font-size: 16px;
+        line-height: 24px;
+        margin-bottom: 0;
+}
+
+.install-theme-info .theme-screenshot {
+        margin-top: 15px;
+        width: 258px;
+        border: 1px solid #ccc;
+}
+
+.install-theme-info .theme-version {
+        margin: 15px 0;
+        float: right;
+}
+
+.install-theme-info .theme-rating {
+        margin: 14px 0;
+        width: 100px;
+        height: 17px;
+        float: left;
+        background: url('../images/stars.png?ver=20120307') repeat-x bottom left;
+}
+.install-theme-info .theme-rating div {
+        background: url('../images/stars.png?ver=20120307') repeat-x top left;
+        height: 17px;
+        float: left;
+}
+
+.install-theme-info .theme-description {
+        margin-top: 34px;
+        padding-top: 1em;
+        color: #777;
+        line-height: 20px;
+}
+
</ins><span class="cx"> /*------------------------------------------------------------------------------
</span><span class="cx"> 25.0 - Misc
</span><span class="cx"> ------------------------------------------------------------------------------*/
</span></span></pre></div>
<a id="trunkwpadminimagesstarspng"></a>
<div class="binary"><h4>Added: trunk/wp-admin/images/stars.png</h4>
<pre class="diff"><span>
<span class="cx">(Binary files differ)
</span></span></pre></div>
<span class="cx">Property changes on: trunk/wp-admin/images/stars.png
</span><span class="cx">___________________________________________________________________
</span><a id="svnmimetype"></a>
<div class="addfile"><h4>Added: svn:mime-type</h4></div>
<a id="trunkwpadminincludesclasswpthemeinstalllisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-theme-install-list-table.php (20137 => 20138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-theme-install-list-table.php        2012-03-07 17:02:22 UTC (rev 20137)
+++ trunk/wp-admin/includes/class-wp-theme-install-list-table.php        2012-03-07 17:35:17 UTC (rev 20138)
</span><span class="lines">@@ -158,6 +158,18 @@
</span><span class="cx">                                                 display_theme( $themes[$theme_name] );
</span><span class="cx">                                 ?></div>
</span><span class="cx">                 <?php } // end foreach $theme_names
</span><ins>+
+                ?>
+                <div id="theme-installer" class="wp-full-overlay">
+                        <a href="#" class="close-full-overlay"><?php printf( __( '&larr; Return to %s' ), get_admin_page_title() ); ?></a>
+                        <a href="#" class="collapse-sidebar button-secondary" title="<?php esc_attr_e('Collapse Sidebar'); ?>"><span></span></a>
+                        <div class="wp-full-overlay-sidebar">
+                                <div class="wp-full-overlay-header"></div>
+                                <div class="install-theme-info"></div>
+                        </div>
+                        <div class="wp-full-overlay-main"></div>
+                </div>
+                <?php
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         /**
</span><span class="lines">@@ -170,7 +182,7 @@
</span><span class="cx">          * @uses $type Global; type of search.
</span><span class="cx">          */
</span><span class="cx">         function _js_vars() {
</span><del>-                global $tab, $type;                
</del><ins>+                global $tab, $type;
</ins><span class="cx">                 parent::_js_vars( compact( 'tab', 'type' ) );
</span><span class="cx">         }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkwpadminincludesthemeinstallphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/theme-install.php (20137 => 20138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/theme-install.php        2012-03-07 17:02:22 UTC (rev 20137)
+++ trunk/wp-admin/includes/theme-install.php        2012-03-07 17:35:17 UTC (rev 20138)
</span><span class="lines">@@ -127,77 +127,72 @@
</span><span class="cx"> }
</span><span class="cx"> add_action('install_themes_upload', 'install_themes_upload', 10, 1);
</span><span class="cx">
</span><del>-function display_theme($theme, $actions = null, $show_details = true) {
</del><ins>+/*
+ * Prints a theme on the Install Themes pages.
+ *
+ * @param object $theme An object that contains theme data returned by the WordPress.org API.
+ *
+ * Example theme data:
+ * object(stdClass)[59]
+ * public 'name' => string 'Magazine Basic' (length=14)
+ * public 'slug' => string 'magazine-basic' (length=14)
+ * public 'version' => string '1.1' (length=3)
+ * public 'author' => string 'tinkerpriest' (length=12)
+ * public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)
+ * public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
+ * public 'rating' => float 80
+ * public 'num_ratings' => int 1
+ * public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
+ * public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)
+ * public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
+ */
+function display_theme( $theme ) {
</ins><span class="cx">         global $themes_allowedtags;
</span><span class="cx">
</span><del>-        if ( empty($theme) )
</del><ins>+        if ( empty( $theme ) )
</ins><span class="cx">                 return;
</span><span class="cx">
</span><del>-        $name = wp_kses($theme->name, $themes_allowedtags);
-        $author = wp_kses($theme->author, $themes_allowedtags);
-        $desc = wp_kses($theme->description, $themes_allowedtags);
-        //if ( strlen($desc) > 30 )
-        //        $desc = substr($desc, 0, 15) . '<span class="dots">...</span><span>' . substr($desc, -15) . '</span>';
</del><ins>+        $name = wp_kses( $theme->name, $themes_allowedtags );
+        $author = wp_kses( $theme->author, $themes_allowedtags );
</ins><span class="cx">
</span><del>-        $preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
-        if ( !is_array($actions) ) {
-                $actions = array();
-                $actions[] = '<a href="' . self_admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
-                                                                                '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=385') . '" class="thickbox thickbox-preview onclick" title="' . esc_attr(sprintf(__('Install &#8220;%s&#8221;'), $name)) . '">' . __('Install') . '</a>';
-                if ( !is_network_admin() )
-                        $actions[] = '<a href="' . $preview_link . '" class="thickbox thickbox-preview onclick previewlink" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)) . '">' . __('Preview') . '</a>';
-                $actions = apply_filters('theme_install_action_links', $actions, $theme);
-        }
</del><ins>+        $num_ratings = sprintf( _n( '(based on %s rating)', '(based on %s ratings)', $theme->num_ratings ), number_format_i18n( $theme->num_ratings ) );
</ins><span class="cx">
</span><del>-        $actions = implode ( ' | ', $actions );
</del><ins>+        $preview_url = add_query_arg( 'theme_preview', '1' );
+        $preview_title = sprintf( __('Preview &#8220;%s&#8221;'), $name );
+
+        $install_url = add_query_arg( array(
+                'action' => 'install-theme',
+                'theme' => $theme->slug,
+        ), self_admin_url( 'update.php' ) );
+
</ins><span class="cx">         ?>
</span><del>-<a class='thickbox thickbox-preview screenshot'
-        href='<?php echo esc_url($preview_link); ?>'
-        title='<?php echo esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $name)); ?>'>
-<img src='<?php echo esc_url($theme->screenshot_url); ?>' width='150' />
-</a>
-<h3><?php
-        /* translators: 1: theme name, 2: author name */
-        printf( __( '%1$s <span>by %2$s</span>' ), $name, $author ); ?></h3>
-<span class='action-links'><?php echo $actions ?></span>
-<?php if ( $show_details ) { ?>
-<span class="separator hide-if-no-js">| </span><a href="#theme_detail" class="theme-detail hide-if-no-js" tabindex='4'><?php _e('Details') ?></a>
-<div class="themedetaildiv hide-if-js">
-<p><?php echo $desc ?></p>
-<p><strong><?php _e('Version:') ?></strong> <?php echo wp_kses($theme->version, $themes_allowedtags) ?></p>
-<?php if ( ! empty($theme->last_updated) ) : ?>
-<p><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $theme->last_updated ?>"><?php printf( __('%s ago'), human_time_diff(strtotime($theme->last_updated)) ) ?></span></p>
-<?php endif; if ( ! empty($theme->requires) ) : ?>
-<p><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $theme->requires) ?></p>
-<?php endif; if ( ! empty($theme->tested) ) : ?>
-<p><strong><?php _e('Compatible up to:') ?></strong> <?php echo $theme->tested ?></p>
-<?php endif; if ( !empty($theme->downloaded) ) : ?>
-<p><strong><?php _e('Downloaded:') ?></strong> <?php printf(_n('%s time', '%s times', $theme->downloaded), number_format_i18n($theme->downloaded)) ?></p>
-<?php endif; ?>
-<div class="star-holder" title="<?php printf(_n('(based on %s rating)', '(based on %s ratings)', $theme->num_ratings), number_format_i18n($theme->num_ratings)) ?>">
-        <div class="star star-rating" style="width: <?php echo esc_attr($theme->rating) ?>px"></div>
-        <div class="star star5"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('5 stars') ?>" /></div>
-        <div class="star star4"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('4 stars') ?>" /></div>
-        <div class="star star3"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('3 stars') ?>" /></div>
-        <div class="star star2"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('2 stars') ?>" /></div>
-        <div class="star star1"><img src="<?php echo admin_url('images/star.png?v=20110615'); ?>" alt="<?php esc_attr_e('1 star') ?>" /></div>
-</div>
-</div>
-<?php }
-        /*
-         object(stdClass)[59]
-         public 'name' => string 'Magazine Basic' (length=14)
-         public 'slug' => string 'magazine-basic' (length=14)
-         public 'version' => string '1.1' (length=3)
-         public 'author' => string 'tinkerpriest' (length=12)
-         public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)
-         public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
-         public 'rating' => float 80
-         public 'num_ratings' => int 1
-         public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
-         public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)
-         public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
-         */
</del><ins>+        <a class="screenshot" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>">
+                <img src='<?php echo esc_url( $theme->screenshot_url ); ?>' width='150' />
+        </a>
+
+        <h3><?php
+                /* translators: 1: theme name, 2: author name */
+                printf( __( '%1$s <span>by %2$s</span>' ), $name, $author );
+        ?></h3>
+
+        <div class="install-theme-info">
+                <a class="theme-install button-primary" href="<?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ); ?>"><?php _e( 'Install' ); ?></a>
+                <h3 class="theme-name"><?php echo $name; ?></h3>
+                <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span>
+                <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" />
+                <div class="theme-rating" title="<?php echo esc_attr( $num_ratings ); ?>">
+                        <div style="width:<?php echo esc_attr( intval( $theme->rating ) . 'px' ); ?>;"></div>
+                </div>
+                <div class="theme-version">
+                        <strong><?php _e('Version:') ?> </strong>
+                        <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?>
+                </div>
+                <div class="theme-description">
+                        <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?>
+                </div>
+                <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" />
+        </div>
+        <?php
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkwpadminjsthemedevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/js/theme.dev.js (20137 => 20138)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/js/theme.dev.js        2012-03-07 17:02:22 UTC (rev 20137)
+++ trunk/wp-admin/js/theme.dev.js        2012-03-07 17:35:17 UTC (rev 20138)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+/*
+ * Theme Install
+ *
+ * Displays theme previews on theme install pages.
+ */
+jQuery( function($) {
+        var preview = $('#theme-installer'),
+                info = preview.find('.install-theme-info'),
+                panel = preview.find('.wp-full-overlay-main'),
+                body = $( document.body );
+
+        preview.on( 'click', '.close-full-overlay', function( event ) {
+                preview.fadeOut( 200, function() {
+                        panel.empty();
+                        body.removeClass('theme-installer-active full-overlay-active');
+                });
+                event.preventDefault();
+        });
+
+        preview.on( 'click', '.collapse-sidebar', function( event ) {
+                preview.toggleClass('collapsed');
+                event.preventDefault();
+        });
+
+        $('#availablethemes').on( 'click', '.available-theme', function( event ) {
+                var src;
+
+                info.html( $(this).find('.install-theme-info').html() );
+                src = info.find( '.theme-preview-url' ).val();
+                panel.html( '<iframe src="' + src + '" />');
+                preview.fadeIn( 200, function() {
+                        body.addClass('theme-installer-active full-overlay-active');
+                });
+                event.preventDefault();
+        });
+});
+
</ins><span class="cx"> var ThemeViewer;
</span><span class="cx">
</span><span class="cx"> (function($){
</span></span></pre>
</div>
</div>
</body>
</html>