From aadeabf44c7712fca77156d05fa2dca3cc025d12 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 16 Dec 2020 19:56:30 +0000 Subject: [PATCH] wip #4128 @4 --- inc/ws/Util/class.ws.pdf.convert.php | 4 +- .../html5/master/class.ws.html5.compiler.php | 22 +++-- .../html5/master/class.ws.html5.links.php | 96 +++++++++++++------ 3 files changed, 86 insertions(+), 36 deletions(-) diff --git a/inc/ws/Util/class.ws.pdf.convert.php b/inc/ws/Util/class.ws.pdf.convert.php index 5c870c1ac..2c364ac40 100644 --- a/inc/ws/Util/class.ws.pdf.convert.php +++ b/inc/ws/Util/class.ws.pdf.convert.php @@ -116,13 +116,15 @@ class wsPDFConvert $xpath->registerNamespace('xlink', 'http://www.w3.org/1999/xlink'); $xpath->registerNamespace("php", "http://php.net/xpath"); $xpath->registerPhpFunctions('has_not_text'); - $toDelete = array('//svg:defs/svg:clipPath', + $toDelete = array( + '//svg:defs/svg:clipPath', '//svg:defs/svg:image', '//svg:defs/svg:path', '//svg:defs/svg:pattern', '//svg:defs/svg:g[starts-with(@id, "surface")]//svg:path', '/svg:svg/svg:g//svg:path', '/svg:svg/svg:g//svg:rect', + '//svg:filter', '//svg:use[starts-with(@xlink:href, "#image")]' ); 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 8d1845f35..b240a61e6 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -348,7 +348,7 @@ class wsHTML5Compiler $this->config->rasterizePages = cubeArray::parseRange($this->config->rasterizePages); $this->config->vectorPages = array_diff(cubeArray::parseRange($this->config->vectorPages), $this->config->rasterizePages); $this->config->triggersLinks = []; - $this->config->hasContentLock=false; + $this->config->hasContentLock = false; } protected function populateConfig() @@ -1603,7 +1603,7 @@ class wsHTML5Compiler $dupData['alternative'] = $linkData['animation']; $dupData['type'] = 6; $dupData['uid'] = 'a_' . $linkData['uid']; - $dupData['video_width']=$dupData['video_height']=0; + $dupData['video_width'] = $dupData['video_height'] = 0; if (wsHTML5Link::isScorm($linkData)) { $dupData['scorm'] = true; } @@ -1633,10 +1633,13 @@ class wsHTML5Compiler $i = 0; $pages = array(); $cpages = array(); + $ctpages = array(); $css = array(); $linkPages = []; $allLinksData = []; + $depths = [10 => 'ctpages', 20 => 'ctpages', 30 => 'cpages', 40 => 'cpages', 50 => 'pages', 60 => 'pages', 70 => 'pages', 80 => 'pages',]; + usort($links, array($this, '_sortLinks')); foreach ($links as $linkData) { @@ -1665,12 +1668,11 @@ class wsHTML5Compiler if (!isset($pages[$lta->page])) { $pages[$lta->page] = ''; $cpages[$lta->page] = ''; + $ctpages[$lta->page] = ''; } - if ($lta instanceof contentLink) { - $cpages[$lta->page] .= $c; - } else { - $pages[$lta->page] .= $c; - } + + $v = $depths[$lta->getDepth()]; + $$v[$lta->page] .= $c; } // Make old "aftersearch" link compatible with new "extra" menu option by extracting link URL if ($link->page == 'aftersearch') { @@ -1682,7 +1684,6 @@ class wsHTML5Compiler $linkPages[$link->page] = true; } - $allLinksData[$linkData['uid']] = $linkData; if ($link->keep()) { @@ -1705,14 +1706,19 @@ class wsHTML5Compiler $c = ''; $cc = ''; + $ct = ''; if (isset($pages[$i])) { $c = $pages[$i]; } if (isset($cpages[$i])) { $cc = $cpages[$i]; } + if (isset($ctpages[$i])) { + $ct = $ctpages[$i]; + } $this->config->links[$i] = $c; $this->config->clinks[$i] = $cc; + $this->config->ctlinks[$i] = $ct; } if ($this->writeLinksData) { 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 6a4595973..ac1fe6458 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -35,7 +35,8 @@ class wsHTML5Link public $uid; public $scorm; public $hidden = false; - public $zindex = 4; + public $defaultZIndex = 70; + public $zindex = -1; public $rightClone = false; public $iframeType = "none"; public $border = 0; @@ -75,10 +76,19 @@ class wsHTML5Link case 5: return new internalLink($id, $init, $compiler); case 4: - if ($init['inline']) { + + $init['inline'] = self::normalizeInlineIntegration($init['inline']); + if ($init['inline'] === 'inline') { + $init['inline'] = 'inline'; return new videoLink($id, $init, $compiler); + } else if ($init['inline'] === 'popup') { + $init['inline'] = 'popup'; + return new videoPopupLink($id, $init, $compiler); + } else if ($init['inline'] === 'background_texts') { + $init['inline'] = 'background_texts'; + return new videoBackgroundLink($id, $init, $compiler); } - return new videoPopupLink($id, $init, $compiler); + case 7: if ($compiler->book->parametres->basketManager === 'Puma') { return new pumaCartLink($id, $init, $compiler); @@ -172,7 +182,6 @@ class wsHTML5Link break; case 27: return new eventOverlayLink($id, $init, $compiler); - case 29: return new facebookLikeLink($id, $init, $compiler); case 30: @@ -209,6 +218,19 @@ class wsHTML5Link default: return null; } + + + } + + public static function normalizeInlineIntegration($inline) + { + if ($inline == '1' || $inline === 'true') { + return 'inline'; + + } else if (!$inline || $inline === 'false') { + return 'popup'; + } + return $inline; } public static function parseExtras($extras, $normalizeKey = false) @@ -282,17 +304,18 @@ class wsHTML5Link if ($init['alternative'] == '') { return null; } + $init['inline'] = self::normalizeInlineIntegration($init['inline']); $ext = mb_strtolower(files::getExtension($init['alternative'])); if (in_array($ext, array('oam', 'zip', 'html')) || substr($init['alternative'], 0, 4) == 'http') { - if ($init['inline']) { + if ($init['inline'] === 'inline') { return new htmlMultimediaLink($id, $init, $compiler); } else { return new htmlMultimediaPopupLink($id, $init, $compiler); } } else if (in_array($ext, array('gif', 'jpeg', 'jpg', 'png', 'svg'))) { - if ($init['inline']) { + if ($init['inline'] === 'inline') { return new htmlMultimediaImage($id, $init, $compiler); } else { return new htmlMultimediaPopupImage($id, $init, $compiler); @@ -343,6 +366,14 @@ class wsHTML5Link $this->init(); } + public function getDepth() + { + if ($this->zindex == -1) { + return $this->defaultZIndex; + } + return $this->zindex; + } + public function getTooltipAttribute($t = null) { if (null === $t) { @@ -468,7 +499,7 @@ class wsHTML5Link public function getCSSZIndex() { - $zindex = (($this->zindex + 1) * 1000) - min(999, round(($this->width * $this->height) / 300)); + $zindex = (($this->getDepth() + 1) * 1000) - min(999, round(($this->width * $this->height) / 300)); return 'z-index:' . $zindex . ';'; } @@ -729,7 +760,7 @@ class textPopupLink extends normalLink class htmlMultimediaImage extends wsHTML5Link { - public $zindex = 2; + public $defaultZIndex = 50; public function getHTMLContainerClass() { @@ -829,7 +860,7 @@ class htmlMultimediaPopupImage extends normalLink class contentLink extends wsHTML5Link { - public $zindex = 0; + public $defaultZIndex = 30; public function getHTMLContainerClass() { @@ -841,9 +872,9 @@ class contentLink extends wsHTML5Link $res = parent::getAdditionnalContent(); $animations = self::parseAnimations($this->image_rollover); foreach ($animations as $animation) { - if (isset($animation['zindex'])) { - $this->zindex = $animation['zindex']; - } +// if (isset($animation['zindex'])) { +// $this->defaultZIndex = $animation['zindex']; +// } } $res .= ' data-animations="' . htmlspecialchars(json_encode($animations), ENT_QUOTES) . '" '; if ($this->_isHiddenFirst($animations)) { @@ -863,19 +894,11 @@ class contentLink extends wsHTML5Link } return false; } - - public function getCSSZIndex() - { - if ($this->zindex === 0) { - return ''; - } - return 'z-index:' . ($this->zindex + 500) . ';'; - } } class eventOverlayLink extends wsHTML5Link { - public $zindex = 3; + public $defaultZIndex = 60; public function getHTMLContainerClass() { @@ -1011,9 +1034,30 @@ class internalLink extends normalLink } } +class videoBackgroundLink extends videoLink +{ + public $defaultZIndex = 10; + + public function __construct($id, $init, &$compiler) + { + /* + * public $video_loop; + public $video_sound_on; + public $video_controls; + public $video_auto_start; + public $video_height; + public $video_width; + */ + $init['video_loop'] = true; + $init['video_controls'] = false; + $init['video_auto_start'] = true; + parent::__construct($id, $init, $compiler); + } +} + class videoLink extends wsHTML5Link { - public $zindex = 2; + public $defaultZIndex = 50; public static function addVideoJS($compiler) { @@ -1047,7 +1091,7 @@ class videoLink extends wsHTML5Link $attributes = static::getVideoAttributes($linkDatas, $w, $h, $compiler); - $res = '
inline . '"'; foreach ($attributes as $name => $value) { $res .= " data-{$name}='{$value}'"; } @@ -1598,7 +1642,7 @@ class htmlMultimediaLink extends wsHTML5Link protected $_content = ''; protected $_url; protected $_externalIframe = false; - public $zindex = 2; + public $defaultZIndex = 50; public function getHTMLContent() { @@ -2406,8 +2450,7 @@ class slideshowLink extends normalLink $slides_options = []; // If the zip file contained a slideshow.xml file, use that for fetching images and their captions - if (file_exists($XML_path)) { - $slideshow_XML = simplexml_load_string(file_get_contents($XML_path)); + if (file_exists($XML_path) && $slideshow_XML = simplexml_load_string(file_get_contents($XML_path))) { $slideshowData = CubeIT_Util_Xml::toObject($slideshow_XML); $thumbnails = isset($slideshowData->_thumbnails) && $slideshowData->_thumbnails !== 'false'; @@ -2445,7 +2488,6 @@ class slideshowLink extends normalLink $slides = $this->_getSlidesFromDirectory($this->path_absolute); } - } else { // Or by default, just get all the images that were in the zip file... $slides = $this->_getSlidesFromDirectory($this->path_absolute); -- 2.39.5