]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Jul 2012 12:24:30 +0000 (12:24 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 11 Jul 2012 12:24:30 +0000 (12:24 +0000)
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/_common.php
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/packager/class.ws.packager.html.php

index d02170c33edec30500bc763d245715dc801c160e..99681573b767c287da2dfe348def685102a11b05 100644 (file)
@@ -1264,7 +1264,7 @@ class wsDAOBook extends commonDAO {
        }\r
 \r
        public function compileHTML5($book_id,$book) {\r
-               $htmlCompiler = new wsHTML5Compiler($book_id,$book->parametres->mobileLVersion);\r
+               $htmlCompiler = wsHTML5Compiler::factory($book_id,$book->parametres->mobileLVersion);\r
                $htmlCompiler->compile();\r
        }\r
 \r
index 45a1b6dd87d57816665b7dfded80655f955835d1..eb6cca4538d2d34a1d97eedc0ccaa941a2081cbc 100644 (file)
@@ -10,6 +10,7 @@ $__autoload['wsSWF2HTMLMatrix'] = dirname(__FILE__) . '/class.ws.swf2html.php';
 $__autoload['wsSecureSWF'] = dirname(__FILE__) . '/class.ws.secure.swf.php';\r
 $__autoload['wsTools'] = dirname(__FILE__) . '/class.ws.tools.php';\r
 $__autoload['wsHTML5Compiler'] = dirname(__FILE__) . '/html5/class.ws.html5.compiler.php';\r
+$__autoload['wsHTML5CompilerDev'] = dirname(__FILE__) . '/html5/class.ws.html5.compiler.php';\r
 $__autoload['wsHTML5Link'] = dirname(__FILE__) . '/html5/class.ws.html5.links.php';\r
 $__autoload['wsPDFFontExtractor'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.fontextractor.php';\r
 $__autoload['wsPDFFont'] = dirname(__FILE__) . '/fontextractor/class.ws.pdf.font.php';\r
index 948a4f7868f51fa39770bbf42d2c04adda946891..76d27677fd0443c4555a1eec61d928158de74b4a 100644 (file)
@@ -2,6 +2,14 @@
 
 class wsHTML5Compiler {
 
+       public static function factory($book_id, $version = 'stable') {
+               if ($version == 'stable') {
+                       return new wsHTML5Compiler($book_id, $version);
+               } else {
+                       return new wsHTML5CompilerDev($book_id, $version);
+               }
+       }
+
        protected static $resolutions = array(150, 36);
        protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
        protected static $jsFiles = array(
@@ -294,7 +302,7 @@ class wsHTML5Compiler {
 
        protected function writeIndex($numCSS) {
                global $core;
-               
+
                $html = file_get_contents($this->assets . '/_index.html');
                $uhtml = $html;
 
@@ -504,7 +512,7 @@ class wsHTML5Compiler {
                $this->config->height = $this->cssHeight;
                $this->config->optimalWidth = $this->optimalWidth;
                $this->config->optimalHeight = $this->optimalHeight;
-               $this->config->chapters=$this->book->chapters;
+               $this->config->chapters = $this->book->chapters;
                foreach ($this->additionalConfig as $k => $v) {
                        $this->config->$k = $v;
                }
@@ -857,4 +865,184 @@ class wsHTML5Compiler {
 
 }
 
+class wsHTML5CompilerDev extends wsHTML5Compiler {
+
+       protected function writeCSS($file, $links) {
+               $res = array();
+
+               // General theme
+               $cssWidth = $this->cssWidth;
+               $cssHeight = $this->cssHeight;
+               $cssScale = $this->cssScale;
+               $w2 = ($cssWidth * 2) . 'px';
+
+
+               $h = $cssHeight . 'px';
+
+               $wm = ($this->width * $this->multiply) . 'px';
+               $hm = ($this->height * $this->multiply) . 'px';
+               $w = $cssWidth . 'px';
+               $offsetLeft = round(($this->optimalWidth - $cssWidth) / 2, 3);
+               $offsetLeft2 = $offsetLeft * 2;
+               $offsetTop = round(($this->optimalHeight - $cssHeight) / 2, 3);
+               $navTop = ($cssHeight - 40 - 100) / 2;
+
+
+               $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links,.doublePage._3d{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
+               $res[] = '.doublePage,#pages,.landscape #shadow.double{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}';
+               $res[] = '.landscape .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w2 . ',0,0)') . '}';
+               $res[] = '.landscape .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w2 . ',0,0)') . '}';
+               $res[] = '.portrait .doublePage._2d.next{' . $this->writeCSSUA('transform', 'translate3d(' . $w . ',0,0)') . '}';
+               $res[] = '.portrait .doublePage._2d.prev{' . $this->writeCSSUA('transform', 'translate3d(-' . $w . ',0,0)') . '}';
+               $res[] = '.doublePage._3d{left:' . $w . ';}';
+               $res[] = '.landscape #shadow.single.right{left: ' . $w . ';}';
+               $res[] = '.landscape #shadow.single.right{left: ' . $w . ';}';
+               $res[] = '.landscape .page.right{left:' . $w . '}';
+               if ($this->theme->parametres->displayPageNumber) {
+                       $res[] = '#pagesnumbers{top:' . $h . ';color:' . self::colorToCSS($this->theme->parametres->colorPageNumber) . '}';
+                       $res[] = '#pagesnumbers div{width:' . $w . '}';
+               } else {
+                       $res[] = '#pagesnumbers{display:none;}';
+               }
+
+
+               $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}';
+               foreach (self::$resolutions as $r) {
+                       $ratio = round(72 / $r, 3) * $cssScale;
+
+                       $wr = $cssWidth / $ratio;
+                       $hr = $cssHeight / $ratio;
+
+                       $br = '.background.r' . $r . '{';
+                       if ($ratio != 1) {
+                               $br.=$this->writeCSSUA('transform', 'scale(' . $ratio . ')') . ';';
+                       }
+                       $br.='width:' . $wr . 'px;height:' . $hr . 'px;}';
+                       $res[] = $br;
+               }
+               $texts = '.texts{' . $this->writeCSSUA('transform-origin', 'top left') . ';';
+               $texts.=$this->writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';';
+               $texts.='width:' . ($wm / $this->cssSVGScale) . '; max-width:' . ($wm / $this->cssSVGScale) . ';';
+               $texts.='height:' . ($hm / $this->cssSVGScale) . '; max-height:' . ($hm / $this->cssSVGScale) . ';';
+               $texts.='}';
+               $res[] = $texts;
+
+               // Theme
+               // Background
+               $body = '#main{';
+               $body.='background-color:#' . $this->theme->parametres->backgroundColor . ';';
+               switch ($this->theme->parametres->repeat) {
+                       case wsTheme::REPEAT:
+                               $body.='background-repeat:repeat;';
+                               break;
+                       case wsTheme::NONE:
+                               $body.='background-repeat:no-repeat;';
+                               break;
+                       case wsTheme::RATIO:
+                               $body.='background-repeat:no-repeat;';
+                               $body.='background-size:cover;';
+                               break;
+                       case wsTheme::STRETCH:
+                               $body.='background-repeat:no-repeat;';
+                               $body.='background-size:100% 100%;';
+                               break;
+               }
+               if ($this->theme->parametres->backgroundImage != '') {
+                       copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage);
+                       $body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';
+                       $body.='background-position:';
+
+                       switch ($this->theme->parametres->backgroundVAlign) {
+                               case wsTheme::TOP:
+                                       $body.='top';
+                                       break;
+                               case wsTheme::MIDDLE:
+                                       $body.='center';
+                                       break;
+                               case wsTheme::BOTTOM:
+                                       $body.='bottom';
+                                       break;
+                       }
+                       $body.=' ';
+                       switch ($this->theme->parametres->backgroundHAlign) {
+                               case wsTheme::LEFT:
+                                       $body.='left';
+                                       break;
+                               case wsTheme::CENTER:
+                                       $body.='center';
+                                       break;
+                               case wsTheme::RIGHT:
+                                       $body.='right';
+                                       break;
+                       }
+                       $body.=';';
+               }
+
+               $body.='}';
+               $res[] = $body;
+
+               // Header
+               $header = '#header{';
+               $header.='height:' . $this->theme->parametres->menuHeight . 'px;';
+               $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';';
+               if ($this->theme->parametres->menuImage != '') {
+                       copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);
+                       $header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');';
+                       $header.='background-repeat:no-repeat;';
+                       $header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';
+               }
+               $header.='}';
+               $res[] = $header;
+
+               //Icons
+               $res = array_merge($res, $this->writeIcons());
+
+               // Logo
+               $logo = '#logo{';
+               if ($this->theme->parametres->logo) {
+                       copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo);
+                       $dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo);
+                       $logo.='background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;';
+               }
+               $logo.='}';
+               $res[] = $logo;
+
+               // Credits
+               $res[] = '#credits,#credits a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}';
+
+               // Arrows
+               $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}';
+               // Book shadow
+               $shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor);
+               if ($shadowColor != 'transparent') {
+                       $res[] = '#shadow{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}';
+               }
+
+               // Links Styles
+               $res = array_merge($res, $links);
+               $res[] = '.link a.displayArea:hover,.link a.displayArea.animating{background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';}';
+               $res[] = '.link a.displayArea{-webkit-tap-highlight-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.4) . ';background-color:' . self::colorToCSS($this->theme->parametres->linksColor, 0.0001) . ';}';
+
+               // Menus
+               # View
+               $res[] = '.portrait #view{width:' . $w . ';min-height:' . $h . '}';
+               $res[] = '.landscape #view{width:' . $w2 . ';min-height:' . $h . '}';
+               $res[] = '#view{background-color:' . self::colorToCSS($this->theme->parametres->couleurB) . ';color:' . self::colorToCSS($this->theme->parametres->subTextColor) . ';}';
+               # Index
+               $ratio = $this->width / $this->height;
+               $thumbh = round(100 / $ratio);
+               $res[] = '#index .thumb img{width:100px;height:' . $thumbh . 'px;}';
+               $res[] = '#index .doubleThumb{height:' . $thumbh . 'px;' . $this->writeCSSUA('box-shadow', '0 0 3px ' . $shadowColor) . '}';
+               $res[] = '#index .doubleThumb .overlay{height:' . $thumbh . 'px;}';
+               $res[] = '#index .doubleThumb .hits.yes{background-color:' . self::colorToCSS($this->theme->parametres->subSelectColor) . ';color:' . self::colorToCSS($this->theme->parametres->subTextSelectColor) . '}';
+
+               $res = array_chunk($res, 3500);
+               foreach ($res as $k => $css) {
+                       file_put_contents(sprintf($file, $k), implode("\n", $css));
+               }
+               return count($res);
+       }
+
+}
+
 ?>
\ No newline at end of file
index 4e19b2e8ef103d7a52c393913385dfbe8e0526d2..538694e4bd9db373fee9107262187bffc4374898 100644 (file)
@@ -132,7 +132,7 @@ class wsPackagerHTML extends wsPackager {
                        } else {\r
                                $label = $this->_getLabelOfPage($page);\r
                                $title = $label . ' - ' . $this->book->parametres->title;\r
-                               $dest = 'pages/' . $page . '-' . cubeText::str2URL($label) . '.html';\r
+                               $dest = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
                                $pathToIndex = '../index.swf';\r
                                $pathToGetflash = '../getflash.gif';\r
                                $redirectScript = '<script type="text/javascript">window.location=\'../index.html#/' . $page . '\';</script>';\r
@@ -227,7 +227,7 @@ class wsPackagerHTML extends wsPackager {
        }\r
 \r
        protected function makeHTMLNav($root) {\r
-               $res = '<ul id="nav">';\r
+               $res = '<nav>';\r
                foreach ($this->pages as $page => $infos) {\r
                        $label = $this->_getLabelOfPage($page);\r
                        if ($page == 1) {\r
@@ -238,14 +238,14 @@ class wsPackagerHTML extends wsPackager {
                                }\r
                        } else {\r
                                if ($root) {\r
-                                       $url = 'pages/' . $page . '-' . cubeText::str2URL($label) . '.html';\r
+                                       $url = 'pages/' . $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
                                } else {\r
-                                       $url = $page . '-' . cubeText::str2URL($label) . '.html';\r
+                                       $url = $page . '-' . mb_strtolower(cubeText::str2URL($label)) . '.html';\r
                                }\r
                        }\r
-                       $res .= '<li><a href="' . $url . '">' . $label . '</a></li>';\r
+                       $res .= '<a href="' . $url . '">' . $label . '</a>';\r
                }\r
-               $res .= '</ul>';\r
+               $res .= '</nav>';\r
                return $res;\r
        }\r
 \r
@@ -310,9 +310,9 @@ class wsPackagerHTML extends wsPackager {
        }\r
 \r
        protected function makeHTMLFooter() {\r
-               $res = '<div class="footer">';\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 .= '</div>';\r
+               $res .= '</footer>';\r
                return $res;\r
        }\r
 \r