summaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorSimon Birnbach <simon@simon-birnbach.de>2012-04-15 23:52:36 +0200
committerSimon Birnbach <simon@simon-birnbach.de>2012-04-15 23:52:36 +0200
commit965a8ba2c60eb04e2f65a4ace215113ac61f7c98 (patch)
tree38292db21226c43c41ce68eb2ccd638d457e678d /files
parent8e27b725ba2aa26cb9037b44b18ff800649017b1 (diff)
downloadnextcloud-server-965a8ba2c60eb04e2f65a4ace215113ac61f7c98.tar.gz
nextcloud-server-965a8ba2c60eb04e2f65a4ace215113ac61f7c98.zip
Fixed cancelling of uploads and wrong merge conflict resolution
Diffstat (limited to 'files')
-rw-r--r--files/css/files.css6
-rw-r--r--files/js/files.js42
2 files changed, 36 insertions, 12 deletions
diff --git a/files/css/files.css b/files/css/files.css
index 544b323bb29..5dc7983bec4 100644
--- a/files/css/files.css
+++ b/files/css/files.css
@@ -42,9 +42,9 @@ tbody tr { background-color:#fff; height:2.5em; }
tbody tr:hover, tbody tr:active, tbody tr.selected { background-color:#f8f8f8; }
tbody tr.selected { background-color:#eee; }
tbody a { color:#000; }
-span.extention, span.uploading, td.date { color:#999; }
-span.extention { opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
-tr:hover span.extention { opacity:1; }
+span.extension, span.uploading, td.date { color:#999; }
+span.extension { text-transform:lowercase; opacity:0; -webkit-transition:opacity 500ms; -moz-transition:opacity 500ms; -o-transition:opacity 500ms; transition:opacity 500ms; }
+tr:hover span.extension { opacity:1; }
div.crumb { float:left; display:block; background:no-repeat right 0; padding:.75em 1.5em 0 1em; height:2.9em; }
div.crumb:first-child { padding-left:1em; }
div.crumb.last { font-weight:bold; }
diff --git a/files/js/files.js b/files/js/files.js
index a7a4d3077c1..56fff753737 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -9,13 +9,20 @@ Files={
return false;
},
cancelUploads:function() {
- $.each(uploadingFiles,function(index,file){
- file.abort();
+ $.each(uploadingFiles,function(index,file) {
+ if(typeof file['abort'] === 'function') {
+ file.abort();
+ var filename = $('tr').filterAttr('data-file',index);
+ filename.hide();
+ filename.find('input[type="checkbox"]').removeAttr('checked');
+ filename.removeClass('selected');
+ } else {
+ $.each(file,function(i,f) {
+ f.abort();
+ delete file[i];
+ });
+ }
delete uploadingFiles[index];
- var filename = $('tr').filterAttr('data-file',index);
- filename.hide();
- filename.find('input[type="checkbox"]').removeAttr('checked');
- filename.removeClass('selected');
});
procesSelection();
}
@@ -206,8 +213,9 @@ $(document).ready(function() {
}else{
if($.support.xhrFileUpload) {
for(var i=0;i<files.length;i++){
+ var fileName = files[i].name
var dropTarget = $(e.originalEvent.target).closest('tr');
- if(dropTarget && dropTarget.attr('data-type') === 'dir') {
+ if(dropTarget && dropTarget.attr('data-type') === 'dir') { // drag&drop upload to folder
var dirName = dropTarget.attr('data-file')
var jqXHR = $('.file_upload_start').fileupload('send', {files: files[i],
formData: function(form) {
@@ -222,7 +230,7 @@ $(document).ready(function() {
$('#notification').fadeIn();
}
var file=response[0];
- delete uploadingFiles[file.name];
+ delete uploadingFiles[dirName][file.name];
var currentUploads = parseInt(uploadtext.attr('currentUploads'));
currentUploads -= 1;
uploadtext.attr('currentUploads', currentUploads);
@@ -238,12 +246,28 @@ $(document).ready(function() {
})
.error(function(jqXHR, textStatus, errorThrown) {
if(errorThrown === 'abort') {
+ var currentUploads = parseInt(uploadtext.attr('currentUploads'));
+ currentUploads -= 1;
+ uploadtext.attr('currentUploads', currentUploads);
+ if(currentUploads === 0) {
+ var img = OC.imagePath('core', 'filetypes/folder.png');
+ var tr=$('tr').filterAttr('data-file',dirName);
+ tr.find('td.filename').attr('style','background-image:url('+img+')');
+ uploadtext.text('');
+ uploadtext.hide();
+ } else {
+ uploadtext.text(currentUploads + ' files uploading')
+ }
$('#notification').hide();
$('#notification').text(t('files', 'Upload cancelled.'));
$('#notification').fadeIn();
}
});
- uploadingFiles[dirName+"/"+files[i].name] = jqXHR;
+ //TODO test with filenames containing slashes
+ if(uploadingFiles[dirName] === undefined) {
+ uploadingFiles[dirName] = {};
+ }
+ uploadingFiles[dirName][fileName] = jqXHR;
} else {
var jqXHR = $('.file_upload_start').fileupload('send', {files: files[i]})
.success(function(result, textStatus, jqXHR) {