From: vincent@cubedesigners.com Date: Sat, 9 Jul 2011 15:10:10 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=6f8b22a324a7f045043f6ff87d3310ffbdac61a5;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.droits.php b/inc/ws/Controlleur/class.ws.droits.php index 20eb4ab00..026ecca3e 100644 --- a/inc/ws/Controlleur/class.ws.droits.php +++ b/inc/ws/Controlleur/class.ws.droits.php @@ -72,7 +72,7 @@ class wsDroits { { global $core; - if(is_null($core->user)){ + if(is_null($core) || is_null($core->user)){ $s=''; }else{ $s=$core->user->getWSSignatures(); diff --git a/inc/ws/Util/packager/class.ws.packager.html5.php b/inc/ws/Util/packager/class.ws.packager.html5.php index f27754d5e..0a5815b5d 100644 --- a/inc/ws/Util/packager/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/class.ws.packager.html5.php @@ -59,12 +59,14 @@ class wsPackagerHTML5 extends wsPackager { mkdir($this->vdir . '/style', 0777, true); mkdir($this->vdir . '/contents', 0777, true); mkdir($this->vdir . '/images', 0777, true); + mkdir($this->vdir . '/data/images', 0777, true); foreach ($this->div as $n => $page) { file_put_contents($this->vdir . '/contents/p' . $n . '.html', $this->writePage($page)); } $this->writeFonts(); $this->writeImages(); + $this->writeTheme(); file_put_contents($this->vdir . '/style/style.css', $this->writeCSS()); file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig()); @@ -86,6 +88,10 @@ class wsPackagerHTML5 extends wsPackager { } } + protected function writeTheme() { + // Icons + } + protected function writeImages() { foreach (self::$resolutions as $r) { @@ -182,7 +188,9 @@ class wsPackagerHTML5 extends wsPackager { protected function writeCSS() { $res = array(); - $h = $this->book->parametres->height . 'px'; + + // General theme + $h = $this->t->parametres->height . 'px'; $w2 = ($this->book->parametres->width * 2) . 'px'; $w = $this->book->parametres->width . 'px'; @@ -192,6 +200,61 @@ class wsPackagerHTML5 extends wsPackager { $res[] = '.doublePage,#pages{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}'; $res[] = '.page.right{left:' . $w . '}'; + // Theme + // Background + $body = 'body{'; + $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;'; + 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(../data/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; + + // Pages styles foreach ($this->cssColor as $color => $index) { $res[] = '.c' . $index . '{color:#' . $color . '}'; } diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index ca61d45c0..b91988566 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -9,6 +9,7 @@ class wsPackager { protected $theme; protected $version; protected $book_id; + protected $themeRoot; public static function package($book_id, $version) { if ($version == 'html') { @@ -45,6 +46,7 @@ class wsPackager { $daoTheme = new wsDAOTheme($core->con); $this->theme = $daoTheme->getThemeOfBook($book_id, true); + $this->themeRoot = WS_THEMES . '/' . $this->theme->theme_id . '/'; } protected function preparePackage() {