From: vincent@cubedesigners.com Date: Sun, 10 Jul 2011 02:11:08 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1f6a0a0c75f2e4d6f6deaea17efc40e74620d25e;p=cubeextranet.git --- diff --git a/fluidbook/icones/1/mobile/nav-bookmark.svg b/fluidbook/icones/1/mobile/nav-bookmark.svg index ca12c90cf..0ff3bd47d 100644 --- a/fluidbook/icones/1/mobile/nav-bookmark.svg +++ b/fluidbook/icones/1/mobile/nav-bookmark.svg @@ -3,6 +3,6 @@ - diff --git a/fluidbook/icones/1/mobile/nav-friend.svg b/fluidbook/icones/1/mobile/nav-friend.svg index 6c331dd4a..3593791ca 100644 --- a/fluidbook/icones/1/mobile/nav-friend.svg +++ b/fluidbook/icones/1/mobile/nav-friend.svg @@ -3,6 +3,6 @@ - diff --git a/fluidbook/icones/1/mobile/nav-help.svg b/fluidbook/icones/1/mobile/nav-help.svg index 6a0ed7cad..4b04058d8 100644 --- a/fluidbook/icones/1/mobile/nav-help.svg +++ b/fluidbook/icones/1/mobile/nav-help.svg @@ -3,7 +3,7 @@ - - - - - - - + + + + + + - + + + diff --git a/fluidbook/icones/1/mobile/previous.svg b/fluidbook/icones/1/mobile/previous.svg index b80c38515..d68cb27d1 100644 --- a/fluidbook/icones/1/mobile/previous.svg +++ b/fluidbook/icones/1/mobile/previous.svg @@ -2,17 +2,16 @@ - + width="40px" height="100px" viewBox="1.5 1.75 40 100" enable-background="new 1.5 1.75 40 100" xml:space="preserve"> + - + diff --git a/inc/ws/Util/packager/class.ws.packager.html5.php b/inc/ws/Util/packager/class.ws.packager.html5.php index fd922ccad..5e9f26281 100644 --- a/inc/ws/Util/packager/class.ws.packager.html5.php +++ b/inc/ws/Util/packager/class.ws.packager.html5.php @@ -65,8 +65,7 @@ class wsPackagerHTML5 extends wsPackager { } $this->writeFonts(); $this->writeImages(); - $this->writeTheme(); - file_put_contents($this->vdir . '/data/style/style.css', $this->writeCSS()); + $this->writeCSS($this->vdir . '/data/style/style_%d.css'); file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig()); } @@ -87,8 +86,48 @@ class wsPackagerHTML5 extends wsPackager { } } - protected function writeTheme() { - // Icons + protected function writeIcons() { + $res = array(); + // Get the colors used to colorize graphics + if ($this->theme->parametres->colorizeIcons) { + $couleurI = '#' . $this->theme->parametres->couleurI; + } else { + $couleurI = '#FFFFFF'; + } + $arrowsColor = '#' . $this->theme->parametres->arrowsColor; + // Set the icon list with the color + $icons = array('nav-bookmark' => $couleurI, 'nav-friend' => $couleurI, 'nav-help' => $couleurI, 'nav-index' => $couleurI, 'nav-sommaire' => $couleurI, + 'next' => $arrowsColor, 'previous' => $arrowsColor); + + foreach ($icons as $icon => $color) { + // Get content of the svg + $svg = file_get_contents(WS_ICONS . '/' . $this->theme->parametres->iconSet . '/mobile/' . $icon . '.svg'); + // Colorize it + $svg = str_replace('$colorize', $color, $svg); + // Write the file + file_put_contents($this->vdir . '/data/images/' . $icon . '.svg', $svg); + $svg = simplexml_load_string($svg); + $w = (string) $svg['width']; + $h = (string) $svg['height']; + $w = rtrim($w, 'px'); + $h = rtrim($h, 'px'); + // Finally rasterize it + $this->rasterizeSVG($this->vdir . '/data/images/' . $icon . '.svg', 'image/png', $w, $h, 4); + $res[] = '#icon-' . $icon . '{width:' . $w . 'px;height:' . $h . 'px;background-image:url(data/images/' . $icon . '.svg), url(data/images/' . $icon . '.png);background-repeat:no-repeat;background-size:' . $w . 'px ' . $h . 'px}'; + } + return $res; + } + + protected function rasterizeSVG($file, $type, $w, $h, $scale=1) { + $batik = new cubeCommandLine('/usr/local/batik/batik-rasterizer'); + $batik->setArg('d', $this->vdir . '/data/images'); + $batik->setArg('m', 'image/png'); + if ($scale != 1) { + $batik->setArg('w', $w * $scale); + $batik->setArg('h', $h * $scale); + } + $batik->setManualArg($file); + $batik->execute(); } protected function writeImages() { @@ -184,7 +223,7 @@ class wsPackagerHTML5 extends wsPackager { return self::escapeHTML($span['text']); } - protected function writeCSS() { + protected function writeCSS($file) { $res = array(); @@ -274,10 +313,18 @@ class wsPackagerHTML5 extends wsPackager { $header.='}'; $res[] = $header; + //Icons + $res = array_merge($res, $this->writeIcons()); + // Logo $logo = '#logo{'; - + if ($this->theme->parametres->logo) { + copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo); + $dim = getimagesize($this->vdir . '/data/images/' . $this->theme->parametres->logo); + $logo.='background-image:url(../images/' . $this->theme->parametres->logo . ');width:' . $dim[0] . 'px;height:' . $dim[1] . 'px;'; + } $logo.='}'; + $res[] = $logo; // Credits $res[] = '#credits,#credits a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}'; @@ -333,7 +380,11 @@ class wsPackagerHTML5 extends wsPackager { $res[] = "@font-face{font-family:F" . $index . ";src:url('F" . $index . ".eot');src:url('F" . $index . ".eot?#iefix') format('eot'),url('F" . $index . ".ttf') format('truetype'),url('F" . $index . ".svgz#" . $font . "') format('svgz'),url('F" . $index . ".svg#" . $font . "') format('svg')}"; $res[] = '.f' . $index . '{font-family:F' . $index . ',Arial,Helvetica}'; } - return implode("\n", $res); + + $res = array_chunk($res, 4000); + foreach ($res as $k => $css) { + file_put_contents(sprintf($file, $k), implode("\n", $css)); + } } protected function writeCSSUA($property, $value) { @@ -511,7 +562,6 @@ class wsPackagerHTML5 extends wsPackager { foreach ($components as $k => $name) { $hex = substr($color, $k * 2, 2); $$name = intval($hex, 16); - fb($hex . '->' . $$name, $name); } $alpha/=255; if ($alpha == 0) {