thickbox and media upload fixes from azaozz. fixes #6843

git-svn-id: http://svn.automattic.com/wordpress/trunk@7862 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2008-04-30 20:21:09 +00:00
parent 96cdf5c7a7
commit 020eb02ef0
6 changed files with 58 additions and 9 deletions

View File

@ -196,6 +196,11 @@ abbr.required {
#media-upload .media-upload-form p {
margin: 0 1em 1em 0;
}
#media-upload .media-upload-form p.ml-submit {
padding: 1em 0;
}
#media-upload p.help {
font-style: italic;
font-weight: normal;
@ -240,3 +245,18 @@ abbr.required {
margin-bottom: 1em;
height: 3em;
}
#media-upload #filter {
width: 623px;
}
#media-upload #filter .subsubsub {
margin: 8px 0;
}
#filter .tablenav select {
border-style:solid;
border-width:1px;
padding:2px;
vertical-align:top;
}

View File

@ -960,7 +960,6 @@ function media_upload_library_form($errors) {
<input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
</div>
<p>
<ul class="subsubsub">
<?php
$type_links = array();
@ -992,7 +991,6 @@ echo implode(' | </li>', $type_links) . '</li>';
unset($type_links);
?>
</ul>
</p>
<div class="tablenav">
@ -1067,8 +1065,10 @@ jQuery(function($){
<div id="media-items">
<?php echo get_media_items(null, $errors); ?>
</div>
<p class="ml-submit">
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
</p>
</form>
<?php
}

View File

@ -8,4 +8,32 @@ function send_to_editor(h) {
tinyMCE.execCommand('mceInsertContent', false, h);
} else
win.edInsertContent(win.edCanvas, h);
}
}
// thickbox settings
jQuery(function($) {
tb_position = function() {
var tbWindow = $('#TB_window');
var width = $(window).width();
var H = $(window).height();
var W = ( 720 < width ) ? 720 : width;
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 );
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
tbWindow.css({marginLeft: '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
};
return $('a.thickbox').each( function() {
var href = $(this).attr('href');
if ( ! href ) return;
href = href.replace(/&width=[0-9]+/g, '');
href = href.replace(/&height=[0-9]+/g, '');
$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
});
};
$(window).resize( function() { tb_position() } );
$(document).ready( function() { tb_position() } );
});

View File

@ -55,7 +55,7 @@ function prepareMediaItemInit(fileObj) {
jQuery('#media-item-' + fileObj.id + ' .filename.original').replaceWith(jQuery('#media-item-' + fileObj.id + ' .filename.new'));
// Also bind toggle to the links
jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150);jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
jQuery('#media-item-' + fileObj.id + ' a.toggle').bind('click', function(){jQuery(this).siblings('.slidetoggle').slideToggle(150, function(){window.scrollTo(0,this.parentNode.offsetTop);});jQuery(this).parent().eq(0).children('.toggle').toggle();jQuery(this).siblings('a.toggle').focus();return false;});
// Bind AJAX to the new Delete button
jQuery('#media-item-' + fileObj.id + ' a.delete').bind('click',function(){

View File

@ -45,19 +45,17 @@
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
display:none;
border: 4px solid #525252;
text-align:left;
top:50%;
top:20px;
left:50%;
}
* html #TB_window { /* ie6 hack */
position: absolute;
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
margin-top: expression(20) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
}
#TB_window img#TB_Image {
@ -97,6 +95,9 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
#TB_title{
background-color:#e8e8e8;
height:27px;
border-width: 4px;
border-color: #525252;
border-style: solid solid none;
}
#TB_ajaxContent{

View File

@ -164,7 +164,7 @@ class WP_Scripts {
'cancel' => __('Cancel'),
'edit' => __('Edit'),
) );
$this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080109' );
$this->add( 'media-upload', '/wp-admin/js/media-upload.js', false, '20080430' );
$this->localize( 'upload', 'uploadL10n', array(
'browseTitle' => attribute_escape(__('Browse your files')),
'back' => __('&laquo; Back'),