]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6064 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Jun 2023 14:09:17 +0000 (16:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 21 Jun 2023 14:09:17 +0000 (16:09 +0200)
app/Fields/FluidbookLinkEditor/Depth.php
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Compiler/Links.php
app/Models/FluidbookPublication.php

index 9f25c42bb7a6be8bc3db077a08a5e874f73002ce..724ed22efa628c2ec17bada9fab2f69c4cd4bd80 100644 (file)
@@ -7,24 +7,32 @@ use Cubist\Backpack\Magic\Fields\SelectFromArray;
 class Depth extends SelectFromArray
 {
     protected $_ajax = false;
-    protected $_allowNull=false;
+    protected $_allowNull = false;
 
-    protected $_default=-1;
+    protected $_default = -1;
 
 
     public function getOptions()
     {
         return [
             -1 => __('Par défaut'),
-            0 => '0 - ' . __('Sous le fond des pages (invisible)'),
-            10 => '1 - ' . __('Sous le texte'),
-            20 => '2 - ' . __('Sous le texte'),
-            30 => '3 - ' . __('Sur la couche de texte'),
-            40 => '4 - ' . __('Sur la couche de texte'),
-            50 => '5 - ' . __('Couche multimedia interactive'),
-            60 => '6 - ' . __('Couche interactive'),
-            70 => '7 - ' . __('Couche interactive'),
-            80 => '8 - ' . __('Couche interactive'),
+            0 => '0.0 - ' . __('Sous le fond des pages (invisible)'),
+            10 => '1.0 - ' . __('Sous le texte'),
+            20 => '2.0 - ' . __('Sous le texte'),
+            30 => '3.0 - ' . __('Sur le texte'),
+            32 => '3.2 - ' . __('Sur le texte'),
+            34 => '3.4 - ' . __('Sur le texte'),
+            36 => '3.6 - ' . __('Sur le texte'),
+            38 => '3.8 - ' . __('Sur le texte'),
+            40 => '4.0 - ' . __('Sur le texte'),
+            42 => '4.2 - ' . __('Sur le texte'),
+            44 => '4.4 - ' . __('Sur le texte'),
+            46 => '4.6 - ' . __('Sur le texte'),
+            48 => '4.8 - ' . __('Sur le texte'),
+            50 => '5.0 - ' . __('Couche multimedia interactive'),
+            60 => '6.0 - ' . __('Couche interactive'),
+            70 => '7.0 - ' . __('Couche interactive'),
+            80 => '8.0 - ' . __('Couche interactive'),
             //90=>'9 - '.__('Au dessus de l\'ombre de la page'),
         ];
     }
index 5be4047ec2c74813bdbb8322e68c59af4319be3f..c16afbcd90251d91effcba1b21a7ab364507d41a 100644 (file)
@@ -1476,58 +1476,14 @@ class Compiler extends Base implements CompilerInterface
         return !$this->isSinglePage();
     }
 
-    /**
-     * @param $e \Exception
-     * @param $link Link
-     * @return void
-     * @throws \Exception
-     */
-    protected function triggerLinkError($e, $link)
-    {
-        Log::error($e);
 
-        /*$c = explode('\\', get_class($link));
-        $type = array_pop($c);
-        $type = str_replace('Link', '', $type);
-
-        throw new \Exception('Error on the ' . $type . ' link to ' . $link->to . ' on page ' . $link->page . '  with message : ' . $e->getMessage());*/
-    }
-
-    protected function _htmlLinkList($list)
-    {
-        if (!count($list)) {
-            return [];
-        }
-        $res = [];
-        foreach ($list as $blendmode => $l) {
-            usort($l, [$this, '_sortLinksByDepth']);
-            $res[$blendmode] = [];
-            foreach ($l as $item) {
-                $res[$blendmode][] = $item->getHTMLContainer();
-            }
-
-        }
-        return $res;
-
-    }
 
     public function getBookSurface()
     {
         return $this->width * $this->height;
     }
 
-    protected function _sortLinksByDepth($a, $b)
-    {
-        $c = $a->getDepth() - $b->getDepth();
-        if ($c === 0) {
-            $c = $b->getSurface() - $a->getSurface();
-        }
-        if ($c === 0) {
-            $c = $b->getInitialOrder() - $a->getInitialOrder();
-        }
 
-        return $c;
-    }
 
     public function addSlideshowLibrary($inline = true)
     {
index a55b64e3d7bf1ef047fad18104427c1ec290c1c4..b4600d78c32bc803284b159e6c9a4ece1f85cc73 100644 (file)
@@ -9,6 +9,7 @@ use Cubist\Util\Files\Files;
 use Cubist\Util\Text;
 use Fluidbook\Tools\Links\AnchorLink;
 use Fluidbook\Tools\Links\ContentLink;
+use Illuminate\Support\Facades\Log;
 
 trait Links
 {
@@ -356,11 +357,12 @@ trait Links
                     }
 
                     $lta->setInitialOrder($i);
-                    if (!isset($$v[$lta->page][$lta->blendmode])) {
-                        $$v[$lta->page][$lta->blendmode] = [];
-                    }
+//                    if (!isset($$v[$lta->page][$lta->blendmode])) {
+//                        $$v[$lta->page][$lta->blendmode] = [];
+//                    }
 
-                    array_push($$v[$lta->page][$lta->blendmode], $lta);
+                    // array_push($$v[$lta->page][$lta->blendmode], $lta);
+                    array_push($$v[$lta->page]['normal'], $lta);
                     $i++;
                 } catch (\Exception $e) {
                     $this->triggerLinkError($e, $lta);
@@ -453,4 +455,52 @@ trait Links
         }
 
     }
+
+    /**
+     * @param $e \Exception
+     * @param $link Link
+     * @return void
+     * @throws \Exception
+     */
+    protected function triggerLinkError($e, $link)
+    {
+        Log::error($e);
+
+        /*$c = explode('\\', get_class($link));
+        $type = array_pop($c);
+        $type = str_replace('Link', '', $type);
+
+        throw new \Exception('Error on the ' . $type . ' link to ' . $link->to . ' on page ' . $link->page . '  with message : ' . $e->getMessage());*/
+    }
+
+    protected function _htmlLinkList($list)
+    {
+        if (!count($list)) {
+            return [];
+        }
+        $res = [];
+        foreach ($list as $blendmode => $l) {
+            usort($l, [$this, '_sortLinksByDepth']);
+            $res[$blendmode] = [];
+            foreach ($l as $item) {
+                $res[$blendmode][] = $item->getHTMLContainer();
+            }
+
+        }
+        return $res;
+
+    }
+
+    protected function _sortLinksByDepth($a, $b)
+    {
+        $c = $a->getDepth() - $b->getDepth();
+        if ($c === 0) {
+            $c = $b->getSurface() - $a->getSurface();
+        }
+        if ($c === 0) {
+            $c = $b->getInitialOrder() - $a->getInitialOrder();
+        }
+
+        return $c;
+    }
 }
index fb10edc20dd02d823422959b110c97ab2bb1e7b8..b0342339b218ca65a583e750451ad4ff23e21742 100644 (file)
@@ -769,7 +769,7 @@ class FluidbookPublication extends ToolboxSettingsModel
         if (!$this->isOnePage()) {
             $w = $this->getPageWidth();
             foreach ($links as $k => $link) {
-                if ($link['left'] > $w && $link['page'] % 2 == 0) {
+                if ($link['left'] > $w && is_numeric($link['page']) && $link['page'] % 2 == 0) {
                     $links[$k]['left'] -= $w;
                     $links[$k]['page']++;
                 }