Use external and shared icons in OC.Dialogs.filepicker()

This commit is contained in:
kondou 2013-09-14 14:35:23 +02:00
parent 556bd1ef23
commit c117e719da
2 changed files with 10 additions and 16 deletions

View File

@ -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;
}
}

View File

@ -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);
});