<!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>[20545] trunk/wp-includes: Theme Customizer: Improve image picker control.</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/20545">20545</a></dd>
<dt>Author</dt> <dd>koopersmith</dd>
<dt>Date</dt> <dd>2012-04-20 02:39:55 +0000 (Fri, 20 Apr 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Theme Customizer: Improve image picker control. see <a href="http://core.trac.wordpress.org/ticket/19910">#19910</a>.

Overhauled image pickers:
* Add support for drag and drop uploads to image controls.
* Improve the 'uploaded' tab in image controls: automatically add images uploaded during the current session, hide the tab when no uploaded images exist.
* Move the header image control to the WP_Customize_Header_Image_Control class. Remove wp_customize_print_uploaded_headers() and wp_customize_print_uploaded_headers() functions.
* Abstract the dropdown functionality from the color picker to the .dropdown class.
* In wp.Uploader, unset element keys if passed an empty jQuery collection.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpincludesclasswpcustomizecontrolphp">trunk/wp-includes/class-wp-customize-control.php</a></li>
<li><a href="#trunkwpincludesclasswpcustomizephp">trunk/wp-includes/class-wp-customize.php</a></li>
<li><a href="#trunkwpincludescsscustomizecontrolsdevcss">trunk/wp-includes/css/customize-controls.dev.css</a></li>
<li><a href="#trunkwpincludesjscustomizecontrolsdevjs">trunk/wp-includes/js/customize-controls.dev.js</a></li>
<li><a href="#trunkwpincludesjspluploadwppluploaddevjs">trunk/wp-includes/js/plupload/wp-plupload.dev.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpincludesclasswpcustomizecontrolphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-customize-control.php (20544 => 20545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-customize-control.php        2012-04-20 01:10:39 UTC (rev 20544)
+++ trunk/wp-includes/class-wp-customize-control.php        2012-04-20 02:39:55 UTC (rev 20545)
</span><span class="lines">@@ -180,10 +180,10 @@
</span><span class="cx">                                 ?&gt;
</span><span class="cx">                                 &lt;label&gt;
</span><span class="cx">                                         &lt;span class=&quot;customize-control-title&quot;&gt;&lt;?php echo esc_html( $this-&gt;label ); ?&gt;&lt;/span&gt;
</span><del>-                                        &lt;a href=&quot;#&quot; class=&quot;color-picker-toggle&quot;&gt;
-                                                &lt;div class=&quot;color-picker-spot&quot;&gt;&lt;/div&gt;
-                                                &lt;div class=&quot;color-picker-dropdown&quot;&gt;&lt;/div&gt;
-                                        &lt;/a&gt;
</del><ins>+                                        &lt;div class=&quot;dropdown color-picker-toggle&quot;&gt;
+                                                &lt;div class=&quot;dropdown-content color-picker-spot&quot;&gt;&lt;/div&gt;
+                                                &lt;div class=&quot;dropdown-arrow&quot;&gt;&lt;/div&gt;
+                                        &lt;/div&gt;
</ins><span class="cx">                                         &lt;div class=&quot;color-picker-control color-picker-hex&quot;&gt;
</span><span class="cx">                                                 &lt;span&gt;#&lt;/span&gt;
</span><span class="cx">                                                 &lt;input type=&quot;text&quot; &lt;?php $this-&gt;link(); ?&gt; /&gt;
</span><span class="lines">@@ -291,9 +291,17 @@
</span><span class="cx"> 
</span><span class="cx"> class WP_Customize_Image_Control extends WP_Customize_Upload_Control {
</span><span class="cx">         public $type = 'image';
</span><del>-        public $tabs = array();
</del><span class="cx">         public $get_url;
</span><span class="cx"> 
</span><ins>+        protected $tabs = array();
+
+        public function __construct( $manager, $id, $args ) {
+                parent::__construct( $manager, $id, $args );
+
+                $this-&gt;add_tab( 'upload-new', __('Upload New'), array( $this, 'tab_upload_new' ) );
+                $this-&gt;add_tab( 'uploaded',   __('Uploaded'),   array( $this, 'tab_uploaded' ) );
+        }
+
</ins><span class="cx">         public function render_content() {
</span><span class="cx">                 $src = $this-&gt;value();
</span><span class="cx">                 if ( isset( $this-&gt;get_url ) )
</span><span class="lines">@@ -303,35 +311,99 @@
</span><span class="cx">                 &lt;label class=&quot;customize-image-picker&quot;&gt;
</span><span class="cx">                         &lt;span class=&quot;customize-control-title&quot;&gt;&lt;?php echo esc_html( $this-&gt;label ); ?&gt;&lt;/span&gt;
</span><span class="cx"> 
</span><del>-                        &lt;div class=&quot;thumbnail&quot;&gt;
-                                &lt;?php if ( empty( $src ) ): ?&gt;
-                                        &lt;img style=&quot;display:none;&quot; /&gt;
-                                &lt;?php else: ?&gt;
-                                        &lt;img src=&quot;&lt;?php echo esc_url( $src ); ?&gt;&quot; /&gt;
-                                &lt;?php endif; ?&gt;
-                        &lt;/div&gt;
</del><span class="cx"> 
</span><del>-                        &lt;div class=&quot;actions&quot;&gt;
-                                &lt;a href=&quot;#&quot; class=&quot;upload&quot;&gt;&lt;?php _e( 'Upload New' ); ?&gt;&lt;/a&gt;
-                                &lt;a href=&quot;#&quot; class=&quot;change&quot;&gt;&lt;?php _e( 'Change Image' ); ?&gt;&lt;/a&gt;
-                                &lt;a href=&quot;#&quot; class=&quot;remove&quot;&gt;&lt;?php _e( 'Remove Image' ); ?&gt;&lt;/a&gt;
</del><ins>+                        &lt;div class=&quot;dropdown preview-thumbnail&quot;&gt;
+                                &lt;div class=&quot;dropdown-content&quot;&gt;
+                                        &lt;?php if ( empty( $src ) ): ?&gt;
+                                                &lt;img style=&quot;display:none;&quot; /&gt;
+                                        &lt;?php else: ?&gt;
+                                                &lt;img src=&quot;&lt;?php echo esc_url( $src ); ?&gt;&quot; /&gt;
+                                        &lt;?php endif; ?&gt;
+                                &lt;/div&gt;
+                                &lt;div class=&quot;dropdown-arrow&quot;&gt;&lt;/div&gt;
</ins><span class="cx">                         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;div class=&quot;library&quot;&gt;
</span><span class="cx">                                 &lt;ul&gt;
</span><del>-                                        &lt;?php foreach ( $this-&gt;tabs as $tab ): ?&gt;
-                                                &lt;li data-customize-tab='&lt;?php echo esc_attr( $tab[0] ); ?&gt;'&gt;
-                                                        &lt;?php echo esc_html( $tab[1] ); ?&gt;
</del><ins>+                                        &lt;?php foreach ( $this-&gt;tabs as $id =&gt; $tab ): ?&gt;
+                                                &lt;li data-customize-tab='&lt;?php echo esc_attr( $id ); ?&gt;'&gt;
+                                                        &lt;?php echo esc_html( $tab['label'] ); ?&gt;
</ins><span class="cx">                                                 &lt;/li&gt;
</span><span class="cx">                                         &lt;?php endforeach; ?&gt;
</span><span class="cx">                                 &lt;/ul&gt;
</span><del>-                                &lt;?php foreach ( $this-&gt;tabs as $tab ): ?&gt;
-                                        &lt;div class=&quot;library-content&quot; data-customize-tab='&lt;?php echo esc_attr( $tab[0] ); ?&gt;'&gt;
-                                                &lt;?php call_user_func( $tab[2] ); ?&gt;
</del><ins>+                                &lt;?php foreach ( $this-&gt;tabs as $id =&gt; $tab ): ?&gt;
+                                        &lt;div class=&quot;library-content&quot; data-customize-tab='&lt;?php echo esc_attr( $id ); ?&gt;'&gt;
+                                                &lt;?php call_user_func( $tab['callback'] ); ?&gt;
</ins><span class="cx">                                         &lt;/div&gt;
</span><span class="cx">                                 &lt;?php endforeach; ?&gt;
</span><span class="cx">                         &lt;/div&gt;
</span><ins>+
+                        &lt;div class=&quot;actions&quot;&gt;
+                                &lt;a href=&quot;#&quot; class=&quot;remove&quot;&gt;&lt;?php _e( 'Remove Image' ); ?&gt;&lt;/a&gt;
+                        &lt;/div&gt;
</ins><span class="cx">                 &lt;/label&gt;
</span><span class="cx">                 &lt;?php
</span><span class="cx">         }
</span><ins>+
+        public function add_tab( $id, $label, $callback ) {
+                $this-&gt;tabs[ $id ] = array(
+                        'label'    =&gt; $label,
+                        'callback' =&gt; $callback,
+                );
+        }
+
+        public function remove_tab( $id ) {
+                unset( $this-&gt;tabs[ $id ] );
+        }
+
+        public function tab_upload_new() {
+                ?&gt;
+                &lt;div class=&quot;upload-dropzone&quot;&gt;
+                        &lt;?php _e('Drop a file here or &lt;a href=&quot;#&quot; class=&quot;upload&quot;&gt;select a file&lt;/a&gt;.'); ?&gt;
+                &lt;/div&gt;
+                &lt;?php
+        }
+
+        public function tab_uploaded() {
+                ?&gt;
+                &lt;div class=&quot;uploaded-target&quot;&gt;&lt;/div&gt;
+                &lt;?php
+        }
</ins><span class="cx"> }
</span><ins>+
+class WP_Customize_Header_Image_Control extends WP_Customize_Image_Control {
+        public function __construct( $manager ) {
+                parent::__construct( $manager, 'header_image', array(
+                        'label'   =&gt; __( 'Header Image' ),
+                        'section' =&gt; 'header',
+                        'context' =&gt; 'custom-header',
+                        'removed' =&gt; 'remove-header',
+                        'get_url' =&gt; 'get_header_image',
+                ) );
+
+                $this-&gt;add_tab( 'default',  __('Default'),  array( $this, 'tab_default_headers' ) );
+        }
+
+        public function tab_uploaded() {
+                $headers = get_uploaded_header_images();
+
+                ?&gt;&lt;div class=&quot;uploaded-target&quot;&gt;&lt;/div&gt;&lt;?php
+
+                foreach ( $headers as $header ) : ?&gt;
+                        &lt;a href=&quot;#&quot; class=&quot;thumbnail&quot; data-customize-image-value=&quot;&lt;?php echo esc_url( $header['url'] ); ?&gt;&quot;&gt;
+                                &lt;img src=&quot;&lt;?php echo esc_url( $header['thumbnail_url'] ); ?&gt;&quot; /&gt;
+                        &lt;/a&gt;
+                &lt;?php endforeach;
+        }
+
+        public function tab_default_headers() {
+                global $custom_image_header;
+                $custom_image_header-&gt;process_default_headers();
+
+                foreach ( $custom_image_header-&gt;default_headers as $header ) : ?&gt;
+                        &lt;a href=&quot;#&quot; class=&quot;thumbnail&quot; data-customize-image-value=&quot;&lt;?php echo esc_url( $header['url'] ); ?&gt;&quot;&gt;
+                                &lt;img src=&quot;&lt;?php echo esc_url( $header['thumbnail_url'] ); ?&gt;&quot; /&gt;
+                        &lt;/a&gt;
+                &lt;?php endforeach;
+        }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesclasswpcustomizephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-customize.php (20544 => 20545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-customize.php        2012-04-20 01:10:39 UTC (rev 20544)
+++ trunk/wp-includes/class-wp-customize.php        2012-04-20 02:39:55 UTC (rev 20545)
</span><span class="lines">@@ -537,17 +537,7 @@
</span><span class="cx">                         'theme_supports' =&gt; 'custom-header',
</span><span class="cx">                 ) );
</span><span class="cx"> 
</span><del>-                $this-&gt;add_control( new WP_Customize_Image_Control( $this, 'header_image', array(
-                        'label'          =&gt; 'Header Image',
-                        'section'        =&gt; 'header',
-                        'context'        =&gt; 'custom-header',
-                        'removed'        =&gt; 'remove-header',
-                        'get_url'        =&gt; 'get_header_image',
-                        'tabs'           =&gt; array(
-                                array( 'uploaded', __('Uploaded'), 'wp_customize_print_uploaded_headers' ),
-                                array( 'included', __('Included'), 'wp_customize_print_included_headers' ),
-                        ),
-                ) ) );
</del><ins>+                $this-&gt;add_control( new WP_Customize_Header_Image_Control( $this ) );
</ins><span class="cx"> 
</span><span class="cx">                 /* Custom Background */
</span><span class="cx"> 
</span><span class="lines">@@ -758,25 +748,4 @@
</span><span class="cx">                 return $color;
</span><span class="cx"> 
</span><span class="cx">         return $color;
</span><del>-}
-
-function wp_customize_print_uploaded_headers() {
-        $headers = get_uploaded_header_images();
-
-        foreach ( $headers as $header ) : ?&gt;
-                &lt;a href=&quot;&lt;?php echo esc_url( $header['url'] ); ?&gt;&quot;&gt;
-                        &lt;img src=&quot;&lt;?php echo esc_url( $header['thumbnail_url'] ); ?&gt;&quot; /&gt;
-                &lt;/a&gt;
-        &lt;?php endforeach;
-}
-
-function wp_customize_print_included_headers() {
-        global $custom_image_header;
-        $custom_image_header-&gt;process_default_headers();
-
-        foreach ( $custom_image_header-&gt;default_headers as $header ) : ?&gt;
-                &lt;a href=&quot;&lt;?php echo esc_url( $header['url'] ); ?&gt;&quot;&gt;
-                        &lt;img src=&quot;&lt;?php echo esc_url( $header['thumbnail_url'] ); ?&gt;&quot; /&gt;
-                &lt;/a&gt;
-        &lt;?php endforeach;
</del><span class="cx"> }
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludescsscustomizecontrolsdevcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/css/customize-controls.dev.css (20544 => 20545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/css/customize-controls.dev.css        2012-04-20 01:10:39 UTC (rev 20544)
+++ trunk/wp-includes/css/customize-controls.dev.css        2012-04-20 02:39:55 UTC (rev 20545)
</span><span class="lines">@@ -196,34 +196,37 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /*
</span><del>- * Color Picker
</del><ins>+ * Dropdowns
</ins><span class="cx">  */
</span><del>-.customize-section .color-picker-toggle {
</del><ins>+.customize-section .dropdown {
</ins><span class="cx">         float: left;
</span><span class="cx">         display: block;
</span><ins>+        position: relative;
+        cursor: pointer;
</ins><span class="cx"> 
</span><span class="cx">         -webkit-border-radius: 3px;
</span><span class="cx">         border-radius: 3px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-spot,
-.customize-section .color-picker-dropdown {
</del><ins>+.customize-section .dropdown-content {
+        overflow: hidden;
</ins><span class="cx">         float: left;
</span><ins>+        min-width: 30px;
</ins><span class="cx">         height: 24px;
</span><span class="cx">         line-height: 24px;
</span><del>-}
-
-.customize-section .color-picker-spot {
-        min-width: 30px;
</del><ins>+        margin-right: 16px;
</ins><span class="cx">         padding: 0 5px;
</span><del>-        background-color: #fff;
-        border: 1px solid rgba( 0, 0, 0, 0.15 );
</del><ins>+        background-color: #eee;
+        border: 1px solid #ccc;
</ins><span class="cx">         -webkit-border-radius: 3px 0 0 3px;
</span><span class="cx">         border-radius: 3px 0 0 3px;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-dropdown {
-        position: relative;
</del><ins>+.customize-control .dropdown-arrow {
+        position: absolute;
+        top: 0;
+        bottom: 0;
+        right: 0;
</ins><span class="cx">         width: 15px;
</span><span class="cx"> 
</span><span class="cx">         border-color: #ccc;
</span><span class="lines">@@ -233,42 +236,51 @@
</span><span class="cx">         border-radius: 0 3px 3px 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-dropdown:after {
</del><ins>+.customize-control .dropdown-arrow:after {
</ins><span class="cx">         content: '';
</span><span class="cx">         width: 0;
</span><span class="cx">         height: 0;
</span><del>-        border-color: #ccc transparent transparent transparent;
</del><ins>+        border-color: #ccc transparent;
</ins><span class="cx">         border-style: solid;
</span><del>-        border-width: 4px;
</del><ins>+        border-width: 4px 4px 0 4px;
</ins><span class="cx">         position: absolute;
</span><del>-        top: 11px;
</del><ins>+        top: 50%;
+        margin-top: -1px;
</ins><span class="cx">         right: 4px;
</span><span class="cx">         z-index: 1;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-toggle.open .color-picker-dropdown:after {
-        border-color: transparent transparent #ccc transparent;
-        top: 6px;
</del><ins>+.customize-control.open .dropdown-arrow:after {
+        border-width: 0 4px 4px 4px;
+        margin-top: -2px;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-toggle:hover .color-picker-spot {
-        border-color: rgba( 0, 0, 0, 0.25 );
</del><ins>+.customize-section .dropdown:hover .dropdown-content,
+.customize-control .dropdown:hover .dropdown-arrow {
+        border-color: #aaa;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-toggle:hover .color-picker-dropdown {
-        border-color: #aaa;
</del><ins>+.customize-section .dropdown:hover .dropdown-arrow:after {
+        border-color: #aaa transparent;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-toggle:hover .color-picker-dropdown:after {
-        border-color: #aaa transparent transparent transparent;
</del><ins>+/*
+ * Color Picker
+ */
+.customize-control .color-picker-control {
+        display: none;
</ins><span class="cx"> }
</span><ins>+.customize-control.open .color-picker-control {
+        display: block;
+}
</ins><span class="cx"> 
</span><del>-.customize-section .color-picker-toggle.open:hover .color-picker-dropdown:after {
-        border-color: transparent transparent #aaa transparent;
</del><ins>+.customize-control .dropdown .color-picker-spot {
+        background-color: #fff;
+        border: 1px solid rgba( 0, 0, 0, 0.15 );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .color-picker-control {
-        display: none;
</del><ins>+.customize-section .dropdown:hover .color-picker-spot {
+        border-color: rgba( 0, 0, 0, 0.25 );
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .customize-section .color-picker-hex {
</span><span class="lines">@@ -317,24 +329,31 @@
</span><span class="cx"> /*
</span><span class="cx">  * Image Picker
</span><span class="cx">  */
</span><del>-.customize-section .customize-control-image .thumbnail {
-        float: right;
-        width: 138px;
-        min-height: 25px;
-        border: 1px solid #ccc;
-        margin-bottom: 5px;
-        background: #eee;
</del><ins>+
+.customize-control-image .library,
+.customize-control-image .actions {
+        display: none;
</ins><span class="cx"> }
</span><ins>+.customize-control-image.open .library,
+.customize-control-image.open .actions {
+        display: block;
+}
</ins><span class="cx"> 
</span><del>-.customize-section .customize-control-image .thumbnail img {
</del><ins>+.customize-section .customize-control-image .dropdown-content {
+        height: auto;
+        min-height: 24px;
+        min-width: 40px;
+        padding: 0;
+}
+
+.customize-section .customize-control-image .preview-thumbnail img {
</ins><span class="cx">         display: block;
</span><del>-        max-width: 138px;
</del><ins>+        max-width: 122px;
</ins><span class="cx">         max-height: 98px;
</span><span class="cx">         margin: 0 auto;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .customize-section .customize-control-image .actions {
</span><del>-        width: 140px;
</del><span class="cx">         float: right;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -342,39 +361,17 @@
</span><span class="cx">         display: block;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library {
-        display: none;
-/*        float: left;*/
-}
-
-/*.customize-section .customize-control-image .library label {
-        display: block;
-        position: relative;
-        float: left;
-        padding: 0 0 5px 20px;
-}
-.customize-section .customize-control-image .library input {
-        display: block;
-        position: absolute;
-        top: 50%;
-        left: 0;
-        margin-top: -7px;
-}*/
-/*.customize-section .customize-control-image .library .wp-tab-panel {
-        padding: 10px 10px 5px 8px;
-}*/
-
</del><span class="cx"> .customize-section .customize-control-image .library ul {
</span><span class="cx">         border-bottom: 1px solid #dfdfdf;
</span><span class="cx">         float: left;
</span><span class="cx">         width: 100%;
</span><del>-        margin: 5px 0;
</del><ins>+        margin: 10px 0 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .customize-section .customize-control-image .library li {
</span><span class="cx">         color: #999;
</span><span class="cx">         float: left;
</span><del>-        padding: 4px 6px;
</del><ins>+        padding: 3px 5px;
</ins><span class="cx">         margin: 0;
</span><span class="cx">         border-style: solid;
</span><span class="cx">         border-color: transparent;
</span><span class="lines">@@ -382,38 +379,53 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .customize-section .customize-control-image .library li.library-selected {
</span><ins>+        margin-bottom: -1px;
+        padding-bottom: 4px;
+
</ins><span class="cx">         color: #777;
</span><ins>+        background: #f5f5f5;
</ins><span class="cx">         border-color: #dfdfdf;
</span><del>-        background: #f5f5f5;
-        margin-bottom: -1px;
-        padding-bottom: 5px;
</del><ins>+        -webkit-border-radius: 3px 3px 0 0;
+        border-radius: 3px 3px 0 0 ;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library div {
-        width: 100%;
</del><ins>+.customize-section .customize-control-image .library-content {
+        display: none;
+        width: 260px;
</ins><span class="cx">         float: left;
</span><ins>+        padding: 10px 0;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library a {
</del><ins>+.customize-section .customize-control-image .library-content.library-selected {
</ins><span class="cx">         display: block;
</span><del>-        max-width: 220px;
-        max-height: 80px;
-        margin: 5px auto;
-        padding: 4px;
-        background: #fff;
-        border: 1px solid #dfdfdf;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library a:hover {
</del><ins>+.customize-section .customize-control-image .library .thumbnail {
+        display: block;
+        width: 100%;
+}
+
+.customize-section .customize-control-image .library .thumbnail:hover img {
</ins><span class="cx">         border-color: #21759b;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library img {
</del><ins>+.customize-section .customize-control-image .library .thumbnail img {
</ins><span class="cx">         display: block;
</span><span class="cx">         max-width: 220px;
</span><span class="cx">         max-height: 80px;
</span><ins>+
+        margin: 5px auto;
+        padding: 4px;
+        background: #fff;
+        border: 1px solid #dfdfdf;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-.customize-section .customize-control-image .library-content {
-        display: none;
-}
</del><ins>+.customize-section .customize-control-upload .upload-dropzone,
+.customize-section .customize-control-image .upload-dropzone {
+        padding: 15px 10px;
+        border: 3px dashed #dfdfdf;
+        margin: 5px auto;
+        text-align: center;
+        color: #777;
+        position: relative;
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkwpincludesjscustomizecontrolsdevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/customize-controls.dev.js (20544 => 20545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/customize-controls.dev.js        2012-04-20 01:10:39 UTC (rev 20544)
+++ trunk/wp-includes/js/customize-controls.dev.js        2012-04-20 02:39:55 UTC (rev 20545)
</span><span class="lines">@@ -90,6 +90,12 @@
</span><span class="cx">                                         element.set( setting() );
</span><span class="cx">                                 });
</span><span class="cx">                         });
</span><ins>+
+                        // Support the .dropdown class to open/close complex elements
+                        this.container.on( 'click', '.dropdown', function( event ) {
+                                event.preventDefault();
+                                control.container.toggleClass('open');
+                        });
</ins><span class="cx">                 },
</span><span class="cx">                 ready: function() {}
</span><span class="cx">         });
</span><span class="lines">@@ -97,23 +103,15 @@
</span><span class="cx">         api.ColorControl = api.Control.extend({
</span><span class="cx">                 ready: function() {
</span><span class="cx">                         var control = this,
</span><del>-                                toggle, spot, ui, text, update;
</del><ins>+                                spot, text, update;
</ins><span class="cx"> 
</span><del>-                        toggle = this.container.find( '.color-picker-toggle' );
-                        spot   = toggle.find('.color-picker-spot');
-                        ui     = this.container.find( '.color-picker-control' );
</del><ins>+                        spot   = this.container.find('.color-picker-spot');
</ins><span class="cx">                         update = function( color ) {
</span><span class="cx">                                 color = '#' + color;
</span><span class="cx">                                 spot.css( 'background', color );
</span><span class="cx">                                 control.farbtastic.setColor( color );
</span><span class="cx">                         };
</span><span class="cx"> 
</span><del>-                        toggle.on( 'click', function( event ) {
-                                ui.toggle();
-                                toggle.toggleClass( 'open' );
-                                event.preventDefault();
-                        });
-
</del><span class="cx">                         this.farbtastic = $.farbtastic( this.container.find('.farbtastic-placeholder'), function( color ) {
</span><span class="cx">                                 control.setting.set( color.replace( '#', '' ) );
</span><span class="cx">                         });
</span><span class="lines">@@ -129,11 +127,12 @@
</span><span class="cx"> 
</span><span class="cx">                         this.params.removed = this.params.removed || '';
</span><span class="cx"> 
</span><ins>+                        this.success = $.proxy( this.success, this );
+
</ins><span class="cx">                         this.uploader = new wp.Uploader({
</span><del>-                                browser: this.container.find('.upload'),
-                                success: function( attachment ) {
-                                        control.setting.set( attachment.url );
-                                }
</del><ins>+                                browser:  this.container.find('.upload'),
+                                dropzone: this.container.find('.upload-dropzone'),
+                                success:  this.success
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         this.remover = this.container.find('.remove');
</span><span class="lines">@@ -149,6 +148,9 @@
</span><span class="cx">                         if ( this.params.context )
</span><span class="cx">                                 control.uploader.param( 'post_data[context]', this.params.context );
</span><span class="cx">                 },
</span><ins>+                success: function( attachment ) {
+                        this.setting.set( attachment.url );
+                },
</ins><span class="cx">                 removerVisibility: function( to ) {
</span><span class="cx">                         this.remover.toggle( to != this.params.removed );
</span><span class="cx">                 }
</span><span class="lines">@@ -156,44 +158,80 @@
</span><span class="cx"> 
</span><span class="cx">         api.ImageControl = api.UploadControl.extend({
</span><span class="cx">                 ready: function() {
</span><del>-                        var control = this;
</del><ins>+                        var control = this,
+                                panels;
</ins><span class="cx"> 
</span><span class="cx">                         api.UploadControl.prototype.ready.call( this );
</span><span class="cx"> 
</span><del>-                        this.thumbnail    = this.container.find('.thumbnail img');
</del><ins>+                        this.thumbnail    = this.container.find('.preview-thumbnail img');
</ins><span class="cx">                         this.thumbnailSrc = $.proxy( this.thumbnailSrc, this );
</span><span class="cx">                         this.setting.bind( this.thumbnailSrc );
</span><span class="cx"> 
</span><span class="cx">                         this.library = this.container.find('.library');
</span><del>-                        this.changer = this.container.find('.change');
</del><span class="cx"> 
</span><del>-                        this.changer.click( function( event ) {
-                                control.library.toggle();
-                                event.preventDefault();
</del><ins>+                        // Generate tab objects
+                        this.tabs = {};
+                        panels    = this.library.find('.library-content');
+
+                        this.library.children('ul').children('li').each( function() {
+                                var link  = $(this),
+                                        id    = link.data('customizeTab'),
+                                        panel = panels.filter('[data-customize-tab=&quot;' + id + '&quot;]');
+
+                                control.tabs[ id ] = {
+                                        both:  link.add( panel ),
+                                        link:  link,
+                                        panel: panel
+                                };
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><del>-                        this.library.on( 'click', 'li', function( event ) {
-                                var tab = $(this),
-                                        id = tab.data('customizeTab');
</del><ins>+                        // Select a tab
+                        this.selected = this.tabs[ panels.first().data('customizeTab') ];
+                        this.selected.both.addClass('library-selected');
</ins><span class="cx"> 
</span><ins>+                        // Bind tab switch events
+                        this.library.children('ul').on( 'click', 'li', function( event ) {
+                                var id  = $(this).data('customizeTab'),
+                                        tab = control.tabs[ id ];
+
</ins><span class="cx">                                 event.preventDefault();
</span><span class="cx"> 
</span><del>-                                if ( tab.hasClass('library-selected') )
</del><ins>+                                if ( tab.link.hasClass('library-selected') )
</ins><span class="cx">                                         return;
</span><span class="cx"> 
</span><del>-                                tab.siblings('.library-selected').removeClass('library-selected');
-                                tab.addClass('library-selected');
-
-                                control.library.find('div').hide().filter( function() {
-                                        return $(this).data('customizeTab') === id;
-                                }).show();
</del><ins>+                                control.selected.both.removeClass('library-selected');
+                                control.selected = tab;
+                                control.selected.both.addClass('library-selected');
</ins><span class="cx">                         });
</span><span class="cx"> 
</span><span class="cx">                         this.library.on( 'click', 'a', function( event ) {
</span><del>-                                control.setting.set( $(this).attr('href') );
-                                event.preventDefault();
</del><ins>+                                var value = $(this).data('customizeImageValue');
+
+                                if ( value ) {
+                                        control.setting.set( value );
+                                        event.preventDefault();
+                                }
</ins><span class="cx">                         });
</span><ins>+
+                        if ( this.tabs.uploaded ) {
+                                this.tabs.uploaded.target = this.library.find('.uploaded-target');
+                                if ( ! this.tabs.uploaded.panel.find('.thumbnail').length )
+                                        this.tabs.uploaded.both.addClass('hidden');
+                        }
</ins><span class="cx">                 },
</span><ins>+                success: function( attachment ) {
+                        api.UploadControl.prototype.success.call( this, attachment );
+
+                        // Add the uploaded image to the uploaded tab.
+                        if ( this.tabs.uploaded &amp;&amp; this.tabs.uploaded.target.length ) {
+                                this.tabs.uploaded.both.removeClass('hidden');
+
+                                $( '&lt;a href=&quot;#&quot; class=&quot;thumbnail&quot;&gt;&lt;/a&gt;' )
+                                        .data( 'customizeImageValue', attachment.url )
+                                        .append( '&lt;img src=&quot;' +  attachment.url+ '&quot; /&gt;' )
+                                        .appendTo( this.tabs.uploaded.target );
+                        }
+                },
</ins><span class="cx">                 thumbnailSrc: function( to ) {
</span><span class="cx">                         if ( /^(https?:)?\/\//.test( to ) )
</span><span class="cx">                                 this.thumbnail.prop( 'src', to ).show();
</span></span></pre></div>
<a id="trunkwpincludesjspluploadwppluploaddevjs"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/js/plupload/wp-plupload.dev.js (20544 => 20545)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/js/plupload/wp-plupload.dev.js        2012-04-20 01:10:39 UTC (rev 20544)
+++ trunk/wp-includes/js/plupload/wp-plupload.dev.js        2012-04-20 02:39:55 UTC (rev 20545)
</span><span class="lines">@@ -47,6 +47,12 @@
</span><span class="cx">                                 continue;
</span><span class="cx"> 
</span><span class="cx">                         this[ key ] = $( this[ key ] ).first();
</span><ins>+
+                        if ( ! this[ key ].length ) {
+                                delete this[ key ];
+                                continue;
+                        }
+
</ins><span class="cx">                         if ( ! this[ key ].prop('id') )
</span><span class="cx">                                 this[ key ].prop( 'id', '__wp-uploader-id-' + Uploader.uuid++ );
</span><span class="cx">                         this.plupload[ elements[ key ] ] = this[ key ].prop('id');
</span></span></pre>
</div>
</div>

</body>
</html>