$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) {
* @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)
{
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;
}
$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';
}
-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) {
$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)
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;
+ }
+
+}