Archived
1
0

fix rename media file reload issue

References #370

and allow better umlaut conversion

This is a plain javascript event, therefore the message and reload stuff had to move into the JS caller.
This commit is contained in:
Ian
2015-10-17 15:03:15 +02:00
parent 732d6067c3
commit 3030b80c2b
5 changed files with 96 additions and 20 deletions
+3 -10
View File
@@ -40,18 +40,11 @@
</form>
{/if}
{if $case_do_multidelete || $case_do_delete}
{if $showML}{$showML}{/if}
{/if}
{if $case_rename}
{if $go_back}
<input class="go_back" type="button" value="{$CONST.BACK}">
{else}
<script>location.href="?serendipity[adminModule]=images&serendipity[adminAction]=default";</script>
<noscript><a class="button_link icon_link standalone" href="?serendipity[adminModule]=images&amp;serendipity[adminAction]=default">{$CONST.DONE}</a></noscript>
{/if}
{if isset($showML)}{$showML}{/if}
{/if}
{* A $case_rename can not respond to reload page while in JS - serendipity.rename() ajax will reload and set message events by script *}
{if $case_add}
{$showML}
{if isset($showML)}{$showML}{/if}
{/if}
{if $case_directoryDoDelete}
{if $print_DIRECTORY_WRITE_ERROR}<span class="msg_error"><span class="icon-attention-circled"></span> {$print_DIRECTORY_WRITE_ERROR}</span>{/if}
+55 -1
View File
@@ -497,7 +497,61 @@
var media_rename = '{$CONST.ENTER_NEW_NAME}';
if (newname = prompt(media_rename + fname, fname)) {
var media_token_url = $('input[name*="serendipity[token]"]').val();
$.post('?serendipity[adminModule]=images&serendipity[adminAction]=rename&serendipity[fid]='+ escape(id) +'&serendipity[newname]='+ escape(newname) +'&serendipity[token]='+ media_token_url);
$.ajax({
type: 'POST',
url: '?serendipity[adminModule]=images&serendipity[adminAction]=rename&serendipity[fid]='+ escape(id) +'&serendipity[newname]='+ escape(newname) +'&serendipity[token]='+ media_token_url,
async: true,
cache: false,
success: function(response) {
$response = (response.trim() == '')
? '<p>{$CONST.DONE}!</p>\
<button id="rename_ok" class="button_link state_submit" type="button" >{$CONST.GO}</button>\
'
: response + '\
<input class="go_back" type="button" onClick="$.magnificPopup.close();" value="{$CONST.BACK}">\
';
$.magnificPopup.open({
items: {
type: 'inline',
src: $('<div id="rename_msg">\
<h4>{$CONST.MEDIA_RENAME}</h4>\
'+ $response +'\
</div>')
},
type: 'inline',
midClick: true,
callbacks: {
open: function() {
this.content.on('click', '#rename_ok', function() {
window.parent.parent.location.href= '?serendipity[adminModule]=images&serendipity[adminAction]=default';
});
},
}
});
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
$.magnificPopup.open({
items: {
type: 'inline',
src: $('<div id="rename_msg">\
<h4>{$CONST.MEDIA_RENAME}</h4>\
<p>"Status: " + textStatus</p>\
'+ errorThrown +'\
<button id="rename_error" class="button_link state_submit" type="button" >{$CONST.GO}</button>\
</div>')
},
type: 'inline',
midClick: true,
callbacks: {
open: function() {
this.content.on('click', '#rename_error', function() {
window.parent.parent.location.href= '?serendipity[adminModule]=images&serendipity[adminAction]=default';
});
},
}
});
}
});
}
}
+19
View File
@@ -1859,6 +1859,25 @@ form > .button_link:first-of-type,
padding-bottom: .583335em;
}
.mfp-content #rename_msg {
width: 40em;
background-color: #FFF;
text-align: center;
margin: auto;
border: 2px double #00FFDB;
padding: 0.5em;
}
.mfp-content #rename_ok {
margin-bottom: 1em;
color: #FFF;
text-shadow: inherit;
}
.mfp-content #rename_msg button.mfp-close {
display: none;
visibility: hidden;
overflow: hidden;
}
.taxonomy h3:hover,
.taxonomy li:hover {
cursor: pointer;