]> _ Git - cubeextranet.git/commitdiff
wip #4128 @4
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 16 Dec 2020 19:56:30 +0000 (19:56 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 16 Dec 2020 19:56:30 +0000 (19:56 +0000)
inc/ws/Util/class.ws.pdf.convert.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 5c870c1acbcd186d225b3a9c157c29480148e861..2c364ac40ad64ae7c93779804fbd0b76c9cadc94 100644 (file)
@@ -116,13 +116,15 @@ class wsPDFConvert
         $xpath->registerNamespace('xlink', 'http://www.w3.org/1999/xlink');\r
         $xpath->registerNamespace("php", "http://php.net/xpath");\r
         $xpath->registerPhpFunctions('has_not_text');\r
-        $toDelete = array('//svg:defs/svg:clipPath',\r
+        $toDelete = array(\r
+            '//svg:defs/svg:clipPath',\r
             '//svg:defs/svg:image',\r
             '//svg:defs/svg:path',\r
             '//svg:defs/svg:pattern',\r
             '//svg:defs/svg:g[starts-with(@id, "surface")]//svg:path',\r
             '/svg:svg/svg:g//svg:path',\r
             '/svg:svg/svg:g//svg:rect',\r
+            '//svg:filter',\r
             '//svg:use[starts-with(@xlink:href, "#image")]'\r
         );\r
 \r
index 8d1845f357388654d5f045b8f3a30a0eb8271186..b240a61e63107d6fae877cbf8ec2a2c6fe531f1c 100644 (file)
@@ -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) {
index 6a4595973af0dfff7c4914571f79b7305ac5b982..ac1fe64582ce362fc58c4aeb67fc0f6ee17d23f4 100644 (file)
@@ -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 = '<div class="videoContainer"';
+        $res = '<div class="videoContainer integration-' . $linkDatas->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);