diff options
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 86c5185bf72..8d52b742c1b 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -462,14 +462,18 @@ $(document).ready(function() { $.post( OC.filePath('files','ajax','newfile.php'), {dir:$('#dir').val(),filename:name,content:" \n"}, - function(data){ - var date=new Date(); - FileList.addFile(name,0,date); - var tr=$('tr').filterAttr('data-file',name); - tr.data('mime','text/plain'); - getMimeIcon('text/plain',function(path){ - tr.find('td.filename').attr('style','background-image:url('+path+')'); - }); + function(result){ + if (result.status == 'success') { + var date=new Date(); + FileList.addFile(name,0,date); + var tr=$('tr').filterAttr('data-file',name); + tr.data('mime','text/plain'); + getMimeIcon('text/plain',function(path){ + tr.find('td.filename').attr('style','background-image:url('+path+')'); + }); + } else { + OC.dialogs.alert(result.data.message, 'Error'); + } } ); break; @@ -477,9 +481,13 @@ $(document).ready(function() { $.post( OC.filePath('files','ajax','newfolder.php'), {dir:$('#dir').val(),foldername:name}, - function(data){ - var date=new Date(); - FileList.addDir(name,0,date); + function(result){ + if (result.status == 'success') { + var date=new Date(); + FileList.addDir(name,0,date); + } else { + OC.dialogs.alert(result.data.message, 'Error'); + } } ); break; @@ -510,7 +518,7 @@ $(document).ready(function() { tr.find('td.filename').attr('style','background-image:url('+path+')'); }); }else{ - + OC.dialogs.alert(result.data.message, 'Error'); } } ); |