From 0be9de5df558232e12e2f582af5d08e1f488ba90 Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Mon, 28 Oct 2013 20:22:06 +0100 Subject: Files, trashbin, public apps use ajax/JSON for the file list Files app: - removed file list template, now rendering list from JSON response - FileList.addFile/addDir is now FileList.add() and takes a JS map with all required arguments instead of having a long number of function arguments - added unit tests for many FileList operations - fixed newfile.php, newfolder.php and rename.php to return the file's full JSON on success - removed obsolete/unused undo code - removed download_url / loading options, now using Files.getDownloadUrl() for that - server side now uses Helper::getFileInfo() to prepare file JSON response - previews are now client-side only Breadcrumbs are now JS only: - Added BreadCrumb class to handle breadcrumb rendering and events - Added unit test for BreadCrumb class - Moved all relevant JS functions to the BreadCrumb class Public page now uses ajax to load the file list: - Added Helper class in sharing app to make it easier to authenticate and retrieve the file's real path - Added ajax/list.php to retrieve the file list - Fixed FileActions and FileList to work with the ajax list Core: - Fixed file picker dialog to use the same list format as files app --- core/js/oc-dialogs.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'core/js/oc-dialogs.js') diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index d1bcb4659b8..73ed20b7553 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -514,7 +514,7 @@ var OCdialogs = { } return $.getJSON( - OC.filePath('files', 'ajax', 'rawlist.php'), + OC.filePath('files', 'ajax', 'list.php'), { dir: dir, mimetypes: JSON.stringify(mimeType) @@ -539,7 +539,7 @@ var OCdialogs = { this.$filelist.empty().addClass('loading'); this.$filePicker.data('path', dir); $.when(this._getFileList(dir, this.$filePicker.data('mimetype'))).then(function(response) { - $.each(response.data, function(index, file) { + $.each(response.data.files, function(index, file) { if (file.type === 'dir') { dirs.push(file); } else { @@ -555,9 +555,16 @@ var OCdialogs = { type: entry.type, dir: dir, filename: entry.name, - date: OC.mtime2date(entry.mtime) + date: OC.mtime2date(Math.floor(entry.mtime / 1000)) }); - $li.find('img').attr('src', entry.mimetype_icon); + $li.find('img').attr('src', entry.icon); + if (entry.isPreviewAvailable) { + var urlSpec = { + file: dir + '/' + entry.name + }; + var previewUrl = OC.generateUrl('/core/preview.png?') + $.param(urlSpec); + $li.find('img').attr('src', previewUrl); + } self.$filelist.append($li); }); -- cgit v1.2.3 From 2b8bb0121133d460755202bfbb0e62433c12938c Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 3 Apr 2014 16:55:01 +0200 Subject: Fixed mime type attribute access in file overwrite dialog --- core/js/oc-dialogs.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/js/oc-dialogs.js') diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 73ed20b7553..6fc8d4d3523 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -294,7 +294,7 @@ var OCdialogs = { conflict.find('.replacement .mtime').text(formatDate(replacement.lastModifiedDate)); } var path = original.directory + '/' +original.name; - Files.lazyLoadPreview(path, original.mime, function(previewpath){ + Files.lazyLoadPreview(path, original.mimetype, function(previewpath){ conflict.find('.original .icon').css('background-image','url('+previewpath+')'); }, 96, 96, original.etag); getCroppedPreview(replacement).then( -- cgit v1.2.3