]> _ Git - cubeextranet.git/commitdiff
wip #3054 @4
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 23 Sep 2019 11:37:21 +0000 (11:37 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 23 Sep 2019 11:37:21 +0000 (11:37 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 6ae40187a507433734c1ce9f4add55952f1cbf17..e35fe9f2fa683f778bada3db778b2a952912b56c 100644 (file)
@@ -449,7 +449,8 @@ class wsBookParametres extends wsParametres
                 'Essilor Recap' => 'com.fluidbook.player.basket.custom.essilorrecap.EssilorRecapBasketManager',
                 'Wesco Ventes' => 'com.fluidbook.player.basket.custom.wesco.WescoBasketManager',
                 'Atlantic Download' => 'com.fluidbook.player.basket.custom.atlantic.AtlanticDownloadBasketManager',
-                'Remarkable' => 'Remarkable'
+                'Remarkable' => 'Remarkable',
+                'Zoom + lien produit' => 'ZoomProductLink',
             ), 'grade' => 5);
         $this->fields['basketReferences'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
             'label' => __('Références produits'), 'grade' => 3, 'fileFilter' => $basketFilter, 'hint' => __('Fichier contenant les références produits'), 'dir' => 'commerce');
index 9d43ccaf5c35e94e29ea8119031d2bc6e9cfbb2e..49870a9229b4d549daca11dce58d91c380db45ec 100644 (file)
@@ -111,6 +111,9 @@ class wsHTML5Link
                     case 'Remarkable':
                         return new remarkableCartLink($id, $init, $compiler);
                         break;
+                    case 'ZoomProductLink':
+                        return new zoomProductLink($id, $init, $compiler);
+                        break;
                     default :
                         return new cartLink($id, $init, $compiler);
                         break;
@@ -634,6 +637,9 @@ class contentLink extends wsHTML5Link
             $lines = CubeIT_Text::splitLines($animation);
             foreach ($lines as $line) {
                 $e = explode('=', $line);
+                if (count($e) < 2) {
+                    continue;
+                }
                 $v = trim($e[1]);
                 // Handle values surronded by quotes
                 if (preg_match('|^\"([^\"]+)\"$|', $v, $matches)) {
@@ -641,6 +647,9 @@ class contentLink extends wsHTML5Link
                 }
                 $variables[trim($e[0])] = $v;
             }
+            if (!isset($variables['direction'])) {
+                $variables['direction'] = 'right';
+            }
             if ($variables['direction'] == 'top') {
                 $variables['direction'] = 'up';
             }
@@ -1748,15 +1757,7 @@ class zoomLink extends normalLink
         $res .= ' id="' . $this->uid . '"';
 
         // Data attributes
-        $attributes = [
-            'maxzoom' => empty($this->to) ? $this->maxzoom_default : $this->to,
-            'group' => $this->group,
-            'group-count' => empty($this->group) ? 0 : count(explode(',', $this->group)),
-            'width' => round($this->width),
-            'height' => round($this->height),
-            'x' => round($this->left),
-            'y' => round($this->top)
-        ];
+        $attributes = $this->getZoomAttributes();
 
         // Set data attributes
         foreach ($attributes as $key => $val) {
@@ -1768,6 +1769,19 @@ class zoomLink extends normalLink
         return $res;
     }
 
+    public function getZoomAttributes()
+    {
+        return [
+            'maxzoom' => empty($this->to) ? $this->maxzoom_default : $this->to,
+            'group' => $this->group,
+            'group-count' => empty($this->group) ? 0 : count(explode(',', $this->group)),
+            'width' => round($this->width),
+            'height' => round($this->height),
+            'x' => round($this->left),
+            'y' => round($this->top)
+        ];
+    }
+
     public function generateImage()
     {
 
@@ -1847,6 +1861,18 @@ class zoomLink extends normalLink
     }
 }
 
+class zoomProductLink extends zoomLink
+{
+    public function getZoomAttributes()
+    {
+        $cart =$this->compiler->getCartData();
+
+        return array_merge(parent::getZoomAttributes(),
+            ['maxzoom' => $this->maxzoom_default, 'ref' => $this->to, 'shareurl' => $url, 'producturl' => $url]
+        );
+    }
+}
+
 
 class slideshowLink extends normalLink
 {