]> source.dussan.org Git - nextcloud-server.git/commitdiff
implement previews of single shared files
authorGeorg Ehrke <developer@georgehrke.com>
Wed, 7 Aug 2013 09:48:08 +0000 (11:48 +0200)
committerGeorg Ehrke <developer@georgehrke.com>
Wed, 7 Aug 2013 09:48:08 +0000 (11:48 +0200)
apps/files_sharing/js/public.js
apps/files_sharing/templates/public.php

index 294223aa094844640debf983731e83820dfae26f..fbbe9b7f3cb4ae0da47c0dedc85293244ddd8dcf 100644 (file)
@@ -16,7 +16,7 @@ $(document).ready(function() {
        if (typeof FileActions !== 'undefined') {
                var mimetype = $('#mimetype').val();
                // Show file preview if previewer is available, images are already handled by the template
-               if (mimetype.substr(0, mimetype.indexOf('/')) != 'image') {
+               if (mimetype.substr(0, mimetype.indexOf('/')) != 'image' && $('.publicpreview').length() !== 0) {
                        // Trigger default action if not download TODO
                        var action = FileActions.getDefault(mimetype, 'file', OC.PERMISSION_READ);
                        if (typeof action === 'undefined') {
index 746a715f3cc3d95d6e523c348399e49ae9ab3684..c164b3ea2b791f214ffd4ce5326dcd08b18a54f1 100644 (file)
                                                <source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />
                                        </video>
                                </div>
+                       <?php elseif (\OC\Preview::isMimeSupported($_['mimetype'])): ?>
+                               <div id="imgframe">
+                                       <img src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => 500, 'y' => 500, 'file' => urlencode($_['directory_path']), 't' => $_['dirToken']))); ?>" class="publicpreview"/>
+                               </div>
                        <?php else: ?>
                                <ul id="noPreview">
                                        <li class="error">