From: Björn Schießle Date: Mon, 8 Oct 2012 15:28:56 +0000 (+0200) Subject: add data-id directly after upload/creation to the file list (bugfix for #1917) X-Git-Tag: v4.5.0RC3~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2923d24921eb7311715587ecc746bfc63fd0f676;p=nextcloud-server.git add data-id directly after upload/creation to the file list (bugfix for #1917) --- 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+')'); });