Use notification to inform about errors in file list.

This commit is contained in:
Brice Maron 2011-10-17 20:39:01 +02:00
parent 492931562f
commit 3c5a6a356a
2 changed files with 25 additions and 12 deletions

View file

@ -173,6 +173,7 @@ FileList={
FileList.deleteCanceled=false;
FileList.deleteFiles=files;
$('#notification').text(t('files','undo deletion'));
$('#notification').data('deletefile',true);
$('#notification').fadeIn();
},
finishDelete:function(ready,sync){
@ -204,14 +205,18 @@ FileList={
$(document).ready(function(){
$('#notification').hide();
$('#notification').click(function(){
FileList.deleteCanceled=true;
$('#notification').fadeOut();
$.each(FileList.deleteFiles,function(index,file){
$('tr[data-file="'+file+'"]').show();
if($('#notification').data('deletefile'))
{
$.each(FileList.deleteFiles,function(index,file){
$('tr[data-file="'+file+'"]').show();
// alert(file);
});
FileList.deleteFiles=null;
});
FileList.deleteCanceled=true;
FileList.deleteFiles=null;
}
$('#notification').fadeOut();
});
$(window).bind('beforeunload', function (){
FileList.finishDelete(null,true);
});

View file

@ -182,13 +182,21 @@ $(document).ready(function() {
var response=jQuery.parseJSON(target.contents().find('body').text());
//set mimetype and if needed filesize
if(response){
for(var i=0;i<response.length;i++){
var file=response[i];
$('tr[data-file="'+file.name+'"]').data('mime',file.mime);
if(size=='Pending'){
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
if(response[0] != undefined && response[0].status == 'success'){
for(var i=0;i<response.length;i++){
var file=response[i];
$('tr[data-file="'+file.name+'"]').data('mime',file.mime);
if(size=='Pending'){
$('tr[data-file='+file.name+'] td.filesize').text(file.size);
}
FileList.loadingDone(file.name);
}
FileList.loadingDone(file.name);
}
else{
$('#notification').text(t('files',response.data.message));
$('#notification').fadeIn();
$('#fileList > tr').not('[data-mime]').fadeOut();
$('#fileList > tr').not('[data-mime]').remove();
}
}
});