diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php index e9ae1f5305..9ccd4cc299 100644 --- a/apps/files/ajax/rawlist.php +++ b/apps/files/ajax/rawlist.php @@ -25,8 +25,10 @@ $files = array(); // If a type other than directory is requested first load them. if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $file ) { + $file['directory'] = $dir; + $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - $file['mimetype_icon'] = \mimetype_icon('dir'); + $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); $files[] = $file; } } @@ -34,23 +36,19 @@ if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) { if (is_array($mimetypes) && count($mimetypes)) { foreach ($mimetypes as $mimetype) { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $file ) { + $file['directory'] = $dir; + $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - if ($file['type'] === "dir") { - $file['mimetype_icon'] = \mimetype_icon('dir'); - } else { - $file['mimetype_icon'] = \mimetype_icon($file['mimetype']); - } + $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); $files[] = $file; } } } else { foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $file ) { + $file['directory'] = $dir; + $file['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($file['mimetype']); $file["date"] = OCP\Util::formatDate($file["mtime"]); - if ($file['type'] === "dir") { - $file['mimetype_icon'] = \mimetype_icon('dir'); - } else { - $file['mimetype_icon'] = \mimetype_icon($file['mimetype']); - } + $file['mimetype_icon'] = \OCA\files\lib\Helper::determineIcon($file); $files[] = $file; } } diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 61b58d00fa..33e3a75fab 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -292,11 +292,7 @@ var OCdialogs = { filename: entry.name, date: OC.mtime2date(entry.mtime) }); - if (entry.mimetype === "httpd/unix-directory") { - $li.find('img').attr('src', OC.imagePath('core', 'filetypes/folder.png')); - } else { - $li.find('img').attr('src', OC.Router.generate('core_ajax_preview', {x:32, y:32, file:escapeHTML(dir+'/'+entry.name)}) ); - } + $li.find('img').attr('src', entry.mimetype_icon); self.$filelist.append($li); });