From: vincent@cubedesigners.com Date: Fri, 13 Apr 2012 15:36:08 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f14ee1c617ef72ddf4afdbd1a435f62bb3858a12;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index 56aba9b67..4edf28d6c 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -250,9 +250,10 @@ class wsAjax extends cubeAjax { if($book->parametres->version==1){ $version='v1'; } - + fb(time(),'start making package'); $package = wsPackager::package($book_id, $version, false); + fb(time(),'start transfert'); if ($server == 'references') { $root = '/home/fluidbook/dev/references'; $url = 'http://www.fluidbook.com/references/'; @@ -281,11 +282,11 @@ class wsAjax extends cubeAjax { $cp = new cubeCommandLine('cp'); $cp->setPath(CONVERTER_PATH); $cp->setArg('r'); - $cp->setArg('u'); - $cp->setArg('preserve','timestamps'); $cp->setArg(null, $package . '*'); $cp->setArg(null, $finalDir); $cp->execute(); + + fb(time(),'end transfert'); $x->addClosePopup(); $x->addTruePopup($url . $dir . '/'); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index f8591ca8b..0423f33d3 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -815,22 +815,27 @@ class wsDAOBook extends commonDAO { if ($v1 || $v2) { + fb(time(),'Compile PDF & Widget'); $this->compilePDF($book, $pages); $this->compileWidget($book, $pages); } $res = ''; if ($v1) { + fb(time(),'Compile V1'); $res.=$this->compile1($book_id, $book, $pages); $this->touchCompile($book_id, '1'); } if ($v2) { + fb(time(),'Compile V2'); $res .= $this->compile3($book_id, $complete, $book, $pages); $this->touchCompile($book_id, '2'); } if ($html5) { + fb(time(),'Compile HTML5'); $res.=$this->compileHTML5($book_id); $this->touchCompile($book_id, 'html5'); } + fb(time(),'End Compile'); return $res; } diff --git a/inc/ws/Util/packager/class.ws.packager.html.php b/inc/ws/Util/packager/class.ws.packager.html.php index 24760edb4..d17a01e28 100644 --- a/inc/ws/Util/packager/class.ws.packager.html.php +++ b/inc/ws/Util/packager/class.ws.packager.html.php @@ -3,6 +3,7 @@ class wsPackagerHTML extends wsPackager { protected $origHTML; + protected $_labels = array(); public function __construct($book_id, $vdir = null, $whole = true) { parent::__construct($book_id, $vdir, $whole); @@ -36,6 +37,8 @@ class wsPackagerHTML extends wsPackager { $this->copyOtherFiles($others); + fb(time(), 'start prepare seo'); + mkdir($this->vdir . '/pages/', 0777, true); $ga = ''; @@ -111,10 +114,14 @@ class wsPackagerHTML extends wsPackager { $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'; @@ -155,12 +162,16 @@ class wsPackagerHTML extends wsPackager { $data = str_replace('$pathToGetflash', $pathToGetflash, $data); $data = str_replace('$redirectScript', $redirectScript, $data); + + file_put_contents($this->vdir . $dest, $data); if (!$seoVersion) { break; } } + + fb(time(), 'end prepare seo'); } protected function getFlashvars() { @@ -168,12 +179,13 @@ class wsPackagerHTML extends wsPackager { } public function prepareHTML5() { + fb(time(), 'start prepare html5'); if (!$this->whole) { return; } - + $this->daoBook->compile($this->book_id, 'html5'); - + $dest = $this->vdir . 'm'; mkdir($dest, 0777, true); @@ -203,6 +215,7 @@ class wsPackagerHTML extends wsPackager { $rm->setArg(null, $dest . '/' . $f); } $rm->execute(); + fb(time(), 'end prepare html5'); } public function makePackage($zip) { @@ -237,14 +250,24 @@ class wsPackagerHTML extends wsPackager { } protected function _getLabelOfPage($page) { - if($page==1){ - return $this->book->parametres->title; + if(!isset($this->_chapters)){ + $this->_chapters = $this->book->chapters; } - $chapters = $this->book->chapters; - $virtual = $this->_getVirtualPage($page); + 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 ($chapters as $c) { @@ -253,12 +276,15 @@ class wsPackagerHTML extends wsPackager { } } if (!count($candidates)) { - return $this->_getLabelOfPage($page-1); + $this->_labels[$page] = $this->_getLabelOfPage($page - 1); + return $this->_labels[$page]; } usort($candidates, array($this, '_sortCandidates')); - $c=array_shift($candidates); - return $c->label; + $c = array_shift($candidates); + + $this->_labels[$page] = $c->label; + return $this->_labels[$page]; } protected function _sortCandidates($a, $b) { @@ -272,7 +298,7 @@ class wsPackagerHTML extends wsPackager { } protected function _getVirtualPage($page) { - $num = explode(',',$this->book->numerotation); + $num = explode(',', $this->book->numerotation); if (isset($num[$page - 1])) { return $num[$page - 1]; } diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index 96903bff1..c77835a46 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -51,7 +51,7 @@ class wsPackager { $this->daoBook = new wsDAOBook($core->con); $this->book = $this->daoBook->selectById($book_id); - $this->pages = $this->daoBook->getPagesOfBook($book_id); + $this->pages = $this->daoBook->getPagesOfBook($book_id,false); $daoTheme = new wsDAOTheme($core->con); $this->theme = $daoTheme->getThemeOfBook($book_id, true);