From: vincent@cubedesigners.com Date: Thu, 14 Jul 2011 10:29:23 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=22849b75aea3483057c07745220395d251576128;p=cubeextranet.git --- diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php index 7ba0c2a7f..71013df06 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.links.php @@ -26,15 +26,15 @@ class wsPackagerHTML5Link { public $packager; public static function getInstance($id, $init, &$packager) { - switch ($init->link) { + switch ($init['type']) { case 1: case 2: return new webLink($id, $init, $packager); case 3: return new mailLink($id, $init, $packager); - case 4: - return new internalLink($id, $init, $packager); case 5: + return new internalLink($id, $init, $packager); + case 4: return new videoLink($id, $init, $packager); case 6: case 7: @@ -61,15 +61,15 @@ class wsPackagerHTML5Link { } public function __construct($id, $init, &$packager) { - $this->id = $id; - $this->packager = $packager; foreach ($init as $k => $v) { $this->$k = $v; } + $this->id = $id; + $this->packager = $packager; } public function getHTMLContainer() { - return '
' . $this->getHTMLContent() . '
'; + return ''; } public function getHTMLContent() { @@ -77,7 +77,20 @@ class wsPackagerHTML5Link { } public function copyExternalFile($file) { - $packager->copyLinkFile($file, 'data/links/'); + $this->packager->copyLinkFile($file, 'data/links/'); + } + + public function getCSSContainer() { + $css = '#link' . $this->id . '{'; + $css.='left:' . $this->left . 'px;top:' . $this->top . 'px;'; + $css.='width:' . $this->width . 'px;height:' . $this->height . 'px;'; + $css.=$this->getCSS(); + $css.='}'; + return $css; + } + + public function getCSS() { + return 'border:1px dotter #ff0000;'; } public static function getUniversalLocation($loc) { @@ -107,18 +120,6 @@ class normalLink extends wsPackagerHTML5Link { return '_self'; } - public function getCSSContainer() { - $css = '#l' . $this->id . '{'; - $css.='left:' . $this->left . 'px;top:' . $this->top . 'px;'; - $css.='width:' . $this->width . 'px;height:' . $this->height . 'px;'; - $css.=$this->getCSS(); - $css.='}'; - } - - public function getCSS() { - - } - } class contentLink extends wsPackagerHTML5Link { @@ -159,6 +160,10 @@ class internalLink extends normalLink { return '#/pages/' . $this->getPage(); } + public function getPage() { + return $this->to; + } + } class videoLink extends wsPackagerHTML5Link { @@ -178,7 +183,7 @@ class videoLink extends wsPackagerHTML5Link { $ext = array_pop($e); $basename = implode('.', $e); - $videos = array('mp4' => 'video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'', 'ogv' => 'video/ogg; codecs="theora, vorbis'); + $types = array('mp4' => 'video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'', 'ogv' => 'video/ogg; codecs=\'theora, vorbis\''); foreach ($types as $ext => $type) { $res.=''; $this->copyExternalFile($basename . '.' . $ext); diff --git a/inc/ws/Util/packager/html5/class.ws.packager.html5.php b/inc/ws/Util/packager/html5/class.ws.packager.html5.php index 3c5f8a2af..996c509c4 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.php @@ -59,14 +59,15 @@ class wsPackagerHTML5 extends wsPackager { mkdir($this->vdir . '/data/contents', 0777, true); mkdir($this->vdir . '/data/background', 0777, true); mkdir($this->vdir . '/data/style', 0777, true); + mkdir($this->vdir . '/data/links/pages', 0777, true); foreach ($this->div as $n => $page) { file_put_contents($this->vdir . '/data/contents/p' . $n . '.html', $this->writePage($page)); } $this->writeFonts(); $this->writeImages(); - $this->writeLinks(); - $this->writeCSS($this->vdir . '/data/style/style_%d.css'); + $linksCSS = $this->writeLinks(); + $this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS); file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig()); } @@ -77,10 +78,25 @@ class wsPackagerHTML5 extends wsPackager { $daoDoc->getLinksAndRulers($this->book_id, $links, $rulers); $i = 0; + $pages = array(); + $css = array(); foreach ($links as $linkData) { $link = wsPackagerHTML5Link::getInstance($this->base62($i), $linkData, $this); + if (is_null($link)) { + continue; + } + if (!isset($pages[$link->page])) { + $pages[$link->page] = ''; + } + $pages[$link->page] .= $link->getHTMLContainer(); + $css[] = $link->getCSSContainer(); $i++; } + + foreach ($pages as $n => $c) { + file_put_contents($this->vdir . '/data/links/pages/p' . $n . '.html', $c); + } + return $css; } protected function writeConfig() { @@ -212,7 +228,7 @@ class wsPackagerHTML5 extends wsPackager { return self::escapeHTML($span['text']); } - protected function writeCSS($file) { + protected function writeCSS($file, $links) { $res = array(); // General theme @@ -224,7 +240,7 @@ class wsPackagerHTML5 extends wsPackager { $navTop = ($this->book->parametres->height - 40 - 100) / 2; - $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; + $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}'; foreach (self::$resolutions as $r) { $ratio = 72 / $r; @@ -339,6 +355,9 @@ class wsPackagerHTML5 extends wsPackager { $res[] = '#shadow{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}'; } + // Links Styles + $res = array_merge($res, $links); + // Pages styles foreach ($this->cssColor as $color => $index) { $res[] = '.c' . $index . '{color:#' . $color . '}';