]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 20 Jan 2014 13:14:31 +0000 (13:14 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 20 Jan 2014 13:14:31 +0000 (13:14 +0000)
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/packager/class.ws.packager.html.php

index bd263961dcc84e22de49e186f5c5b6837dbb6fcf..5cd60abcfa7f4964ccbecc00458a0891759dc170 100644 (file)
@@ -1476,9 +1476,6 @@ class wsDAOBook extends commonDAO {
                $originalPDF = $cacheDir . '/original.pdf';
                $compressedPDF = $cacheDir . '/compressed.pdf';
 
-
-
-
                if (file_exists($originalPDF)) {
                        $fmtime = filemtime($originalPDF);
                        if ($fmtime >= $book->composition_update) {
index f741d3a6c3fad318300cee7c8433594f9e955046..36084f9c8fbf70d8f2a4bda2a5e70e4ee43f3eca 100644 (file)
-<?php\r
-\r
-class wsPackagerHTML extends wsPackager {\r
-\r
-       protected $origHTML;\r
-       protected $_labels = array();\r
-\r
-       public function __construct($book_id, $vdir = null, $whole = true) {\r
-               parent::__construct($book_id, $vdir, $whole);\r
-               $this->version = 'html';\r
-       }\r
-\r
-       protected function getMinFlashVersion() {\r
-               return '10.0.22';\r
-       }\r
-\r
-       protected function getSWFFiles() {\r
-               return array('index.swf', 'player.swf');\r
-       }\r
-\r
-       protected function preparePackage() {\r
-               parent::preparePackage();\r
-\r
-               if ($this->book->parametres->offlineExport && $this->book->parametres->pdfComplex) {\r
-                       $versions = array('win-ins' => 'exe', 'mac-exe' => 'zip');\r
-                       foreach ($versions as $v => $ext) {\r
-                               $a = wsPackager::package($this->book_id, $v);\r
-                               rename(ROOT . $a, $this->vdir . '/data/document.' . $ext);\r
-                       }\r
-               }\r
-\r
-               $this->copyFluidbookFiles();\r
-               $this->mergeJavascript();\r
-\r
-               $others = array('fluidbook.js', 'getflash.gif', 'index.html', 'style.css');\r
-               $others = array_merge($others, $this->getSWFFiles());\r
-\r
-               $this->copyOtherFiles($others);\r
-\r
-               if (!file_exists($this->vdir . '/pages')) {\r
-                       mkdir($this->vdir . '/pages/', 0777, true);\r
-               }\r
-\r
-               $ga = '';\r
-               if ($this->book->parametres->googleAnalyticsCustom) {\r
-                       $ga = $this->book->parametres->googleAnalyticsCustom;\r
-               } elseif ($this->book->parametres->googleAnalytics != '') {\r
-                       $variables = array('Language' => array('value' => 'getLang()', 'valueAsJS' => true, 'scope' => 2));\r
-                       $ga = cubePage::googleAnalytics(explode(',', $this->book->parametres->googleAnalytics), true, $variables);\r
-               }\r
-\r
-               $facebook = '';\r
-               if ($this->book->parametres->facebook) {\r
-                       if ($this->book->parametres->facebook_title != '') {\r
-                               $facebook .= '<meta property="og:title" content="' . self::escape($this->book->parametres->facebook_title) . '" />';\r
-                       } else {\r
-                               $facebook .= '<meta property="og:title" content="' . self::escape($this->book->parametres->title) . '" />';\r
-                       }\r
-                       if ($this->book->parametres->facebook_description != '') {\r
-                               $facebook .= '<meta property="og:description" content="' . self::escape($this->book->parametres->facebook_description) . '" />';\r
-                       }\r
-                       $facebook .= '<meta property="og:image" content="http://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book->book_id . '" />';\r
-               }\r
-\r
-               $favicon = '';\r
-\r
-               if ($this->theme->parametres->favicon != '') {\r
-                       $favicon = '<link rel="shortcut icon" href="data/fluidbook.ico">';\r
-               }\r
-\r
-               $redirectPDF = 'redirectPDF();';\r
-               if ($this->book->parametres->mobileVersion == 'pdf') {\r
-                       $redirectMobile = $redirectPDF;\r
-               } else {\r
-                       $redirectMobile = 'redirectMobile();';\r
-                       $this->prepareHTML5();\r
-               }\r
-\r
-               $seoVersion = true;\r
-               if (isset($this->book->parametres->seoVersion)) {\r
-                       $seoVersion = $this->book->parametres->seoVersion;\r
-               }\r
-\r
-               $seoRobot = true;\r
-               if (isset($this->book->parametres->seoRobot)) {\r
-                       $seoRobot = $this->book->parametres->seoRobot;\r
-               }\r
-\r
-               $robots = '';\r
-               if (!$seoRobot) {\r
-                       $robots = '<meta name="robots" content="noindex, nofollow">';\r
-               }\r
-\r
-               $description = '';\r
-               if ($this->book->parametres->seoDescription) {\r
-                       $description = '<meta name="description" content="' . self::escape($this->book->parametres->seoDescription) . '">';\r
-               }\r
-               $keywords = '';\r
-               if ($this->book->parametres->seoKeywords) {\r
-                       $keywords = '<meta name="keywords" content="' . self::escape($this->book->parametres->seoKeywords) . '">';\r
-               }\r
-\r
-               $alwaysHTML5 = $this->book->parametres->alwaysHTML5;\r
-               if (is_null($alwaysHTML5) || !$alwaysHTML5) {\r
-                       $alwaysHTML5 = 'false';\r
-               }\r
-\r
-               // Stuffs to replace in html\r
-               $toReplace = array('lang' => strtolower($this->book->lang),\r
-                       'ga' => $ga,\r
-                       'facebook' => $facebook,\r
-                       'bgcolor' => $this->theme->parametres->loadingBackColor,\r
-                       'redirectMobile' => $redirectMobile,\r
-                       'redirectPDF' => $redirectPDF,\r
-                       'junk' => TIME,\r
-                       'description' => $description,\r
-                       'robots' => $robots,\r
-                       'favicon' => $favicon,\r
-                       'flashversion' => $this->getMinFlashVersion(),\r
-                       'fv' => json_encode($this->getFlashvars()),\r
-                       'alwaysHTML5' => $alwaysHTML5,\r
-                       'keywords' => $keywords);\r
-\r
-\r
-\r
-               $this->origHTML = file_get_contents($this->vdir . '/index.html');\r
-               $this->origHTML = $this->replaceHTML($toReplace);\r
-\r
-               $nav1 = $this->makeHTMLNav(true);\r
-               $nav = $this->makeHTMLNav(false);\r
-               $footer = $this->makeHTMLFooter();\r
-\r
-               fb(time(), 'end prepare constant parts of seo');\r
-\r
-               foreach ($this->pages as $page => $infos) {\r
-                       $pathToIndex = 'index.swf';\r
-                       $pathToGetflash = 'getflash.gif';\r
-                       $redirectScript = '';\r
-                       if ($page == 1) {\r
-                               $dest = 'index.html';\r
-                               $title = $this->book->parametres->title;\r
-                               $sp = '';\r
-                       } else {\r
-                               $label = $this->_getLabelOfPage($page);\r
-                               $title = $label . ' - ' . $this->book->parametres->title;\r
-                               $dest = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
-                               $pathToIndex = '../index.swf';\r
-                               $pathToGetflash = '../getflash.gif';\r
-                               $sp = '../';\r
-                               $redirectScript = '<script type="text/javascript">window.location=\'../index.html#/' . $page . '\';</script>';\r
-                       }\r
-                       $alt = '';\r
-\r
-                       $htmlfile = WS_DOCS . '/' . $infos['document_id'] . '/h' . $infos['document_page'] . '.txt';\r
-\r
-                       if ($seoVersion && file_exists($htmlfile)) {\r
-                               $html = file_get_contents($htmlfile);\r
-                               $alt .= "\n" . $html . "\n";\r
-\r
-\r
-                               if ($page == 1) {\r
-                                       $alt .= $nav1;\r
-                               } else {\r
-                                       $alt .= $nav;\r
-                               }\r
-                       }\r
-\r
-\r
-                       $alt .= $footer;\r
-\r
-                       $data = str_replace('$alt', $alt, $this->origHTML);\r
-                       $data = str_replace('$pathToIndex', $pathToIndex, $data);\r
-                       $data = str_replace('$title', $this->escape($title), $data);\r
-                       $data = str_replace('$pathToGetflash', $pathToGetflash, $data);\r
-                       $data = str_replace('$redirectScript', $redirectScript, $data);\r
-                       $data = str_replace('$sp', $sp, $data);\r
-\r
-                       file_put_contents($this->vdir . $dest, $data);\r
-\r
-                       if (!$seoVersion) {\r
-                               break;\r
-                       }\r
-               }\r
-\r
-               fb(time(), 'end prepare seo');\r
-       }\r
-\r
-       protected function getFlashvars() {\r
-               return array();\r
-       }\r
-\r
-       public function prepareHTML5() {\r
-               fb(time(), 'start prepare html5');\r
-               if (!$this->whole) {\r
-                       return;\r
-               }\r
-\r
-               $this->daoBook->compile($this->book_id, 'html5');\r
-\r
-               $dest = $this->vdir . 'm';\r
-               if (!file_exists($dest)) {\r
-                       mkdir($dest, 0777, true);\r
-               }\r
-\r
-               $cp = new cubeCommandLine('cp');\r
-               $cp->setPath(CONVERTER_PATH);\r
-               $cp->setArg('r');\r
-               $cp->setArg('p');\r
-               $cp->setArg(null, WS_BOOKS . '/html5/' . $this->book_id . '/*');\r
-               $cp->setArg(null, $dest);\r
-               $cp->execute();\r
-\r
-               $filesToAdd = array();\r
-               if ($this->book->parametres->mobileServerConfig) {\r
-                       $filesToAdd = array('.htaccess', 'web.config');\r
-               }\r
-               foreach ($filesToAdd as $f) {\r
-                       $this->copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);\r
-               }\r
-\r
-               $filesToDelete = array('indext.html', 'indexu.html');\r
-               if ($this->book->parametres->mobileVersion == 'html5') {\r
-                       $filesToDelete[] = 'data/background/*/t*.jpg';\r
-                       $filesToDelete[] = 'data/background/contents/p*.html';\r
-               } else {\r
-                       $filesToDelete[] = 'data/background/*/p*.jpg';\r
-                       $filesToDelete[] = 'data/contents/p*.svg';\r
-               }\r
-               $rm = new cubeCommandLine('rm');\r
-               $rm->setPath(CONVERTER_PATH);\r
-               foreach ($filesToDelete as $f) {\r
-                       $rm->setArg(null, $dest . '/' . $f);\r
-               }\r
-               $rm->execute();\r
-               fb(time(), 'end prepare html5');\r
-       }\r
-\r
-       public function makePackage($zip) {\r
-               parent::makePackage($zip);\r
-               if ($zip) {\r
-                       return $this->zip();\r
-               }\r
-               return $this->vdir;\r
-       }\r
-\r
-       protected function makeHTMLNav($root) {\r
-               $res = '<nav>';\r
-               foreach ($this->pages as $page => $infos) {\r
-                       $label = $this->_getLabelOfPage($page);\r
-                       if ($page == 1) {\r
-                               if ($root) {\r
-                                       $url = 'index.html';\r
-                               } else {\r
-                                       $url = '../index.html';\r
-                               }\r
-                       } else {\r
-                               if ($root) {\r
-                                       $url = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
-                               } else {\r
-                                       $url = $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
-                               }\r
-                       }\r
-                       $res .= '<a href="' . $url . '">' . $label . '</a>';\r
-               }\r
-               $res .= '</nav>';\r
-               return $res;\r
-       }\r
-\r
-       protected function _getLabelOfPage($page) {\r
-               if (!isset($this->_chapters)) {\r
-                       $this->_chapters = $this->book->chapters;\r
-               }\r
-\r
-\r
-               if (isset($this->_labels[$page])) {\r
-                       return $this->_labels[$page];\r
-               }\r
-\r
-\r
-               if ($page == 1) {\r
-                       $this->_labels[1] = $this->book->parametres->title;\r
-\r
-                       return $this->_labels[1];\r
-               }\r
-\r
-\r
-               $virtual = $this->_getVirtualPage($page);\r
-\r
-               $candidates = array();\r
-               foreach ($this->_chapters as $c) {\r
-                       if ($c->page == $virtual) {\r
-                               $candidates[] = $c;\r
-                       }\r
-               }\r
-               if (!count($candidates)) {\r
-                       $this->_labels[$page] = $this->_getLabelOfPage($page - 1);\r
-                       return $this->_labels[$page];\r
-               }\r
-\r
-               usort($candidates, array($this, '_sortCandidates'));\r
-               $c = array_shift($candidates);\r
-\r
-               $this->_labels[$page] = $c->label;\r
-               return $this->_labels[$page];\r
-       }\r
-\r
-       protected function _sortCandidates($a, $b) {\r
-               if ($a->level > $b->level) {\r
-                       return 1;\r
-               } else if ($a->level < $b->level) {\r
-                       return -1;\r
-               } else {\r
-                       return 0;\r
-               }\r
-       }\r
-\r
-       protected function _getVirtualPage($page) {\r
-               $num = explode(',', $this->book->numerotation);\r
-               if (isset($num[$page - 1])) {\r
-                       return $num[$page - 1];\r
-               }\r
-               return 1;\r
-       }\r
-\r
-       protected function escape($txt) {\r
-               return htmlentities($txt, ENT_COMPAT, 'UTF-8');\r
-       }\r
-\r
-       protected function makeHTMLFooter() {\r
-               $res = '<footer>';\r
-               $res .= '<h2><a href="http://www.fluidbook.com">Fluidbook : Solution de catalogues interactifs et brochures en ligne</a></h2>';\r
-               $res .= '</footer>';\r
-               return $res;\r
-       }\r
-\r
-       protected function replaceHTML($toReplace) {\r
-               return $this->replaceContents($this->origHTML, $toReplace);\r
-       }\r
-\r
-       protected function mergeJavascript() {\r
-               $dest = WS_COMPILE_ASSETS . '/fluidbook.js';\r
-               $orig = WS_COMPILE_ASSETS . '/_js/';\r
-               $files = array('swfobject.js' => false, 'swfaddress.js' => true, 'fluidbook.js' => true);\r
-\r
-               $refresh = false;\r
-               if (file_exists($dest)) {\r
-                       $mtime = filemtime($dest);\r
-                       foreach ($files as $file => $min) {\r
-                               if (filemtime($orig . $file) > $mtime) {\r
-                                       $refresh = true;\r
-                                       break;\r
-                               }\r
-                       }\r
-               } else {\r
-                       $refresh = true;\r
-               }\r
-               if (!$refresh) {\r
-                       return;\r
-               }\r
-\r
-               $minjs = "\n\n";\r
-               foreach ($files as $file => $min) {\r
-                       $c = file_get_contents($orig . $file);\r
-                       if ($min) {\r
-                               $c = JSMin::minify($c);\r
-                       }\r
-\r
-                       $minjs .= $c . "\n\n";\r
-               }\r
-               file_put_contents($dest, $minjs);\r
-       }\r
-\r
-}\r
-\r
+<?php
+
+class wsPackagerHTML extends wsPackager {
+
+       protected $origHTML;
+       protected $_labels = array();
+
+       public function __construct($book_id, $vdir = null, $whole = true) {
+               parent::__construct($book_id, $vdir, $whole);
+               $this->version = 'html';
+       }
+
+       protected function getMinFlashVersion() {
+               return '10.0.22';
+       }
+
+       protected function getSWFFiles() {
+               return array('index.swf', 'player.swf');
+       }
+
+       protected function preparePackage() {
+               parent::preparePackage();
+
+               if ($this->book->parametres->offlineExport && $this->book->parametres->pdfComplex) {
+                       $versions = array('win-ins' => 'exe', 'mac-exe' => 'zip');
+                       foreach ($versions as $v => $ext) {
+                               $a = wsPackager::package($this->book_id, $v);
+                               rename(ROOT . $a, $this->vdir . '/data/document.' . $ext);
+                       }
+               }
+
+               $this->copyFluidbookFiles();
+               $this->mergeJavascript();
+
+               $others = array('fluidbook.js', 'getflash.gif', 'index.html', 'style.css');
+               $others = array_merge($others, $this->getSWFFiles());
+
+               $this->copyOtherFiles($others);
+
+               if (!file_exists($this->vdir . '/pages')) {
+                       mkdir($this->vdir . '/pages/', 0777, true);
+               }
+
+               $ga = '';
+               if ($this->book->parametres->googleAnalyticsCustom) {
+                       $ga = $this->book->parametres->googleAnalyticsCustom;
+               } elseif ($this->book->parametres->googleAnalytics != '') {
+                       $variables = array('Language' => array('value' => 'getLang()', 'valueAsJS' => true, 'scope' => 2));
+                       $ga = cubePage::googleAnalytics(explode(',', $this->book->parametres->googleAnalytics), true, $variables);
+               }
+
+               $facebook = '';
+               if ($this->book->parametres->facebook) {
+                       if ($this->book->parametres->facebook_title != '') {
+                               $facebook .= '<meta property="og:title" content="' . self::escape($this->book->parametres->facebook_title) . '" />';
+                       } else {
+                               $facebook .= '<meta property="og:title" content="' . self::escape($this->book->parametres->title) . '" />';
+                       }
+                       if ($this->book->parametres->facebook_description != '') {
+                               $facebook .= '<meta property="og:description" content="' . self::escape($this->book->parametres->facebook_description) . '" />';
+                       }
+                       $facebook .= '<meta property="og:image" content="http://workshop.fluidbook.com/services/facebook_thumbnail?id=' . $this->book->book_id . '" />';
+               }
+
+               $favicon = '';
+
+               if ($this->theme->parametres->favicon != '') {
+                       $favicon = '<link rel="shortcut icon" href="data/fluidbook.ico">';
+               }
+
+               $redirectPDF = 'redirectPDF();';
+               if ($this->book->parametres->mobileVersion == 'pdf') {
+                       $redirectMobile = $redirectPDF;
+               } else {
+                       $redirectMobile = 'redirectMobile();';
+                       $this->prepareHTML5();
+               }
+
+               $seoVersion = true;
+               if (isset($this->book->parametres->seoVersion)) {
+                       $seoVersion = $this->book->parametres->seoVersion;
+               }
+
+               $seoRobot = true;
+               if (isset($this->book->parametres->seoRobot)) {
+                       $seoRobot = $this->book->parametres->seoRobot;
+               }
+
+               $robots = '';
+               if (!$seoRobot) {
+                       $robots = '<meta name="robots" content="noindex, nofollow">';
+               }
+
+               $description = '';
+               if ($this->book->parametres->seoDescription) {
+                       $description = '<meta name="description" content="' . self::escape($this->book->parametres->seoDescription) . '">';
+               }
+               $keywords = '';
+               if ($this->book->parametres->seoKeywords) {
+                       $keywords = '<meta name="keywords" content="' . self::escape($this->book->parametres->seoKeywords) . '">';
+               }
+
+               $alwaysHTML5 = $this->book->parametres->alwaysHTML5;
+               if (is_null($alwaysHTML5) || !$alwaysHTML5) {
+                       $alwaysHTML5 = 'false';
+               }
+
+               // Stuffs to replace in html
+               $toReplace = array('lang' => strtolower($this->book->lang),
+                       'ga' => $ga,
+                       'facebook' => $facebook,
+                       'bgcolor' => $this->theme->parametres->loadingBackColor,
+                       'redirectMobile' => $redirectMobile,
+                       'redirectPDF' => $redirectPDF,
+                       'junk' => TIME,
+                       'description' => $description,
+                       'robots' => $robots,
+                       'favicon' => $favicon,
+                       'flashversion' => $this->getMinFlashVersion(),
+                       'fv' => json_encode($this->getFlashvars()),
+                       'alwaysHTML5' => $alwaysHTML5,
+                       'keywords' => $keywords);
+
+
+
+               $this->origHTML = file_get_contents($this->vdir . '/index.html');
+               $this->origHTML = $this->replaceHTML($toReplace);
+
+               $nav1 = $this->makeHTMLNav(true);
+               $nav = $this->makeHTMLNav(false);
+               $footer = $this->makeHTMLFooter();
+
+               fb(time(), 'end prepare constant parts of seo');
+
+               foreach ($this->pages as $page => $infos) {
+                       $pathToIndex = 'index.swf';
+                       $pathToGetflash = 'getflash.gif';
+                       $redirectScript = '';
+                       if ($page == 1) {
+                               $dest = 'index.html';
+                               $title = $this->book->parametres->title;
+                               $sp = '';
+                       } else {
+                               $label = $this->_getLabelOfPage($page);
+                               $title = $label . ' - ' . $this->book->parametres->title;
+                               $dest = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';
+                               $pathToIndex = '../index.swf';
+                               $pathToGetflash = '../getflash.gif';
+                               $sp = '../';
+                               $redirectScript = '<script type="text/javascript">window.location=\'../index.html#/' . $page . '\';</script>';
+                       }
+                       $alt = '';
+
+                       $htmlfile = WS_DOCS . '/' . $infos['document_id'] . '/h' . $infos['document_page'] . '.txt';
+
+                       if ($seoVersion && file_exists($htmlfile)) {
+                               $html = file_get_contents($htmlfile);
+                               $alt .= "\n" . $html . "\n";
+
+
+                               if ($page == 1) {
+                                       $alt .= $nav1;
+                               } else {
+                                       $alt .= $nav;
+                               }
+                       }
+
+
+                       $alt .= $footer;
+
+                       $data = str_replace('$alt', $alt, $this->origHTML);
+                       $data = str_replace('$pathToIndex', $pathToIndex, $data);
+                       $data = str_replace('$title', $this->escape($title), $data);
+                       $data = str_replace('$pathToGetflash', $pathToGetflash, $data);
+                       $data = str_replace('$redirectScript', $redirectScript, $data);
+                       $data = str_replace('$sp', $sp, $data);
+
+                       file_put_contents($this->vdir . $dest, $data);
+
+                       if (!$seoVersion) {
+                               break;
+                       }
+               }
+
+               fb(time(), 'end prepare seo');
+       }
+
+       protected function getFlashvars() {
+               return array();
+       }
+
+       public function prepareHTML5() {
+               fb(time(), 'start prepare html5');
+               if (!$this->whole) {
+                       return;
+               }
+
+               $this->daoBook->compile($this->book_id, 'html5');
+
+               $dest = $this->vdir . 'm';
+               if (!file_exists($dest)) {
+                       mkdir($dest, 0777, true);
+               }
+
+               $cp = new cubeCommandLine('cp');
+               $cp->setPath(CONVERTER_PATH);
+               $cp->setArg('r');
+               $cp->setArg('p');
+               $cp->setArg(null, WS_BOOKS . '/html5/' . $this->book_id . '/*');
+               $cp->setArg(null, $dest);
+               $cp->execute();
+
+               $filesToAdd = array();
+               if ($this->book->parametres->mobileServerConfig) {
+                       $filesToAdd = array('.htaccess', 'web.config');
+               }
+               foreach ($filesToAdd as $f) {
+                       $this->copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);
+               }
+
+               $filesToDelete = array('indext.html', 'indexu.html');
+               if ($this->book->parametres->mobileVersion == 'html5') {
+                       $filesToDelete[] = 'data/background/*/t*.jpg';
+                       $filesToDelete[] = 'data/background/contents/p*.html';
+               } else {
+                       $filesToDelete[] = 'data/background/*/p*.jpg';
+                       $filesToDelete[] = 'data/contents/p*.svg';
+               }
+               $rm = new cubeCommandLine('rm');
+               $rm->setPath(CONVERTER_PATH);
+               foreach ($filesToDelete as $f) {
+                       $rm->setArg(null, $dest . '/' . $f);
+               }
+               $rm->execute();
+               fb(time(), 'end prepare html5');
+       }
+
+       public function makePackage($zip) {
+               parent::makePackage($zip);
+               if ($zip) {
+                       return $this->zip();
+               }
+               return $this->vdir;
+       }
+
+       protected function makeHTMLNav($root) {
+               $res = '<nav>';
+               foreach ($this->pages as $page => $infos) {
+                       $label = $this->_getLabelOfPage($page);
+                       if ($page == 1) {
+                               if ($root) {
+                                       $url = 'index.html';
+                               } else {
+                                       $url = '../index.html';
+                               }
+                       } else {
+                               if ($root) {
+                                       $url = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';
+                               } else {
+                                       $url = $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';
+                               }
+                       }
+                       $res .= '<a href="' . $url . '">' . $label . '</a>';
+               }
+               $res .= '</nav>';
+               return $res;
+       }
+
+       protected function _getLabelOfPage($page) {
+               if (!isset($this->_chapters)) {
+                       $this->_chapters = $this->book->chapters;
+               }
+
+
+               if (isset($this->_labels[$page])) {
+                       return $this->_labels[$page];
+               }
+
+
+               if ($page == 1) {
+                       $this->_labels[1] = $this->book->parametres->title;
+
+                       return $this->_labels[1];
+               }
+
+
+               $virtual = $this->_getVirtualPage($page);
+
+               $candidates = array();
+               foreach ($this->_chapters as $c) {
+                       if ($c->page == $virtual) {
+                               $candidates[] = $c;
+                       }
+               }
+               if (!count($candidates)) {
+                       $this->_labels[$page] = $this->_getLabelOfPage($page - 1);
+                       return $this->_labels[$page];
+               }
+
+               usort($candidates, array($this, '_sortCandidates'));
+               $c = array_shift($candidates);
+
+               $this->_labels[$page] = $c->label;
+               return $this->_labels[$page];
+       }
+
+       protected function _sortCandidates($a, $b) {
+               if ($a->level > $b->level) {
+                       return 1;
+               } else if ($a->level < $b->level) {
+                       return -1;
+               } else {
+                       return 0;
+               }
+       }
+
+       protected function _getVirtualPage($page) {
+               $num = explode(',', $this->book->numerotation);
+               if (isset($num[$page - 1])) {
+                       return $num[$page - 1];
+               }
+               return 1;
+       }
+
+       protected function escape($txt) {
+               return htmlentities($txt, ENT_COMPAT, 'UTF-8');
+       }
+
+       protected function makeHTMLFooter() {
+               $res = '<footer>';
+               $res .= '<h2><a href="http://www.fluidbook.com">Fluidbook : Solution de catalogues interactifs et brochures en ligne</a></h2>';
+               $res .= '</footer>';
+               return $res;
+       }
+
+       protected function replaceHTML($toReplace) {
+               return $this->replaceContents($this->origHTML, $toReplace);
+       }
+
+       protected function mergeJavascript() {
+               $dest = WS_COMPILE_ASSETS . '/fluidbook.js';
+               $orig = WS_COMPILE_ASSETS . '/_js/';
+               $files = array('swfobject.js' => false, 'swfaddress.js' => true, 'fluidbook.js' => true);
+
+               $refresh = false;
+               if (file_exists($dest)) {
+                       $mtime = filemtime($dest);
+                       foreach ($files as $file => $min) {
+                               if (filemtime($orig . $file) > $mtime) {
+                                       $refresh = true;
+                                       break;
+                               }
+                       }
+               } else {
+                       $refresh = true;
+               }
+               if (!$refresh) {
+                       return;
+               }
+
+               $minjs = "\n\n";
+               foreach ($files as $file => $min) {
+                       $c = file_get_contents($orig . $file);
+                       if ($min) {
+                               $c = JSMin::minify($c);
+                       }
+
+                       $minjs .= $c . "\n\n";
+               }
+               file_put_contents($dest, $minjs);
+       }
+
+}
+
 ?>
\ No newline at end of file