From c94f4cc02d8f4b4ca55212e3335b16ca78b14e49 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Sat, 16 Jul 2011 15:04:18 +0000 Subject: [PATCH] --- images/ws/html5.png | Bin 0 -> 1468 bytes images/ws/macos.png | Bin 871 -> 1504 bytes inc/ws/Controlleur/class.ws.url.php | 2 +- .../html5/class.ws.packager.html5.links.php | 4 +-- .../html5/class.ws.packager.html5.php | 27 ++++++++++++++++++ 5 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 images/ws/html5.png diff --git a/images/ws/html5.png b/images/ws/html5.png new file mode 100644 index 0000000000000000000000000000000000000000..82b896830fe245289981d9219a89d6b17d825660 GIT binary patch literal 1468 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m=!WZB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%s|1+P|wiV z#N6CmN5ROz&_Lh7NZ-&%*U;R`*vQJjKmiJrfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8EkR}&8R-I5=oVMzl_XZ^<`pZ$OmImpPAEg{v+u2}(t{7puX=A(aKG z`a!A1`K3k4z=%sz23b{LXCp%sLswS= zO9NAwUYGpj(%jU%5}4i;gkDRWdO-;xw*Y9fOKMSOS!#+~QGTuh*uz$txZPrg(>$o& z6x?nx$EjBz=oo!av?4__ObD2EKuma|1#;lYJ~a=R){B6N+VgYgbOr_{BTpB{kcwMV zf=_3OIEvVYUcLO%=9s%o4~q(SCu2CXQlY9_pnxlD_&=9x>o#%i2n{ee-H><0_sR-J z$16EL4ikSUbP0C$^{1#MpHKN^7#n+U)jTy@$5xR$uhy-r_M2<<-7MH^VM$tseS>38 z?vcOW#pR>c9_2X7n^U`C%7fW6J$t)m9g+RdK9RZQ!g^ENr7ZK zON`uKCcdtElo=j4CFI3nDTyQNHgcBC-^CI6ud`#F$}jc<)#c9XrgSK%>``2?ZT5=L z6C8^!w4a-}`Grl9RIIw5gtKcRzs{@v2Tye_^dx9)d&%|dwRM{HlRr$Wt{;0KW5t#J zBSPu?+68s*)&4x^7c$-{D3=rV;N`pEDHmq!H$i-eG(pHau>E$9tu6{1-oD!M<5L6=u literal 0 HcmV?d00001 diff --git a/images/ws/macos.png b/images/ws/macos.png index a8577d79fdea54751e5d5f82f2ba16a11896a5c2..d184cfe81935e05c1e15c032cdb1781581511298 100644 GIT binary patch literal 1504 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`k|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+m=!WZB1$5BeXNr6bM+EIYV;~{3xK*A7;Nk-3KEmEQ%e+* zQqwc@Y?a>c-mj#PnPRIHZt82`Ti~3Uk?B!Ylp0*+7m{3+ootz+WN)WnQ(*-(AUCxn zQK2F?C$HG5!d3}vt`(3C64qBz04piUwpD^SD#ABF!8yMuRl!uxKsVXI%s|1+P|wiV z#N6CmN5ROz&_Lh7NZ-&%*U;R`*vQJjKmiJrfVLH-q*(>IxIyg#@@$ndN=gc>^!3Zj z%k|2Q_413-^$jg8EkR}&8R-I5=oVMzl_XZ^<`pZ$OmImpPAEg{v+u2}(t{7puX=A(aKG z`a!A1`K3k4z=%sz23b{L$o& z6x?nx#Hm*w=oo!av?4__ObD2EKuma|1#;lYJ~a=R){B6Nx^BYLrwj~CVV*9IAr-f3 zg1xh&0tMvm^NXzQ&U10`C{aANz{xSku!DQ4){;l@8h1r=7UprqwghOjay5nDpNX|Z*OsRJF_yxtF5`NiGknPLv8Xsx5bP~6FJ^RE15MqY|t&; z8r2w~!?ymq^yHH%^Cg_mq-~Z?zPW% z50YXG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=> 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) . ';'; -- 2.39.5