JS localization from mdawaffe. fixes #3913
git-svn-id: http://svn.automattic.com/wordpress/trunk@4970 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e3782a3e2b
commit
34928e6ef0
|
@ -1,14 +1,10 @@
|
||||||
<?php
|
|
||||||
require_once('../wp-config.php');
|
|
||||||
cache_javascript_headers();
|
|
||||||
?>
|
|
||||||
addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
|
addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;});
|
||||||
addLoadEvent(newCatAddIn);
|
addLoadEvent(newCatAddIn);
|
||||||
function newCatAddIn() {
|
function newCatAddIn() {
|
||||||
var jaxcat = $('jaxcat');
|
var jaxcat = $('jaxcat');
|
||||||
if ( !jaxcat )
|
if ( !jaxcat )
|
||||||
return false;
|
return false;
|
||||||
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php echo js_escape(__('Separate multiple categories with commas.')); ?></span></span>');
|
Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><span id="howto">' + catL10n.how + '</span></span>');
|
||||||
$('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
|
$('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
|
||||||
$('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
|
$('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
|
||||||
}
|
}
|
|
@ -1,68 +0,0 @@
|
||||||
<?php
|
|
||||||
require_once('admin.php');
|
|
||||||
cache_javascript_headers();
|
|
||||||
|
|
||||||
switch ( $_GET['pagenow'] ) :
|
|
||||||
case 'post.php' :
|
|
||||||
case 'post-new.php' :
|
|
||||||
$man = 'postmeta';
|
|
||||||
break;
|
|
||||||
case 'page.php' :
|
|
||||||
case 'page-new.php' :
|
|
||||||
$man = 'pagemeta';
|
|
||||||
break;
|
|
||||||
case 'link.php' :
|
|
||||||
$man = 'linkmeta';
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
exit;
|
|
||||||
break;
|
|
||||||
endswitch;
|
|
||||||
?>
|
|
||||||
addLoadEvent( function() {var manager = new dbxManager('<?php echo $man; ?>');} );
|
|
||||||
|
|
||||||
addLoadEvent( function()
|
|
||||||
{
|
|
||||||
//create new docking boxes group
|
|
||||||
var meta = new dbxGroup(
|
|
||||||
'grabit', // container ID [/-_a-zA-Z0-9/]
|
|
||||||
'vertical', // orientation ['vertical'|'horizontal']
|
|
||||||
'10', // drag threshold ['n' pixels]
|
|
||||||
'no', // restrict drag movement to container axis ['yes'|'no']
|
|
||||||
'10', // animate re-ordering [frames per transition, or '0' for no effect]
|
|
||||||
'yes', // include open/close toggle buttons ['yes'|'no']
|
|
||||||
'closed', // default state ['open'|'closed']
|
|
||||||
'<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"
|
|
||||||
'<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"
|
|
||||||
'<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse
|
|
||||||
'<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse
|
|
||||||
'<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard
|
|
||||||
'<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
|
|
||||||
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
|
|
||||||
);
|
|
||||||
|
|
||||||
// Boxes are closed by default. Open the Category box if the cookie isn't already set.
|
|
||||||
var catdiv = document.getElementById('categorydiv');
|
|
||||||
if ( catdiv ) {
|
|
||||||
var button = catdiv.getElementsByTagName('A')[0];
|
|
||||||
if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
|
|
||||||
meta.toggleBoxState(button, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
var advanced = new dbxGroup(
|
|
||||||
'advancedstuff', // container ID [/-_a-zA-Z0-9/]
|
|
||||||
'vertical', // orientation ['vertical'|'horizontal']
|
|
||||||
'10', // drag threshold ['n' pixels]
|
|
||||||
'yes', // restrict drag movement to container axis ['yes'|'no']
|
|
||||||
'10', // animate re-ordering [frames per transition, or '0' for no effect]
|
|
||||||
'yes', // include open/close toggle buttons ['yes'|'no']
|
|
||||||
'closed', // default state ['open'|'closed']
|
|
||||||
'<?php echo js_escape(__('open')); ?>', // word for "open", as in "open this box"
|
|
||||||
'<?php echo js_escape(__('close')); ?>', // word for "close", as in "close this box"
|
|
||||||
'<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse
|
|
||||||
'<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse
|
|
||||||
'<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard
|
|
||||||
'<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>', // pattern-match sentence-fragment for "(open|close) this box" by keyboard
|
|
||||||
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
|
|
||||||
);
|
|
||||||
});
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
addLoadEvent( function() {var manager = new dbxManager( dbxL10n.mananger );} );
|
||||||
|
|
||||||
|
addLoadEvent( function()
|
||||||
|
{
|
||||||
|
//create new docking boxes group
|
||||||
|
var meta = new dbxGroup(
|
||||||
|
'grabit', // container ID [/-_a-zA-Z0-9/]
|
||||||
|
'vertical', // orientation ['vertical'|'horizontal']
|
||||||
|
'10', // drag threshold ['n' pixels]
|
||||||
|
'no', // restrict drag movement to container axis ['yes'|'no']
|
||||||
|
'10', // animate re-ordering [frames per transition, or '0' for no effect]
|
||||||
|
'yes', // include open/close toggle buttons ['yes'|'no']
|
||||||
|
'closed', // default state ['open'|'closed']
|
||||||
|
dbxL10n.open, // word for "open", as in "open this box"
|
||||||
|
dbxL10n.close, // word for "close", as in "close this box"
|
||||||
|
dbxL10n.moveMouse, // sentence for "move this box" by mouse
|
||||||
|
dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse
|
||||||
|
dbxL10n.moveKey, // sentence for "move this box" by keyboard
|
||||||
|
dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard
|
||||||
|
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
|
||||||
|
);
|
||||||
|
|
||||||
|
// Boxes are closed by default. Open the Category box if the cookie isn't already set.
|
||||||
|
var catdiv = document.getElementById('categorydiv');
|
||||||
|
if ( catdiv ) {
|
||||||
|
var button = catdiv.getElementsByTagName('A')[0];
|
||||||
|
if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) )
|
||||||
|
meta.toggleBoxState(button, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
var advanced = new dbxGroup(
|
||||||
|
'advancedstuff',
|
||||||
|
'vertical',
|
||||||
|
'10',
|
||||||
|
'yes', // restrict drag movement to container axis ['yes'|'no']
|
||||||
|
'10',
|
||||||
|
'yes',
|
||||||
|
'closed',
|
||||||
|
dbxL10n.open,
|
||||||
|
dbxL10n.close,
|
||||||
|
dbxL10n.moveMouse,
|
||||||
|
dbxL10n.toggleMouse,
|
||||||
|
dbxL10n.moveKey,
|
||||||
|
dbxL10n.toggleKey,
|
||||||
|
'%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
|
||||||
|
);
|
||||||
|
});
|
|
@ -1,4 +1,3 @@
|
||||||
<?php require_once('admin.php'); cache_javascript_headers(); ?>
|
|
||||||
addLoadEvent( function() {
|
addLoadEvent( function() {
|
||||||
theFileList = {
|
theFileList = {
|
||||||
currentImage: {ID: 0},
|
currentImage: {ID: 0},
|
||||||
|
@ -69,22 +68,23 @@ addLoadEvent( function() {
|
||||||
var params = $H(this.params);
|
var params = $H(this.params);
|
||||||
params.ID = '';
|
params.ID = '';
|
||||||
params.action = '';
|
params.action = '';
|
||||||
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";
|
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
|
||||||
} else {
|
} else {
|
||||||
h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')) ?></a>";
|
h += "<a href='#' onclick='return theFileList.cancelView();'";
|
||||||
}
|
}
|
||||||
|
h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
|
||||||
h += "<div id='file-title'>"
|
h += "<div id='file-title'>"
|
||||||
if ( 0 == this.currentImage.isImage )
|
if ( 0 == this.currentImage.isImage )
|
||||||
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";
|
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
|
||||||
else
|
else
|
||||||
h += "<h2>" + this.currentImage.title + "</h2>";
|
h += "<h2>" + this.currentImage.title + "</h2>";
|
||||||
h += " — <span>";
|
h += " — <span>";
|
||||||
h += "<a href='#' onclick='return theFileList.editView(" + id + ");'><?php echo attribute_escape(__('Edit')); ?></a>"
|
h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
|
||||||
h += "</span>";
|
h += "</span>";
|
||||||
h += '</div>'
|
h += '</div>'
|
||||||
h += "<div id='upload-file-view' class='alignleft'>";
|
h += "<div id='upload-file-view' class='alignleft'>";
|
||||||
if ( 1 == this.currentImage.isImage ) {
|
if ( 1 == this.currentImage.isImage ) {
|
||||||
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>";
|
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
|
||||||
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
||||||
h += "</a>";
|
h += "</a>";
|
||||||
} else
|
} else
|
||||||
|
@ -98,28 +98,28 @@ addLoadEvent( function() {
|
||||||
if ( 1 == this.currentImage.isImage ) {
|
if ( 1 == this.currentImage.isImage ) {
|
||||||
checked = 'display-full';
|
checked = 'display-full';
|
||||||
if ( this.currentImage.thumb ) {
|
if ( this.currentImage.thumb ) {
|
||||||
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Thumbnail')); ?></label><br />");
|
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />");
|
||||||
checked = 'display-thumb';
|
checked = 'display-thumb';
|
||||||
}
|
}
|
||||||
display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo attribute_escape(__('Full size')); ?></label>");
|
display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>");
|
||||||
} else if ( this.currentImage.thumb ) {
|
} else if ( this.currentImage.thumb ) {
|
||||||
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> <?php echo attribute_escape(__('Icon')); ?></label>");
|
display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>");
|
||||||
}
|
}
|
||||||
if ( display.length ) {
|
if ( display.length ) {
|
||||||
display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> <?php echo attribute_escape(__('Title')); ?></label>");
|
display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>");
|
||||||
h += "<tr><th style='padding-bottom:.5em'><?php echo attribute_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>";
|
h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>";
|
||||||
$A(display).each( function(i) { h += i; } );
|
$A(display).each( function(i) { h += i; } );
|
||||||
h += "</td></tr>";
|
h += "</td></tr>";
|
||||||
}
|
}
|
||||||
|
|
||||||
h += "<tr><th><?php echo attribute_escape(__('Link to:')); ?></th><td>";
|
h += "<tr><th>" + this.link + "</th><td>";
|
||||||
h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo attribute_escape(__('File')); ?></label><br />";
|
h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />";
|
||||||
h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo attribute_escape(__('Page')); ?></label><br />";
|
h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />";
|
||||||
h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo attribute_escape(__('None')); ?></label>";
|
h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>";
|
||||||
h += "</td></tr>";
|
h += "</td></tr>";
|
||||||
|
|
||||||
h += "<tr><td colspan='2'><p class='submit'>";
|
h += "<tr><td colspan='2'><p class='submit'>";
|
||||||
h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo attribute_escape(__('Send to editor »')); ?>' />";
|
h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />";
|
||||||
h += "</p></td></tr></table>";
|
h += "</p></td></tr></table>";
|
||||||
h += "</form>";
|
h += "</form>";
|
||||||
|
|
||||||
|
@ -147,22 +147,23 @@ addLoadEvent( function() {
|
||||||
var params = $H(this.params);
|
var params = $H(this.params);
|
||||||
params.ID = '';
|
params.ID = '';
|
||||||
params.action = '';
|
params.action = '';
|
||||||
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";
|
h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'";
|
||||||
} else {
|
} else {
|
||||||
h += "<a href='#' onclick='return theFileList.cancelView();' title='<?php echo attribute_escape(__('Browse your files')); ?>' class='back'><?php echo attribute_escape(__('« Back')); ?></a>";
|
h += "<a href='#' onclick='return theFileList.cancelView();'";
|
||||||
}
|
}
|
||||||
|
h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
|
||||||
h += "<div id='file-title'>"
|
h += "<div id='file-title'>"
|
||||||
if ( 0 == this.currentImage.isImage )
|
if ( 0 == this.currentImage.isImage )
|
||||||
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo attribute_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>";
|
h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>";
|
||||||
else
|
else
|
||||||
h += "<h2>" + this.currentImage.title + "</h2>";
|
h += "<h2>" + this.currentImage.title + "</h2>";
|
||||||
h += " — <span>";
|
h += " — <span>";
|
||||||
h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php echo attribute_escape(__('Insert')); ?></a>"
|
h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
|
||||||
h += "</span>";
|
h += "</span>";
|
||||||
h += '</div>'
|
h += '</div>'
|
||||||
h += "<div id='upload-file-view' class='alignleft'>";
|
h += "<div id='upload-file-view' class='alignleft'>";
|
||||||
if ( 1 == this.currentImage.isImage ) {
|
if ( 1 == this.currentImage.isImage ) {
|
||||||
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo wp_specialchars(__('Direct link to file')); ?>'>";
|
h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>";
|
||||||
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
|
||||||
h += "</a>";
|
h += "</a>";
|
||||||
} else
|
} else
|
||||||
|
@ -170,21 +171,21 @@ addLoadEvent( function() {
|
||||||
h += "</div>";
|
h += "</div>";
|
||||||
|
|
||||||
|
|
||||||
h += "<table><col /><col class='widefat' /><tr>"
|
h += "<table><col /><col class='widefat' /><tr>";
|
||||||
h += "<th scope='row'><label for='url'><?php echo attribute_escape(__('URL')); ?></label></th>";
|
h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>";
|
||||||
h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
|
h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
|
||||||
h += "</tr><tr>";
|
h += "</tr><tr>";
|
||||||
h += "<th scope='row'><label for='post_title'><?php echo attribute_escape(__('Title')); ?></label></th>";
|
h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>";
|
||||||
h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
|
h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
|
||||||
h += "</tr><tr>";
|
h += "</tr><tr>";
|
||||||
h += "<th scope='row'><label for='post_content'><?php echo attribute_escape(__('Description')); ?></label></th>";
|
h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>";
|
||||||
h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
|
h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>";
|
||||||
h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='<?php echo attribute_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />";
|
h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />";
|
||||||
h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
|
h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
|
||||||
h += "<input type='hidden' name='action' id='action-value' value='save' />";
|
h += "<input type='hidden' name='action' id='action-value' value='save' />";
|
||||||
h += "<input type='hidden' name='ID' value='" + id + "' />";
|
h += "<input type='hidden' name='ID' value='" + id + "' />";
|
||||||
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
|
h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />";
|
||||||
h += "<div class='submit'><input type='submit' value='<?php echo attribute_escape(__('Save »')); ?>' /></div>";
|
h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>";
|
||||||
h += "</td></tr></table></form>";
|
h += "</td></tr></table></form>";
|
||||||
|
|
||||||
new Insertion.Top('upload-content', h);
|
new Insertion.Top('upload-content', h);
|
||||||
|
@ -257,7 +258,7 @@ addLoadEvent( function() {
|
||||||
},
|
},
|
||||||
|
|
||||||
deleteFile: function(id) {
|
deleteFile: function(id) {
|
||||||
if ( confirm("<?php printf(js_escape(__("Are you sure you want to delete the file '%s'?\nClick ok to delete or cancel to go back.")), '" + this.currentImage.title + "'); ?>") ) {
|
if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {
|
||||||
$('action-value').value = 'delete';
|
$('action-value').value = 'delete';
|
||||||
$('upload-file').submit();
|
$('upload-file').submit();
|
||||||
return true;
|
return true;
|
||||||
|
@ -266,6 +267,7 @@ addLoadEvent( function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Object.extend( theFileList, uploadL10n );
|
||||||
theFileList.initializeVars();
|
theFileList.initializeVars();
|
||||||
theFileList.initializeLinks();
|
theFileList.initializeLinks();
|
||||||
} );
|
} );
|
|
@ -1,6 +1,3 @@
|
||||||
<?php @require_once('../../wp-config.php');
|
|
||||||
cache_javascript_headers();
|
|
||||||
?>
|
|
||||||
var autosaveLast = '';
|
var autosaveLast = '';
|
||||||
var autosavePeriodical;
|
var autosavePeriodical;
|
||||||
|
|
||||||
|
@ -8,7 +5,7 @@ function autosave_start_timer() {
|
||||||
var form = $('post');
|
var form = $('post');
|
||||||
autosaveLast = form.post_title.value+form.content.value;
|
autosaveLast = form.post_title.value+form.content.value;
|
||||||
// Keep autosave_interval in sync with edit_post().
|
// Keep autosave_interval in sync with edit_post().
|
||||||
autosavePeriodical = new PeriodicalExecuter(autosave, <?php echo apply_filters('autosave_interval', '120'); ?>);
|
autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval);
|
||||||
//Disable autosave after the form has been submitted
|
//Disable autosave after the form has been submitted
|
||||||
if(form.addEventListener) {
|
if(form.addEventListener) {
|
||||||
form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);
|
form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);
|
||||||
|
@ -40,9 +37,9 @@ function autosave_update_post_ID() {
|
||||||
var message;
|
var message;
|
||||||
|
|
||||||
if(isNaN(res)) {
|
if(isNaN(res)) {
|
||||||
message = "<?php echo js_escape(__('Error: ')); ?>" + response;
|
message = autosaveL10n.errorText.replace(/%response%/g, response);
|
||||||
} else {
|
} else {
|
||||||
message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time();
|
message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());
|
||||||
$('post_ID').name = "post_ID";
|
$('post_ID').name = "post_ID";
|
||||||
$('post_ID').value = res;
|
$('post_ID').value = res;
|
||||||
// We need new nonces
|
// We need new nonces
|
||||||
|
@ -52,7 +49,7 @@ function autosave_update_post_ID() {
|
||||||
nonceAjax.setVar("post_ID", res);
|
nonceAjax.setVar("post_ID", res);
|
||||||
nonceAjax.setVar("cookie", document.cookie);
|
nonceAjax.setVar("cookie", document.cookie);
|
||||||
nonceAjax.setVar("post_type", $('post_type').value);
|
nonceAjax.setVar("post_type", $('post_type').value);
|
||||||
nonceAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
|
nonceAjax.requestFile = autosaveL10n.requestFile;
|
||||||
nonceAjax.onCompletion = autosave_update_nonce;
|
nonceAjax.onCompletion = autosave_update_nonce;
|
||||||
nonceAjax.method = "POST";
|
nonceAjax.method = "POST";
|
||||||
nonceAjax.runAJAX();
|
nonceAjax.runAJAX();
|
||||||
|
@ -63,7 +60,7 @@ function autosave_update_post_ID() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function autosave_loading() {
|
function autosave_loading() {
|
||||||
$('autosave').innerHTML = "<?php echo js_escape(__('Saving Draft...')); ?>";
|
$('autosave').innerHTML = autosaveL10n.savingText;
|
||||||
}
|
}
|
||||||
|
|
||||||
function autosave_saved() {
|
function autosave_saved() {
|
||||||
|
@ -72,9 +69,9 @@ function autosave_saved() {
|
||||||
var message;
|
var message;
|
||||||
|
|
||||||
if(isNaN(res)) {
|
if(isNaN(res)) {
|
||||||
message = "<?php echo js_escape(__('Error: ')); ?>" + response;
|
message = autosaveL10n.errorText.replace(/%response%/g, response);
|
||||||
} else {
|
} else {
|
||||||
message = "<?php echo js_escape(__('Saved at ')); ?>" + autosave_cur_time() + ".";
|
message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());
|
||||||
}
|
}
|
||||||
$('autosave').innerHTML = message;
|
$('autosave').innerHTML = message;
|
||||||
autosave_enable_buttons();
|
autosave_enable_buttons();
|
||||||
|
@ -148,7 +145,7 @@ function autosave() {
|
||||||
autosaveAjax.setVar("content", form.content.value);
|
autosaveAjax.setVar("content", form.content.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
autosaveAjax.requestFile = "<?php echo get_option('siteurl'); ?>/wp-admin/admin-ajax.php";
|
autosaveAjax.requestFile = autosaveL10n.requestFile;
|
||||||
autosaveAjax.method = "POST";
|
autosaveAjax.method = "POST";
|
||||||
autosaveAjax.element = null;
|
autosaveAjax.element = null;
|
||||||
autosaveAjax.onLoading = autosave_loading;
|
autosaveAjax.onLoading = autosave_loading;
|
|
@ -8,7 +8,7 @@ function deleteSomething( what, id, message, obj ) {
|
||||||
if ( !obj )
|
if ( !obj )
|
||||||
obj=theList;
|
obj=theList;
|
||||||
if ( !message )
|
if ( !message )
|
||||||
message = obj.delText.replace(/%/g, what);
|
message = obj.delText.replace(/%thing%/g, what);
|
||||||
if( confirm(message) )
|
if( confirm(message) )
|
||||||
return obj.ajaxDelete( what, id );
|
return obj.ajaxDelete( what, id );
|
||||||
else return false;
|
else return false;
|
||||||
|
@ -36,8 +36,8 @@ Object.extend(listMan.prototype, {
|
||||||
dataStore: null,
|
dataStore: null,
|
||||||
formStore: null,
|
formStore: null,
|
||||||
|
|
||||||
jumpText: 'Jump to new item',
|
jumpText: '', // We get these from listManL10n
|
||||||
delText: 'Are you sure you want to delete this %s?',
|
delText: '',
|
||||||
|
|
||||||
initialize: function(theListId) {
|
initialize: function(theListId) {
|
||||||
this.theList = $(theListId ? theListId : 'the-list');
|
this.theList = $(theListId ? theListId : 'the-list');
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
<?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>
|
|
||||||
var WPAjax = Class.create();
|
var WPAjax = Class.create();
|
||||||
Object.extend(WPAjax.prototype, Ajax.Request.prototype);
|
Object.extend(WPAjax.prototype, Ajax.Request.prototype);
|
||||||
Object.extend(WPAjax.prototype, {
|
Object.extend(WPAjax.prototype, {
|
||||||
WPComplete: false, // onComplete function
|
WPComplete: false, // onComplete function
|
||||||
WPError: false, // onWPError function
|
WPError: false, // onWPError function
|
||||||
|
defaultUrl: '', // We get these from WPAjaxL10n
|
||||||
|
permText: '',
|
||||||
|
strangeText: '',
|
||||||
|
whoaText: '',
|
||||||
|
|
||||||
initialize: function(url, responseEl) {
|
initialize: function(url, responseEl) {
|
||||||
var tempObj = this;
|
var tempObj = this;
|
||||||
this.transport = Ajax.getTransport();
|
this.transport = Ajax.getTransport();
|
||||||
|
@ -19,7 +23,7 @@ Object.extend(WPAjax.prototype, {
|
||||||
tempObj.WPError(transport);
|
tempObj.WPError(transport);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php';
|
this.url = url ? url : this.defaultUrl;
|
||||||
this.getResponseElement(responseEl);
|
this.getResponseElement(responseEl);
|
||||||
},
|
},
|
||||||
addArg: function(key, value) {
|
addArg: function(key, value) {
|
||||||
|
@ -52,10 +56,10 @@ Object.extend(WPAjax.prototype, {
|
||||||
}
|
}
|
||||||
var r = parseInt(r,10);
|
var r = parseInt(r,10);
|
||||||
if ( -1 == r ) {
|
if ( -1 == r ) {
|
||||||
Element.update(this.myResponseElement,"<div class='error'><p><?php _e("You don't have permission to do that."); ?></p></div>");
|
Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText + "</p></div>");
|
||||||
return false;
|
return false;
|
||||||
} else if ( 0 == r ) {
|
} else if ( 0 == r ) {
|
||||||
Element.update(this.myResponseElement,"<div class='error'><p><?php _e("Something strange happened. Try refreshing the page."); ?></p></div>");
|
Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText + "</p></div>");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -71,6 +75,8 @@ Object.extend(WPAjax.prototype, {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false )
|
||||||
|
|
||||||
Ajax.activeSendCount = 0;
|
Ajax.activeSendCount = 0;
|
||||||
Ajax.Responders.register( {
|
Ajax.Responders.register( {
|
||||||
onCreate: function() {
|
onCreate: function() {
|
||||||
|
@ -79,7 +85,7 @@ Ajax.Responders.register( {
|
||||||
return;
|
return;
|
||||||
wpBeforeUnload = window.onbeforeunload;
|
wpBeforeUnload = window.onbeforeunload;
|
||||||
window.onbeforeunload = function() {
|
window.onbeforeunload = function() {
|
||||||
return "<?php js_escape(__("Slow down, I'm still sending your data!")); ?>";
|
return WPAjax.whoaText;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onLoading: function() { // Can switch to onLoaded if we lose data
|
onLoading: function() { // Can switch to onLoaded if we lose data
|
|
@ -19,12 +19,25 @@ class WP_Scripts {
|
||||||
$mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
|
$mce_config = apply_filters('tiny_mce_config_url', '/wp-includes/js/tinymce/tiny_mce_config.php');
|
||||||
$this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' );
|
$this->add( 'wp_tiny_mce', $mce_config, array('tiny_mce'), '20070225' );
|
||||||
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0');
|
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0-0');
|
||||||
$this->add( 'autosave', '/wp-includes/js/autosave-js.php', array('prototype', 'sack'), '20070116');
|
$this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306');
|
||||||
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '20070118');
|
$this->localize( 'autosave', 'autosaveL10n', array(
|
||||||
$this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070305');
|
'autosaveInterval' => apply_filters('autosave_interval', '120'),
|
||||||
|
'errorText' => __('Error: %response%'),
|
||||||
|
'saveText' => __('Saved at %time%.'),
|
||||||
|
'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
|
||||||
|
'savingText' => __('Saving Draft...')
|
||||||
|
) );
|
||||||
|
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306');
|
||||||
|
$this->localize( 'wp-ajax', 'WPAjaxL10n', array(
|
||||||
|
'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
|
||||||
|
'permText' => __("You don't have permission to do that."),
|
||||||
|
'strangeText' => __("Something strange happened. Try refreshing the page."),
|
||||||
|
'whoaText' => __("Slow down, I'm still sending your data!")
|
||||||
|
) );
|
||||||
|
$this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306');
|
||||||
$this->localize( 'listman', 'listManL10n', array(
|
$this->localize( 'listman', 'listManL10n', array(
|
||||||
'jumpText' => __('Jump to new item'),
|
'jumpText' => __('Jump to new item'),
|
||||||
'delText' => __('Are you sure you want to delete this %s?')
|
'delText' => __('Are you sure you want to delete this %thing%?')
|
||||||
) );
|
) );
|
||||||
$this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0');
|
$this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/wp-scriptaculous.js', array('prototype'), '1.7.0');
|
||||||
$this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0');
|
$this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.0');
|
||||||
|
@ -37,14 +50,66 @@ class WP_Scripts {
|
||||||
$this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1');
|
$this->add( 'jquery', '/wp-includes/js/jquery/jquery.js', false, '1.1.1');
|
||||||
$this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1');
|
$this->add( 'interface', '/wp-includes/js/jquery/interface.js', array('jquery'), '1.1.1');
|
||||||
if ( is_admin() ) {
|
if ( is_admin() ) {
|
||||||
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
|
global $pagenow;
|
||||||
$this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '20070118' );
|
$man = false;
|
||||||
|
switch ( $pagenow ) :
|
||||||
|
case 'post.php' :
|
||||||
|
case 'post-new.php' :
|
||||||
|
$man = 'postmeta';
|
||||||
|
break;
|
||||||
|
case 'page.php' :
|
||||||
|
case 'page-new.php' :
|
||||||
|
$man = 'pagemeta';
|
||||||
|
break;
|
||||||
|
case 'link.php' :
|
||||||
|
$man = 'linkmeta';
|
||||||
|
break;
|
||||||
|
endswitch;
|
||||||
|
if ( $man ) {
|
||||||
|
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key.js', array('dbx'), '20070306' );
|
||||||
|
$this->localize( 'dbx-admin-key', 'dbxL10n', array(
|
||||||
|
'manager' => $man,
|
||||||
|
'open' => __('open'),
|
||||||
|
'close' => __('close'),
|
||||||
|
'moveMouse' => __('click-down and drag to move this box'),
|
||||||
|
'toggleMouse' => __('click to %toggle% this box'),
|
||||||
|
'moveKey' => __('use the arrow keys to move this box'),
|
||||||
|
'toggleKey' => __(', or press the enter key to %toggle% it'),
|
||||||
|
) );
|
||||||
|
}
|
||||||
|
$this->add( 'ajaxcat', '/wp-admin/cat.js', array('listman'), '20070306' );
|
||||||
|
$this->localize( 'ajaxcat', 'catL10n', array(
|
||||||
|
'add' => attribute_escape(__('Add')),
|
||||||
|
'how' => __('Separate multiple categories with commas.')
|
||||||
|
) );
|
||||||
$this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' );
|
$this->add( 'admin-categories', '/wp-admin/categories.js', array('listman'), '3684' );
|
||||||
$this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' );
|
$this->add( 'admin-custom-fields', '/wp-admin/custom-fields.js', array('listman'), '3733' );
|
||||||
$this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' );
|
$this->add( 'admin-comments', '/wp-admin/edit-comments.js', array('listman'), '3847' );
|
||||||
$this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' );
|
$this->add( 'admin-users', '/wp-admin/users.js', array('listman'), '4583' );
|
||||||
$this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
|
$this->add( 'xfn', '/wp-admin/xfn.js', false, '3517' );
|
||||||
$this->add( 'upload', '/wp-admin/upload-js.php', array('prototype'), '20070118' );
|
$this->add( 'upload', '/wp-admin/upload.js', array('prototype'), '20070306' );
|
||||||
|
$this->localize( 'upload', 'uploadL10n', array(
|
||||||
|
'browseTitle' => attribute_escape(__('Browse your files')),
|
||||||
|
'back' => __('« Back'),
|
||||||
|
'directTitle' => attribute_escape(__('Direct link to file')),
|
||||||
|
'edit' => __('Edit'),
|
||||||
|
'thumb' => __('Thumbnail'),
|
||||||
|
'full' => __('Full size'),
|
||||||
|
'icon' => __('Icon'),
|
||||||
|
'title' => __('Title'),
|
||||||
|
'show' => __('Show:'),
|
||||||
|
'link' => __('Link to:'),
|
||||||
|
'file' => __('File'),
|
||||||
|
'page' => __('Page'),
|
||||||
|
'none' => __('None'),
|
||||||
|
'editorText' => attribute_escape(__('Send to editor »')),
|
||||||
|
'insert' => __('Insert'),
|
||||||
|
'urlText' => __('URL'),
|
||||||
|
'desc' => __('Description'),
|
||||||
|
'deleteText' => attribute_escape(__('Delete File')),
|
||||||
|
'saveText' => attribute_escape(__('Save »')),
|
||||||
|
'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
|
||||||
|
) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue