]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 7 Mar 2013 14:10:47 +0000 (14:10 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 7 Mar 2013 14:10:47 +0000 (14:10 +0000)
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/html5/class.ws.html5.links.php

index ae53e94ddb8408952909a79d54b97d4d9ca8ea02..aa5fbf37e58dbc19b3e46954eb86aa1871ba99b1 100644 (file)
@@ -49,6 +49,7 @@ class wsHTML5Compiler {
                'js/libs/fluidbook/fluidbook.stats.js',
                'js/libs/fluidbook/fluidbook.cache.js',
                'js/libs/fluidbook/fluidbook.bookmarks.js',
+               'js/libs/fluidbook/fluidbook.background.js',
                'js/libs/fluidbook/views/fluidbook.chapters.js',
                'js/libs/fluidbook/views/fluidbook.index.js',
                'js/libs/fluidbook/fluidbook.js',
@@ -915,57 +916,9 @@ class wsHTML5Compiler {
                $res[] = $search;
 
                // Background
-               $body = '#main,.mview.index{';
-               $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 != '') {
-                       $this->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.=';';
-               }
+               $res[] = $this->_cssBackground();
 
-               $body.='}';
-               $res[] = $body;
 
                // Header
                $header = 'header{';
@@ -1076,6 +1029,67 @@ class wsHTML5Compiler {
                return count($res);
        }
 
+protected function _cssBackground() {
+               $body = '#background{';
+               $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 != '') {
+                       $bi = $this->themeRoot . '/' . $this->theme->parametres->backgroundImage;
+                       if (file_exists($bi)) {
+                               $dbi = getimagesize($bi);
+                               $this->config->backgroundImageDimensions = array('width' => $dbi[0], 'height' => $dbi[1]);
+                       }
+
+                       $this->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.='}';
+
+               return $body;
+       }
+
        protected function writeCSSUA($property, $value) {
                $res = array();
                foreach (self::$uaPrefixes as $prefix) {
@@ -1162,6 +1176,7 @@ class wsHTML5Compiler {
 }
 
 class wsHTML5CompilerDev extends wsHTML5Compiler {
+
        
 }
 
index 4ac446514e8be55623c0797a347cf97f7425197a..7e73949d4130e863f1bf1a95906f04deae39d068 100644 (file)
@@ -125,17 +125,23 @@ class wsHTML5Link {
                return array('dir' => $dir, 'fdir' => $fdir);
        }
 
-       public function getCSSContainer() {
-
+       public function getCssScale() {
+               if (is_int($this->page)) {
+                       return $this->compiler->getCssScale();
+               } else {
+                       return 1;
+               }
+       }
 
+       public function getCSSContainer() {
                if (!($this instanceof contentLink) && $this->page % 2 == 1) {
                        $this->page--;
                        $this->left+=$this->compiler->width;
                }
 
                $css = '#l_' . $this->id . '{';
-               $css.='left:' . $this->left * $this->compiler->getCssScale() . 'px;top:' . $this->top * $this->compiler->getCssScale() . 'px;';
-               $css.='width:' . $this->width * $this->compiler->getCssScale() . 'px;height:' . $this->height * $this->compiler->getCssScale() . 'px;';
+               $css.='left:' . $this->left * $this->getCssScale() . 'px;top:' . $this->top * $this->getCssScale() . 'px;';
+               $css.='width:' . $this->width * $this->getCssScale() . 'px;height:' . $this->height * $this->getCssScale() . 'px;';
                $css.=$this->getCSS();
                $css.='}';
                return $css;
@@ -254,8 +260,8 @@ class videoLink extends wsHTML5Link {
        public function getHTMLContent() {
                $this->copyExternalFile($this->to, true);
 
-               $w = round($this->width * $this->compiler->getCssScale());
-               $h = round($this->height * $this->compiler->getCssScale());
+               $w = round($this->width * $this->getCssScale());
+               $h = round($this->height * $this->getCssScale());
 
                return self::makeVideoTag($this, $w, $h, $this->compiler);
        }
@@ -316,7 +322,7 @@ class webVideoLink extends videoLink {
        }
 
        public function getEmbed() {
-               return '<iframe width="' . $this->width * $this->compiler->getCssScale() . '" height="' . $this->height * $this->compiler->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
+               return '<iframe width="' . $this->width * $this->getCssScale() . '" height="' . $this->height * $this->getCssScale() . '" src="' . $this->getEmbedURL() . '" frameborder="0" allowfullscreen></iframe>';
        }
 
        public function getEmbedURL() {
@@ -380,8 +386,8 @@ class multimediaLink extends wsHTML5Link {
 
        public function getHTMLContent() {
                //$this->copyExternalFile($this->to);
-               $w = $this->width * $this->compiler->getCssScale();
-               $h = $this->height * $this->compiler->getCssScale();
+               $w = $this->width * $this->getCssScale();
+               $h = $this->height * $this->getCssScale();
                if ($this->alternative != '') {
                        $this->copyExternalFile($this->alternative);
                }
@@ -395,8 +401,8 @@ class htmlMultimediaLink extends wsHTML5Link {
 
        public function getHTMLContent() {
                $d = $this->unzipFile($this->to);
-               $w = $this->width * $this->compiler->getCssScale();
-               $h = $this->height * $this->compiler->getCssScale();
+               $w = $this->width * $this->getCssScale();
+               $h = $this->height * $this->getCssScale();
 
                $dr = opendir($d['dir']);
                while ($file = readdir($dr)) {