From: Thomas Mueller Date: Fri, 11 Jan 2013 09:00:12 +0000 (+0100) Subject: Merge branch 'master' into fixing-998-master X-Git-Tag: v5.0.0alpha1~192^2~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=364b1cd3915ab8d33f1a63f598be3acb4bfcf86a;p=nextcloud-server.git Merge branch 'master' into fixing-998-master Conflicts: apps/files/js/files.js --- 364b1cd3915ab8d33f1a63f598be3acb4bfcf86a diff --cc apps/files/js/files.js index ac47f390826,bb298431e84..81f596d6647 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@@ -319,16 -313,18 +321,17 @@@ $(document).ready(function() var response; response=jQuery.parseJSON(result); if(response[0] == undefined || response[0].status != 'success') { - $('#notification').text(t('files', response.data.message)); - $('#notification').fadeIn(); + OC.Notification.show(t('files', response.data.message)); } var file=response[0]; - // TODO: this doesn't work if the file name has been changed server side + // TODO: this doesn't work if the file name has been changed server side delete uploadingFiles[dirName][file.name]; - if ($.assocArraySize(uploadingFiles[dirName]) == 0) { - delete uploadingFiles[dirName]; - } + if ($.assocArraySize(uploadingFiles[dirName]) == 0) { + delete uploadingFiles[dirName]; + } + //TODO update file upload size limit - var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') + var uploadtext = $('tr').filterAttr('data-type', 'dir').filterAttr('data-file', dirName).find('.uploadtext') var currentUploads = parseInt(uploadtext.attr('currentUploads')); currentUploads -= 1; uploadtext.attr('currentUploads', currentUploads); @@@ -377,16 -376,22 +380,19 @@@ if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } + //TODO update file upload size limit FileList.loadingDone(file.name, file.id); } else { - Files.cancelUpload(this.files[0].name); - $('#notification').text(t('files', response.data.message)); - $('#notification').fadeIn(); ++ Files.cancelUpload(this.files[0].name); + OC.Notification.show(t('files', response.data.message)); $('#fileList > tr').not('[data-mime]').fadeOut(); $('#fileList > tr').not('[data-mime]').remove(); } }) .error(function(jqXHR, textStatus, errorThrown) { if(errorThrown === 'abort') { - Files.cancelUpload(this.files[0].name); - $('#notification').hide(); - $('#notification').text(t('files', 'Upload cancelled.')); - $('#notification').fadeIn(); ++ Files.cancelUpload(this.files[0].name); + OC.Notification.show(t('files', 'Upload cancelled.')); } }); uploadingFiles[uniqueName] = jqXHR; @@@ -404,9 -409,12 +410,11 @@@ if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } + //TODO update file upload size limit FileList.loadingDone(file.name, file.id); } else { - //TODO Files.cancelUpload(/*where do we get the filename*/); - $('#notification').text(t('files', response.data.message)); - $('#notification').fadeIn(); ++ //TODO Files.cancelUpload(/*where do we get the filename*/); + OC.Notification.show(t('files', response.data.message)); $('#fileList > tr').not('[data-mime]').fadeOut(); $('#fileList > tr').not('[data-mime]').remove(); } @@@ -516,15 -524,25 +524,24 @@@ var text=$(this).children('p').text(); $(this).data('text',text); $(this).children('p').remove(); + var form=$('
'); var input=$(''); - $(this).append(input); + form.append(input); + $(this).append(form); input.focus(); - input.change(function(){ - if (type != 'web' && !Files.isFileNameValid($(this).val())) { - return; - } else if( type == 'folder' && $('#dir').val() == '/' && $(this).val() == 'Shared') { - OC.Notification.show(t('files','Invalid folder name. Usage of "Shared" is reserved by Owncloud')); - return; + form.submit(function(event){ + event.stopPropagation(); + event.preventDefault(); + var newname=input.val(); + if(type == 'web' && newname.length == 0) { + $('#notification').text(t('files', 'URL cannot be empty.')); + $('#notification').fadeIn(); + return false; + } else if (type != 'web' && !Files.isFileNameValid(newname)) { + return false; + } else if( type == 'folder' && $('#dir').val() == '/' && newname == 'Shared') { - $('#notification').text(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud')); - $('#notification').fadeIn(); ++ OC.Notification.show(t('files','Invalid folder name. Usage of \'Shared\' is reserved by Owncloud')); + return false; } if (FileList.lastAction) { FileList.lastAction();