Skip to content

Commit

Permalink
bug 3127: during upload, warn user if she wants to leave the page (wo…
Browse files Browse the repository at this point in the history
…rks fine on Firefox/Chrome)

git-svn-id: http://piwigo.org/svn/trunk@29356 68402e56-0260-453c-a942-63ccdbb3a9ee
  • Loading branch information
plegall committed Sep 1, 2014
1 parent ccea530 commit 0e28516
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
9 changes: 8 additions & 1 deletion admin/themes/default/template/photos_add_direct.tpl
Expand Up @@ -103,6 +103,11 @@ jQuery(document).ready(function(){
BeforeUpload: function(up, file) {
console.log('[BeforeUpload]', file);
// warn user if she wants to leave page while upload is running
jQuery(window).bind('beforeunload', function() {
return "{/literal}{'Upload in progress'|translate|escape}{literal}";
});

// no more change on category/level
jQuery("select[name=level]").attr("disabled", "disabled");

Expand Down Expand Up @@ -165,10 +170,12 @@ jQuery(document).ready(function(){
jQuery(".batchLink").html(sprintf(batch_Label, uploadedPhotos.length));
jQuery(".afterUploadActions").show();
// user can safely leave page without warning
jQuery(window).unbind('beforeunload');
}
}
});

{/literal}
});
{/footer_script}
Expand Down
1 change: 1 addition & 0 deletions language/en_UK/admin.lang.php
Expand Up @@ -981,4 +981,5 @@
$lang['file name'] = 'file name';
$lang['date & time'] = 'date & time';
$lang['width & height'] = 'width & height';
$lang['Upload in progress'] = 'Upload in progress';
?>
3 changes: 2 additions & 1 deletion language/fr_FR/admin.lang.php
Expand Up @@ -982,4 +982,5 @@
$lang['file name'] = 'nom de fichier';
$lang['date & time'] = 'date et heure';
$lang['width & height'] = 'largeur et hauteur';
$lang['No and unlock sub-albums'] = 'Déverrouiller ou non les sous-albums';
$lang['No and unlock sub-albums'] = 'Non, et déverrouiller les sous-albums';
$lang['Upload in progress'] = 'Transfert en cours...';

0 comments on commit 0e28516

Please sign in to comment.