From 0b37a1ccec13d24e39caa8700d376e9e5adb29b3 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Thu, 7 Mar 2013 14:10:47 +0000 Subject: [PATCH] --- inc/ws/Util/html5/class.ws.html5.compiler.php | 113 ++++++++++-------- inc/ws/Util/html5/class.ws.html5.links.php | 28 +++-- 2 files changed, 81 insertions(+), 60 deletions(-) diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index ae53e94dd..aa5fbf37e 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -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 { + } diff --git a/inc/ws/Util/html5/class.ws.html5.links.php b/inc/ws/Util/html5/class.ws.html5.links.php index 4ac446514..7e73949d4 100644 --- a/inc/ws/Util/html5/class.ws.html5.links.php +++ b/inc/ws/Util/html5/class.ws.html5.links.php @@ -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 ''; + return ''; } 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)) { -- 2.39.5