]> _ Git - odl.git/commitdiff
wip #5002 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Jan 2022 18:51:34 +0000 (19:51 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 4 Jan 2022 18:51:34 +0000 (19:51 +0100)
app/Http/Controllers/FrontController.php
resources/pdfjs/web/viewer.html
resources/views/front/resources.blade.php

index 7a34456a83937afde079bc49178627e5400b18c4..55e1ca110dbce8b62474eb56219f239c1b12995e 100644 (file)
@@ -23,7 +23,6 @@ class FrontController extends Controller
 
     public function resources()
     {
-
         return view('front.resources', $this->_getDataFromCMS());
     }
 
index 3f642424685a599ed621465a75d83d98b5abfa6a..f422e3a7236c8fa9bf45a0c3d632f28bf361c19d 100644 (file)
@@ -30,10 +30,16 @@ See https://github.com/adobe-type-tools/cmap-resources
     <link rel="resource" type="application/l10n" href="locale/locale.properties">
     <script src="jquery.min.js"></script>
     <script>
+        var inFluidbook = window.parent.fluidbook !== undefined;
         $(function () {
             $(document).on('click', 'a[href^="pdf:"]', function () {
                 var e = $(this).attr('href').split('#');
-                var file = window.parent.fluidbook.settings.mediaIDToFile[e[0]];
+                var file;
+                if (inFluidbook) {
+                    file = window.parent.fluidbook.settings.mediaIDToFile[e[0]]
+                } else {
+                    file = window.parent.mediaIDToFile[e[0]];
+                }
                 var hash = '';
                 if (e.length > 1) {
                     var p = parseInt(e[1]);
@@ -43,7 +49,11 @@ See https://github.com/adobe-type-tools/cmap-resources
                         hash = '#page=' + e[1];
                     }
                 }
-                window.location = 'viewer.html?file=../../data/links/' + file + hash;
+                if(inFluidbook) {
+                    window.location = 'viewer.html?file=../../data/links/' + file + hash;
+                }else{
+                    window.location = 'viewer.html?file=' + file + hash;
+                }
                 return false;
             });
         });
index 809d20689356c07392f906865a25516bfd0f39bf..863a0de1e61147ee11e04ca7e7e3787f7522139c 100644 (file)
@@ -6,7 +6,15 @@
 @endpush
 
 @section('content')
-
+    @php
+        $mediaIDToFile=[];
+        foreach ($resources_pdf as $id=>$item) {
+            $mediaIDToFile[$id]=$resources->getImageURLbyCollection($pdf->get('file_upload'));
+        }
+    @endphp
+    <script>
+        var mediaIDToFile=@json($mediaIDTiFile);
+    </script>
     {{-- RESOURCES --}}
     <div class="resources" x-data="{
         viewerURL: '/front/coeur/pdfjs/web/viewer.html?file=', // Base URL for viewer