[Pkg-owncloud-commits] [owncloud] 110/394: backport of PR #471
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:39 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 6188f07c951dc1ed30252cb2f0e0dc7265a5fed7
Author: Thomas Mueller <thomas.mueller at tmit.eu>
Date: Fri Nov 16 10:23:40 2012 +0100
backport of PR #471
---
apps/files/ajax/upload.php | 4 +++-
apps/files/js/filelist.js | 2 +-
apps/files/js/files.js | 20 +++++++++++++++++---
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index a4dcd80..1eb0842 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -48,10 +48,12 @@ if(strpos($dir, '..') === false) {
$fileCount=count($files['name']);
for($i=0;$i<$fileCount;$i++) {
$target = OCP\Files::buildNotExistingFileName(stripslashes($dir), $files['name'][$i]);
+ // $path needs to be normalized - this failed within drag'n'drop upload to a sub-folder
+ $target = OC_Filesystem::normalizePath($target);
if(is_uploaded_file($files['tmp_name'][$i]) and OC_Filesystem::fromTmpFile($files['tmp_name'][$i], $target)) {
$meta = OC_FileCache::get($target);
$id = OC_FileCache::getId($target);
- $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'],'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target));
+ $result[]=array( "status" => "success", 'mime'=>$meta['mimetype'], 'size'=>$meta['size'], 'id'=>$id, 'name'=>basename($target));
}
}
OCP\JSON::encodedPrint($result);
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index ed2db12..fb17825 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -137,7 +137,7 @@ var FileList={
tr=$('tr').filterAttr('data-file',name);
tr.data('renaming',true);
td=tr.children('td.filename');
- input=$('<input class="filename"></input>').val(name);
+ input=$('<input class="filename"/>').val(name);
form=$('<form></form>');
form.append(input);
td.children('a.name').text('');
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 64919ac..d454a74 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -233,7 +233,12 @@ $(document).ready(function() {
}
});
}else{
- var date=new Date();
+ var dropTarget = $(e.originalEvent.target).closest('tr');
+ if(dropTarget && dropTarget.attr('data-type') === 'dir') { // drag&drop upload to folder
+ var dirName = dropTarget.attr('data-file')
+ }
+
+ var date=new Date();
if(files){
for(var i=0;i<files.length;i++){
if(files[i].size>0){
@@ -286,7 +291,10 @@ $(document).ready(function() {
var jqXHR = $('.file_upload_start').fileupload('send', {files: files[i],
formData: function(form) {
var formArray = form.serializeArray();
- formArray[1]['value'] = dirName;
+ // array index 0 contains the max files size
+ // array index 1 contains the request token
+ // array index 2 contains the directory
+ formArray[2]['value'] = dirName;
return formArray;
}}).success(function(result, textStatus, jqXHR) {
var response;
@@ -296,7 +304,13 @@ $(document).ready(function() {
$('#notification').fadeIn();
}
var file=response[0];
+ // 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];
+ }
+
+ 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);
@@ -826,7 +840,7 @@ function getSelectedFiles(property){
name:$(element).attr('data-file'),
mime:$(element).data('mime'),
type:$(element).data('type'),
- size:$(element).data('size'),
+ size:$(element).data('size')
};
if(property){
files.push(file[property]);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list