From 1b118877b2f26d2a0838cdc9671d9655382a24a7 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 22 Aug 2022 14:27:35 +0200 Subject: [PATCH] wip #5408 @1 --- app/Fluidbook/Link/Cart/PumaCartLink.php | 39 +++++++++++ app/Fluidbook/Link/Custom/IntexLink.php | 16 +++++ app/Fluidbook/Link/Link.php | 82 ++++++++++++++++++++++++ app/Jobs/FluidbookCompiler.php | 25 ++++---- composer.json | 4 +- composer.lock | 6 +- 6 files changed, 157 insertions(+), 15 deletions(-) create mode 100644 app/Fluidbook/Link/Cart/PumaCartLink.php create mode 100644 app/Fluidbook/Link/Custom/IntexLink.php create mode 100644 app/Fluidbook/Link/Link.php diff --git a/app/Fluidbook/Link/Cart/PumaCartLink.php b/app/Fluidbook/Link/Cart/PumaCartLink.php new file mode 100644 index 000000000..f5277c3a3 --- /dev/null +++ b/app/Fluidbook/Link/Cart/PumaCartLink.php @@ -0,0 +1,39 @@ + + + + + + + + + + +'; + } + + public function getAdditionnalContent() + { + $res = parent::getAdditionnalContent(); + $res .= ' data-tooltip-conditional="' . htmlspecialchars(json_encode(['.active' => 'remove from cart'])) . '" '; + return $res; + } +} diff --git a/app/Fluidbook/Link/Custom/IntexLink.php b/app/Fluidbook/Link/Custom/IntexLink.php new file mode 100644 index 000000000..eec4a6adb --- /dev/null +++ b/app/Fluidbook/Link/Custom/IntexLink.php @@ -0,0 +1,16 @@ +book->parametres->basketManager === 'Puma') { + return new PumaCartLink($id, $init, $compiler); + } + if ($compiler->book->parametres->basketManager === 'MIF') { + return new CartLink($id, $init, $compiler); + } + switch ($compiler->book->parametres->customLinkClass) { + case 'IntexLink': + return new intexLink($id, $init, $compiler); + case 'WescoLink': + return new wescoLink($id, $init, $compiler); + case 'HaguenauManifLink': + return new haguenauManifLink($id, $init, $compiler); + case 'FLFLink': + return new flfLink($id, $init, $compiler); + case 'InpesPopinLink': + return new inpesPopinLink($id, $init, $compiler); + case 'PierronLink': + return new pierronLink($id, $init, $compiler); + case 'WescoSalesLink': + return new wescoSalesLink($id, $init, $compiler); + case 'AtlanticDownloadLink': + return new atlanticDownloadLink($id, $init, $compiler); + case 'MiraklEaster2021': + return new miraklEaster2021Link($id, $init, $compiler); + default : + break; + } + case 12: // Basket / Cart links + if ($compiler->book->parametres->product_zoom_references !== '') { + return new zoomProductLink($id, $init, $compiler); + } + switch ($compiler->book->parametres->basketManager) { + case 'Bastide': + return new BastideCartLink($id, $init, $compiler); + case 'CFOC': + return new CFOCCartLink($id, $init, $compiler); + case 'GrandVision': + return new grandVisionCartLink($id, $init, $compiler); + case 'GrandPavois': + return new grandPavoisCartLink($id, $init, $compiler); + case 'JoueclubWishlist2021': + return new joueclub2021CartLink($id, $init, $compiler); + case 'JoueclubWishlist': + return new JoueclubWishlistLink($id, $init, $compiler); + case 'Remarkable': + return new remarkableCartLink($id, $init, $compiler); + case 'ZoomProductLink': + case 'Flexipan': + case 'Puma': + case 'MIF': + return new ZoomProductLink($id, $init, $compiler); + default : + break; + } + default: + break; + } + return parent::getInstance($id, $init, $compiler); + } +} diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index 9be23c04f..574ad2209 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -19,6 +19,9 @@ use Cubist\Util\Url; use DOMDocument; use DOMElement; use DOMXPath; +use Fluidbook\Tools\Links\AnchorLink; +use Fluidbook\Tools\Links\ContentLink; +use App\Fluidbook\Link\Link; use Illuminate\Console\Command; use SimpleXMLElement; @@ -673,7 +676,7 @@ class FluidbookCompiler extends Base public function writeJoueClub2021Cart() { $this->lessVariables['import-cart-styles'] = 'joueclub2021'; - $extra = wsHTML5Link::parseExtras($this->fluidbookSettings->cartExtraSettings, true); + $extra = Link::parseExtras($this->fluidbookSettings->cartExtraSettings, true); /** * buttonColor=#d7b646 @@ -863,7 +866,7 @@ class FluidbookCompiler extends Base // It's possible to use the cartExtraSettings field in the parameters to define publication specific settings, // such as the subject line used in the e-mail that is sent from the cart validation - $extra = wsHTML5Link::parseExtras($this->fluidbookSettings->cartExtraSettings, true); + $extra = Link::parseExtras($this->fluidbookSettings->cartExtraSettings, true); $this->config->cartEmailSubject = $extra['email_subject'] ?? 'Récapitulatif de votre commande CFOC'; } @@ -2252,12 +2255,12 @@ height="0" width="0" style="display:none;visibility:hidden"> $links[$k] = $linkData; } if ($linkData['type'] == 26 || $linkData == 40) { - $linkData['to'] = anchorLink::normalizeAnchor($linkData['to']); + $linkData['to'] = AnchorLink::normalizeAnchor($linkData['to']); $anchorExists[$linkData['to']] = $linkData; } if ($linkData['type'] == 35 || $linkData['type'] == 15 || $linkData['type'] == 39) { $linkData = FluidbookLinks::decryptLink($linkData); - $animations = contentLink::parseAnimations($linkData['image_rollover']); + $animations = ContentLink::parseAnimations($linkData['image_rollover']); foreach ($animations as $animation) { if (isset($animation['backgroundcolor']) && $animation['backgroundcolor'] !== 'transparent') { $dupData = $linkData; @@ -2284,7 +2287,7 @@ height="0" width="0" style="display:none;visibility:hidden"> $dupData['image_rollover'] = ''; $dupData['type'] = 15; $dupData['uid'] = 'i_' . $linkData['uid']; - if (wsHTML5Link::isScorm($linkData)) { + if (Link::isScorm($linkData)) { $dupData['scorm'] = true; } array_push($links, $dupData); @@ -2299,7 +2302,7 @@ height="0" width="0" style="display:none;visibility:hidden"> $dupData['type'] = 6; $linkData['relatedAnimation'] = $dupData['uid'] = 'a_' . $linkData['uid']; $dupData['video_width'] = $dupData['video_height'] = 0; - if (wsHTML5Link::isScorm($linkData)) { + if (Link::isScorm($linkData)) { $dupData['scorm'] = true; } $links[$k] = $linkData; @@ -2345,8 +2348,8 @@ height="0" width="0" style="display:none;visibility:hidden"> $lines = Text::explodeNewLines(file_get_contents($this->fluidbookSettings->anchorsAliases)); foreach ($lines as $line) { $e = explode("\t", $line); - $from = anchorLink::normalizeAnchor($e[0]); - $to = anchorLink::normalizeAnchor($e[1]); + $from = AnchorLink::normalizeAnchor($e[0]); + $to = AnchorLink::normalizeAnchor($e[1]); $aliases[$from] = $to; if (is_numeric($to) && !isset($anchorExists[$from])) { $anchor = [ @@ -2357,7 +2360,7 @@ height="0" width="0" style="display:none;visibility:hidden"> 'height' => 100, 'type' => 26, 'to' => $from, - 'uid' => wsHTML5Link::generateUID() + 'uid' => Link::generateUID() ]; $anchorExists[$from] = $anchor; $links[] = $anchor; @@ -2365,7 +2368,7 @@ height="0" width="0" style="display:none;visibility:hidden"> if (!isset($anchorExists[$from]) && isset($anchorExists[$to])) { $anchor = $anchorExists[$to]; $anchor['to'] = $from; - $anchor['uid'] = wsHTML5Link::generateUID(); + $anchor['uid'] = Link::generateUID(); $anchorExists[$from] = $anchor; $links[] = $anchor; } @@ -2405,7 +2408,7 @@ height="0" width="0" style="display:none;visibility:hidden"> continue; } - $link = wsHTML5Link::getInstance($this->base62($i), $linkData, $this); + $link = Link::getInstance($this->base62($i), $linkData, $this); if (is_null($link) || $link->ignore()) { continue; } diff --git a/composer.json b/composer.json index 02e8da463..7a5ce98d6 100644 --- a/composer.json +++ b/composer.json @@ -24,10 +24,10 @@ "ext-json": "*", "ext-libxml": "*", "ext-simplexml": "*", + "ext-sodium": "*", "ext-tidy": "*", "ext-zip": "*", "ext-zlib": "*", - "ext-sodium": "*", "ahmadshah/lucy": "dev-master", "cubedesigners/userdatabase": "dev-master", "cubist/azuretts": "dev-master", @@ -36,12 +36,12 @@ "cubist/pdf": "dev-master", "cubist/scorm": "dev-master", "fluidbook/tools": "dev-master", + "jolicode/slack-php-api": "^v4.5", "league/csv": "^9.8", "mxl/laravel-job": "^1.3", "nyholm/psr7": "^1.5", "php-ffmpeg/php-ffmpeg": "^0.18.0", "phpoffice/phpspreadsheet": "^1.22", - "jolicode/slack-php-api": "^v4.5", "rustici-software/scormcloud-api-v2-client-php": "^2.0", "symfony/http-client": "^v6.0" }, diff --git a/composer.lock b/composer.lock index 74dc46c02..e5adcd34d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "fff097437e6034c90b33c9861db5b39a", + "content-hash": "6bf7dc70ab8577e11a99bba012989f5e", "packages": [ { "name": "ahmadshah/lucy", @@ -14932,8 +14932,10 @@ "ext-json": "*", "ext-libxml": "*", "ext-simplexml": "*", + "ext-sodium": "*", "ext-tidy": "*", - "ext-zip": "*" + "ext-zip": "*", + "ext-zlib": "*" }, "platform-dev": [], "plugin-api-version": "2.1.0" -- 2.39.5