]> source.dussan.org Git - nextcloud-server.git/commitdiff
add data-id directly after upload/creation to the file list (bugfix for #1917)
authorBjörn Schießle <schiessle@owncloud.com>
Mon, 8 Oct 2012 15:28:56 +0000 (17:28 +0200)
committerBjörn Schießle <schiessle@owncloud.com>
Mon, 8 Oct 2012 15:30:35 +0000 (17:30 +0200)
apps/files/ajax/newfolder.php
apps/files/ajax/upload.php
apps/files/js/filelist.js
apps/files/js/files.js

index 34c2d0ca145a9d57cd855fc53087d2ce9bfd6e7b..0f1f2f14eb04b695da9356d8f2e5e73892e43837 100644 (file)
@@ -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();
 }
 
index a4dcd80a2e2209bb5c87a436229e0c4ebc85aa2a..e9d85ef005a319ddc6dd9c12acd039b821c87496 100644 (file)
@@ -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');
 
index 4bce4a624efba891b8b77cfe7dea50f11b60d704..c68b4a89c404954753cd0da4d7f4cc9f976431dc 100644 (file)
@@ -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+')');
                });
index b36e46813dcf7c02364943302fd703194b12b905..64919acb5dd6ca0d63cf5ca1fa98ef95004ddc01 100644 (file)
@@ -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+')');
                                                });