From c8e88c08ae8d033823218c5b0910392798868717 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Wed, 4 Sep 2013 11:38:00 +0000 Subject: [PATCH] --- fluidbook/icones/1/mobile/nav-fullscreen.svg | 13 + fluidbook/icones/1/mobile/nav-zoomin.svg | 12 + fluidbook/icones/1/mobile/nav-zoomout.svg | 11 + inc/ws/Controlleur/class.ws.url.php | 6 +- inc/ws/Util/html5/class.ws.html5.compiler.php | 8 +- inc/ws/Util/html5/class.ws.html5.links.php | 1033 +++++++++-------- 6 files changed, 580 insertions(+), 503 deletions(-) create mode 100644 fluidbook/icones/1/mobile/nav-fullscreen.svg create mode 100644 fluidbook/icones/1/mobile/nav-zoomin.svg create mode 100644 fluidbook/icones/1/mobile/nav-zoomout.svg diff --git a/fluidbook/icones/1/mobile/nav-fullscreen.svg b/fluidbook/icones/1/mobile/nav-fullscreen.svg new file mode 100644 index 000000000..ecf42efa4 --- /dev/null +++ b/fluidbook/icones/1/mobile/nav-fullscreen.svg @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/fluidbook/icones/1/mobile/nav-zoomin.svg b/fluidbook/icones/1/mobile/nav-zoomin.svg new file mode 100644 index 000000000..db397d17a --- /dev/null +++ b/fluidbook/icones/1/mobile/nav-zoomin.svg @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/fluidbook/icones/1/mobile/nav-zoomout.svg b/fluidbook/icones/1/mobile/nav-zoomout.svg new file mode 100644 index 000000000..0df062698 --- /dev/null +++ b/fluidbook/icones/1/mobile/nav-zoomout.svg @@ -0,0 +1,11 @@ + + + + + + + diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 223ec0ca5..c48b754fe 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -126,7 +126,7 @@ class wsUrl { } $res .= '' . $core->books_status[$book->status] . '' . $p . ''; - } else { + } else { $res .= '' . $core->books_status[1] . ''; } $res.='' . $book->version . ''; @@ -350,7 +350,7 @@ class wsUrl { } $res.='

' . __('Notifications') . '

'; - $res.='

' . __('Indiquez le texte de la notification à envoyer aux utilisateurs') . ' (' . __('Max 200 caractères') . ').
'.__('Laissez vide si vous souhaitez simplement afficher un badge').'

'; + $res.='

' . __('Indiquez le texte de la notification à envoyer aux utilisateurs') . ' (' . __('Max 200 caractères') . ').
' . __('Laissez vide si vous souhaitez simplement afficher un badge') . '

'; $res.='
'; $res.=form::hidden('collection', $collection->collection_id); $res.=''; @@ -703,7 +703,7 @@ class wsUrl { $s->setTitle(cubeText::str2URL($lang_name)); - $tab = cubeLang::getTranslationsList(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js'), array('php', 'as', 'js'), array(), $lang->traductions); + $tab = cubeLang::getTranslationsList(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js', ROOT . '/inc/ws/Util/html5'), array('php', 'as', 'js'), array(), $lang->traductions); $s->setCellValueByColumnAndRow(0, 1, 'ID', true); $s->setCellValueByColumnAndRow(1, 1, $ref_name, true); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 992fb0c05..22cbcb313 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -30,6 +30,7 @@ class wsHTML5Compiler { 'js/libs/modernizr/tests.js', 'js/libs/json2.js', 'js/libs/flashdetect.js', + 'js/libs/screenfull.js', 'js/libs/jquery/jquery.js', 'js/libs/jquery/jquery.transform.js', 'js/libs/jquery/jquery.mousewheel.js', @@ -56,6 +57,7 @@ class wsHTML5Compiler { 'js/libs/fluidbook/fluidbook.coquillette.js', 'js/libs/fluidbook/fluidbook.stats.js', 'js/libs/fluidbook/fluidbook.cache.js', + 'js/libs/fluidbook/fluidbook.tooltip.js', 'js/libs/fluidbook/fluidbook.bookmarks.js', 'js/libs/fluidbook/fluidbook.background.js', 'js/libs/fluidbook/fluidbook.pad.js', @@ -277,7 +279,7 @@ class wsHTML5Compiler { foreach ($dirsToCreate as $dir) { $d = $this->vdir . '/' . $dir; if (!file_exists($d)) { - mkdir($d, 0777, true); + mkdir($d, 0777, true); } } @@ -881,6 +883,7 @@ class wsHTML5Compiler { $arrowsColor = $this->theme->parametres->arrowsColor; // Set the icon list with the color $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI, + 'nav-zoomin' => $couleurI, 'nav-zoomout' => $couleurI, 'nav-fullscreen' => $couleurI, 'interface-next' => $arrowsColor, 'interface-previous' => $arrowsColor, 'interface-search' => $couleurI, 'interface-back-arrow' => $subTextColor, 'interface-print' => $subTextColor, 'interface-down' => $arrowsColor, 'help-fingers' => $couleurI, 'help-mouse' => $couleurI, 'nav-home' => $couleurI, 'nav-archives' => $couleurI, 'nav-map' => $couleurI, @@ -1172,6 +1175,9 @@ class wsHTML5Compiler { $res[] = '#indexView .doubleThumb .overlay{height:' . $thumbh . 'px;}'; $res[] = '#indexView .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}'; + # Tooltip + $res[] = '#tooltip{background-color:' . self::colorToCSS($this->theme->parametres->tooltipBackColor) . ';color:' . self::colorToCSS($this->theme->parametres->tooltipTextColor) . ';}'; + $res = array_chunk($res, 3500); foreach ($res as $k => $css) { file_put_contents(sprintf($file, $k), implode("\n", $css)); diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index c1831d4c6..28e47443b 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -2,616 +2,651 @@ class wsHTML5Link { - public $left; - public $top; - public $width; - public $height; - public $page; - public $type; - public $to; - public $numerotation; - public $target; - public $interactive; - public $video_loop; - public $video_sound_on; - public $video_controls; - public $video_auto_start; - public $video_height; - public $video_width; - public $video_service; - public $inline; - public $display_area; - public $infobulle; - public $id; - - /** - * - * @var wsHTML5Compiler - */ - public $compiler; - - /** - * - * @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 - */ - public static function getInstance($id, $init, &$compiler) { - switch ($init['type']) { - case 1: - case 2: - return new webLink($id, $init, $compiler); - case 3: - return new mailLink($id, $init, $compiler); - case 5: - return new internalLink($id, $init, $compiler); - case 4: - if ($init['inline']) { - return new videoLink($id, $init, $compiler); - } else { - return new videoPopupLink($id, $init, $compiler); - } - - case 7: - if ($compiler->book->parametres->customLinkClass == 'WescoLink') { - return new wescoLink($id, $init, $compiler); - } else if ($compiler->book->parametres->customLinkClass == 'HaguenauManifLink') { - return new haguenauManifLink($id, $init, $compiler); - } - case 8: - case 9: - return null; - case 10: - if ($init['inline']) { - return new webVideoLink($id, $init, $compiler); - } else { - return new webVideoPopupLink($id, $init, $compiler); - } - case 11: - if ($init['to'] == 'fullScreen') { - return null; - } - return new actionLink($id, $init, $compiler); - case 12: - return new basketLink($id, $init, $compiler); - case 13: - return null; - case 14: - return new colorLink($id, $init, $compiler); - case 15: - return new imageLink($id, $init, $compiler); - case 16: - return new fileLink($id, $init, $compiler); - case 17: - //return new audioLink($id,$init,$compiler); - break; - case 18: - case 19: - break; - case 20: - $compiler->addBookmarkGroup($init); - break; - case 21: - case 6: - return self::getMultimediaInstance($id, $init, $compiler); - break; - default: - return null; - } - } - - public static function getMultimediaInstance($id, $init, &$compiler) { - if ($init['alternative'] == '') { - return null; - } - - $ext = mb_strtolower(files::getExtension($init['alternative'])); - - if (in_array($ext, array('oam', 'zip'))) { - if ($init['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']) { - return new htmlMultimediaImage($id, $init, $compiler); - } else { - return new htmlMultimediaPopupImage($id, $init, $compiler); - } - } - return null; - } - - public function __construct($id, $init, &$compiler) { - foreach ($init as $k => $v) { - $this->$k = $v; - } - if ($this->target == '') { - $this->target = '_blank'; - } - $this->wdir = WS_BOOKS . '/working/' . $compiler->book_id . '/'; - $this->id = $id; - $this->compiler = $compiler; - } - - public function getHTMLContainer() { - return '
' . $this->getHTMLContent() . '
'; - } - - public function getHTMLContainerClass() { - return 'link'; - } - - public function getHTMLContent() { - return ''; - } - - public function getAdditionnalContent() { - - } - - public function getClasses() { - return array(); - } - - public function copyExternalFile($file, $video = false) { - $this->compiler->copyLinkFile($file, 'data/links/', $video); - } - - public function copyExternalDir($dir) { - $this->compiler->copyLinkDir($dir, 'data/links'); - } - - public function unzipFile($file, $moveAssets = false) { - $fdir = 'data/links/' . $file; - $dir = $this->compiler->vdir . '/' . $fdir; - if (!file_exists($dir)) { - mkdir($dir, 0777, true); - } - $unzip = new cubeCommandLine('unzip'); - $unzip->setArg(null, $this->compiler->wdir . '/' . $file); - $unzip->setArg('d', $dir); - $unzip->execute(); - - if ($moveAssets) { - `mv $dir/Assets/* $dir`; - rmdir($dir . '/Assets'); - } - - return array('dir' => $dir, 'fdir' => $fdir); - } - - public function getCssScale() { - if (is_int($this->page)) { - return $this->compiler->getCssScale(); - } else { - return 1; - } - } - - public function getCSSContainer() { - if (!($this instanceof contentLink) && $this->page % 2 == 1) { - $this->page--; - $this->left+=$this->compiler->width; - } - - $css = '#l_' . $this->id . '{'; - $css.='left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;'; - $css.='width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;'; - $css.=$this->getCSS(); - $css.='}'; - return $css; - } - - public function getCSS() { - return ''; - } - - public function keep() { - return false; - } - - public static function getUniversalLocation($loc, $css = false) { - $datas = parse_url($loc); - - if (isset($datas['scheme']) && !is_null($datas['scheme'])) { - return $loc; - } else { - if ($css) { - return '../links/' . $loc; - } else { - return 'data/links/' . $loc; - } - } - } + public $left; + public $top; + public $width; + public $height; + public $page; + public $type; + public $to; + public $numerotation; + public $target; + public $interactive; + public $video_loop; + public $video_sound_on; + public $video_controls; + public $video_auto_start; + public $video_height; + public $video_width; + public $video_service; + public $inline; + public $display_area; + public $infobulle; + public $id; + + /** + * + * @var wsHTML5Compiler + */ + public $compiler; + + /** + * + * @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 + */ + public static function getInstance($id, $init, &$compiler) { + switch ($init['type']) { + case 1: + case 2: + return new webLink($id, $init, $compiler); + case 3: + return new mailLink($id, $init, $compiler); + case 5: + return new internalLink($id, $init, $compiler); + case 4: + if ($init['inline']) { + return new videoLink($id, $init, $compiler); + } else { + return new videoPopupLink($id, $init, $compiler); + } + + case 7: + if ($compiler->book->parametres->customLinkClass == 'WescoLink') { + return new wescoLink($id, $init, $compiler); + } else if ($compiler->book->parametres->customLinkClass == 'HaguenauManifLink') { + return new haguenauManifLink($id, $init, $compiler); + } + case 8: + case 9: + return null; + case 10: + if ($init['inline']) { + return new webVideoLink($id, $init, $compiler); + } else { + return new webVideoPopupLink($id, $init, $compiler); + } + case 11: + if ($init['to'] == 'fullScreen') { + return null; + } + return new actionLink($id, $init, $compiler); + case 12: + return new basketLink($id, $init, $compiler); + case 13: + return null; + case 14: + return new colorLink($id, $init, $compiler); + case 15: + return new imageLink($id, $init, $compiler); + case 16: + return new fileLink($id, $init, $compiler); + case 17: + //return new audioLink($id,$init,$compiler); + break; + case 18: + case 19: + break; + case 20: + $compiler->addBookmarkGroup($init); + break; + case 21: + case 6: + return self::getMultimediaInstance($id, $init, $compiler); + break; + default: + return null; + } + } + + public static function getMultimediaInstance($id, $init, &$compiler) { + if ($init['alternative'] == '') { + return null; + } + + $ext = mb_strtolower(files::getExtension($init['alternative'])); + + if (in_array($ext, array('oam', 'zip'))) { + if ($init['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']) { + return new htmlMultimediaImage($id, $init, $compiler); + } else { + return new htmlMultimediaPopupImage($id, $init, $compiler); + } + } + return null; + } + + public function __construct($id, $init, &$compiler) { + foreach ($init as $k => $v) { + $this->$k = $v; + } + if ($this->target == '') { + $this->target = '_blank'; + } + $this->wdir = WS_BOOKS . '/working/' . $compiler->book_id . '/'; + $this->id = $id; + $this->compiler = $compiler; + } + + public function getDefaultTooltip() { + return false; + } + + public function getTooltip() { + if (is_null($this->infobulle) || !$this->infobulle) { + return '~' .$this->getDefaultTooltip(); + } + return $this->infobulle; + } + + public function getHTMLContainer() { + return '
' . $this->getHTMLContent() . '
'; + } + + public function getHTMLContainerClass() { + return 'link'; + } + + public function getHTMLContent() { + return ''; + } + + public function getAdditionnalContent() { + + } + + public function getClasses() { + return array(); + } + + public function copyExternalFile($file, $video = false) { + $this->compiler->copyLinkFile($file, 'data/links/', $video); + } + + public function copyExternalDir($dir) { + $this->compiler->copyLinkDir($dir, 'data/links'); + } + + public function unzipFile($file, $moveAssets = false) { + $fdir = 'data/links/' . $file; + $dir = $this->compiler->vdir . '/' . $fdir; + if (!file_exists($dir)) { + mkdir($dir, 0777, true); + } + $unzip = new cubeCommandLine('unzip'); + $unzip->setArg(null, $this->compiler->wdir . '/' . $file); + $unzip->setArg('d', $dir); + $unzip->execute(); + + if ($moveAssets) { + `mv $dir/Assets/* $dir`; + rmdir($dir . '/Assets'); + } + + return array('dir' => $dir, 'fdir' => $fdir); + } + + public function getCssScale() { + if (is_int($this->page)) { + return $this->compiler->getCssScale(); + } else { + return 1; + } + } + + public function getCSSContainer() { + if (!($this instanceof contentLink) && $this->page % 2 == 1) { + $this->page--; + $this->left+=$this->compiler->width; + } + + $css = '#l_' . $this->id . '{'; + $css.='left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;'; + $css.='width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;'; + $css.=$this->getCSS(); + $css.='}'; + return $css; + } + + public function getCSS() { + return ''; + } + + public function keep() { + return false; + } + + public static function getUniversalLocation($loc, $css = false) { + $datas = parse_url($loc); + + if (isset($datas['scheme']) && !is_null($datas['scheme'])) { + return $loc; + } else { + if ($css) { + return '../links/' . $loc; + } else { + return 'data/links/' . $loc; + } + } + } } class normalLink extends wsHTML5Link { - public function getHTMLContent() { - $class = $this->getClasses(); - if ($this->display_area) { - $class[] = 'displayArea'; - } - $c = ''; - if (count($class)) { - $c = ' class="' . implode(' ', $class) . '"'; - } - return 'getAdditionnalContent() . $this->getTrack() . '>'; - } - - public function getTrack() { - return ''; - } - - public function getURL() { - return '#'; - } - - public function getTarget() { - return '_self'; - } + public function getHTMLContent() { + $class = $this->getClasses(); + if ($this->display_area) { + $class[] = 'displayArea'; + } + $c = ''; + if (count($class)) { + $c = ' class="' . implode(' ', $class) . '"'; + } + $tooltip = ''; + $t = $this->getTooltip(); + if ($t !== false) { + $tooltip = ' data-tooltip="' . $t . '"'; + } + return 'getAdditionnalContent() . $this->getTrack() . '>'; + } + + public function getTrack() { + return ''; + } + + public function getURL() { + return '#'; + } + + public function getTarget() { + return '_self'; + } } class htmlMultimediaImage extends wsHTML5Link { - public function getHTMLContainerClass() { - return 'link multimedia'; - } + public function getHTMLContainerClass() { + return 'link multimedia'; + } - public function getHTMLContent() { - $w = $this->width * $this->getCssScale(); - $h = $this->height * $this->getCssScale(); - $this->copyExternalFile($this->alternative); - $alt = ''; - return $alt; - } + public function getHTMLContent() { + $w = $this->width * $this->getCssScale(); + $h = $this->height * $this->getCssScale(); + $this->copyExternalFile($this->alternative); + $alt = ''; + return $alt; + } } class htmlMultimediaPopupImage extends normalLink { - public function getURL() { - $this->copyExternalFile($this->alternative); - return '#/multimedia/' . $this->alternative; - } + public function getURL() { + $this->copyExternalFile($this->alternative); + return '#/multimedia/' . $this->alternative; + } - public function getAdditionnalContent() { - $dim = getimagesize($this->wdir . '/' . $this->alternative); - $markup = '
'; - return ' data-multimedia="' . rawurlencode($markup) . '" '; - } + public function getAdditionnalContent() { + $dim = getimagesize($this->wdir . '/' . $this->alternative); + $markup = '
'; + return ' data-multimedia="' . rawurlencode($markup) . '" '; + } - public function keep() { - return true; - } + public function keep() { + return true; + } } class contentLink extends wsHTML5Link { - public function getHTMLContainerClass() { - return 'link contentLink'; - } + public function getHTMLContainerClass() { + return 'link contentLink'; + } } class webLink extends normalLink { - public function getURL() { - return wsHTML5Link::getUniversalLocation($this->to); - } + public function getURL() { + return wsHTML5Link::getUniversalLocation($this->to); + } - public function getTarget() { - return $this->target; - } + public function getTarget() { + return $this->target; + } - public function getTrack() { - return ' data-track="' . $this->getURL() . '"'; - } + public function getTrack() { + return ' data-track="' . $this->getURL() . '"'; + } - public function getCSS() { - - } + public function getCSS() { + + } + + public function getDefaultTooltip() { + return 'click to open the link'; + } } class mailLink extends normalLink { - public function getURL() { - return 'mailto:' . $this->to; - } + public function getURL() { + return 'mailto:' . $this->to; + } + + public function getTrack() { + return ' data-track="' . $this->to . '"'; + } - public function getTrack() { - return ' data-track="' . $this->to . '"'; - } + public function getTarget() { + return '_self'; + } - public function getTarget() { - return '_self'; - } + public function getDefaultTooltip() { + return 'click to send an e-mail'; + } } class internalLink extends normalLink { - public function getURL() { - return '#/page/' . $this->getPage(); - } + public function getURL() { + return '#/page/' . $this->getPage(); + } + + public function getPage() { + if ($this->numerotation == 'physical') { + return $this->to; + } else { + return $this->compiler->virtualToPhysical($this->to); + } + } - public function getPage() { - if ($this->numerotation == 'physical') { - return $this->to; - } else { - return $this->compiler->virtualToPhysical($this->to); - } - } + public function getDefaultTooltip() { + return 'go to page'; + } } class videoLink extends wsHTML5Link { - public function getHTMLContent() { - $this->copyExternalFile($this->to, true); - - $w = round($this->width * $this->getCssScale()); - $h = round($this->height * $this->getCssScale()); - - return self::makeVideoTag($this, $w, $h, $this->compiler); - } - - public static function makeVideoTag($linkDatas, $w = null, $h = null, $compiler = null) { - $file = $linkDatas->to; - $e = explode('.', $file); - $ext = array_pop($e); - $basename = implode('.', $e); - - $autoplay = ($linkDatas->video_auto_start ? '1' : '0'); - $controls = ($linkDatas->video_controls ? '1' : '0'); - $loop = ($linkDatas->video_loop ? '1' : '0'); - $sound = ($linkDatas->video_sound_on ? '1' : '0'); - - $res = '
book_id . '/' . $basename . '.jpg'; - $dim = getimagesize($path); - $res.='data-width="' . $dim[0] . '" data-height="' . $dim[1] . '" '; - } - $res.=' data-autoplay="' . $autoplay . '"'; - $res.=' data-controls="' . $controls . '"'; - $res.=' data-loop="' . $loop . '"'; - $res.=' data-sound="' . $sound . '"'; - $res.=' data-name="' . $basename . '"'; - $res.='>
'; - return $res; - } + public function getHTMLContent() { + $this->copyExternalFile($this->to, true); + + $w = round($this->width * $this->getCssScale()); + $h = round($this->height * $this->getCssScale()); + + return self::makeVideoTag($this, $w, $h, $this->compiler); + } + + public static function makeVideoTag($linkDatas, $w = null, $h = null, $compiler = null) { + $file = $linkDatas->to; + $e = explode('.', $file); + $ext = array_pop($e); + $basename = implode('.', $e); + + $autoplay = ($linkDatas->video_auto_start ? '1' : '0'); + $controls = ($linkDatas->video_controls ? '1' : '0'); + $loop = ($linkDatas->video_loop ? '1' : '0'); + $sound = ($linkDatas->video_sound_on ? '1' : '0'); + + $res = '
book_id . '/' . $basename . '.jpg'; + $dim = getimagesize($path); + $res.='data-width="' . $dim[0] . '" data-height="' . $dim[1] . '" '; + } + $res.=' data-autoplay="' . $autoplay . '"'; + $res.=' data-controls="' . $controls . '"'; + $res.=' data-loop="' . $loop . '"'; + $res.=' data-sound="' . $sound . '"'; + $res.=' data-name="' . $basename . '"'; + $res.='>
'; + return $res; + } } class videoPopupLink extends normalLink { - public function getURL() { - $this->copyExternalFile($this->to, true); - $file = $this->to; - $e = explode('.', $file); - $ext = array_pop($e); - $basename = implode('.', $e); + public function getURL() { + $this->copyExternalFile($this->to, true); + $file = $this->to; + $e = explode('.', $file); + $ext = array_pop($e); + $basename = implode('.', $e); - return '#/video/' . $basename; - } + return '#/video/' . $basename; + } - public function getAdditionnalContent() { - return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this, null, null, $this->compiler)) . '" '; - } + public function getAdditionnalContent() { + return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this, null, null, $this->compiler)) . '" '; + } - public function keep() { - return true; - } + public function keep() { + return true; + } + + public function getDefaultTooltip() { + return 'click to play the video'; + } } class webVideoLink extends videoLink { - public function getHTMLContent() { - return $this->getEmbed(); - } + public function getHTMLContent() { + return $this->getEmbed(); + } - public function getEmbed() { - return ''; - } + public function getEmbed() { + return ''; + } - public function getEmbedURL() { - if ($this->video_service == 0) { - $url = 'http://www.youtube.com/embed/' . $this->to . '?html5=1'; - } else { - $url = 'http://www.dailymotion.com/embed/video/' . $this->to; - } - return $url; - } + public function getEmbedURL() { + if ($this->video_service == 0) { + $url = 'http://www.youtube.com/embed/' . $this->to . '?html5=1'; + } else { + $url = 'http://www.dailymotion.com/embed/video/' . $this->to; + } + return $url; + } } class actionLink extends internalLink { - public function getURL() { - return '#/' . $this->to; - } + public function getURL() { + return '#/' . $this->to; + } } class basketLink extends contentLink { - public function getCSS() { - return 'background-color:#fff;'; - } + public function getCSS() { + return 'background-color:#fff;'; + } } class colorLink extends contentLink { - public function getCSS() { - return 'background-color:' . wsHTML5Compiler::colorToCSS($this->to) . ';'; - } + public function getCSS() { + return 'background-color:' . wsHTML5Compiler::colorToCSS($this->to) . ';'; + } } class imageLink extends contentLink { - public function getCSS() { - $this->copyExternalFile($this->to); - return 'background-image:url(' . wsHTML5Link::getUniversalLocation($this->to, true) . ');background-size:100% 100%;background-repeat:no-repeat;'; - } + public function getCSS() { + $this->copyExternalFile($this->to); + return 'background-image:url(' . wsHTML5Link::getUniversalLocation($this->to, true) . ');background-size:100% 100%;background-repeat:no-repeat;'; + } } class fileLink extends normalLink { - public function getURL() { - $this->copyExternalFile($this->to); - return wsHTML5Link::getUniversalLocation($this->to); - } + public function getURL() { + $this->copyExternalFile($this->to); + return wsHTML5Link::getUniversalLocation($this->to); + } + + public function getTarget() { + return '_blank'; + } - public function getTarget() { - return '_blank'; - } + public function getDefaultTooltip() { + return 'click to open the file'; + } } class htmlMultimediaLink extends wsHTML5Link { - protected $_config = null; - protected $_content = ''; - - public function getHTMLContent() { - if ($this->_content == '') { - $ext = files::getExtension($this->alternative); - if ($ext == 'oam') { - $d = $this->unzipFile($this->alternative, true); - $this->_config = $this->getConfigOAM($d['dir']); - } else { - $d = $this->unzipFile($this->alternative, false); - $this->_config = $this->getConfigZIP($d['dir']); - } - - $w = $this->width * $this->getCssScale(); - $h = $this->height * $this->getCssScale(); - - $iw = $this->_config['width']; - $ih = $this->_config['height']; - - $res = ''; - $this->copyExternalDir($d['dir']); - $this->_content = $res; - } - return $this->_content; - } - - protected function _correctFiles($dir) { - $files = CubeIT_Files::getRecursiveDirectoryIterator($dir); - foreach ($files as $f) { - /* @var $f SplFileInfo */ - if ($f->getExtension() == 'js') { - $this->_correctFile($f); - } - } - } - - public function getCSSContainer() { - if (!($this instanceof contentLink) && $this->page % 2 == 1) { - $this->page--; - $this->left+=$this->compiler->width; - } - - $css = '#l_' . $this->id . '{'; - $css.='left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;'; - $css.='width:' . $this->_config['width'] . 'px;height:' . $this->_config['height'] . 'px;'; - $css.=$this->getCSS(); - $css.='}'; - return $css; - } - - public function getCSS() { - $sx = ($this->width / ($this->_config['width'])) * $this->getCssScale(); - $sy = ($this->height / ($this->_config['height'])) * $this->getCssScale(); - - $res = wsHTML5Compiler::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')'); - $res.= wsHTML5Compiler::writeCSSUA('transform-origin', '0% 0%'); - return $res; - } - - public function getConfigZIP($d) { - return array('html' => 'index.html', 'width' => $this->video_width, 'height' => $this->video_height); - } - - public function getConfigOAM($d) { - $x = simplexml_load_file($d . '/config.xml'); - $config = (string) $x->oamfile['src']; - $config = str_replace('/Assets', '', $d . '/' . $config); - $x = simplexml_load_file($config, 'SimpleXMLElement', LIBXML_NOCDATA); - $c = CubeIT_Util_Xml::toObject($x); - - $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html'); - - - $res = array('content' => trim($c->content), 'name' => $c->_name, 'assets' => array()); - foreach ($c->properties->property as $p) { - if (isset($props[$p->_name])) { - $res[$props[$p->_name]] = $p->_defaultValue; - } - } - foreach ($c->require as $r) { - if ($r->_type == 'folder') { - continue; - } - $res['assets'][] = $r->_src; - } - - return $res; - } + protected $_config = null; + protected $_content = ''; + + public function getHTMLContent() { + if ($this->_content == '') { + $ext = files::getExtension($this->alternative); + if ($ext == 'oam') { + $d = $this->unzipFile($this->alternative, true); + $this->_config = $this->getConfigOAM($d['dir']); + } else { + $d = $this->unzipFile($this->alternative, false); + $this->_config = $this->getConfigZIP($d['dir']); + } + + $w = $this->width * $this->getCssScale(); + $h = $this->height * $this->getCssScale(); + + $iw = $this->_config['width']; + $ih = $this->_config['height']; + + $res = ''; + $this->copyExternalDir($d['dir']); + $this->_content = $res; + } + return $this->_content; + } + + protected function _correctFiles($dir) { + $files = CubeIT_Files::getRecursiveDirectoryIterator($dir); + foreach ($files as $f) { + /* @var $f SplFileInfo */ + if ($f->getExtension() == 'js') { + $this->_correctFile($f); + } + } + } + + public function getCSSContainer() { + if (!($this instanceof contentLink) && $this->page % 2 == 1) { + $this->page--; + $this->left+=$this->compiler->width; + } + + $css = '#l_' . $this->id . '{'; + $css.='left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;'; + $css.='width:' . $this->_config['width'] . 'px;height:' . $this->_config['height'] . 'px;'; + $css.=$this->getCSS(); + $css.='}'; + return $css; + } + + public function getCSS() { + $sx = ($this->width / ($this->_config['width'])) * $this->getCssScale(); + $sy = ($this->height / ($this->_config['height'])) * $this->getCssScale(); + + $res = wsHTML5Compiler::writeCSSUA('transform', 'scale(' . $sx . ',' . $sy . ')'); + $res.= wsHTML5Compiler::writeCSSUA('transform-origin', '0% 0%'); + return $res; + } + + public function getConfigZIP($d) { + return array('html' => 'index.html', 'width' => $this->video_width, 'height' => $this->video_height); + } + + public function getConfigOAM($d) { + $x = simplexml_load_file($d . '/config.xml'); + $config = (string) $x->oamfile['src']; + $config = str_replace('/Assets', '', $d . '/' . $config); + $x = simplexml_load_file($config, 'SimpleXMLElement', LIBXML_NOCDATA); + $c = CubeIT_Util_Xml::toObject($x); + + $props = array('default-width' => 'width', 'default-height' => 'height', 'html-page' => 'html'); + + + $res = array('content' => trim($c->content), 'name' => $c->_name, 'assets' => array()); + foreach ($c->properties->property as $p) { + if (isset($props[$p->_name])) { + $res[$props[$p->_name]] = $p->_defaultValue; + } + } + foreach ($c->require as $r) { + if ($r->_type == 'folder') { + continue; + } + $res['assets'][] = $r->_src; + } + return $res; + } } class webVideoPopupLink extends videoPopupLink { - public function getURL() { - if ($this->video_service == 0) { - $service = 'youtube'; - } elseif ($this->video_service == 1) { - $service = 'dailymotion'; - } - return '#/webvideo/' . $service . '/' . $this->to; - } + public function getURL() { + if ($this->video_service == 0) { + $service = 'youtube'; + } elseif ($this->video_service == 1) { + $service = 'dailymotion'; + } + return '#/webvideo/' . $service . '/' . $this->to; + } } class wescoLink extends normalLink { - public function getURL() { - return 'http://workshop.fluidbook.com/services/wescoRef?ref=' . $this->to; - } + public function getURL() { + return 'http://workshop.fluidbook.com/services/wescoRef?ref=' . $this->to; + } - public function getTarget() { - return '_blank'; - } + public function getTarget() { + return '_blank'; + } } class haguenauManifLink extends internalLink { - public function getPage() { - $fiches = array( - "1" => 7, "2" => 8, "3" => 14, "4" => 16, "5" => 17, "6" => 18, "7" => 19, "8" => 20, "9" => 22, "10" => 23, "11" => 24, "12" => 27 - , "13" => 29, "14" => 32, "15" => 34, "16" => 37, "17" => 38, "18" => 41, "19" => 43, - "20" => 45, "21" => 46, "22" => 52, "23" => 53, "24" => 54, "25" => 56, "26" => 59, "27" => 60 - ); - return $fiches[$this->to]; - } + public function getPage() { + $fiches = array( + "1" => 7, "2" => 8, "3" => 14, "4" => 16, "5" => 17, "6" => 18, "7" => 19, "8" => 20, "9" => 22, "10" => 23, "11" => 24, "12" => 27 + , "13" => 29, "14" => 32, "15" => 34, "16" => 37, "17" => 38, "18" => 41, "19" => 43, + "20" => 45, "21" => 46, "22" => 52, "23" => 53, "24" => 54, "25" => 56, "26" => 59, "27" => 60 + ); + return $fiches[$this->to]; + } } -- 2.39.5