Alert user of errors when creating new files or folders

This commit is contained in:
Michael Gapczynski 2012-07-23 22:35:34 -04:00
parent 7b01e3285e
commit b58e72cdb2

View file

@ -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');
}
}
);