diff options
author | Björn Schießle <schiessle@owncloud.com> | 2012-10-08 19:28:56 +0400 |
---|---|---|
committer | Björn Schießle <schiessle@owncloud.com> | 2012-10-08 19:30:35 +0400 |
commit | 2923d24921eb7311715587ecc746bfc63fd0f676 (patch) | |
tree | df5fbe4b1fe8ecbe3c8fb7562682bee9fc0ad1b0 /apps | |
parent | dc116b994d7749a2c0cb2c3c1f0f5ad8f028a3d0 (diff) |
add data-id directly after upload/creation to the file list (bugfix for #1917)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/ajax/newfolder.php | 8 | ||||
-rw-r--r-- | apps/files/ajax/upload.php | 2 | ||||
-rw-r--r-- | apps/files/js/filelist.js | 3 | ||||
-rw-r--r-- | apps/files/js/files.js | 8 |
4 files changed, 16 insertions, 5 deletions
diff --git a/apps/files/ajax/newfolder.php b/apps/files/ajax/newfolder.php index 34c2d0ca145..0f1f2f14eb0 100644 --- a/apps/files/ajax/newfolder.php +++ b/apps/files/ajax/newfolder.php @@ -20,7 +20,13 @@ if(strpos($foldername, '/')!==false) { } if(OC_Files::newFile($dir, stripslashes($foldername), 'dir')) { - OCP\JSON::success(array("data" => array())); + if ( $dir != '/') { + $path = $dir.'/'.$foldername; + } else { + $path = '/'.$foldername; + } + $id = OC_FileCache::getId($path); + OCP\JSON::success(array("data" => array('id'=>$id))); exit(); } diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index a4dcd80a2e2..e9d85ef005a 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -2,7 +2,7 @@ // Init owncloud - +error_log("upload!!!"); // Firefox and Konqueror tries to download application/json for me. --Arthur OCP\JSON::setContentTypeHeader('text/plain'); diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 4bce4a624ef..c68b4a89c40 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -116,11 +116,12 @@ var FileList={ $('#emptyfolder').hide(); $('.file_upload_filename').removeClass('highlight'); }, - loadingDone:function(name){ + loadingDone:function(name, id){ var mime, tr=$('tr').filterAttr('data-file',name); tr.data('loading',false); mime=tr.data('mime'); tr.attr('data-mime',mime); + tr.attr('data-id', id); getMimeIcon(mime,function(path){ tr.find('td.filename').attr('style','background-image:url('+path+')'); }); diff --git a/apps/files/js/files.js b/apps/files/js/files.js index b36e46813dc..64919acb5dd 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -347,7 +347,7 @@ $(document).ready(function() { if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } - FileList.loadingDone(file.name); + FileList.loadingDone(file.name, file.id); } else { $('#notification').text(t('files', response.data.message)); $('#notification').fadeIn(); @@ -377,7 +377,7 @@ $(document).ready(function() { if(size==t('files','Pending')){ $('tr').filterAttr('data-file',file.name).find('td.filesize').text(file.size); } - FileList.loadingDone(file.name); + FileList.loadingDone(file.name, file.id); } else { $('#notification').text(t('files', response.data.message)); $('#notification').fadeIn(); @@ -519,6 +519,7 @@ $(document).ready(function() { FileList.addFile(name,0,date,false,hidden); var tr=$('tr').filterAttr('data-file',name); tr.data('mime','text/plain').data('id',result.data.id); + tr.attr('data-id', result.data.id); getMimeIcon('text/plain',function(path){ tr.find('td.filename').attr('style','background-image:url('+path+')'); }); @@ -536,6 +537,8 @@ $(document).ready(function() { if (result.status == 'success') { var date=new Date(); FileList.addDir(name,0,date,hidden); + var tr=$('tr').filterAttr('data-file',name); + tr.attr('data-id', result.data.id); } else { OC.dialogs.alert(result.data.message, 'Error'); } @@ -572,6 +575,7 @@ $(document).ready(function() { FileList.addFile(localName,size,date,false,hidden); var tr=$('tr').filterAttr('data-file',localName); tr.data('mime',mime).data('id',id); + tr.attr('data-id', id); getMimeIcon(mime,function(path){ tr.find('td.filename').attr('style','background-image:url('+path+')'); }); |