]> _ Git - cubeextranet.git/commitdiff
wip #2112 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 17 Jul 2018 13:45:55 +0000 (13:45 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 17 Jul 2018 13:45:55 +0000 (13:45 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index 4796c9a3baf970c6b40cf57d95b9ce99424d6c48..973e5d5a809e600892d0953fc366e1ac5cbfeea3 100644 (file)
@@ -605,10 +605,10 @@ class wsFlash extends cubeFlashGateway
 
                $types = array(1, 2, 3, 4, 5, 6, 7, 11, 13, 14, 15, 16, 17, 18, 19, 24, 25);
                if (wsDroits::revendeur()) {
-                       $types = array(1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25);
+                       $types = array(1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 31);
                }
                if (wsDroits::admin()) {
-                       $types = range(1, 30);
+                       $types = range(1, 100);
                }
 
                if ($this->json) {
index 8268f264bb4f03845d2619e465c1c82acde71023..97933d792fd9cf99af97551c2520bc132f654d3d 100644 (file)
@@ -46,7 +46,7 @@ class wsHTML5Link
         * @param integer $id
         * @param stdClass $init
         * @param wsHTML5Compiler $compiler
-        * @return \webLink|\mailLink|\internalLink|\videoLink|\videoPopupLink|\multimediaLink|null|\webVideoLink|\webVideoPopupLink|\actionLink|\basketLink|\colorLink|\imageLink|\fileLink|\htmlMultimediaLink|\normalLink
+        * @return wsHTML5Link
         */
        public static function getInstance($id, $init, &$compiler)
        {
@@ -147,9 +147,15 @@ class wsHTML5Link
                        case 29:
                                return new facebookLikeLink($id, $init, $compiler);
                                break;
-            case 30:
-                return new slideshowLink($id, $init, $compiler);
+                       case 30:
+                               return new slideshowLink($id, $init, $compiler);
                                break;
+                       case 31:
+                               if ($init['inline']) {
+                                       return new iframeLink($id, $init, $compiler);
+                               } else {
+                                       return new iframePopupLink($id, $init, $compiler);
+                               }
                        default:
                                return null;
                }
@@ -1004,7 +1010,7 @@ class htmlMultimediaLink extends wsHTML5Link
                                $d = $this->unzipFile($this->alternative, false);
                                $this->_config = $this->getConfigZIP($d['dir']);
                                $this->copyExternalDir($d['dir'], $d['fdir']);
-                               if(file_exists($d['dir'] . '/index.html')) {
+                               if (file_exists($d['dir'] . '/index.html')) {
                                        $html = file_get_contents($d['dir'] . '/index.html');
                                        $html = str_replace('var pRatio = window.devicePixelRatio || 1,', 'var pRatio = 0.5,', $html);
                                        $this->_config['lowDef'] = 'index_ld.html';
@@ -1542,64 +1548,69 @@ class zoomLink extends normalLink
 }
 
 
-class slideshowLink extends normalLink {
+class slideshowLink extends normalLink
+{
 
-    protected $path;
-    protected $path_absolute;
+       protected $path;
+       protected $path_absolute;
 
-    public function getURL() {
+       public function getURL()
+       {
 
-        if (empty($this->to)) {
-            return '';
-        }
+               if (empty($this->to)) {
+                       return '';
+               }
 
-        $d = $this->unzipFile($this->to, false);
-        $this->copyExternalDir($d['dir'], $d['fdir']);
+               $d = $this->unzipFile($this->to, false);
+               $this->copyExternalDir($d['dir'], $d['fdir']);
 
-        $this->path = $d['fdir'];
-        $this->path_absolute = $this->compiler->vdir->path($d['fdir']);
+               $this->path = $d['fdir'];
+               $this->path_absolute = $this->compiler->vdir->path($d['fdir']);
 
-        return '#/slideshow/' . $this->uid;
-    }
+               return '#/slideshow/' . $this->uid;
+       }
 
-    public function getAdditionnalContent() {
-        return ' data-slideshow="' . rawurlencode($this->generateSlideshow()) . '" ';
-    }
+       public function getAdditionnalContent()
+       {
+               return ' data-slideshow="' . rawurlencode($this->generateSlideshow()) . '" ';
+       }
 
 //    public function keep() {
 //        return true;
 //    }
 
-    public function getDefaultTooltip() {
-        return 'view slideshow';
-    }
+       public function getDefaultTooltip()
+       {
+               return 'view slideshow';
+       }
 
-    public function generateSlideshow() {
+       public function generateSlideshow()
+       {
 
-        $this->compiler->addJs('js/libs/slick/slick.js');
-        $this->compiler->addLess('slick/slick-bundle');
-        $this->compiler->addLess('fluidbook.slideshow');
+               $this->compiler->addJs('js/libs/slick/slick.js');
+               $this->compiler->addLess('slick/slick-bundle');
+               $this->compiler->addLess('fluidbook.slideshow');
 
                $extensions = ['jpg', 'png', 'jpeg', 'gif'];
 
-        $slideshowID = 'slideshow_' . $this->uid;
-        $XML_path = $this->path_absolute . '/slideshow.xml'; // Optional file so it may not exist
+               $slideshowID = 'slideshow_' . $this->uid;
+               $XML_path = $this->path_absolute . '/slideshow.xml'; // Optional file so it may not exist
 
                $this->getURL();
 
                $slides = [];
-        // If the zip file contained a slideshow.xml file, use that for fetching images and their captions
-        if (file_exists($XML_path)) {
+               // 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_file($XML_path);
-            $slideshowData = CubeIT_Util_Xml::toObject($slideshow_XML);
-            foreach ($slideshowData->image as $img) {
-                $full_path = $this->path_absolute . '/' . $img->_name;
+                       $slideshow_XML = simplexml_load_file($XML_path);
+                       $slideshowData = CubeIT_Util_Xml::toObject($slideshow_XML);
+                       foreach ($slideshowData->image as $img) {
+                               $full_path = $this->path_absolute . '/' . $img->_name;
                                $slides[] = ['caption' => $img->_caption, 'path' => $full_path];
-            }
+                       }
 
-        } else {
-            // Or by default, just get all the images that were in the zip file...
+               } else {
+                       // Or by default, just get all the images that were in the zip file...
                        $afiles = CubeIT_Files::getRecursiveDirectoryIterator($this->path_absolute);
 
                        foreach ($afiles as $afile) {
@@ -1614,27 +1625,27 @@ class slideshowLink extends normalLink {
                                $slides[] = ['path' => $afile->getPathname(), 'caption' => null];
                                uasort($slides, [$this, '_orderSlidesByFilename']);
                        }
-        }
+               }
 
                $res = '';
                foreach ($slides as $slide) {
-            $res .= '<div class="fb-slideshow-slide">';
+                       $res .= '<div class="fb-slideshow-slide">';
                        $res .= '<img class="fb-slideshow-slide-image" src="' . $this->compiler->vdir->relativePath($slide['path']) . '">';
                        if (null !== $slide['caption']) {
                                $res .= '<p class="fb-slideshow-slide-caption">' . $slide['caption'] . '</p>';
-            }
+                       }
 
-            $res .= '</div>'; // .fb-slideshow-slide
-        }
+                       $res .= '</div>'; // .fb-slideshow-slide
+               }
 
-        $res  = '<div class="fb-slideshow" id="'. $slideshowID .'">'. $res .'</div>';
+               $res = '<div class="fb-slideshow" id="' . $slideshowID . '">' . $res . '</div>';
 
-        $res .= '<script>';
-        $res .= 'fluidbook.slideshow.initSlideshow("'. $slideshowID .'");';
-        $res .= '</script>';
+               $res .= '<script>';
+               $res .= 'fluidbook.slideshow.initSlideshow("' . $slideshowID . '");';
+               $res .= '</script>';
 
-        return $res;
-    }
+               return $res;
+       }
 
 
        protected function _orderSlidesByFilename($a, $b)
@@ -1642,3 +1653,40 @@ class slideshowLink extends normalLink {
                return strcmp($a['path'], $b['path']);
        }
 }
+
+class iframeLink extends wsHTML5Link
+{
+       function getHTMLContainerClass()
+       {
+               return parent::getHTMLContainerClass() . ' iframe';
+       }
+
+       function getHTMLContent()
+       {
+               return '<iframe src="' . $this->to . '" width="100%" height="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
+       }
+}
+
+class iframePopupLink extends normalLink
+{
+       public function getURL()
+       {
+               return '#/iframe/' . md5($this->to);
+       }
+
+
+       public function getAdditionnalContent()
+       {
+               $res = parent::getAdditionnalContent();
+               $markup = '<div class="iframeContainer">';
+               $markup .= '<iframe src="' . $this->to . '" width="100%" height="100%" frameborder="0" marginwidth="0" marginheight="0" scrolling="auto" allowfullscreen mozallowfullscreen="true" webkitallowfullscreen="true" onmousewheel=""></iframe>';
+               $markup .= '</div>';
+               return $res . ' data-iframe="' . rawurlencode($markup) . '" ';
+       }
+
+       public function keep()
+       {
+               return true;
+       }
+
+}