diff options
author | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-23 22:35:34 -0400 |
---|---|---|
committer | Michael Gapczynski <mtgap@owncloud.com> | 2012-07-23 22:35:34 -0400 |
commit | b58e72cdb27d46188675484c73d2783102f7d050 (patch) | |
tree | a28050fd5d7cc0ccefcf53ed6371ad432c691cb3 /apps | |
parent | 7b01e3285e59d8184aae6c1a8de54c742b35fc54 (diff) | |
download | nextcloud-server-b58e72cdb27d46188675484c73d2783102f7d050.tar.gz nextcloud-server-b58e72cdb27d46188675484c73d2783102f7d050.zip |
Alert user of errors when creating new files or folders
Diffstat (limited to 'apps')
-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'); } } ); |