]> source.dussan.org Git - nextcloud-server.git/commitdiff
implement use of previews in sharing app
authorGeorg Ehrke <developer@georgehrke.com>
Thu, 11 Jul 2013 09:58:52 +0000 (11:58 +0200)
committerGeorg Ehrke <developer@georgehrke.com>
Thu, 11 Jul 2013 09:58:52 +0000 (11:58 +0200)
apps/files/index.php
apps/files/templates/part.list.php
apps/files_sharing/public.php
lib/helper.php
lib/public/template.php
lib/template.php

index 2338cf439e4c625ce2f4d655b832bf0a6fef4827..156febd87f4b860714f8881a694b3db30f7268f4 100644 (file)
@@ -95,6 +95,7 @@ $list->assign('files', $files);
 $list->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
 $list->assign('downloadURL', OCP\Util::linkToRoute('download', array('file' => '/')));
 $list->assign('disableSharing', false);
+$list->assign('isPublic', false);
 $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
 $breadcrumbNav->assign('breadcrumb', $breadcrumb);
 $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir=');
index 38d1314392b5ecab84a26bb1ee77675f874cb798..9e62c99197572bec018981282dd1c5857261f91f 100644 (file)
@@ -30,7 +30,14 @@ $totalsize = 0; ?>
                <?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\preview_icon($relativePath)); ?>)"
+                       <?php if($_['isPublic']): ?>
+                               <?php
+                               $relativePath = substr($relativePath, strlen($_['sharingroot']));
+                               ?>
+                               style="background-image:url(<?php print_unescaped(OCP\publicPreview_icon($relativePath, $_['sharingtoken'])); ?>)"
+                       <?php else: ?>
+                               style="background-image:url(<?php print_unescaped(OCP\preview_icon($relativePath)); ?>)"
+                       <?php endif; ?>
                <?php endif; ?>
                        >
                <?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
index 9462844a82b7be7db8a54876744fc6fd57059f2c..0c4150f74d2ddf32df84bb63ea5e97da81c93cc4 100644 (file)
@@ -191,6 +191,9 @@ if (isset($path)) {
                        $list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
                        $list->assign('downloadURL',
                                OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=');
+                       $list->assign('isPublic', true);
+                       $list->assign('sharingtoken', $token);
+                       $list->assign('sharingroot', ($path));
                        $breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
                        $breadcrumbNav->assign('breadcrumb', $breadcrumb);
                        $breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
index 856dba625b38941f812b27b944ebb049d94f234d..6153f31872341c85683262c1fd2e7626698fc00c 100644 (file)
@@ -234,6 +234,10 @@ class OC_Helper {
                return self::linkToRoute( 'core_ajax_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path) ));
        }
 
+       public static function publicPreview_icon( $path, $token ) {
+               return self::linkToRoute( 'core_ajax_public_preview', array('x' => 44, 'y' => 44, 'file' => urlencode($path), 't' => $token));
+       }
+
        /**
         * @brief Make a human file size
         * @param int $bytes file size in bytes
index 5f9888f9f28d121ff8319f64a7574e9c38fddbaf..69997ad42b655505779e313e4e8ba79e582d5056 100644 (file)
@@ -64,6 +64,16 @@ function preview_icon( $path ) {
        return(\preview_icon( $path ));
 }
 
+/**
+ * @brief make publicpreview_icon available as a simple function
+ * Returns the path to the preview of the image.
+ * @param $path path of file
+ * @returns link to the preview
+ */
+function publicPreview_icon ( $path, $token ) {
+       return(\publicPreview_icon( $path, $token ));
+}
+
 /**
  * @brief make OC_Helper::humanFileSize available as a simple function
  * Makes 2048 to 2 kB.
index 048d172f1c9c1853effc432648a76cfd1e8fedb3..842c33253576bf69e5892ff3a431d0ff9ebb011b 100644 (file)
@@ -74,6 +74,10 @@ function preview_icon( $path ) {
        return OC_Helper::previewIcon( $path );
 }
 
+function publicPreview_icon ( $path, $token ) {
+       return OC_Helper::publicPreview_icon( $path, $token );
+}
+
 /**
  * @brief make OC_Helper::mimetypeIcon available as a simple function
  * @param string $mimetype mimetype