diff options
Diffstat (limited to 'apps/files/js')
-rw-r--r-- | apps/files/js/filelist.js | 58 | ||||
-rw-r--r-- | apps/files/js/files.js | 19 |
2 files changed, 37 insertions, 40 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 417c4b9fe99..183b5e909a6 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -670,7 +670,7 @@ */ _createRow: function(fileData, options) { var td, simpleSize, basename, extension, sizeColor, - icon = OC.Util.replaceSVGIcon(fileData.icon), + icon = OC.MimeType.getIconUrl(fileData.mimetype), name = fileData.name, type = fileData.type || 'file', mtime = parseInt(fileData.mtime, 10), @@ -685,6 +685,10 @@ if (type === 'dir') { mime = mime || 'httpd/unix-directory'; + + if (fileData.mountType && fileData.mountType.indexOf('external') === 0) { + icon = OC.MimeType.getIconUrl('dir-external'); + } } //containing tr @@ -1213,36 +1217,34 @@ var etag = options.etag; // get mime icon url - OCA.Files.Files.getMimeIcon(mime, function(iconURL) { - var previewURL, - urlSpec = {}; - ready(iconURL); // set mimeicon URL + var iconURL = OC.MimeType.getIconUrl(mime); + var previewURL, + urlSpec = {}; + ready(iconURL); // set mimeicon URL - urlSpec.file = OCA.Files.Files.fixPath(path); + urlSpec.file = OCA.Files.Files.fixPath(path); - if (etag){ - // use etag as cache buster - urlSpec.c = etag; - } - else { - console.warn('OCA.Files.FileList.lazyLoadPreview(): missing etag argument'); - } + if (etag){ + // use etag as cache buster + urlSpec.c = etag; + } else { + console.warn('OCA.Files.FileList.lazyLoadPreview(): missing etag argument'); + } - previewURL = self.generatePreviewUrl(urlSpec); - previewURL = previewURL.replace('(', '%28'); - previewURL = previewURL.replace(')', '%29'); - - // preload image to prevent delay - // this will make the browser cache the image - var img = new Image(); - img.onload = function(){ - // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 - if (img.width > 5) { - ready(previewURL); - } - }; - img.src = previewURL; - }); + previewURL = self.generatePreviewUrl(urlSpec); + previewURL = previewURL.replace('(', '%28'); + previewURL = previewURL.replace(')', '%29'); + + // preload image to prevent delay + // this will make the browser cache the image + var img = new Image(); + img.onload = function(){ + // if loading the preview image failed (no preview for the mimetype) then img.width will < 5 + if (img.width > 5) { + ready(previewURL); + } + }; + img.src = previewURL; }, setDirectoryPermissions: function(permissions) { diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 44868e78bd0..1b498769dd6 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -163,18 +163,14 @@ return OC.filePath('files', 'ajax', action + '.php') + q; }, + /** + * Fetch the icon url for the mimetype + * @param {string} mime The mimetype + * @param {Files~mimeicon} ready Function to call when mimetype is retrieved + * @deprecated use OC.MimeType.getIconUrl(mime) + */ getMimeIcon: function(mime, ready) { - if (Files.getMimeIcon.cache[mime]) { - ready(Files.getMimeIcon.cache[mime]); - } else { - $.get( OC.filePath('files','ajax','mimeicon.php'), {mime: mime}, function(path) { - if(OC.Util.hasSVGSupport()){ - path = path.substr(0, path.length-4) + '.svg'; - } - Files.getMimeIcon.cache[mime]=path; - ready(Files.getMimeIcon.cache[mime]); - }); - } + ready(OC.MimeType.getIconUrl(mime)); }, /** @@ -211,7 +207,6 @@ * Initialize the files view */ initialize: function() { - Files.getMimeIcon.cache = {}; Files.bindKeyboardShortcuts(document, $); // TODO: move file list related code (upload) to OCA.Files.FileList |