Skip to content
Snippets Groups Projects
Commit 9d661eab authored by Thomas Müller's avatar Thomas Müller
Browse files

adding calls to \OCA\files\lib\Helper::determineIcon($i) in files, trashbin and sharing

parent 5af111b0
No related branches found
No related tags found
No related merge requests found
......@@ -34,6 +34,7 @@ if($doBreadcrumb) {
$files = array();
foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $i ) {
$i["date"] = OCP\Util::formatDate($i["mtime"] );
$i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
$files[] = $i;
}
......
......@@ -75,6 +75,7 @@ foreach ($content as $i) {
}
$i['directory'] = $dir;
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
$i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
$files[] = $i;
}
......
......@@ -19,6 +19,20 @@ function fileCmp($a, $b) {
}
}
function determineIcon($file, $sharingRoot, $sharingToken) {
// for folders we simply reuse the files logic
if($file['type'] == 'dir') {
return \OCA\files\lib\Helper::determineIcon($file);
}
$relativePath = substr($file['path'], 6);
$relativePath = substr($relativePath, strlen($sharingRoot));
if($file['isPreviewAvailable']) {
return OCP\publicPreview_icon($relativePath, $sharingToken);
}
return OCP\mimetype_icon($file['mimetype']);
}
if (isset($_GET['t'])) {
$token = $_GET['t'];
$linkItem = OCP\Share::getShareByToken($token);
......@@ -176,6 +190,7 @@ if (isset($path)) {
}
$i['directory'] = $getPath;
$i['permissions'] = OCP\PERMISSION_READ;
$i['icon'] = determineIcon($i, $basePath, $token);
$files[] = $i;
}
usort($files, "fileCmp");
......
......@@ -65,6 +65,7 @@ foreach ($result as $r) {
}
$i['permissions'] = OCP\PERMISSION_READ;
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($r['mime']);
$i['icon'] = \OCA\files\lib\Helper::determineIcon($i);
$files[] = $i;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment