From: vincent@cubedesigners.com Date: Sat, 16 Jul 2011 15:04:18 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c94f4cc02d8f4b4ca55212e3335b16ca78b14e49;p=cubeextranet.git --- diff --git a/images/ws/html5.png b/images/ws/html5.png new file mode 100644 index 000000000..82b896830 Binary files /dev/null and b/images/ws/html5.png differ diff --git a/images/ws/macos.png b/images/ws/macos.png index a8577d79f..d184cfe81 100644 Binary files a/images/ws/macos.png and b/images/ws/macos.png differ diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 78e1e3093..86074070c 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -158,7 +158,7 @@ class wsUrl { $versions['mac-exe'] = array('title' => __('Version offline') . ' - ' . __('Exécutable Mac OS X'), 'icon' => cubeMedia::image(IMG . '/macos.png')); $versions['win-cd'] = array('title' => __('Version offline') . ' - ' . __('CD-ROM') . ' / ' . __('Clé USB'), 'icon' => cubeMedia::silk('cd.png')); if (wsDroits::admin()) { - $versions['html5'] = array('title' => __('Version HTML5 (α)'), 'icon' => cubeMedia::silk('page_white_world.png')); + $versions['html5'] = array('title' => __('Version HTML5 (α)'), 'icon' => cubeMedia::image(IMG . '/html5.png')); } $res = '
'; 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 22aff77f2..3a5c15199 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 @@ -184,7 +184,7 @@ class internalLink extends normalLink { if ($this->numerotation == 'physical') { return $this->to; } else { - return $this->to; + return $this->packager->virtualToPhysical($this->to); } } @@ -242,7 +242,7 @@ class webVideoLink extends videoLink { public function getEmbedURL() { if ($this->video_service == 0) { - $url = 'http://www.youtube.com/embed/' . $this->to .'?html5=1'; + $url = 'http://www.youtube.com/embed/' . $this->to . '?html5=1'; } else { $url = 'http://www.dailymotion.com/embed/video/' . $this->to; } 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 a6cdfed86..450373e54 100644 --- a/inc/ws/Util/packager/html5/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/html5/class.ws.packager.html5.php @@ -16,6 +16,7 @@ class wsPackagerHTML5 extends wsPackager { protected $scale; protected $multiply; protected $div = array(); + protected $numerotation; protected static $resolutions = array(36, 72, 150); protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); @@ -38,6 +39,7 @@ class wsPackagerHTML5 extends wsPackager { $this->pdf2htmlRatio = $imagesize[0] / $this->layouts[1]['width']; $this->scale = 4; $this->multiply = $this->pdf2htmlRatio * $this->scale; + $this->numerotation = explode(',', $this->book->numerotation); $this->createHTML(); } @@ -47,6 +49,14 @@ class wsPackagerHTML5 extends wsPackager { return $this->zip(); } + public function virtualToPhysical($virtual) { + if (!in_array($virtual, $this->numerotation)) { + return 1; + } + $p = array_search($virtual, $this->numerotation); + return $p + 1; + } + protected function createHTML() { foreach ($this->layouts as $page => $layout) { $this->div[$page] = array(); @@ -61,6 +71,7 @@ class wsPackagerHTML5 extends wsPackager { mkdir($this->vdir . '/data/thumbnails', 0777, true); mkdir($this->vdir . '/data/style', 0777, true); mkdir($this->vdir . '/data/links/pages', 0777, true); + mkdir($this->vdir . '/data/l10n/', 0777, true); foreach ($this->div as $n => $page) { file_put_contents($this->vdir . '/data/contents/p' . $n . '.html', $this->writePage($page)); @@ -69,10 +80,25 @@ class wsPackagerHTML5 extends wsPackager { $this->writeImages(); $linksCSS = $this->writeLinks(); $this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS); + $this->writeLangs(); file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig()); } + protected function writeLangs() { + global $core; + $daoLang = new wsDAOLang($core->con); + $lang = $daoLang->selectById($this->book->lang); + $langs = $daoLang->selectAll(); + + + $traductions = (!count($this->book->traductions)) ? $lang->traductions : $this->book->traductions; + file_put_contents($this->vdir . '/data/l10n/default.json', json_encode($traductions)); + foreach ($langs as $lang) { + file_put_contents($this->vdir . '/data/l10n/' . $lang->lang_id . '.json', json_encode($lang->traductions)); + } + } + protected function writeLinks() { global $core; $daoDoc = new wsDAODocument($core->con); @@ -106,6 +132,7 @@ class wsPackagerHTML5 extends wsPackager { protected function writeConfig() { $config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject()); + $config->numerotation = explode(',', $this->book->numerotation); $config->id = $this->book->book_id; $config->cacheDate = TIME; return 'DATAS=' . json_encode($config) . ';';