]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 16 Aug 2011 07:26:17 +0000 (07:26 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 16 Aug 2011 07:26:17 +0000 (07:26 +0000)
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/class.ws.html5.compiler.php

index bd80334f7a6ca1a5a9ea18d35ae60fe616f484b3..1aadb3f78d0911633d0615fa087a4d0b616a5808 100644 (file)
@@ -536,7 +536,7 @@ class wsDAOBook extends commonDAO {
                        return false;\r
                }\r
 \r
-               $checks = array($r->changedate, filemtime(WS_COMPILE_ASSETS . '/_html5'));\r
+               $checks = array($r->changedate, cubeFiles::filemtimeRecursive(WS_COMPILE_ASSETS . '/_html5'));\r
                $reffile = WS_BOOKS . '/html5/' . $book_id;\r
 \r
                if (!file_exists($reffile)) {\r
index abed44590af68f598ef30e3967c94e604e57fc90..0b89cc36682f1b5b49bf21243578899ef40958b3 100644 (file)
@@ -4,7 +4,9 @@ class wsHTML5Compiler {
 
        protected static $resolutions = array(36, 72, 150);
        protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
-       protected static $jsFiles = array('js/libs/modernizr.js',
+       protected static $jsFiles = array(
+               'js/libs/cube/fb.js',
+               'js/libs/modernizr.js',
                'js/libs/jquery/jquery.js',
                'js/libs/jquery/jquery.transform.js',
                'js/libs/jquery/jquery.mousewheel.js',
@@ -47,6 +49,8 @@ class wsHTML5Compiler {
        protected $daoBook;
        protected $needToRecompileContents = true;
        protected $needToRecompileSettings = true;
+       protected $width;
+       protected $height;
 
        function __construct($book_id) {
                global $core;
@@ -84,6 +88,13 @@ class wsHTML5Compiler {
                $this->scale = 4;
                $this->multiply = $this->pdf2htmlRatio * $this->scale;
                $this->numerotation = explode(',', $this->book->numerotation);
+
+               $daoDoc = new wsDAODocument($core->con);
+               $firstDoc = $daoDoc->selectById($this->pages[1]['document_id']);
+               $size = $firstDoc->generalInfos['size'];
+
+               $this->width = round($size[0],2);
+               $this->height = round($size[1],2);
        }
 
        public function virtualToPhysical($virtual) {
@@ -276,8 +287,8 @@ class wsHTML5Compiler {
                }
 
                $config = $this->writeConfig();
-               $js=$config.file_get_contents($minimized);
-               file_put_contents($this->vdir.'/data/datas.js',$config);
+               $js = $config . file_get_contents($minimized);
+               file_put_contents($this->vdir . '/data/datas.js', $config);
                file_put_contents($this->vdir . '/data/fluidbook.js', $js);
        }
 
@@ -286,6 +297,8 @@ class wsHTML5Compiler {
                $config->numerotation = explode(',', $this->book->numerotation);
                $config->id = $this->book->book_id;
                $config->cacheDate = TIME;
+               $config->width=$this->width;
+               $config->height=$this->height;
                return 'var DATAS=' . json_encode($config) . ';' . "\n";
        }
 
@@ -414,20 +427,20 @@ class wsHTML5Compiler {
                $res = array();
 
                // General theme
-               $h = $this->book->parametres->height . 'px';
-               $w2 = ($this->book->parametres->width * 2) . 'px';
-               $w = $this->book->parametres->width . 'px';
-               $wm = ($this->book->parametres->width * $this->multiply) . 'px';
-               $hm = ($this->book->parametres->height * $this->multiply) . 'px';
+               $h = $this->height . 'px';
+               $w2 = ($this->width * 2) . 'px';
+               $w = $this->width . 'px';
+               $wm = ($this->width * $this->multiply) . 'px';
+               $hm = ($this->height * $this->multiply) . 'px';
 
 
-               $navTop = ($this->book->parametres->height - 40 - 100) / 2;
+               $navTop = ($this->height - 40 - 100) / 2;
                $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';
                $res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}';
                foreach (self::$resolutions as $r) {
                        $ratio = round(72 / $r, 2);
-                       $wr = $this->book->parametres->width / $ratio;
-                       $hr = $this->book->parametres->height / $ratio;
+                       $wr = $this->width / $ratio;
+                       $hr = $this->height / $ratio;
 
                        $br = '.background.r' . $r . '{';
                        if ($ratio != 1) {
@@ -547,6 +560,7 @@ class wsHTML5Compiler {
                // 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).';}';
 
                // Menus
                # View
@@ -554,7 +568,7 @@ class wsHTML5Compiler {
                $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->book->parametres->width / $this->book->parametres->height;
+               $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) . '}';