]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 14 Jun 2012 15:53:37 +0000 (15:53 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 14 Jun 2012 15:53:37 +0000 (15:53 +0000)
inc/ws/Util/html5/class.ws.html5.compiler.php

index 861f23322317fce78dc797ca4e394ed47cd95a3c..b9cdb14b790863a246e18d17b1fe8529bb25317f 100644 (file)
@@ -2,7 +2,7 @@
 
 class wsHTML5Compiler {
 
-       protected static $resolutions = array(150,36);
+       protected static $resolutions = array(150, 36);
        protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', '');
        protected static $jsFiles = array(
                'js/libs/cube/fb.js',
@@ -78,6 +78,7 @@ class wsHTML5Compiler {
        protected $cache = array();
        protected $backgroundsPrefix = 'p';
        protected $svg = true;
+       protected $config = array();
 
        function __construct($book_id) {
                global $core;
@@ -139,6 +140,8 @@ class wsHTML5Compiler {
                        $this->multiply = $this->pdf2htmlRatio * $this->scale * $this->cssScale;
                }
                $this->numerotation = explode(',', $this->book->numerotation);
+
+               $this->config = cubeObject::merge($this->book->parametres->toStandardObject(), $this->theme->parametres->toStandardObject());
        }
 
        public function getCssScale() {
@@ -154,7 +157,7 @@ class wsHTML5Compiler {
        }
 
        public function compile() {
-               $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style', 'data/links/pages', 'data/l10n', 'swf');
+               $dirsToCreate = array('data/images', 'data/contents', 'data/background', 'data/thumbnails', 'data/style', 'swf');
 
                foreach ($dirsToCreate as $dir) {
                        $d = $this->vdir . '/' . $dir;
@@ -187,7 +190,6 @@ class wsHTML5Compiler {
        protected function writeCache() {
                $videosExtensions = array('flv', 'ogv', 'webm', 'mp4');
                $videos = array('flv' => array(), 'ogv' => array(), 'webm' => array(), 'mp4' => array());
-               $ignore = array('data/l10n/([a-z-]{2,5}).json');
 
                $cacheFile = $this->vdir . '/cache.appcache';
 
@@ -210,13 +212,12 @@ class wsHTML5Compiler {
                $lines[] = 'index.html* index.html';
                $lines[] = '';
                $lines[] = 'CACHE:';
-               $assets = array('images', 'style', 'swf', 'data/l10n', 'data/style', 'data/images', 'data/fluidbook.js');
+               $assets = array('images', 'style', 'swf', 'data/style', 'data/images', 'data/fluidbook.js');
 
                $pages = $this->book->parametres->pages + 1;
 
                for ($i = 0; $i <= $pages; $i++) {
                        $assets[] = 'data/background/150/' . $this->backgroundsPrefix . $i . '.jpg';
-                       $assets[] = 'data/links/pages/p' . $i . '.html';
                        $assets[] = 'data/contents/p' . $i . '.svg';
                }
                $assets[] = 'data/thumbnails';
@@ -369,11 +370,13 @@ class wsHTML5Compiler {
                $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));
+               
+               $this->config->l10n=array();
+               $this->config->l10n['default']=$traductions;
+               
                foreach ($langs as $lang) {
-                       file_put_contents($this->vdir . '/data/l10n/' . $lang->lang_id . '.json', json_encode($lang->traductions));
+                       $this->config->l10n[$lang->lang_id]=$lang->traductions;
                }
        }
 
@@ -398,12 +401,14 @@ class wsHTML5Compiler {
                        $i++;
                }
 
+               $this->config->links = array();
+
                for ($i = 0; $i <= $this->book->parametres->pages + 1; $i++) {
                        $c = '';
                        if (isset($pages[$i])) {
                                $c = $pages[$i];
                        }
-                       file_put_contents($this->vdir . 'data/links/pages/p' . $i . '.html', $c);
+                       $this->config->links[$i] = $c;
                }
                return $css;
        }
@@ -453,18 +458,18 @@ class wsHTML5Compiler {
        }
 
        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;
-               $config->width = $this->cssWidth;
-               $config->height = $this->cssHeight;
-               $config->optimalWidth = $this->optimalWidth;
-               $config->optimalHeight = $this->optimalHeight;
+
+               $this->config->numerotation = explode(',', $this->book->numerotation);
+               $this->config->id = $this->book->book_id;
+               $this->config->cacheDate = TIME;
+               $this->config->width = $this->cssWidth;
+               $this->config->height = $this->cssHeight;
+               $this->config->optimalWidth = $this->optimalWidth;
+               $this->config->optimalHeight = $this->optimalHeight;
                foreach ($this->additionalConfig as $k => $v) {
-                       $config->$k = $v;
+                       $this->config->$k = $v;
                }
-               return 'var DATAS=' . json_encode($config) . ';' . "\n";
+               return 'var DATAS=' . json_encode($this->config) . ';' . "\n";
        }
 
        protected function writeIcons() {