]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sat, 9 Jul 2011 18:49:15 +0000 (18:49 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Sat, 9 Jul 2011 18:49:15 +0000 (18:49 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/Metier/class.ws.parametres.php
inc/ws/Metier/class.ws.theme.parametres.php
inc/ws/Util/packager/class.ws.packager.html5.php

index 1ecd46953f7bc39ca23a56f3cc4147f5c8ad9ad8..f8fb2f2162be07b76fd5909af93e823c978b2e4b 100644 (file)
@@ -466,7 +466,7 @@ html{height:100%}' . "\n";
                        'video_loop' => __('Video : boucle'), 'video_auto_start' => __('Video : démarrage automatique'), 'video_controls' => __('Vidéo : afficher les contrôles'), 'video_sound_on' => __('Vidéo : activer le son'),\r
                        'inline' => __('Vidéo : afficher dans la page'), 'video_width' => __('Vidéo : Largeur du popup'), 'video_height' => __('Vidéo : Hauteur du popup'),\r
                        'interactive' => __('Interactivité'), 'video_service' => __('Webvideo : service'),\r
-                       'display_area'=>__('Afficher le lien au rollover')\r
+                       'display_area' => __('Afficher le lien au rollover')\r
                );\r
 \r
                $xls = new PHPExcel();\r
@@ -499,14 +499,14 @@ html{height:100%}' . "\n";
                                                if ($l[$id] == 'false') {\r
                                                        $l[$id] = 'physical';\r
                                                }\r
-                                       }else if($id=='display_area'){\r
-                                               if($l[$id]==''){\r
-                                                       $l[$id]='1';\r
+                                       } else if ($id == 'display_area') {\r
+                                               if ($l[$id] == '') {\r
+                                                       $l[$id] = '1';\r
                                                }\r
                                        }\r
                                        $value = $l[$id];\r
                                }\r
-                               \r
+\r
                                $s->setCellValueByColumnAndRow($i, $j, $value);\r
                                $s->getStyleByColumnAndRow($i, $j)->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_LEFT);\r
                                $i++;\r
@@ -889,21 +889,41 @@ html{height:100%}' . "\n";
                $dao->updateFromObject($doc);\r
        }\r
 \r
-       public static function getParamsHelp() {\r
+       public static function getParamsHelp($args) {\r
                commonDroits::min(5);\r
+               global $core;\r
 \r
                $res = '';\r
 \r
-               $theme = new wsThemeParametres(new wsTheme());\r
-               $res .= self::formatHelp($theme->getHelp());\r
+               if (isset($args[1]) && $args[1] != '') {\r
+                       $dao = new wsDAOBook($core->con);\r
+                       $b = $dao->selectById($args[1]);\r
 \r
-               $book = new wsBookParametres(new wsBook());\r
-               $res .= self::formatHelp($book->getHelp());\r
+                       $daoTheme = new wsDAOTheme($core->con);\r
+                       $t = $daoTheme->getThemeOfBook($args[1], true);\r
 \r
-               header('Content-type: text/plain; charset=UTF-8');\r
-               ob_clean();\r
-               echo $res;\r
-               exit;\r
+                       $book = $b->parametres;\r
+                       $theme = $t->parametres;\r
+               } else {\r
+                       $theme = new wsThemeParametres(new wsTheme());\r
+                       $book = new wsBookParametres(new wsBook());\r
+               }\r
+\r
+               $res = commonPage::barre();\r
+               $res .= commonPage::tMain();\r
+               $res.=commonPage::bh();\r
+               $res.='<table class="liste">';\r
+               $res.= self::formatHelp($theme->getHelp());\r
+               $res.='</table>';\r
+               $res.=commonPage::bf();\r
+               $res.=commonPage::bh();\r
+               $res.='<table class="liste">';\r
+               $res.= self::formatHelp($book->getHelp());\r
+               $res.='</table>';\r
+               $res.=commonPage::bf();\r
+               $res .= commonPage::bMain();\r
+\r
+               return $res;\r
        }\r
 \r
        public static function formatHelp($rubriques) {\r
@@ -911,14 +931,16 @@ html{height:100%}' . "\n";
 \r
                $res = '';\r
                foreach ($rubriques as $label => $fields) {\r
-                       $res .= "\n" . '-------------------------' . "\n";\r
-                       $res .= $label . "\n";\r
-                       $res .= '-------------------------' . "\n\n";\r
-                       foreach ($fields as $name => $label) {\r
-                               if ($label == '|') {\r
-                                       $res .= '--' . "\n";\r
+                       $res.='<tr class="odd"><th colspan="5">' . $label . '</th></tr>';\r
+                       foreach ($fields as $name => $t) {\r
+                               if (is_string($t) && $t == '|') {\r
+                                       $res .= '<tr class="odd"><th></th></tr>';\r
                                } else {\r
-                                       $res .= $name . str_repeat("\t", 4 - floor(strlen($name) / 8)) . ': ' . $label . "\n";\r
+                                       $res.= '<tr>';\r
+                                       foreach ($t as $tt) {\r
+                                               $res.='<td>' . $tt . '</td>';\r
+                                       }\r
+                                       $res.='</tr>';\r
                                }\r
                        }\r
                }\r
index 8073e2eacc81b65b66737e70847e5cd0ab9c2766..b3da6c4e9511286151303a389865e9d010a46c3a 100644 (file)
@@ -1,94 +1,82 @@
 <?php\r
+\r
 class wsParametres extends cubeMetier implements Iterator {\r
+\r
        protected $datas;\r
        protected $fields;\r
        protected $forms;\r
        protected $parent;\r
+\r
        // Magic functions\r
-       public function __construct($parent)\r
-       {\r
+       public function __construct($parent) {\r
                $this->parent = $parent;\r
                $this->initFields();\r
                $this->datas = array();\r
        }\r
 \r
-       public function isEmpty()\r
-       {\r
+       public function isEmpty() {\r
                return count($this->datas) == 0;\r
        }\r
 \r
-       public function setParent($parent)\r
-       {\r
+       public function setParent($parent) {\r
                $this->parent = $parent;\r
                $this->initFields();\r
        }\r
 \r
-       public function __set($varname, $value)\r
-       {\r
-               if(empty($varname)){\r
+       public function __set($varname, $value) {\r
+               if (empty($varname)) {\r
                        return;\r
                }\r
                $this->set($varname, $value);\r
        }\r
 \r
-       public function __unset($varname)\r
-       {\r
+       public function __unset($varname) {\r
                $this->set($varname, null);\r
        }\r
 \r
-       public function __get($varname)\r
-       {\r
+       public function __get($varname) {\r
                return $this->get($varname);\r
        }\r
 \r
-       public function __isset($varname)\r
-       {\r
+       public function __isset($varname) {\r
                return $this->_isset($varname);\r
        }\r
 \r
-       public function __sleep()\r
-       {\r
+       public function __sleep() {\r
                return array('datas');\r
        }\r
 \r
-       public function __wakeup()\r
-       {\r
+       public function __wakeup() {\r
                $this->initFields();\r
        }\r
+\r
        // Iterator functions\r
-       public function rewind()\r
-       {\r
+       public function rewind() {\r
                reset($this->fields);\r
        }\r
 \r
-       public function current()\r
-       {\r
+       public function current() {\r
                return $this->get($this->key());\r
        }\r
 \r
-       public function key()\r
-       {\r
+       public function key() {\r
                return key($this->fields);\r
        }\r
 \r
-       public function next()\r
-       {\r
+       public function next() {\r
                return next($this->fields);\r
        }\r
 \r
-       public function valid()\r
-       {\r
+       public function valid() {\r
                return $this->_isset($this->key());\r
        }\r
 \r
-       protected function initFields()\r
-       {\r
+       protected function initFields() {\r
                $this->fields = array();\r
                $this->forms = array();\r
        }\r
 \r
-       protected function set($varname, $value)\r
-       {\r
+       protected function set($varname, $value) {\r
                if (!$this->_isset($varname)) {\r
                        throw new Exception('You are setting an attribute (' . get_class($this) . '::' . $varname . ') which not exists');\r
                }\r
@@ -111,14 +99,16 @@ class wsParametres extends cubeMetier implements Iterator {
                                break;\r
                        case 'boolean':\r
                                if (!is_bool($value)) {\r
-                                       $value = ($value == '' || $value == '0' || $value == 'false')?false:true;\r
+                                       $value = ($value == '' || $value == '0' || $value == 'false') ? false : true;\r
                                }\r
                                break;\r
                        case 'color':\r
                        case 'couleur':\r
                                $value = cubeMath::fill(ltrim($value, '#'), 6);\r
-                               fb($value);\r
                                break;\r
+                       case 'couleurAlpha':\r
+                               $value = cubeMath::fill(ltrim($value, '#'), 6);\r
+                               $value=cubeMath::fill($value,8,'f');\r
                        case 'date':\r
                                if (!is_int($value)) {\r
                                        $value = intval($value);\r
@@ -129,19 +119,17 @@ class wsParametres extends cubeMetier implements Iterator {
                                $value = array_pop($e);\r
                                break;\r
                        default:\r
-                               $value = (string)$value;\r
+                               $value = (string) $value;\r
                                break;\r
                } // switch\r
                $this->datas[$varname] = $value;\r
        }\r
 \r
-       protected function _isset($varname)\r
-       {\r
+       protected function _isset($varname) {\r
                return isset($this->fields[$varname]) && isset($this->fields[$varname]['default']);\r
        }\r
 \r
-       protected function get($varname)\r
-       {\r
+       protected function get($varname) {\r
                if (is_null($varname)) {\r
                        return false;\r
                }\r
@@ -149,20 +137,23 @@ class wsParametres extends cubeMetier implements Iterator {
                        throw new Exception('You are getting an attribute (' . get_class($this) . '::' . $varname . ') which not exists');\r
                }\r
                if (!isset($this->datas[$varname]) || is_null($this->datas[$varname])) {\r
-                       if (substr($this->fields[$varname]['default'], 0, 1) == '$') {\r
-                               return $this->get(substr($this->fields[$varname]['default'], 1));\r
-                       } else {\r
-                               return $this->fields[$varname]['default'];\r
-                       }\r
+                       return $this->getDefault($varname);\r
                }\r
                return $this->datas[$varname];\r
        }\r
 \r
-       public function getForm($name)\r
-       {\r
+       protected function getDefault($varname) {\r
+               if (substr($this->fields[$varname]['default'], 0, 1) == '$') {\r
+                       return $this->get(substr($this->fields[$varname]['default'], 1));\r
+               } else {\r
+                       return $this->fields[$varname]['default'];\r
+               }\r
+       }\r
+\r
+       public function getForm($name) {\r
                $f = $this->forms[$name];\r
                $f['fields'] = array();\r
-               foreach($f['fieldsnames'] as $n) {\r
+               foreach ($f['fieldsnames'] as $n) {\r
                        if ($n == '|') {\r
                                $f['fields'][] = '|';\r
                        } else {\r
@@ -173,60 +164,77 @@ class wsParametres extends cubeMetier implements Iterator {
                return $f;\r
        }\r
 \r
-       public function getForms()\r
-       {\r
+       public function getForms() {\r
                return array_keys($this->forms);\r
        }\r
 \r
-       public function fromRecord($r)\r
-       {\r
+       public function fromRecord($r) {\r
                $c = array_flip($r->columns());\r
-               foreach($this->fields as $n => $f) {\r
+               foreach ($this->fields as $n => $f) {\r
                        if (isset($c[$n]) && !is_null($r->$n)) {\r
                                $this->set($n, $r->$n);\r
                        }\r
                }\r
        }\r
 \r
-       public function fromXML($xml)\r
-       {\r
-               foreach($this->fields as $n => $f) {\r
+       public function fromXML($xml) {\r
+               foreach ($this->fields as $n => $f) {\r
                        $xp = $xml->$n;\r
                        if (!$xp || !count($xp)) {\r
                                continue;\r
                        }\r
-                       foreach($xp as $x) {\r
+                       foreach ($xp as $x) {\r
                                $this->set($n, $x);\r
                        }\r
                }\r
        }\r
 \r
-       public function toStandardObject()\r
-       {\r
+       public function toStandardObject() {\r
                $res = new stdClass();\r
-               foreach($this as $k => $v) {\r
+               foreach ($this as $k => $v) {\r
                        $res->$k = $v;\r
                }\r
                return $res;\r
        }\r
 \r
-       public function getHelp()\r
-       {\r
+       public function getHelp() {\r
                $rubriques = array();\r
-               foreach($this->forms as $name => $form) {\r
+               foreach ($this->forms as $name => $form) {\r
                        $rub = array();\r
-                       foreach($form['fieldsnames'] as $f) {\r
+                       foreach ($form['fieldsnames'] as $f) {\r
                                if ($f == '|') {\r
                                        $rub[] = '|';\r
                                } else {\r
+\r
+                                       $d = self::formatValueForHelp($this->getDefault($f));\r
+                                       $v = self::formatValueForHelp($this->get($f));\r
+                                       if ($d != $v) {\r
+                                               $v = '<strong>' . $v . '</strong>';\r
+                                       }\r
+\r
+\r
                                        $field = $this->fields[$f];\r
-                                       $rub[$f] = '(' . $field['type'] . ')' . str_repeat("\t", 2 - floor((strlen($field['type']) + 2) / 12)) . $field['label'];\r
+                                       $t = array();\r
+                                       $t[] = $f;\r
+                                       $t[] = $field['type'];\r
+                                       $t[] = $field['label'];\r
+                                       $t[] = $d;\r
+                                       $t[] = $v;\r
+                                       $rub[$f] = $t;\r
                                }\r
                        }\r
                        $rubriques[$form['label']] = $rub;\r
                }\r
                return $rubriques;\r
        }\r
+\r
+       public static function formatValueForHelp($v) {\r
+               if (is_bool($v)) {\r
+                       $v = ($v) ? 'true' : 'false';\r
+               }\r
+               return $v;\r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 96c32d0764d93dc905036ded41471951f621b9f3..8143d8e79903a5b7edaa65ab961a87ee5c848f96 100644 (file)
@@ -15,7 +15,7 @@ class wsThemeParametres extends wsParametres {
 \r
                parent::initFields();\r
                /* Navigation */\r
-               $this->fields['couleurA'] = array('type' => 'couleurAlpha', 'default' => '', 'editable' => true,\r
+               $this->fields['couleurA'] = array('type' => 'couleurAlpha', 'default' => 'ff000000', 'editable' => true,\r
                        'label' => __("Couleur de fond"));\r
                $this->fields['arrowsColor'] = array('type' => 'couleur', 'default' => 'ffffff', 'editable' => true,\r
                        'label' => __('Couleur des flèches'));\r
index 74a89741464d91423022b01e23c53aad761f975b..01d1beb435948dbbba208ac3b4892591f75dbc7c 100644 (file)
@@ -36,7 +36,7 @@ class wsPackagerHTML5 extends wsPackager {
 \r
                $imagesize = getimagesize(WS_DOCS . '/' . $this->pages[1]['document_id'] . '/html/h72-' . $this->pages[1]['document_page'] . '.jpg');\r
                $this->pdf2htmlRatio = $imagesize[0] / $this->layouts[1]['width'];\r
-               $this->scale = 1;\r
+               $this->scale = 4;\r
                $this->multiply = $this->pdf2htmlRatio * $this->scale;\r
 \r
                $this->createHTML();\r
@@ -55,19 +55,18 @@ class wsPackagerHTML5 extends wsPackager {
                                $this->div[$page][] = $this->addLine($line, $document_id);\r
                        }\r
                }\r
-\r
-               mkdir($this->vdir . '/style', 0777, true);\r
-               mkdir($this->vdir . '/contents', 0777, true);\r
-               mkdir($this->vdir . '/images', 0777, true);\r
                mkdir($this->vdir . '/data/images', 0777, true);\r
+               mkdir($this->vdir . '/data/contents', 0777, true);\r
+               mkdir($this->vdir . '/data/background', 0777, true);\r
+               mkdir($this->vdir . '/data/style', 0777, true);\r
 \r
                foreach ($this->div as $n => $page) {\r
-                       file_put_contents($this->vdir . '/contents/p' . $n . '.html', $this->writePage($page));\r
+                       file_put_contents($this->vdir . '/data/contents/p' . $n . '.html', $this->writePage($page));\r
                }\r
                $this->writeFonts();\r
                $this->writeImages();\r
                $this->writeTheme();\r
-               file_put_contents($this->vdir . '/style/style.css', $this->writeCSS());\r
+               file_put_contents($this->vdir . '/data/style/style.css', $this->writeCSS());\r
 \r
                file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig());\r
        }\r
@@ -83,7 +82,7 @@ class wsPackagerHTML5 extends wsPackager {
                foreach ($this->cssFont as $font => $index) {\r
                        list($font, $document_id) = explode('//', $font);\r
                        foreach ($fext as $ext) {\r
-                               copy(WS_DOCS . '/' . $document_id . "/fonts/web/" . $font . '.' . $ext, $this->vdir . '/style/F' . $index . '.' . $ext);\r
+                               copy(WS_DOCS . '/' . $document_id . "/fonts/web/" . $font . '.' . $ext, $this->vdir . '/data/style/F' . $index . '.' . $ext);\r
                        }\r
                }\r
        }\r
@@ -95,11 +94,11 @@ class wsPackagerHTML5 extends wsPackager {
        protected function writeImages() {\r
 \r
                foreach (self::$resolutions as $r) {\r
-                       mkdir($this->vdir . '/images/' . $r, 0777);\r
+                       mkdir($this->vdir . '/data/background/' . $r, 0777);\r
                }\r
                foreach ($this->pages as $page => $infos) {\r
                        foreach (self::$resolutions as $r) {\r
-                               copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/images/' . $r . '/p' . $page . '.jpg');\r
+                               copy(WS_DOCS . '/' . $infos['document_id'] . '/html/h' . $r . '-' . $infos['document_page'] . '.jpg', $this->vdir . '/data/background/' . $r . '/p' . $page . '.jpg');\r
                        }\r
                }\r
        }\r
@@ -190,19 +189,19 @@ class wsPackagerHTML5 extends wsPackager {
 \r
 \r
                // General theme\r
-               $h = $this->t->parametres->height . 'px';\r
+               $h = $this->book->parametres->height . 'px';\r
                $w2 = ($this->book->parametres->width * 2) . 'px';\r
                $w = $this->book->parametres->width . 'px';\r
 \r
                $navTop = ($this->book->parametres->height - 40 - 100) / 2;\r
                $res[] = '.portrait #pages,.portrait .doublePage.page,.texts,.page,.background{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';\r
-               $res[] = '.background{background-size:' . $w . 'px ' . $h . 'px;}';\r
+               $res[] = '.background{background-size:' . $w . ' ' . $h . ';}';\r
                $res[] = '.doublePage,#pages{width:' . $w2 . ';max-width:' . $w2 . ';height:' . $h . ';max-height:' . $h . '}';\r
                $res[] = '.page.right{left:' . $w . '}';\r
 \r
                // Theme\r
                // Background\r
-               $body = 'body{';\r
+               $body = '#main{';\r
                $body.='background-color:#' . $this->theme->parametres->backgroundColor . ';';\r
                switch ($this->theme->parametres->repeat) {\r
                        case wsTheme::REPEAT:\r
@@ -221,7 +220,7 @@ class wsPackagerHTML5 extends wsPackager {
                }\r
                if ($this->theme->parametres->backgroundImage != '') {\r
                        copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $this->theme->parametres->backgroundImage);\r
-                       $body.='background-image:url(../data/images/' . $this->theme->parametres->backgroundImage . ');';\r
+                       $body.='background-image:url(../images/' . $this->theme->parametres->backgroundImage . ');';\r
                        $body.='background-position:';\r
 \r
 \r
@@ -260,13 +259,29 @@ class wsPackagerHTML5 extends wsPackager {
                $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';';\r
                if ($this->theme->parametres->menuImage != '') {\r
                        copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);\r
-                       $header.='background-image:url(../data/images/' . $this->theme->parametres->menuImage . ');';\r
+                       $header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');';\r
                        $header.='background-repeat:no-repeat;';\r
                        $header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';\r
                }\r
                $header.='}';\r
                $res[] = $header;\r
 \r
+               // Logo\r
+               $logo = '#logo{';\r
+\r
+               $logo.='}';\r
+\r
+               // Credits\r
+               $res[] = '#credits,#credits a{color:' . self::colorToCSS($this->theme->parametres->creditsColor) . ';}';\r
+\r
+               // Arrows\r
+               $res[] = '#next,#previous{background-color:' . self::colorToCSS($this->theme->parametres->couleurA) . ';}';\r
+               // Book shadow\r
+               $shadowColor = self::colorToCSS($this->theme->parametres->bookShadeColor);\r
+               if ($shadowColor != 'transparent') {\r
+                       $res[] = '#pages{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}';\r
+               }\r
+\r
                // Pages styles\r
                foreach ($this->cssColor as $color => $index) {\r
                        $res[] = '.c' . $index . '{color:#' . $color . '}';\r
@@ -372,7 +387,7 @@ class wsPackagerHTML5 extends wsPackager {
        }\r
 \r
        protected function getCSSSize(&$size) {\r
-               $size = $this->normalizeFloatValue($size, 1);\r
+               $size = $this->normalizeFloatValue($size*$this->multiply, 3);\r
                $sizer = $size;\r
                return $this->getIndex($sizer, $this->cssSize);\r
        }\r
@@ -486,14 +501,16 @@ class wsPackagerHTML5 extends wsPackager {
 \r
                        $components = array('alpha', 'red', 'green', 'blue');\r
                        foreach ($components as $k => $name) {\r
-                               $$name = substr($color, $k * 2, 2);\r
-                               $$name = intval('0x' . $$name);\r
+                               $hex = substr($color, $k * 2, 2);\r
+                               $$name = intval($hex, 16);\r
+                               fb($hex . '->' . $$name, $name);\r
                        }\r
-\r
+                       $alpha/=255;\r
                        if ($alpha == 0) {\r
                                return 'transparent';\r
+                       } elseif ($alpha == 1) {\r
+                               return '#' . substr($color, 2, 6);\r
                        }\r
-                       $alpha/=256;\r
                        return 'rgba(' . $red . ',' . $green . ',' . $blue . ',' . $alpha . ')';\r
                }\r
        }\r