From 642bd53a67d8267ff70eef36e52bdd4c3e9f6c86 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 10 Jul 2008 03:49:52 +0000 Subject: [PATCH] Media Uploader improvements from azaozz: Improves the insert external image dialog, redirects to the gallery tab after "Save all changes" is clicked, shows the "Order" fields on the closed tabs, where they are easier to use, and only in the Gallery. see #7274 git-svn-id: http://svn.automattic.com/wordpress/trunk@8304 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/css/media.css | 39 ++++++- wp-admin/gears-manifest.php | 5 +- wp-admin/images/no.png | Bin 0 -> 792 bytes wp-admin/images/required.gif | Bin 0 -> 62 bytes wp-admin/images/yes.png | Bin 0 -> 612 bytes wp-admin/includes/media.php | 187 +++++++++++++++++++++++++++++----- wp-admin/js/gallery.js | 10 +- wp-includes/script-loader.php | 4 +- 8 files changed, 212 insertions(+), 33 deletions(-) create mode 100644 wp-admin/images/no.png create mode 100644 wp-admin/images/required.gif create mode 100644 wp-admin/images/yes.png diff --git a/wp-admin/css/media.css b/wp-admin/css/media.css index 225fa8495f..d04866afe0 100644 --- a/wp-admin/css/media.css +++ b/wp-admin/css/media.css @@ -32,6 +32,7 @@ form { .media-upload-form label, .media-upload-form legend { display:block; font-weight: bold; + font-size: 13px; margin-bottom: 0.5em; margin: 0 0 0.5em 0; } @@ -228,9 +229,11 @@ abbr.required { } .filename { + float: left; line-height: 36px; margin-left: 10px; - float: left; + overflow: hidden; + max-width: 430px; } #media-upload .describe { border-top-width: 1px; @@ -276,3 +279,37 @@ abbr.required { display: none; margin: 5px 0; } + +.menu_order { + float: right; + font-size: 11px; + margin: 10px 10px 0; +} + +.menu_order_input { + border: 1px solid #DDDDDD; + font-size: 10px; + padding: 1px; + width: 23px; +} + +.ui-sortable-helper { + background-color: #fff; + border: 1px solid #aaa; + opacity: 0.6; + filter: alpha(opacity=60); +} + +#media-upload th.order-head { + width: 25%; + text-align: center; +} + +#media-upload .widefat { + width: 626px; + border-style: solid solid none; +} + +.sorthelper { + z-index: -1; +} diff --git a/wp-admin/gears-manifest.php b/wp-admin/gears-manifest.php index 9abb9b374f..8edd254992 100644 --- a/wp-admin/gears-manifest.php +++ b/wp-admin/gears-manifest.php @@ -64,7 +64,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); ?> { "betaManifestVersion" : 1, -"version" : "_20080704", +"version" : "_20080709", "entries" : [ @@ -99,6 +99,9 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); { "url" : "images/xit.gif" }, { "url" : "images/loading-publish.gif" }, { "url" : "images/loading.gif" }, +{ "url" : "images/required.gif" }, +{ "url" : "images/no.png" }, +{ "url" : "images/yes.png" }, { "url" : "../wp-includes/images/crystal/archive.png" }, { "url" : "../wp-includes/images/crystal/audio.png" }, diff --git a/wp-admin/images/no.png b/wp-admin/images/no.png new file mode 100644 index 0000000000000000000000000000000000000000..e2db55f22d6752e10a57f07e286081ebebacfea5 GIT binary patch literal 792 zcmV+z1LypSP)AsU_?Zci9d!A_6x~Insr^bw(It`ecQh8*8@Fx_eq|^b9kOS$wyR`|06NPhocs8 zU?v>-=-EnfdDG!10kVJ}=mfmL3x4C3JD#r5^Se7=<^gXYh=3bt;e*loYJQ%@zqp#o zc)ieEZw~|j12}i_vg*D#!8fNTYH-)p(SZRifR{fXpPVOOg5)8_Pfax}pxL$sOiaI_ z9663WbAXxGGQR;QY}-bF{nj_X{Nr6+f*aSdgArUWy~x7#3tYQ*U;M!9W0N|Xd56Y> zdw6NVP@4PMEslKs#fSj7!@bq{RDZ|F(lUi+9ee>|JyA+;y-hurBRMxmp;CdWNzChE zEgUAbv5jI00Q-_DfCrBwQLTgC1pOJbJebx(GO4#fZ-Z7r7eRrwu3!}WegvSSe~?;s zg&54uc6CmaclX!;Ty0b?pa&4c#fOgla1%y+p#)Z=f~-xR;Wr)XE6PJrdB<@ zkX^(65AWw<3BGfCZc8qEVwk5llHC!E4clf5C;=vLa<_ciGWRF}HJ|~Mfr?dU+T}WK zwsR5K0^D`Sq1rBg5bskfzs`!nAt2Vip96}O9S)jR-j65r$IZL|SSUu*ZczvKR4}MU zA;+G=VV*iLHje+;F`frfK+$f}Su8OX4QUMmEk`k$jYjm7Pd{sRn(48RUTuLs23_h7>hH;3oe{xsP*g;=fdj*7t_=_KYN7DNh9L(*MX+IPs+eE= zDxM&f=%ZXQal{bBz)%Dm!3LQf+RwS^Q`pLYql&h1ISRI;>9a!ve49Rq1EL~0BK!+x WVm^3T=Dr&M0000rBUO4f*s#JWo)C=2NW(z=Pj2y|)=wUAF^X9) z4JKxy1u6j0)RIi|M|)sH*wG=?lkGp?mG>pB_MOq^I)2;MG~R$-+5s)qA?%3_N2eo} zXv=IwoqbWvE*4At)uq*@s1n7bC*oOgSF=+RwLNr5*I9GqvaR{^Jq*&<5EDB1n?fTb zm9i$Dus8s4icGE-l{gAN2=9q38c~p!Py4(B*$}~^&cCXrMFSPUdx{aWOhk+U~sJy}m-eUU844&0=2l-7&OZcb~TiB5r z0AlWV30J0SgN!1!`5SNM*CEVJV1gTiG6i&8eG$y5$Xq{AJQ~MOnYT)Dr*_ais&-j# z+G5;h%n*ox)FklyQdiJ%!fJW6w(}QwQIRtCsoTnXOA{Bur&;c)oZ*vSD>X|Aw&+rK yNc65bzq+rET@n6d=x-0l;`?bjil?RWQuz-0He^X1)ISyg0000\n"; - if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) + if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) + $current = $redir_tab; + elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) $current = $_GET['tab']; else { $keys = array_keys($tabs); @@ -154,7 +157,7 @@ function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = if ( trim($image_meta['caption']) ) $content = $image_meta['caption']; } - + $title = @$desc; // Construct the attachment array @@ -325,8 +328,10 @@ function media_upload_image() { $errors = $return; } - if ( isset($_POST['save']) ) + if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } return wp_iframe( 'media_upload_type_form', 'image', $errors, $id ); } @@ -336,7 +341,7 @@ function media_sideload_image($file, $post_id, $desc = null) { $file_array['name'] = basename($file); $file_array['tmp_name'] = download_url($file); $desc = @$desc; - + $id = media_handle_sideload($file_array, $post_id, $desc); $src = $id; @@ -385,8 +390,10 @@ function media_upload_audio() { $errors = $return; } - if ( isset($_POST['save']) ) + if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id ); } @@ -423,8 +430,10 @@ function media_upload_video() { $errors = $return; } - if ( isset($_POST['save']) ) + if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } return wp_iframe( 'media_upload_type_form', 'video', $errors, $id ); } @@ -461,8 +470,10 @@ function media_upload_file() { $errors = $return; } - if ( isset($_POST['save']) ) + if ( isset($_POST['save']) ) { $errors['upload_notice'] = __('Saved.'); + return media_upload_gallery(); + } return wp_iframe( 'media_upload_type_form', 'file', $errors, $id ); } @@ -673,6 +684,8 @@ function get_media_items( $post_id, $errors ) { } function get_media_item( $attachment_id, $args = null ) { + global $redir_tab; + $default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true ); $args = wp_parse_args( $args, $default_args ); extract( $args, EXTR_SKIP ); @@ -720,11 +733,27 @@ function get_media_item( $attachment_id, $args = null ) { } $display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case - $display_title = wp_html_excerpt($display_title, 100); + $display_title = wp_html_excerpt($display_title, 60); + + $gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false; + $order = ''; + + foreach ( $form_fields as $key => $val ) { + if ( 'menu_order' == $key ) { + if ( $gallery ) + $order = ''; + else + $order = ''; + + unset($form_fields['menu_order']); + break; + } + } $item = " $type $toggle_links + $order
$display_title
@@ -958,6 +987,79 @@ jQuery(function($){

+ +
@@ -969,12 +1071,13 @@ jQuery(function($){ } function media_upload_gallery_form($errors) { + global $redir_tab; + + $redir_tab = 'gallery'; media_upload_header(); $post_id = intval($_REQUEST['post_id']); - $form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id"); - ?>