implement use of preview icons in thrashbin app
This commit is contained in:
parent
6e864e6599
commit
04292ff16c
|
@ -850,4 +850,8 @@ class Trashbin {
|
|||
//Listen to delete user signal
|
||||
\OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Trashbin\Hooks", "deleteUser_hook");
|
||||
}
|
||||
|
||||
public static function preview_icon($path) {
|
||||
return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 44, 'y' => 44, 'file' => $path));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<?php if($file['type'] == 'dir'): ?>
|
||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon('dir')); ?>)"
|
||||
<?php else: ?>
|
||||
style="background-image:url(<?php print_unescaped(OCP\mimetype_icon($file['mimetype'])); ?>)"
|
||||
style="background-image:url(<?php print_unescaped(OCA\Files_Trashbin\Trashbin::preview_icon($file['name'].'.d'.$file['timestamp'])); ?>)"
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
|
||||
|
|
|
@ -44,6 +44,8 @@ $this->create('core_ajax_routes', '/core/routes.json')
|
|||
->action('OC_Router', 'JSRoutes');
|
||||
$this->create('core_ajax_preview', '/core/preview.png')
|
||||
->action('OC\Preview', 'previewRouter');
|
||||
$this->create('core_ajax_trashbin_preview', '/core/trashbinpreview.png')
|
||||
->action('OC\Preview', 'trashbinPreviewRouter');
|
||||
$this->create('core_ajax_public_preview', '/core/publicpreview.png')
|
||||
->action('OC\Preview', 'publicPreviewRouter');
|
||||
OC::$CLASSPATH['OC_Core_LostPassword_Controller'] = 'core/lostpassword/controller.php';
|
||||
|
|
|
@ -519,10 +519,6 @@ class Preview {
|
|||
$file = '';
|
||||
$maxX = 0;
|
||||
$maxY = 0;
|
||||
/*
|
||||
* use: ?scalingup=0 / ?scalingup = 1
|
||||
* do not use ?scalingup=false / ?scalingup = true as these will always be true
|
||||
*/
|
||||
$scalingup = true;
|
||||
|
||||
if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']);
|
||||
|
@ -610,6 +606,37 @@ class Preview {
|
|||
}
|
||||
}
|
||||
|
||||
public static function trashbinPreviewRouter() {
|
||||
if(!\OC_App::isEnabled('files_trashbin')){
|
||||
exit;
|
||||
}
|
||||
\OC_Util::checkLoggedIn();
|
||||
|
||||
$file = '';
|
||||
$maxX = 0;
|
||||
$maxY = 0;
|
||||
$scalingup = true;
|
||||
|
||||
if(array_key_exists('file', $_GET)) $file = (string) urldecode($_GET['file']);
|
||||
if(array_key_exists('x', $_GET)) $maxX = (int) $_GET['x'];
|
||||
if(array_key_exists('y', $_GET)) $maxY = (int) $_GET['y'];
|
||||
if(array_key_exists('scalingup', $_GET)) $scalingup = (bool) $_GET['scalingup'];
|
||||
|
||||
if($file !== '' && $maxX !== 0 && $maxY !== 0) {
|
||||
try{
|
||||
$preview = new Preview(\OC_User::getUser(), 'files_trashbin/files', $file, $maxX, $maxY, $scalingup);
|
||||
$preview->showPreview();
|
||||
}catch(\Exception $e) {
|
||||
\OC_Response::setStatus(404);
|
||||
\OC_Log::write('core', $e->getmessage(), \OC_Log::ERROR);
|
||||
exit;
|
||||
}
|
||||
}else{
|
||||
\OC_Response::setStatus(404);
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
public static function post_write($args) {
|
||||
self::post_delete($args);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue