From ea9b16d40c6e729ebc5619114abd7df9a0a84a42 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 27 Nov 2019 18:28:16 +0000 Subject: [PATCH] wip #3186 @3 --- inc/ws/Metier/class.ws.book.parametres.php | 23 ++++++++++++++----- inc/ws/Util/class.ws.util.php | 18 +++++++++++++++ .../html5/master/class.ws.html5.compiler.php | 17 ++++++++++++++ .../html5/master/class.ws.html5.links.php | 12 +++++++--- 4 files changed, 61 insertions(+), 9 deletions(-) diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 5c179da03..bc4683495 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -424,6 +424,21 @@ class wsBookParametres extends wsParametres 'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth')); //. + $this->fields['product_zoom_references'] = 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'); + $icons = ['share' => __('Partage'), 'click' => __('Ecran'), 'pdf' => 'PDF', 'none' => __('Aucune')]; + $f = []; + for ($i = 1; $i <= 2; $i++) { + $this->fields['product_zoom_label_' . $i] = ['type' => 'text', 'label' => 'Label du bouton ' . $i, 'default' => '', 'editable' => true, 'grade' => 3]; + $this->fields['product_zoom_icon_' . $i] = ['type' => 'combo', 'datas' => $icons, 'label' => 'Icône du bouton ' . $i, 'default' => 'click', 'editable' => true, 'grade' => 3]; + $f[] = '|'; + $f[] = 'product_zoom_label_' . $i; + $f[] = 'product_zoom_icon_' . $i; + } + $this->fields['product_email_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"'); + $this->fields['product_email_body'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Corps de l'email") . ' "' . __('Envoyer à un ami') . '"'); + $this->fields['product_tweet'] = array('type' => 'textarea', 'default' => '%short%', 'editable' => true, 'label' => __("Contenu Partage court"), 'hint' => __('Contenu du partagé sur les partages courts')); + $this->forms['product_zoom'] = ['label' => __('Zooms produits'), 'fieldsnames' => array_merge(["product_zoom_references"], $f, ['|', 'product_email_title', 'product_email_body', 'product_tweet'])]; $this->fields['audiodescriptionTexts'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Contenus textuels pour l\'audiodescription'), 'fileFilter' => $seoFilter]; $this->fields['audiodescriptionVoice'] = ['type' => 'combo', 'datas' => wsDroits::getTTSVoices(), 'editable' => true, 'default' => true, 'label' => __('Voix pour l\'audiodescription')]; @@ -470,13 +485,9 @@ class wsBookParametres extends wsParametres 'Wesco Ventes' => 'com.fluidbook.player.basket.custom.wesco.WescoBasketManager', 'Atlantic Download' => 'com.fluidbook.player.basket.custom.atlantic.AtlanticDownloadBasketManager', 'Remarkable' => 'Remarkable', - 'Zoom + lien produit' => 'ZoomProductLink', + 'Zoom + lien produit (déprécié, utiliser la fonctionnalité "Zoom produits")' => 'ZoomProductLink', ), 'grade' => 5); - $this->fields['product_email_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"'); - $this->fields['product_email_body'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Corps de l'email") . ' "' . __('Envoyer à un ami') . '"'); - $this->fields['product_tweet'] = array('type' => 'textarea', 'default' => '%short%', 'editable' => true, 'label' => __("Contenu Partage court"), 'hint' => __('Contenu du partagé sur les partages courts')); - $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'); $this->fields['basketImages'] = array('type' => 'freefile', 'default' => '', 'editable' => true, @@ -487,7 +498,7 @@ class wsBookParametres extends wsParametres $this->forms['basket'] = array('label' => __('Panier'), - 'fieldsnames' => array('basket', 'basketManager', 'basketReferences', 'basketImages', 'basketPDFBackground', '|', 'product_email_title', 'product_email_body', 'product_tweet')); + 'fieldsnames' => array('basket', 'basketManager', 'basketReferences', 'basketImages', 'basketPDFBackground')); // . $this->fields['offlineLink'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __("URL du Fluidbook"), 'hint' => __('URL du fluidbook utilisée pour la version Offline (CD-ROM, clé USB, Exécutables)')); $this->fields['offlineTitle'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de l'application")); diff --git a/inc/ws/Util/class.ws.util.php b/inc/ws/Util/class.ws.util.php index af307c72d..4510ce25e 100644 --- a/inc/ws/Util/class.ws.util.php +++ b/inc/ws/Util/class.ws.util.php @@ -75,6 +75,24 @@ class wsUtil return $res; } + public static function excelToArrayKeyValMulti($excelFile) + { + $worksheets = self::excelToArray($excelFile); + $res = []; + foreach ($worksheets as $worksheet) { + foreach ($worksheet as $line) { + $multi = []; + $n = count($line); + for ($i = 1; $i < $n; $i++) { + $multi[] = trim($line[$i]); + } + $res[trim($line[0])] = $multi; + } + break; + } + return $res; + } + protected static function _assocSheet($s) { $res = []; diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 73faaf710..6ff4d8b65 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -403,6 +403,23 @@ class wsHTML5Compiler break; } } + if (!$this->config->product_zoom_references && $this->config->basketReferences && $this->config->basketManager == "ZoomProductLink") { + $this->config->product_zoom_references = $this->config->basketReferences; + $this->config->basketReferences = ''; + } + + if ($this->config->product_zoom_references) { + if (file_exists($this->config->product_zoom_references) || CubeIT_Util_Url::isDistant($this->config->product_zoom_references)) { + $referencesFile = $this->config->product_zoom_references; + } else { + $referencesFile = $this->wdir . '/commerce/' . $this->config->product_zoom_references; + } + if (file_exists($referencesFile) || CubeIT_Util_Url::isDistant($referencesFile)) { + $function = 'excelToArrayKeyValMulti'; + $this->config->product_zoom_references = wsUtil::$function($referencesFile); + } + } + if ($this->config->basketReferences) { if (file_exists($this->config->basketReferences) || CubeIT_Util_Url::isDistant($this->config->basketReferences)) { $referencesFile = $this->config->basketReferences; 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 351d56d19..4e1aa67f0 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -1903,14 +1903,20 @@ class zoomProductLink extends zoomLink public function getZoomAttributes() { - $url = isset($this->compiler->config->basketReferences[$this->to]) ? $this->compiler->config->basketReferences[$this->to] : ''; + $url = isset($this->compiler->config->product_zoom_references[$this->to]) ? $this->compiler->config->product_zoom_references[$this->to] : ''; $res = array_merge(parent::getZoomAttributes(), ['maxzoom' => $this->maxzoom_default, 'ref' => $this->to] ); if ($url) { - $res['shareurl'] = $url; - $res['producturl'] = $url; + $res['shareurl'] = $url[0]; + $res['producturl'] = $url[0]; + $n = count($url); + for ($i = 1; $i < $n; $i++) { + if (isset($url[$i]) && $url[$i]) { + $res['extra-'.$i] = $url[$i]; + } + } } return $res; -- 2.39.5