<!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>[28682] trunk/src: Grid view for the media library, first pass.</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 { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { 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/28682">28682</a></dd>
<dt>Author</dt> <dd>helen</dd>
<dt>Date</dt> <dd>2014-06-05 22:00:24 +0000 (Thu, 05 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Grid view for the media library, first pass. This is alpha; expect imperfection. We will be iterating further.

props ericlewis, shaunandrews, wonderboymusic.
see <a href="http://core.trac.wordpress.org/ticket/24716">#24716</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadmincsslisttablescss">trunk/src/wp-admin/css/list-tables.css</a></li>
<li><a href="#trunksrcwpadminincludesclasswplisttablephp">trunk/src/wp-admin/includes/class-wp-list-table.php</a></li>
<li><a href="#trunksrcwpadminincludesclasswpmedialisttablephp">trunk/src/wp-admin/includes/class-wp-media-list-table.php</a></li>
<li><a href="#trunksrcwpadminjsmediajs">trunk/src/wp-admin/js/media.js</a></li>
<li><a href="#trunksrcwpadminuploadphp">trunk/src/wp-admin/upload.php</a></li>
<li><a href="#trunksrcwpincludescssmediaviewscss">trunk/src/wp-includes/css/media-views.css</a></li>
<li><a href="#trunksrcwpincludesjsmediamodelsjs">trunk/src/wp-includes/js/media-models.js</a></li>
<li><a href="#trunksrcwpincludesjsmediaviewsjs">trunk/src/wp-includes/js/media-views.js</a></li>
<li><a href="#trunksrcwpincludesmediatemplatephp">trunk/src/wp-includes/media-template.php</a></li>
<li><a href="#trunksrcwpincludesmediaphp">trunk/src/wp-includes/media.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadmincsslisttablescss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/css/list-tables.css (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/css/list-tables.css   2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-admin/css/list-tables.css      2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -634,7 +634,6 @@
</span><span class="cx"> 
</span><span class="cx"> .view-switch > a:before {
</span><span class="cx">  color: #bbb;
</span><del>-       content: '\f163';
</del><span class="cx">   display: inline-block;
</span><span class="cx">  float: left;
</span><span class="cx">  font: normal 20px/1 'dashicons';
</span><span class="lines">@@ -645,6 +644,10 @@
</span><span class="cx">  -moz-osx-font-smoothing: grayscale;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.view-switch > .view-list:before {
+       content: '\f163';
+}
+
</ins><span class="cx"> .view-switch a:hover:before {
</span><span class="cx">  color: #727272;
</span><span class="cx"> }
</span><span class="lines">@@ -653,11 +656,18 @@
</span><span class="cx">  color: #0074a2;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.view-switch > a + a:before {
</del><ins>+.view-switch > a + a {
</ins><span class="cx">   margin-left: 5px;
</span><ins>+}
+
+.view-switch > .view-excerpt:before {
</ins><span class="cx">   content: '\f164';
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.view-switch > .view-grid:before {
+       content: '\f180';
+}
+
</ins><span class="cx"> .filter {
</span><span class="cx">  float: left;
</span><span class="cx">  margin: -5px 0 0 10px;
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswplisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-list-table.php (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-list-table.php      2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-admin/includes/class-wp-list-table.php 2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -493,8 +493,17 @@
</span><span class="cx">          <div class="view-switch">
</span><span class="cx"> <?php
</span><span class="cx">                  foreach ( $modes as $mode => $title ) {
</span><del>-                               $class = ( $current_mode == $mode ) ? 'class="current"' : '';
-                               echo "<a href='" . esc_url( add_query_arg( 'mode', $mode, $_SERVER['REQUEST_URI'] ) ) . "' $class><img id='view-switch-$mode' src='" . esc_url( includes_url( 'images/blank.gif' ) ) . "' width='20' height='20' title='$title' alt='$title' /></a>\n";
</del><ins>+                                $classes = array( 'view-' . $mode );
+                               if ( $current_mode == $mode )
+                                       $classes[] = 'current';
+                               printf(
+                                       "<a href='%s' class='%s'><img id='view-switch-$mode' src='%s' width='20' height='20' title='%s' alt='%s' /></a>\n",
+                                       esc_url( add_query_arg( 'mode', $mode ) ),
+                                       implode( ' ', $classes ),
+                                       esc_url( includes_url( 'images/blank.gif' ) ),
+                                       $title,
+                                       $title
+                               );
</ins><span class="cx">                   }
</span><span class="cx">          ?>
</span><span class="cx">          </div>
</span></span></pre></div>
<a id="trunksrcwpadminincludesclasswpmedialisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/includes/class-wp-media-list-table.php (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/includes/class-wp-media-list-table.php        2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-admin/includes/class-wp-media-list-table.php   2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">  }
</span><span class="cx"> 
</span><span class="cx">  public function prepare_items() {
</span><del>-               global $lost, $wp_query, $post_mime_types, $avail_post_mime_types;
</del><ins>+                global $lost, $wp_query, $post_mime_types, $avail_post_mime_types, $mode;
</ins><span class="cx"> 
</span><span class="cx">          $q = $_REQUEST;
</span><span class="cx"> 
</span><span class="lines">@@ -34,6 +34,8 @@
</span><span class="cx"> 
</span><span class="cx">                  $this->is_trash = isset( $_REQUEST['status'] ) && 'trash' == $_REQUEST['status'];
</span><span class="cx"> 
</span><ins>+               $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
+
</ins><span class="cx">           $this->set_pagination_args( array(
</span><span class="cx">                  'total_items' => $wp_query->found_posts,
</span><span class="cx">                  'total_pages' => $wp_query->max_num_pages,
</span><span class="lines">@@ -125,6 +127,49 @@
</span><span class="cx">          _e( 'No media attachments found.' );
</span><span class="cx">  }
</span><span class="cx"> 
</span><ins>+       protected function pagination( $which ) {
+               global $mode;
+
+               parent::pagination( $which );
+
+               $this->view_switcher( $mode );
+       }
+
+       /**
+        * Display a view switcher
+        *
+        * @since 3.1.0
+        * @access protected
+        */
+       protected function view_switcher( $current_mode ) {
+               $modes = array(
+                       'list'    => __( 'List View' ),
+                       'grid' => __( 'Grid View' )
+               );
+
+?>
+               <input type="hidden" name="mode" value="<?php echo esc_attr( $current_mode ); ?>" />
+               <div class="view-switch">
+<?php
+                       foreach ( $modes as $mode => $title ) {
+                               $classes = array( 'view-' . $mode );
+                               if ( $current_mode == $mode )
+                                       $classes[] = 'current';
+                               printf(
+                                       "<a href='%s' class='%s'><img id='view-switch-$mode' src='%s' width='20' height='20' title='%s' alt='%s' /></a>\n",
+                                       esc_url( add_query_arg( 'mode', $mode ) ),
+                                       implode( ' ', $classes ),
+                                       esc_url( includes_url( 'images/blank.gif' ) ),
+                                       $title,
+                                       $title
+
+                               );
+                       }
+               ?>
+               </div>
+<?php
+       }
+
</ins><span class="cx">   protected function get_columns() {
</span><span class="cx">          $posts_columns = array();
</span><span class="cx">          $posts_columns['cb'] = '<input type="checkbox" />';
</span></span></pre></div>
<a id="trunksrcwpadminjsmediajs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/js/media.js (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/js/media.js   2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-admin/js/media.js      2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -72,6 +72,12 @@
</span><span class="cx">  };
</span><span class="cx"> 
</span><span class="cx">  $( document ).ready( function() {
</span><ins>+               // Open up a manage media frame into the grid.
+               wp.media && wp.media({
+                       frame: 'manage',
+                       container: $('#wpbody-content')
+               }).open();
+
</ins><span class="cx">           $( '#find-posts-submit' ).click( function( event ) {
</span><span class="cx">                  if ( ! $( '#find-posts-response input[type="radio"]:checked' ).length )
</span><span class="cx">                          event.preventDefault();
</span></span></pre></div>
<a id="trunksrcwpadminuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-admin/upload.php (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-admin/upload.php    2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-admin/upload.php       2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -12,6 +12,30 @@
</span><span class="cx"> if ( !current_user_can('upload_files') )
</span><span class="cx">  wp_die( __( 'You do not have permission to upload files.' ) );
</span><span class="cx"> 
</span><ins>+$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
+$modes = array( 'grid', 'list' );
+
+if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
+       $mode = $_GET['mode'];
+       update_user_option( get_current_user_id(), 'media_library_mode', $mode );
+}
+
+if ( 'grid' === $mode ) {
+       wp_enqueue_media();
+       wp_enqueue_script( 'media' );
+       require_once( ABSPATH . 'wp-admin/admin-header.php' );
+       ?><div class="view-switch media-grid-view-switch">
+               <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list">
+                       <img id="view-switch-list" src="<?php echo includes_url( 'images/blank.gif' ) ?>" width="20" height="20" title="List View" alt="List View"/>
+               </a>
+               <a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current">
+                       <img id="view-switch-excerpt" src="<?php echo includes_url( 'images/blank.gif' ) ?>" width="20" height="20" title="Grid View" alt="Grid View"/>
+               </a>
+       </div><?php
+       include( ABSPATH . 'wp-admin/admin-footer.php' );
+       exit;
+}
+
</ins><span class="cx"> $wp_list_table = _get_list_table('WP_Media_List_Table');
</span><span class="cx"> $pagenum = $wp_list_table->get_pagenum();
</span><span class="cx"> 
</span><span class="lines">@@ -237,7 +261,7 @@
</span><span class="cx"> <?php $wp_list_table->display(); ?>
</span><span class="cx"> 
</span><span class="cx"> <div id="ajax-response"></div>
</span><del>-<?php find_posts_div(); ?> 
</del><ins>+<?php find_posts_div(); ?>
</ins><span class="cx"> </form>
</span><span class="cx"> </div>
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunksrcwpincludescssmediaviewscss"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/css/media-views.css (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/css/media-views.css        2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-includes/css/media-views.css   2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -295,10 +295,11 @@
</span><span class="cx">  margin: 3px 0;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.media-sidebar .setting span {
</del><ins>+.media-sidebar .setting .name {
</ins><span class="cx">   min-width: 30%;
</span><span class="cx">  margin-right: 4%;
</span><span class="cx">  font-size: 12px;
</span><ins>+       text-align: right;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> .media-sidebar .setting select {
</span><span class="lines">@@ -319,13 +320,17 @@
</span><span class="cx">  min-height: 22px;
</span><span class="cx">  padding-top: 8px;
</span><span class="cx">  line-height: 16px;
</span><del>-       text-align: right;
</del><span class="cx">   font-weight: normal;
</span><span class="cx">  color: #666;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.compat-item label span  {
+       text-align: right;
+}
+
</ins><span class="cx"> .media-sidebar .setting input,
</span><del>-.media-sidebar .setting textarea {
</del><ins>+.media-sidebar .setting textarea,
+.media-sidebar .setting .value {
</ins><span class="cx">   margin: 1px;
</span><span class="cx">  width: 65%;
</span><span class="cx">  float: right;
</span><span class="lines">@@ -1812,7 +1817,7 @@
</span><span class="cx">  color: #666;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.image-details .embed-media-settings .setting span {
</del><ins>+.image-details .embed-media-settings .setting .name {
</ins><span class="cx">   float: left;
</span><span class="cx">  width: 25%;
</span><span class="cx">  text-align: right;
</span><span class="lines">@@ -2368,3 +2373,77 @@
</span><span class="cx">                  background-image: url(../images/spinner-2x.gif);
</span><span class="cx">          }
</span><span class="cx"> }
</span><ins>+
+
+/**
+ * Media Grid
+ */
+
+.media-grid-view h1 {
+       color: #222;
+       font-size: 23px;
+       font-weight: 400;
+       margin: 10px 0 0;
+       padding: 9px 15px 4px 22px;
+       line-height: 29px;
+}
+
+.media-grid-view-switch {
+       position: fixed;
+       right: 10px;
+       top: 44px;
+       z-index: 300;
+}
+
+/**
+ * Position both the frame and the uploader window into the content
+ * area of the screen.
+ */
+.media-grid-view {
+       position: fixed;
+       bottom: 0;
+       left: 160px;
+       right: 0;
+       top: 32px;
+}
+@media screen and (max-width: 900px) {
+       .auto-fold .media-grid-view {
+               left: 36px;
+       }
+}
+@media screen and (max-width: 782px) {
+       .media-grid-view {
+               top: 46px;
+       }
+       .auto-fold .media-grid-view {
+               left: 0px;
+               bottom: 0px;
+       }
+}
+
+/* Regions we don't use at all */
+.media-grid-view .media-frame-toolbar,
+.media-grid-view .media-frame-menu {
+       display: none;
+}
+
+.media-grid-view .media-frame-content {
+       bottom: 40px;
+}
+@media screen and (max-width: 782px) {
+       .media-grid-view .media-frame-content {
+               border-bottom: none;
+               bottom: 0;
+       }
+}
+
+@media only screen and (max-width: 640px), screen and (max-height: 400px) {
+       .media-grid-view .media-frame-title {
+               display: block;
+               width: auto;
+               bottom: auto;
+               right: 0;
+               top: 0;
+               height: 60px;
+       }
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediamodelsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-models.js (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-models.js 2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-includes/js/media-models.js    2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -30,6 +30,8 @@
</span><span class="cx">                  frame = new MediaFrame.Select( attributes );
</span><span class="cx">          } else if ( 'post' === attributes.frame && MediaFrame.Post ) {
</span><span class="cx">                  frame = new MediaFrame.Post( attributes );
</span><ins>+               } else if ( 'manage' === attributes.frame && MediaFrame.Manage ) {
+                       frame = new MediaFrame.Manage( attributes ); 
</ins><span class="cx">           } else if ( 'image' === attributes.frame && MediaFrame.ImageDetails ) {
</span><span class="cx">                  frame = new MediaFrame.ImageDetails( attributes );
</span><span class="cx">          } else if ( 'audio' === attributes.frame && MediaFrame.AudioDetails ) {
</span></span></pre></div>
<a id="trunksrcwpincludesjsmediaviewsjs"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/js/media-views.js (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/js/media-views.js  2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-includes/js/media-views.js     2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -615,7 +615,7 @@
</span><span class="cx"> 
</span><span class="cx">                  this.get('selection').on( 'add remove reset', this.refreshContent, this );
</span><span class="cx"> 
</span><del>-                       if ( this.get('contentUserSetting') ) {
</del><ins>+                        if ( this.get( 'router' ) && this.get('contentUserSetting') ) {
</ins><span class="cx">                           this.frame.on( 'content:activate', this.saveContentMode, this );
</span><span class="cx">                          this.set( 'content', getUserSetting( 'libraryContent', this.get('content') ) );
</span><span class="cx">                  }
</span><span class="lines">@@ -1921,6 +1921,160 @@
</span><span class="cx">  });
</span><span class="cx"> 
</span><span class="cx">  /**
</span><ins>+        * wp.media.view.MediaFrame.Manage
+        *
+        * A generic management frame workflow.
+        *
+        * Used in the media grid view.
+        *
+        * @constructor
+        * @augments wp.media.view.MediaFrame
+        * @augments wp.media.view.Frame
+        * @augments wp.media.View
+        * @augments wp.Backbone.View
+        * @augments Backbone.View
+        * @mixes wp.media.controller.StateMachine
+        */
+       media.view.MediaFrame.Manage = media.view.MediaFrame.extend({
+               /**
+                * @global wp.Uploader
+                */
+               initialize: function() {
+                       _.defaults( this.options, {
+                               title:     l10n.mediaLibraryTitle,
+                               modal:     false,
+                               selection: [],
+                               library:   {},
+                               multiple:  false,
+                               state:     'library',
+                               uploader:  true
+                       });
+
+                       // Ensure core and media grid view UI is enabled.
+                       this.$el.addClass('wp-core-ui media-grid-view');
+
+                       // Force the uploader off if the upload limit has been exceeded or
+                       // if the browser isn't supported.
+                       if ( wp.Uploader.limitExceeded || ! wp.Uploader.browser.supported ) {
+                               this.options.uploader = false;
+                       }
+
+                       // Initialize a window-wide uploader.
+                       if ( this.options.uploader ) {
+                               this.uploader = new media.view.UploaderWindow({
+                                       controller: this,
+                                       uploader: {
+                                               dropzone:  $('body'),
+                                               container: $('body')
+                                       }
+                               }).render();
+                               this.uploader.ready();
+                               $('body').append( this.uploader.el );
+
+                               this.options.uploader = false;
+                       }
+
+                       /**
+                        * call 'initialize' directly on the parent class
+                        */
+                       media.view.MediaFrame.prototype.initialize.apply( this, arguments );
+
+                       // Since we're not using the default modal built into
+                       // a media frame, append our $element to the supplied container.
+                       this.$el.appendTo( this.options.container );
+
+                       this.createSelection();
+                       this.createStates();
+                       this.bindHandlers();
+                       this.render();
+               },
+
+               createSelection: function() {
+                       var selection = this.options.selection;
+
+                       if ( ! (selection instanceof media.model.Selection) ) {
+                               this.options.selection = new media.model.Selection( selection, {
+                                       multiple: this.options.multiple
+                               });
+                       }
+
+                       this._selection = {
+                               attachments: new media.model.Attachments(),
+                               difference: []
+                       };
+               },
+
+               createStates: function() {
+                       var options = this.options;
+
+                       if ( this.options.states ) {
+                               return;
+                       }
+
+                       // Add the default states.
+                       this.states.add([
+                               new media.controller.Library({
+                                       library:    media.query( options.library ),
+                                       multiple:   options.multiple,
+                                       title:      options.title,
+                                       priority:   20,
+                                       toolbar:    false,
+                                       router:     false,
+                                       content:    'browse',
+                                       filterable: 'mime-types'
+                               }),
+
+                               new media.controller.EditImage( { model: options.editImage } )
+                       ]);
+               },
+
+               bindHandlers: function() {
+                       this.on( 'content:create:browse', this.browseContent, this );
+                       this.on( 'content:render:edit-image', this.editImageContent, this );
+               },
+
+               /**
+                * Content
+                *
+                * @param {Object} content
+                * @this wp.media.controller.Region
+                */
+               browseContent: function( content ) {
+                       var state = this.state();
+
+                       // Browse our library of attachments.
+                       content.view = new media.view.AttachmentsBrowser({
+                               controller: this,
+                               collection: state.get('library'),
+                               selection:  state.get('selection'),
+                               model:      state,
+                               sortable:   state.get('sortable'),
+                               search:     state.get('searchable'),
+                               filters:    state.get('filterable'),
+                               display:    state.get('displaySettings'),
+                               dragInfo:   state.get('dragInfo'),
+                               bulkEdit:   true,
+
+                               suggestedWidth:  state.get('suggestedWidth'),
+                               suggestedHeight: state.get('suggestedHeight'),
+
+                               AttachmentView: state.get('AttachmentView')
+                       });
+               },
+
+               editImageContent: function() {
+                       var image = this.state().get('image'),
+                               view = new media.view.EditImage( { model: image, controller: this } ).render();
+
+                       this.content.set( view );
+
+                       // after creating the wrapper view, load the actual editor via an ajax call
+                       view.loadEditor();
+
+               },
+       });
+
+       /**
</ins><span class="cx">    * wp.media.view.MediaFrame.Select
</span><span class="cx">   *
</span><span class="cx">   * Type of media frame that is used to select an item or items from the media library
</span><span class="lines">@@ -5363,7 +5517,46 @@
</span><span class="cx">          }
</span><span class="cx">  });
</span><span class="cx"> 
</span><ins>+       /**
+        * wp.media.view.AttachmentFilters.FileTypes
+        *
+        * @constructor
+        * @augments wp.media.view.AttachmentFilters
+        * @augments wp.media.View
+        * @augments wp.Backbone.View
+        * @augments Backbone.View
+        */
+       media.view.AttachmentFilters.mimeTypes = media.view.AttachmentFilters.extend({
+               createFilters: function() {
+                       var filters = {};
</ins><span class="cx"> 
</span><ins>+                       _.each( media.view.settings.mimeTypes || {}, function( text, key ) {
+                               filters[ key ] = {
+                                       text: text,
+                                       props: {
+                                               type:    key,
+                                               uploadedTo: null,
+                                               orderby: 'date',
+                                               order:   'DESC'
+                                       }
+                               };
+                       });
+                       filters.all = {
+                               text:  l10n.allMediaTypes,
+                               props: {
+                                       type:    null,
+                                       uploadedTo: null,
+                                       orderby: 'date',
+                                       order:   'DESC'
+                               },
+                               priority: 10
+                       };
+
+                       this.filters = filters;
+               }
+       });
+
+
</ins><span class="cx">   /**
</span><span class="cx">   * wp.media.view.AttachmentsBrowser
</span><span class="cx">   *
</span><span class="lines">@@ -5417,6 +5610,8 @@
</span><span class="cx">                          FiltersConstructor = media.view.AttachmentFilters.Uploaded;
</span><span class="cx">                  } else if ( 'all' === filters ) {
</span><span class="cx">                          FiltersConstructor = media.view.AttachmentFilters.All;
</span><ins>+                       } else if ( 'mime-types' === filters ) {
+                               FiltersConstructor = media.view.AttachmentFilters.mimeTypes;
</ins><span class="cx">                   }
</span><span class="cx"> 
</span><span class="cx">                  if ( FiltersConstructor ) {
</span></span></pre></div>
<a id="trunksrcwpincludesmediatemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media-template.php (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media-template.php 2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-includes/media-template.php    2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -308,6 +308,7 @@
</span><span class="cx">                          <div class="filename">{{ data.filename }}</div>
</span><span class="cx">                          <div class="uploaded">{{ data.dateFormatted }}</div>
</span><span class="cx"> 
</span><ins>+                               <div class="file-size">{{ data.filesizeHumanReadable }}</div>
</ins><span class="cx">                           <# if ( 'image' === data.type && ! data.uploading ) { #>
</span><span class="cx">                                  <# if ( data.width && data.height ) { #>
</span><span class="cx">                                          <div class="dimensions">{{ data.width }} &times; {{ data.height }}</div>
</span><span class="lines">@@ -339,25 +340,39 @@
</span><span class="cx">                  </div>
</span><span class="cx">          </div>
</span><span class="cx"> 
</span><ins>+               <label class="setting" data-setting="url">
+                       <span class="name"><?php _e('URL'); ?></span>
+                       <input type="text" value="{{ data.url }}" readonly />
+               </label>
</ins><span class="cx">           <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #>
</span><del>-                       <label class="setting" data-setting="title">
-                               <span><?php _e('Title'); ?></span>
-                               <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
-                       </label>
-                       <label class="setting" data-setting="caption">
-                               <span><?php _e('Caption'); ?></span>
-                               <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
-                       </label>
</del><ins>+                <label class="setting" data-setting="title">
+                       <span class="name"><?php _e('Title'); ?></span>
+                       <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} />
+               </label>
+               <label class="setting" data-setting="caption">
+                       <span class="name"><?php _e('Caption'); ?></span>
+                       <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea>
+               </label>
</ins><span class="cx">           <# if ( 'image' === data.type ) { #>
</span><span class="cx">                  <label class="setting" data-setting="alt">
</span><del>-                               <span><?php _e('Alt Text'); ?></span>
</del><ins>+                                <span class="name"><?php _e('Alt Text'); ?></span>
</ins><span class="cx">                           <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} />
</span><span class="cx">                  </label>
</span><span class="cx">          <# } #>
</span><del>-                       <label class="setting" data-setting="description">
-                               <span><?php _e('Description'); ?></span>
-                               <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
</del><ins>+                <label class="setting" data-setting="description">
+                       <span class="name"><?php _e('Description'); ?></span>
+                       <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea>
+               </label>
+               <label class="setting">
+                               <span class="name"><?php _e( 'Uploaded By' ); ?></span>
+                               <span class="value">{{ data.authorName }}</span>
</ins><span class="cx">                   </label>
</span><ins>+               <# if ( data.uploadedTo ) { #>
+                       <label class="setting">
+                               <span class="name"><?php _e('Uploaded To'); ?></span>
+                               <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span>
+                       </label>
+               <# } #>
</ins><span class="cx">   </script>
</span><span class="cx"> 
</span><span class="cx">  <script type="text/html" id="tmpl-media-selection">
</span></span></pre></div>
<a id="trunksrcwpincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/src/wp-includes/media.php (28681 => 28682)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/src/wp-includes/media.php  2014-06-05 18:28:15 UTC (rev 28681)
+++ trunk/src/wp-includes/media.php     2014-06-05 22:00:24 UTC (rev 28682)
</span><span class="lines">@@ -2592,6 +2592,19 @@
</span><span class="cx">          'editLink'   => false,
</span><span class="cx">  );
</span><span class="cx"> 
</span><ins>+       $author = new WP_User( $attachment->post_author );
+       $response['authorName'] = $author->display_name;
+
+       if ( $attachment->post_parent ) {
+               $post_parent = get_post( $attachment->post_parent );
+               $response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
+               $response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(No title)' );
+       }
+
+       $bytes = filesize( get_attached_file( $attachment->ID ) );
+       $response['filesizeInBytes'] = $bytes;
+       $response['filesizeHumanReadable'] = size_format( $bytes );
+
</ins><span class="cx">   if ( current_user_can( 'edit_post', $attachment->ID ) ) {
</span><span class="cx">          $response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
</span><span class="cx">          $response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
</span><span class="lines">@@ -2849,6 +2862,7 @@
</span><span class="cx">          'createNewVideoPlaylist'   => __( 'Create a new video playlist' ),
</span><span class="cx">          'returnToLibrary'    => __( '&#8592; Return to library' ),
</span><span class="cx">          'allMediaItems'      => __( 'All media items' ),
</span><ins>+               'allMediaTypes'      => __( 'All media types' ),
</ins><span class="cx">           'noItemsFound'       => __( 'No items found.' ),
</span><span class="cx">          'insertIntoPost'     => $hier ? __( 'Insert into page' ) : __( 'Insert into post' ),
</span><span class="cx">          'uploadedToThisPost' => $hier ? __( 'Uploaded to this page' ) : __( 'Uploaded to this post' ),
</span></span></pre>
</div>
</div>

</body>
</html>