From: Vincent Vanwaelscappel Date: Wed, 21 Jun 2023 14:09:17 +0000 (+0200) Subject: wait #6064 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7f7d5e3ade1f5f4c0bf7da40e422900078e952cd;p=fluidbook-toolbox.git wait #6064 @0.5 --- diff --git a/app/Fields/FluidbookLinkEditor/Depth.php b/app/Fields/FluidbookLinkEditor/Depth.php index 9f25c42bb..724ed22ef 100644 --- a/app/Fields/FluidbookLinkEditor/Depth.php +++ b/app/Fields/FluidbookLinkEditor/Depth.php @@ -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'), ]; } diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index 5be4047ec..c16afbcd9 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -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) { diff --git a/app/Fluidbook/Compiler/Links.php b/app/Fluidbook/Compiler/Links.php index a55b64e3d..b4600d78c 100644 --- a/app/Fluidbook/Compiler/Links.php +++ b/app/Fluidbook/Compiler/Links.php @@ -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; + } } diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index fb10edc20..b0342339b 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -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']++; }