]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5408 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 12:27:35 +0000 (14:27 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 22 Aug 2022 12:27:35 +0000 (14:27 +0200)
app/Fluidbook/Link/Cart/PumaCartLink.php [new file with mode: 0644]
app/Fluidbook/Link/Custom/IntexLink.php [new file with mode: 0644]
app/Fluidbook/Link/Link.php [new file with mode: 0644]
app/Jobs/FluidbookCompiler.php
composer.json
composer.lock

diff --git a/app/Fluidbook/Link/Cart/PumaCartLink.php b/app/Fluidbook/Link/Cart/PumaCartLink.php
new file mode 100644 (file)
index 0000000..f5277c3
--- /dev/null
@@ -0,0 +1,39 @@
+<?php
+
+namespace App\Fluidbook\Link\Cart;
+
+use Fluidbook\Tools\Links\CartLink;
+
+class PumaCartLink extends cartLink
+{
+    public function getInnerContent()
+    {
+        return '<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
+        viewBox="0 0 32 32" style="enable-background:new 0 0 32 32;" xml:space="preserve">
+<style type="text/css">
+       .st0{fill:#B09474;}
+       .st1{fill:#FFFFFF;}
+       .st2{opacity:0.5;fill:#B09474;enable-background:new;}
+</style>
+<g class="on">
+       <circle class="st0" cx="16" cy="16" r="14"/>
+       <path class="st1" d="M16,23.2c-0.2,0-0.4-0.1-0.5-0.2L10,17.4c-1.2-1.2-1.5-3-0.7-4.4c1-1.9,3.4-2.7,5.3-1.7c0.4,0.2,0.7,0.4,1,0.7
+               l0.4,0.4l0.4-0.4c1.5-1.5,4-1.5,5.6,0c0.3,0.3,0.6,0.6,0.7,1c0.8,1.5,0.5,3.3-0.7,4.5l-5.5,5.5C16.4,23.1,16.2,23.2,16,23.2z"/>
+</g>
+<g class="off">
+       <circle class="st2" cx="16" cy="16" r="14"/>
+       <path class="st1" d="M16,23.2c-0.2,0-0.4-0.1-0.5-0.2L10,17.4c-1.2-1.2-1.5-3-0.7-4.4c1-1.9,3.4-2.7,5.3-1.7c0.4,0.2,0.7,0.4,1,0.7
+               l0.4,0.4l0.4-0.4c1.5-1.5,4-1.5,5.6,0c0.3,0.3,0.6,0.6,0.7,1c0.8,1.5,0.5,3.3-0.7,4.5l-5.5,5.5C16.4,23.1,16.2,23.2,16,23.2z
+                M12.8,12.3c-0.9,0-1.8,0.5-2.3,1.4c-0.5,0.9-0.3,2.1,0.5,2.8l5,5l5-5c0.8-0.7,1-1.9,0.5-2.8c-0.1-0.2-0.3-0.4-0.5-0.6
+               c-1-1-2.6-1-3.6,0l-0.9,0.9c-0.3,0.3-0.7,0.3-1,0L14.6,13c-0.2-0.2-0.4-0.3-0.7-0.5C13.6,12.3,13.2,12.3,12.8,12.3z"/>
+</g>
+</svg>';
+    }
+
+    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 (file)
index 0000000..eec4a6a
--- /dev/null
@@ -0,0 +1,16 @@
+<?php
+
+namespace App\Fluidbook\Link\Custom;
+
+class IntexLink extends CustomLink
+{
+    public static function _getURL($to)
+    {
+        return self::_getURLOfType('intex', $to);
+    }
+
+    public function getDefaultTooltip()
+    {
+        return 'Cliquer pour voir la page du produit';
+    }
+}
diff --git a/app/Fluidbook/Link/Link.php b/app/Fluidbook/Link/Link.php
new file mode 100644 (file)
index 0000000..abb057e
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+
+namespace App\Fluidbook\Link;
+
+use App\Fluidbook\Link\Cart\PumaCartLink;
+use Cubist\Util\ArrayUtil;
+use Fluidbook\Tools\Links\CartLink;
+use Fluidbook\Tools\Links\CustomLink;
+use Fluidbook\Tools\Links\ZoomProductLink;
+
+class Link extends \Fluidbook\Tools\Links\Link
+{
+    public static function getInstance($id, $init, &$compiler)
+    {
+        $init = ArrayUtil::asArray($init);
+
+        $init['scorm'] = self::isScorm($init);
+        $init['to'] = self::replaceCustomURL($init['to']);
+
+        switch ($init['type']) {
+            case 7:
+                if ($compiler->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);
+    }
+}
index 9be23c04f5235bf9e8fb0b8e70440fd6bf392df1..574ad2209a22ae2505b942dcd10701254e8a9ecf 100644 (file)
@@ -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"></iframe></noscript>
                 $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"></iframe></noscript>
                 $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"></iframe></noscript>
                 $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"></iframe></noscript>
                 $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"></iframe></noscript>
                             '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"></iframe></noscript>
                         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"></iframe></noscript>
                 continue;
             }
 
-            $link = wsHTML5Link::getInstance($this->base62($i), $linkData, $this);
+            $link = Link::getInstance($this->base62($i), $linkData, $this);
             if (is_null($link) || $link->ignore()) {
                 continue;
             }
index 02e8da4630b39c0f6800f059162e228ceeab015d..7a5ce98d6993c438d472739aa2ba9494080140ba 100644 (file)
         "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",
         "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"
     },
index 74dc46c02d7fc87fb342c68c58052e6496f18ad0..e5adcd34d85695534e2810ef2a2287918a0f24ba 100644 (file)
@@ -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",
         "ext-json": "*",
         "ext-libxml": "*",
         "ext-simplexml": "*",
+        "ext-sodium": "*",
         "ext-tidy": "*",
-        "ext-zip": "*"
+        "ext-zip": "*",
+        "ext-zlib": "*"
     },
     "platform-dev": [],
     "plugin-api-version": "2.1.0"