From: vincent@cubedesigners.com Date: Tue, 17 Jul 2018 13:45:55 +0000 (+0000) Subject: wip #2112 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c944b83193a88b498a120c637fd7465c9d91a0f9;p=cubeextranet.git wip #2112 @1.5 --- diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index 4796c9a3b..973e5d5a8 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -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) { 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 8268f264b..97933d792 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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 .= '
'; + $res .= '
'; $res .= ''; if (null !== $slide['caption']) { $res .= '

' . $slide['caption'] . '

'; - } + } - $res .= '
'; // .fb-slideshow-slide - } + $res .= '
'; // .fb-slideshow-slide + } - $res = '
'. $res .'
'; + $res = '
' . $res . '
'; - $res .= ''; + $res .= ''; - 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 ''; + } +} + +class iframePopupLink extends normalLink +{ + public function getURL() + { + return '#/iframe/' . md5($this->to); + } + + + public function getAdditionnalContent() + { + $res = parent::getAdditionnalContent(); + $markup = '
'; + $markup .= ''; + $markup .= '
'; + return $res . ' data-iframe="' . rawurlencode($markup) . '" '; + } + + public function keep() + { + return true; + } + +}