move isMimeSupported out of template files
This commit is contained in:
parent
d9e8ebabdc
commit
224b80f906
|
@ -74,6 +74,7 @@ foreach ($content as $i) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$i['directory'] = $dir;
|
$i['directory'] = $dir;
|
||||||
|
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
|
||||||
$files[] = $i;
|
$files[] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ $totalsize = 0; ?>
|
||||||
data-mime="<?php p($file['mimetype'])?>"
|
data-mime="<?php p($file['mimetype'])?>"
|
||||||
data-size="<?php p($file['size']);?>"
|
data-size="<?php p($file['size']);?>"
|
||||||
data-permissions="<?php p($file['permissions']); ?>">
|
data-permissions="<?php p($file['permissions']); ?>">
|
||||||
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
<?php if($file['isPreviewAvailable']): ?>
|
||||||
<td class="filename svg preview-icon"
|
<td class="filename svg preview-icon"
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<td class="filename svg"
|
<td class="filename svg"
|
||||||
|
@ -38,13 +38,13 @@ $totalsize = 0; ?>
|
||||||
<?php
|
<?php
|
||||||
$relativePath = substr($relativePath, strlen($_['sharingroot']));
|
$relativePath = substr($relativePath, strlen($_['sharingroot']));
|
||||||
?>
|
?>
|
||||||
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
<?php if($file['isPreviewAvailable']): ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)"
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
<?php if($file['isPreviewAvailable']): ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)"
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||||
|
|
|
@ -172,6 +172,7 @@ if (isset($path)) {
|
||||||
} else {
|
} else {
|
||||||
$i['extension'] = '';
|
$i['extension'] = '';
|
||||||
}
|
}
|
||||||
|
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($i['mimetype']);
|
||||||
}
|
}
|
||||||
$i['directory'] = $getPath;
|
$i['directory'] = $getPath;
|
||||||
$i['permissions'] = OCP\PERMISSION_READ;
|
$i['permissions'] = OCP\PERMISSION_READ;
|
||||||
|
|
|
@ -64,6 +64,7 @@ foreach ($result as $r) {
|
||||||
$i['directory'] = '';
|
$i['directory'] = '';
|
||||||
}
|
}
|
||||||
$i['permissions'] = OCP\PERMISSION_READ;
|
$i['permissions'] = OCP\PERMISSION_READ;
|
||||||
|
$i['isPreviewAvailable'] = \OCP\Preview::isMimeSupported($r['mime']);
|
||||||
$files[] = $i;
|
$files[] = $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,12 +21,16 @@
|
||||||
data-timestamp='<?php p($file['timestamp']);?>'
|
data-timestamp='<?php p($file['timestamp']);?>'
|
||||||
data-dirlisting=0
|
data-dirlisting=0
|
||||||
<?php endif; ?>>
|
<?php endif; ?>>
|
||||||
|
<?php if($file['isPreviewAvailable']): ?>
|
||||||
|
<td class="filename svg preview-icon"
|
||||||
|
<?php else: ?>
|
||||||
<td class="filename svg"
|
<td class="filename svg"
|
||||||
|
<?php endif; ?>
|
||||||
<?php if($file['type'] === 'dir'): ?>
|
<?php if($file['type'] === 'dir'): ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
<?php if(\OCP\Preview::isMimeSupported($file['mimetype'])): ?>
|
<?php if($file['isPreviewAvailable']): ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCA\Files_Trashbin\Trashbin::preview_icon(!$_['dirlisting'] ? ($file['name'].'.d'.$file['timestamp']) : ($file['directory'].'/'.$file['name']))); ?>)" class="preview-icon"
|
style="background-image:url(<?php print_unescaped(OCA\Files_Trashbin\Trashbin::preview_icon(!$_['dirlisting'] ? ($file['name'].'.d'.$file['timestamp']) : ($file['directory'].'/'.$file['name']))); ?>)"
|
||||||
<?php else: ?>
|
<?php else: ?>
|
||||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
Loading…
Reference in New Issue