Move Gallery Settings to the Gallery tab in the uploader, split the Upload tab in "From Computer" and "From URL" tabs

git-svn-id: http://svn.automattic.com/wordpress/trunk@9894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz
2008-11-26 02:27:37 +00:00
parent 3cd406eab7
commit ddead422a1
17 changed files with 398 additions and 599 deletions

View File

@@ -1,208 +0,0 @@
html, body {
background-color: #f9f9f9;
margin: 0;
padding: 0;
}
.button,
.button-primary,
.button-secondary {
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
text-decoration: none;
font-size: 11px !important;
line-height: 16px;
padding: 2px 8px;
cursor: pointer;
border-width: 1px;
border-style: solid;
-moz-border-radius: 11px;
-khtml-border-radius: 11px;
-webkit-border-radius: 11px;
border-radius: 11px;
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box;
-khtml-box-sizing: content-box;
box-sizing: content-box;
}
a.button {
padding: 4px 8px;
}
textarea,
input,
select {
font: 13px Verdana, Arial, Helvetica, sans-serif;
margin: 1px;
padding: 2px;
background-color: #fff;
}
.align input {
vertical-align: middle;
}
body, td {
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
}
.alignright {
float: right;
}
.alignleft {
float: left;
}
.aligncenter {
display: block;
margin-left: auto;
margin-right: auto;
}
label {
cursor: pointer;
}
th.label {
width: 160px;
}
#media-upload #basic th.label {
padding: 5px 5px 5px 0;
}
#media-upload #basic .imgwidth {
vertical-align: top;
}
#saveeditimg {
padding: 10px 0 0 5px;
}
#sidemenu,
#sidemenu li {
list-style: none;
}
#sidemenu li {
display: inline;
}
#sidemenu a {
border-bottom-style: solid;
border-bottom-width: 1px;
border-top-style: solid;
border-top-width: 1px;
display: block;
float: left;
line-height: 28px;
text-decoration: none;
text-align: center;
white-space: nowrap;
margin: 0;
padding: 0pt 7px;
}
#sidemenu a.current {
-moz-border-radius-topleft: 4px;
-khtml-border-top-left-radius: 4px;
-webkit-border-top-left-radius: 4px;
border-top-left-radius: 4px;
-moz-border-radius-topright: 4px;
-khtml-border-top-right-radius: 4px;
-webkit-border-top-right-radius: 4px;
border-top-right-radius: 4px;
border-style:solid;
border-width:1px;
font-weight:normal;
}
#media-upload h3 {
clear: both;
padding: 0pt 0pt 3px;
border-bottom-style: solid;
border-bottom-width: 1px;
font-family: Georgia,"Times New Roman",Times,serif;
font-size: 20px;
font-weight: normal;
line-height: normal;
margin: 0 0 10px -4px;
padding: 15px 0 3px;
border-bottom-color: #DADADA;
color: #5A5A5A;
}
#basic {
padding-top: 2px;
}
td {
padding: 2px 0;
}
.describe td {
vertical-align: middle;
height: 3.5em;
}
#media-upload .describe th.label {
padding-top: .5em;
text-align: left;
}
#media-upload .describe {
border: 1px solid #dfdfdf;
padding: 5px 15px;
width: 100%;
clear: both;
cursor: default;
}
form {
margin: 1em;
}
.describe select {
width: 15em;
border: 1px solid #dfdfdf;
}
#imgwidth {
width: 3em;
border: 1px solid #dfdfdf;
}
.media-upload-form label,
.media-upload-form legend {
font-size: 13px;
color: #464646;
}
.align .field label {
margin: 0 1.5em 0 0;
}
div#media-upload-header {
margin: 0;
padding: 0 5px;
font-weight: bold;
position: relative;
border-bottom-width: 1px;
border-bottom-style: solid;
height: 2.5em;
}
body#media-upload ul#sidemenu {
font-weight: normal;
margin: 0 5px;
position: relative;
left: 0px;
bottom: -4px;
}
div#media-upload-error {
margin: 1em;
font-weight: bold;
}

View File

@@ -15,7 +15,9 @@
if ( el.nodeName != 'IMG' ) return;
if ( ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 ) return;
tb_show('', url + '/gallery.html?ver=321&TB_iframe=true');
var post_id = tinymce.DOM.get('post_ID').value;
tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=gallery&TB_iframe=true');
/*
tinymce.DOM.setStyles('TB_window', {
'width':( W - 50 )+'px',
'height':'430px',
@@ -33,6 +35,7 @@
'width':( W - 50 )+'px',
'height':'400px'
});
*/
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
});
@@ -95,7 +98,7 @@
if ( cls.indexOf('wpGallery') != -1 )
return '<p>'+getAttr(im, 'title')+'</p>';
return im;
return a;
});
},
@@ -164,7 +167,7 @@
wp_delgallery.onmousedown = function(e) {
var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('mceItemWPgallery') != -1 ) {
if ( el.nodeName == 'IMG' && ed.dom.getAttrib(el, 'class').indexOf('wpGallery') != -1 ) {
ed.dom.remove(el);
this.parentNode.style.display = 'none';

View File

@@ -1,121 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script type="text/javascript" src="js/gallery.js?ver=321"></script>
<script type="text/javascript" src="../../utils/form_utils.js?ver=321"></script>
<link rel="stylesheet" href="css/gallery.css?ver=321" type="text/css" media="all" />
<script type="text/javascript">
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
document.write('<link rel="stylesheet" href="css/gallery-rtl.css?ver=321" type="text/css" media="all" />');
</script>
<base target="_self" />
</head>
<body id="media-upload" style="display:none;">
<div id="media-upload-header">
<ul id="sidemenu">
<li><a href="javascript:;" id="tab_basic" class="current">{#gallery.settings}</a></li>
</ul>
</div>
<div id="img-edit">
<form class="media-upload-form" action="" onsubmit="wpgallery.update();">
<div id="div_basic">
<table id="basic" class="describe">
<tbody>
<tr class="align">
<th scope="row" class="label">
<label>
<span class="alignleft">{#gallery.linkto}</span>
</label>
</th>
<td class="field">
<input type="radio" name="linkto" id="linkto-file" value="file" />
<label for="linkto-file" class="radio">{#gallery.linktofile}</label>
<input type="radio" checked="checked" name="linkto" id="linkto-post" value="post" />
<label for="linkto-post" class="radio">{#gallery.linktopost}</label>
</td>
</tr>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft">{#gallery.orderby}</span>
</label>
</th>
<td class="field">
<select id="orderby" name="orderby">
<option value="menu_order" selected="selected">{#gallery.menu_order}</option>
<option value="post_name">{#gallery.byname}</option>
<option value="ID">{#gallery.bydate}</option>
<option value="RAND()">{#gallery.random}</option>
</select>
</td>
</tr>
<tr class="align">
<th scope="row" class="label">
<label>
<span class="alignleft">{#gallery.order}</span>
</label>
</th>
<td class="field">
<input type="radio" checked="checked" name="order" id="order-asc" value="asc" />
<label for="order-asc" class="radio">{#gallery.orderasc}</label>
<input type="radio" name="order" id="order-desc" value="desc" />
<label for="order-desc" class="radio">{#gallery.orderdesc}</label>
</td>
</tr>
<tr>
<th scope="row" class="label">
<label>
<span class="alignleft">{#gallery.cols}</span>
</label>
</th>
<td class="field">
<select id="columns" name="columns">
<option value="2">{#gallery.two}</option>
<option value="3" selected="selected">{#gallery.three}</option>
<option value="4">{#gallery.four}</option>
<option value="5">{#gallery.five}</option>
<option value="6">{#gallery.six}</option>
<option value="7">{#gallery.seven}</option>
<option value="8">{#gallery.eight}</option>
<option value="9">{#gallery.nine}</option>
</select>
</td>
</tr>
<tr>
<th scope="row" class="label imgwidth">
<label>
<span class="alignleft">{#gallery.imgwidth}</span>
</label>
</th>
<td class="field">
<input type="text" id="imgwidth" name="imgwidth" value="" size="6" />
<p>{#gallery.imgwidthhelp}</p>
</td>
</tr>
</tbody>
</table></div>
<div id="saveeditimg">
<input type="button" class="button alignleft" id="cancelimg" name="cancelimg" value="{#cancel}" onclick="tinyMCEPopup.close();" />
<input type="submit" id="saveimg" class="button-primary alignright" value="{#update}" />
<div style="clear:both"></div>
</div>
</form>
</div>
</body>
</html>

View File

@@ -1,165 +0,0 @@
var tinymce = null, tinyMCEPopup, tinyMCE;
tinyMCEPopup = {
init: function() {
var t = this, w, ti, li, q, i, it;
li = ('' + document.location.search).replace(/^\?/, '').split('&');
q = {};
for (i=0; i<li.length; i++) {
it = li[i].split('=');
q[unescape(it[0])] = unescape(it[1]);
}
if (q.mce_rdomain)
document.domain = q.mce_rdomain;
// Find window & API
w = t.getWin();
tinymce = w.tinymce;
tinyMCE = w.tinyMCE;
t.editor = tinymce.EditorManager.activeEditor;
t.params = t.editor.windowManager.params;
// Setup local DOM
t.dom = t.editor.windowManager.createInstance('tinymce.dom.DOMUtils', document);
t.editor.windowManager.onOpen.dispatch(t.editor.windowManager, window);
},
getWin : function() {
return window.dialogArguments || opener || parent || top;
},
getParam : function(n, dv) {
return this.editor.getParam(n, dv);
},
close : function() {
var t = this, win = t.getWin();
// To avoid domain relaxing issue in Opera
function close() {
win.tb_remove();
tinymce = tinyMCE = t.editor = t.dom = t.dom.doc = null; // Cleanup
};
if (tinymce.isOpera)
win.setTimeout(close, 0);
else
close();
},
execCommand : function(cmd, ui, val, a) {
a = a || {};
a.skip_focus = 1;
this.restoreSelection();
return this.editor.execCommand(cmd, ui, val, a);
},
storeSelection : function() {
this.editor.windowManager.bookmark = tinyMCEPopup.editor.selection.getBookmark('simple');
},
restoreSelection : function() {
var t = tinyMCEPopup;
if (tinymce.isIE)
t.editor.selection.moveToBookmark(t.editor.windowManager.bookmark);
}
}
tinyMCEPopup.init();
var wpgallery = {
preInit : function() {
// import colors stylesheet from parent
var win = tinyMCEPopup.getWin();
var styles = win.document.styleSheets;
for ( i = 0; i < styles.length; i++ ) {
var url = styles.item(i).href;
if ( url && url.indexOf('colors') != -1 )
document.write( '<link rel="stylesheet" href="'+url+'" type="text/css" media="all" />' );
}
},
I : function(e) {
return document.getElementById(e);
},
init : function() {
var ed = tinyMCEPopup.editor, h;
h = document.body.innerHTML;
// Replace a=x with a="x" in IE
if (tinymce.isIE)
h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"')
document.body.innerHTML = ed.translate(h);
window.setTimeout( function(){wpgallery.setup();}, 100 );
},
setup : function() {
var t = this, a, f = document.forms[0], ed = tinyMCEPopup.editor, dom = tinyMCEPopup.dom;
document.dir = tinyMCEPopup.editor.getParam('directionality','');
tinyMCEPopup.restoreSelection();
el = ed.selection.getNode();
if (el.nodeName != 'IMG') return;
a = ed.dom.getAttrib(el, 'title');
a = ed.dom.decode(a);
if ( a ) {
var columns = a.match(/columns=['"]([0-9]+)['"]/), link = a.match(/link=['"]([^'"]+)['"]/i);
var imgwidth = a.match(/imgwidth=['"]([0-9]+)['"]/), order = a.match(/order=['"]([^'"]+)['"]/i);
var orderby = a.match(/orderby=['"]([^'"]+)['"]/i), all = '';
if ( link && link[1] ) t.I('linkto-file').checked = "checked";
if ( order && order[1] ) t.I('order-desc').checked = "checked";
if ( columns && columns[1] ) t.I('columns').value = ''+columns[1];
if ( orderby && orderby[1] ) t.I('orderby').value = orderby[1];
if ( imgwidth && imgwidth[1] ) t.I('imgwidth').value = imgwidth[1];
}
document.body.style.display = '';
},
update : function() {
var t = this, ed = tinyMCEPopup.editor, el, all;
tinyMCEPopup.restoreSelection();
el = ed.selection.getNode();
if (el.nodeName != 'IMG') return;
all = ed.dom.decode(ed.dom.getAttrib(el, 'title'));
all = all.substr(0, all.lastIndexOf(']'));
all = all.replace(/\s*(order|link|columns|orderby|imgwidth)=['"]([^'"]+)['"]/gi, '');
if ( t.I('linkto-file').checked )
all += ' link="file"';
if ( t.I('order-desc').checked )
all += ' order="DESC"';
if ( t.I('columns').value != 3 )
all += ' columns="'+t.I('columns').value+'"';
if ( t.I('orderby').value != 'menu_order' )
all += ' orderby="'+t.I('orderby').value+'"';
if ( t.I('imgwidth').value )
all += ' imgwidth="'+t.I('imgwidth').value+'"';
all += ']';
ed.dom.setAttrib(el, 'title', all);
tinyMCEPopup.close();
}
};
window.onload = function(){wpgallery.init();}
wpgallery.preInit();