External onclick handler for renaming media file.
NOTE: Renaming is not completed, submitting the prompt results in an error msg: "Your browser did not sent a valid HTTP-Referrer string. This may have either been caused by a misconfigured browser/proxy or by a Cross Site Request Forgery (XSRF) aimed at you. The action you requested could not be completed." This is beyond my JS knowledge. @onli …?
This commit is contained in:
parent
891792b987
commit
6bba09cbf2
templates/2k11/admin
@ -98,7 +98,7 @@
|
||||
<li><a class="media_show_info button_link" href="#media_file_meta_{$file.id}" title="Show media info"><span class="icon-info-circled"></span><span class="visuallyhidden"> Show media info</span></a></li> {* i18n *}
|
||||
{if $file.is_editable}
|
||||
<li><a class="media_fullsize button_link" href="#" title="{$CONST.MEDIA_FULLSIZE}" onclick="F1 = window.open('{if $file.hotlink}{$file.path}{else}{$file.full_file}{/if}', 'Zoom', 'height={$file.popupHeight},width={$file.popupWidth},top='+ (screen.height-{$file.popupHeight})/2 +',left='+ (screen.width-{$file.popupWidth})/2 +',toolbar=no,menubar=no,location=no,resize=1,resizable=1{if NOT $file.is_image},scrollbars=yes{/if}');"><span class="icon-resize-full-alt"></span><span class="visuallyhidden"> {$CONST.MEDIA_FULLSIZE}</span></a></li>
|
||||
<li><a class="media_rename button_link" href="#" title="{$CONST.MEDIA_RENAME}" onclick="rename('{$file.id}', '{$file.name|escape:javascript}')"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.MEDIA_RENAME}</span></a></li>
|
||||
<li><a class="media_rename button_link" href="#" title="{$CONST.MEDIA_RENAME}" data-fileid="{$file.id}" data-filename="{$file.name|escape:javascript}"><span class="icon-edit"></span><span class="visuallyhidden"> {$CONST.MEDIA_RENAME}</span></a></li>
|
||||
{if $file.is_image AND NOT $file.hotlink}
|
||||
<li><a class="media_resize button_link" href="#" title="{$CONST.IMAGE_RESIZE}" onclick="location.href='?serendipity[adminModule]=images&serendipity[adminAction]=scaleSelect&serendipity[fid]={$file.id}';"><span class="icon-resize-full"></span><span class="visuallyhidden"> {$CONST.IMAGE_RESIZE}</span></a></li>
|
||||
{/if}
|
||||
|
@ -298,7 +298,7 @@ function serendipity_imageSelector_done(textarea) {
|
||||
if (floating == "") {
|
||||
floating = "center";
|
||||
}
|
||||
img = "<!-- s9ymdb:" + imgID + " --><img class=\"serendipity_image_"+ floating +"\" width=\"" + imgWidth + "\" height=\"" + imgHeight + '" src="' + img + "\" " + (title != '' ? 'title="' + title + '"' : '') + " alt=\"" + alt + "\" />";
|
||||
img = "<!-- s9ymdb:" + imgID + " --><img class=\"serendipity_image_"+ floating +"\" width=\"" + imgWidth + "\" height=\"" + imgHeight + '" src="' + img + "\" " + (title != '' ? 'title="' + title + '"' : '') + " alt=\"" + alt + "\">";
|
||||
|
||||
if ($("#radio_islink_yes").attr("checked")) {
|
||||
// wrap the img in a link to the image. TODO: The label in the media_chooser.tpl explains it wrong
|
||||
@ -425,6 +425,8 @@ function rescale(dim, newval) {
|
||||
}
|
||||
|
||||
// Rename file in media db
|
||||
var media_rename = '{$CONST.ENTER_NEW_NAME}';
|
||||
var media_token_url = '{$media.token_url}';
|
||||
function rename(id, fname) {
|
||||
var newname;
|
||||
if (newname = prompt(media_rename + fname, fname)) {
|
||||
@ -680,7 +682,6 @@ function highlightComment(id, checkvalue) {
|
||||
$('#serendipityNewTimestamp').val($('#serendipityNewTimestamp').val().replace("T", " "));
|
||||
}
|
||||
|
||||
|
||||
// Set entry timestamp
|
||||
$('#reset_timestamp').click(function(e) {
|
||||
$('#serendipityNewTimestamp').val($(this).attr('data-currtime'));
|
||||
@ -837,6 +838,13 @@ function highlightComment(id, checkvalue) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
// Media file actions
|
||||
$('.media_rename').click(function(e) {
|
||||
e.preventDefault();
|
||||
var $el = $(this);
|
||||
rename($el.attr('data-fileid'), $el.attr('data-filename'));
|
||||
});
|
||||
|
||||
// Confirm media scale
|
||||
$('.image_scale').click(function(e) {
|
||||
if (confirm('{$CONST.REALLY_SCALE_IMAGE}')) document.serendipityScaleForm.submit();
|
||||
|
Loading…
x
Reference in New Issue
Block a user