diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php index 7b8d3cb425..e82a597c61 100644 --- a/apps/files_trashbin/lib/trash.php +++ b/apps/files_trashbin/lib/trash.php @@ -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)); + } } diff --git a/apps/files_trashbin/templates/part.list.php b/apps/files_trashbin/templates/part.list.php index 92a38bd263..d53e38549d 100644 --- a/apps/files_trashbin/templates/part.list.php +++ b/apps/files_trashbin/templates/part.list.php @@ -27,7 +27,7 @@ style="background-image:url()" - style="background-image:url()" + style="background-image:url()" > diff --git a/core/routes.php b/core/routes.php index 4b3ad53da0..41e82f8a73 100644 --- a/core/routes.php +++ b/core/routes.php @@ -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'; diff --git a/lib/preview.php b/lib/preview.php index 87e2e78d1d..f12107c9f5 100755 --- a/lib/preview.php +++ b/lib/preview.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); }