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 '<div class="' . $this->getHTMLContainerClass() . '" id="l_' . $this->id . '">' . $this->getHTMLContent() . '</div>';
- }
-
- 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 '<div class="' . $this->getHTMLContainerClass() . '" id="l_' . $this->id . '">' . $this->getHTMLContent() . '</div>';
+ }
+
+ 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 '<a href="' . $this->getURL() . '" target="' . $this->getTarget() . '"' . $c . $this->getAdditionnalContent() . $this->getTrack() . '></a>';
- }
-
- 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 '<a href="' . $this->getURL() . '" target="' . $this->getTarget() . '"' . $tooltip . $c . $this->getAdditionnalContent() . $this->getTrack() . '></a>';
+ }
+
+ 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 = '<img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $w . '" height="' . $h . '" />';
- return $alt;
- }
+ public function getHTMLContent() {
+ $w = $this->width * $this->getCssScale();
+ $h = $this->height * $this->getCssScale();
+ $this->copyExternalFile($this->alternative);
+ $alt = '<img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $w . '" height="' . $h . '" />';
+ 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 = '<div class="multimediaContainer"><img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $dim[0] . '" height="' . $dim[1] . '" class="multimedia" /></div>';
- return ' data-multimedia="' . rawurlencode($markup) . '" ';
- }
+ public function getAdditionnalContent() {
+ $dim = getimagesize($this->wdir . '/' . $this->alternative);
+ $markup = '<div class="multimediaContainer"><img src="' . wsHTML5Link::getUniversalLocation($this->alternative) . '" width="' . $dim[0] . '" height="' . $dim[1] . '" class="multimedia" /></div>';
+ 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 = '<div class="videoContainer" ';
- if (!is_null($w) && !is_null($h)) {
- $res.='data-width="' . $w . '" data-height="' . $h . '" ';
- } else if (!is_null($compiler)) {
-
- $path = WS_BOOKS . '/working/' . $compiler->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.='></div>';
- 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 = '<div class="videoContainer" ';
+ if (!is_null($w) && !is_null($h)) {
+ $res.='data-width="' . $w . '" data-height="' . $h . '" ';
+ } else if (!is_null($compiler)) {
+
+ $path = WS_BOOKS . '/working/' . $compiler->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.='></div>';
+ 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 '<iframe width="' . $this->width * $this->getCssScale() . '" height="' . $this->height * $this->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
- }
+ public function getEmbed() {
+ return '<iframe width="' . $this->width * $this->getCssScale() . '" height="' . $this->height * $this->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
+ }
- 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 = '<iframe width="' . $iw . '" height="' . $ih . '" src="' . $d['fdir'] . '/' . $this->_config['html'] . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
- $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 = '<iframe width="' . $iw . '" height="' . $ih . '" src="' . $d['fdir'] . '/' . $this->_config['html'] . '" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"></iframe>';
+ $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];
+ }
}