]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6681 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Jan 2024 13:01:06 +0000 (14:01 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Jan 2024 13:01:06 +0000 (14:01 +0100)
app/Http/Controllers/Admin/Operations/FluidbookPublication/CompositionOperation.php
app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php
app/Models/FluidbookPublication.php
resources/views/fields/fluidbook_composition.blade.php

index cd36a77a14bd863985e5f0c653ffc0b658f857a9..6f3de05e29433ce5e1765a810e9455b169d8c9b2 100644 (file)
@@ -25,7 +25,7 @@ trait CompositionOperation
         Route::match(['get'], $segment . '/docInfos/{doc_id}', $controller . '@docInfos');
         Route::match(['get'], $segment . '/{fluidbook_id}/pdfarchive/{time}', $controller . '@pdfArchive');
         Route::match(['get'], $segment . '/{fluidbook_id}/{type}/{page}.{ext}', $controller . '@getPageAsset')
-            ->whereIn('type', ['originalpdf', 'texts', 'index', 'layout']);
+            ->whereIn('type', ['originalpdf', 'texts', 'index', 'layout', 'links']);
     }
 
     protected function setupCompositionDefaults()
@@ -43,6 +43,10 @@ trait CompositionOperation
             $doc = $fb->getDocument($page);
             return XSendFileController::sendfile($fb->protected_path('fluidbookpublication/docs/' . $doc->id . '/original.pdf'), 86400, ['Content-Disposition', 'attachment; filename="' . $doc->id . '.pdf"']);
         }
+        if ($type === 'links') {
+            $file = $fb->getLinksFile($page);
+            return XSendFileController::sendfile($file, headers: ['Content-type', 'text/plain']);
+        }
         $types = ['texts' => FluidbookDocument::TEXT_PLAIN, 'index' => FluidbookDocument::TEXT_INDEX, 'layout' => FluidbookDocument::TEXT_LAYOUT];
         if (!isset($types[$type])) {
             abort(404, 'Text type not found');
index a48dead666474f31812a0a251336dcf94bc84610..11d9813bc8f89146231c65c3d581838eb7ba1b50 100644 (file)
@@ -11,6 +11,7 @@ use App\Models\FluidbookTheme;
 use Cubist\Backpack\Http\Controllers\Base\XSendFileController;
 use Cubist\Util\PHP;
 use Illuminate\Support\Facades\Auth;
+use Illuminate\Support\Facades\Log;
 use Illuminate\Support\Facades\Route;
 
 // __('!!Paramètres des fluidbooks')
@@ -129,6 +130,7 @@ trait PreviewOperation
         $dest = $fluidbook->getFinalPath($theme, $isScorm);
         if ($path === 'index.html') {
             $fluidbook->incrementPreviewVisit();
+            Log::debug('Compile fluidbook ' . $fluidbook->id . '//' . $path);
             $compiler = new Compiler($fluidbook, $isScorm, theme: $theme);
             $compiler->handle();
         }
index 2d82741f73908de37ace1659386558c7e48db5bf..c8f4507ba92946878717aa3693a67d0989faf869 100644 (file)
@@ -409,6 +409,12 @@ class FluidbookPublication extends ToolboxStatusModel
         return self::$_docs[$documentID];
     }
 
+    public function getLinksFile($page){
+        $compo = $this->getComposition()[$page];
+        $document=self::_getDocument($compo[0]);
+        return $document->path('links').'p'.$compo[1].'.csv';
+    }
+
     public function getTextFile($page, $type = FluidbookDocument::TEXT_PLAIN, $mode = null)
     {
         $compo = $this->getComposition()[$page];
index 7f5d037ffb398d8ccc94529272121dc99ce558d1..6ceff6016417303658bb803fe3b19718bb6b99de 100644 (file)
                                     callback: function (key, opt) {
                                         window.open('/fluidbook-publication/' + {{$entry->id}} + '/layout/' + ($(opt.$trigger[0]).index() + 1) + '.txt');
                                     },
-                                }
+                                },
+                                seelinks: {
+                                    name: "{{__('Liens détectés dans le PDF')}}",
+                                    callback: function (key, opt) {
+                                        window.open('/fluidbook-publication/' + {{$entry->id}} + '/links/' + ($(opt.$trigger[0]).index() + 1) + '.csv');
+                                    },
+                                },
                             }
                         }
                     };