From c568e150a2528d8cb5a165c6ad2bf242e0fffb0e Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 23 Sep 2019 11:37:21 +0000 Subject: [PATCH] wip #3054 @4 --- inc/ws/Metier/class.ws.book.parametres.php | 3 +- .../html5/master/class.ws.html5.links.php | 44 +++++++++++++++---- 2 files changed, 37 insertions(+), 10 deletions(-) diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 6ae40187a..e35fe9f2f 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -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'); diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 9d43ccaf5..49870a922 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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 { -- 2.39.5