]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 29 Jul 2013 09:19:04 +0000 (09:19 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 29 Jul 2013 09:19:04 +0000 (09:19 +0000)
fluidbook/cover.jpg [new file with mode: 0644]
images/ws/shade-cover-app.png [new file with mode: 0644]
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Controlleur/class.ws.services.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php
inc/ws/Util/html5/class.ws.html5.compiler.php

diff --git a/fluidbook/cover.jpg b/fluidbook/cover.jpg
new file mode 100644 (file)
index 0000000..d95e2a2
Binary files /dev/null and b/fluidbook/cover.jpg differ
diff --git a/images/ws/shade-cover-app.png b/images/ws/shade-cover-app.png
new file mode 100644 (file)
index 0000000..f96319b
Binary files /dev/null and b/images/ws/shade-cover-app.png differ
index 192b6ba3269e9aefd271bc35b4cbb20213cc63c5..4887b80b78184fe45a0d5afbf1b264bab0415edf 100644 (file)
@@ -452,7 +452,19 @@ class wsFlash extends cubeFlashGateway {
        public function saveSettings() {\r
                global $core;\r
                $dao = new wsDAOBook($core->con);\r
-               $dao->setSettings($this->args['book_id'], $this->args['settings']);\r
+\r
+               $pages = $dao->getPagesOfBook($this->args['book_id']);\r
+               $nb_pages = count($pages);\r
+\r
+               $daoDoc = new wsDAODocument($core->con);\r
+               $firstDoc = $daoDoc->selectById($pages[1]['document_id']);\r
+               $size = $firstDoc->generalInfos['size'];\r
+\r
+               $settings = json_decode($this->args['settings'], false);\r
+               $settings->width=$size[0];\r
+               $settings->height=$size[1];\r
+\r
+               $dao->setSettings($this->args['book_id'], $settings);\r
        }\r
 \r
        public function setChapters() {\r
index cf923b5d56751913ac62bfffff6331489f18e675..6642cdb284f85835ecce328db4b71ac72ba3079e 100644 (file)
@@ -586,17 +586,30 @@ class wsServices extends cubeFlashGateway {
                        $couvertures = array();\r
                        $vroot = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/' . $os . '/';\r
 \r
+                       $publications = array();\r
+\r
                        foreach ($composition as $k => $g) {\r
                                foreach ($g->publications as $l => $p) {\r
+                                       $publications[] = $p->id;\r
+                               }\r
+                       }\r
+\r
+                       $daoBook = new wsDAOBook($core->con);\r
+                       $books = $daoBook->selectByIds($publications);\r
+\r
+                       foreach ($composition as $k => $g) {\r
+                               foreach ($g->publications as $l => $p) {\r
+                                       $book = $books[$p->id];\r
                                        $root = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/' . $os . '/' . $p->id;\r
                                        $couv = $root . '/cover.jpg';\r
                                        $couvertures[$p->id] = base64_encode(file_get_contents($couv));\r
-                                       $publications[] = $p->id;\r
+                                       $composition[$k]->publications[$l]->width = $book->parametres->width;\r
+                                       $composition[$k]->publications[$l]->height = $book->parametres->height;\r
                                }\r
                        }\r
 \r
                        $d = array('id' => $id, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures);\r
-                       $d = array_merge($d, $this->_getManifest($publications, '/fluidbook/collections/versions/' . $id . '/' . $version . '/' . $os));\r
+                       $d = array_merge($d, $this->_getManifest($publications, '/fluidbook/collections/versions/' . $id . '/' . $version . '/' . $os, $books));\r
 \r
                        $dao = new wsDAOCollection($core->con);\r
                        $col = $dao->selectById($id);\r
@@ -622,7 +635,7 @@ class wsServices extends cubeFlashGateway {
                exit;\r
        }\r
 \r
-       protected function _getManifest($publications, $dir) {\r
+       protected function _getManifest($publications, $dir, $books) {\r
                global $core;\r
                $res = array();\r
                $res['manifest'] = array('assetRoot' => 'http://workshop.fluidbook.com' . $dir . '/', 'autoDownload' => true);\r
@@ -631,7 +644,7 @@ class wsServices extends cubeFlashGateway {
                $bundles = array();\r
 \r
                $removeFromRelative = realpath(ROOT . '/' . $dir) . '/';\r
-\r
+               $daoTheme = new wsDAOTheme($core->con);\r
 \r
                foreach ($publications as $p) {\r
                        $res['manifestPub'][$p] = array('assetRoot' => 'http://workshop.fluidbook.com' . $dir . '/', 'autoDownload' => true);\r
@@ -639,9 +652,7 @@ class wsServices extends cubeFlashGateway {
                        $r = $p . '/';\r
                        $iterator = CubeIT_Files::getRecursiveDirectoryIterator(ROOT . $dir . '/' . $p);\r
 \r
-                       $daoBook = new wsDAOBook($core->con);\r
-                       $book = $daoBook->selectById($p);\r
-                       $daoTheme = new wsDAOTheme($core->con);\r
+                       $book = $books[$p];\r
                        $theme = $daoTheme->selectById($book->theme);\r
                        $orders = $this->_getBundles($book);\r
                        $reg = $this->_getRegExpManifest($r, $book, $theme);\r
@@ -662,10 +673,7 @@ class wsServices extends cubeFlashGateway {
                                $b[$order][] = $path;\r
                        }\r
 \r
-\r
-\r
                        $bundles[] = array('name' => 'p_' . $p, 'contents' => $b['loading']);\r
-\r
                        $res['manifestPub'][$p]['bundles'] = array();\r
 \r
                        foreach ($b as $name => $contents) {\r
index b1c86855ce39325142d86e6f504f4fd8fc1c505f..2aa2c0aa3f3d05d04c231da195afeee8fe5b8f90 100644 (file)
@@ -629,7 +629,7 @@ class wsDAOBook extends commonDAO {
        public function setSettings($book_id, $settings) {\r
                $book = $this->selectById($book_id);\r
                $parametres = $book->parametres;\r
-               $new = json_decode($settings, false);\r
+               $new =$settings;\r
                foreach ($new as $k => $v) {\r
                        if ($k == '_empty_') {\r
                                continue;\r
index 364f389c738910d29108e8395f24b2b100fa5c6f..23578c514e51b0181024fae731ca361a5d38767e 100644 (file)
@@ -106,9 +106,9 @@ class wsHTML5AppCompiler {
        function writeScript() {
                $config = array();
                $config['id'] = $this->collectionId;
-               $config['couleurA']=$this->collection->settings['couleurA'];
-               $config['couleurB']=$this->collection->settings['couleurB'];
-               $config['couleurC']=$this->collection->settings['couleurC'];
+               $config['couleurA'] = $this->collection->settings['couleurA'];
+               $config['couleurB'] = $this->collection->settings['couleurB'];
+               $config['couleurC'] = $this->collection->settings['couleurC'];
 
                $this->copy(WS_COMPILE_ASSETS . '/_html5/js/libs/phonegap/' . $this->phonegapVersion . '/cordova-' . $this->os . '.js', $this->vdir . '/js/cordova.js');
                file_put_contents($this->vdir . '/data/app.js', 'DATAS = ' . CubeIT_Util_Json::encode($config) . ';');
@@ -127,8 +127,10 @@ class wsHTML5AppCompiler {
                }
 
                $this->copy($this->wdir . '/' . $this->collection->theme['back'], $imagesdir . '/' . $this->collection->theme['back']);
+               $this->copy($this->wdir . '/' . $this->collection->theme['etagere'], $imagesdir . '/' . $this->collection->theme['etagere']);
 
                $c[] = 'body{background-image:url("images/' . $this->collection->theme['back'] . '");}';
+               $c[] = '#shelves{background-image:url("images/' . $this->collection->theme['etagere'] . '");}';
                file_put_contents($this->vdir . '/data/app.css', implode("\n", $c));
        }
 
index 997287f68f649b3673813e176f202ccd88069f45..1b04a8df4238b0eadb430eca76a5d1545313971f 100644 (file)
@@ -845,7 +845,7 @@ class wsHTML5Compiler {
        }
 
        protected function writeManifest() {
-               $res=array();
+               $res = array();
        }
 
        protected function writeIcons() {
@@ -910,11 +910,35 @@ class wsHTML5Compiler {
                        $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/thumbnails/p' . $page . '.jpg');
 
                        if ($page == 1) {
-                               $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/html/t36-' . $infos['document_page'] . '.jpg', $this->vdir . '/cover.jpg');
+                               $this->_makeCover(WS_DOCS . '/' . $infos['document_id'] . '/html/t36-' . $infos['document_page'] . '.jpg');
                        }
                }
        }
 
+       protected function _makeCover($orig) {
+               $size = getimagesize($orig);
+               $w = $size[0];
+               $h = $size[1];
+
+               //$tmp = cubeFiles::tempnam() . '.png';
+               $tmp = $this->vdir . '/covers.png';
+
+               $c = new cubeCommandLine('convert');
+               $c->setArg(null, ROOT . '/images/ws/shade-cover-app.png');
+               $c->setManualArg('-resize ' . round($w / 3) . 'x' . $h);
+               $c->setArg(null, $tmp);
+               $c->execute();
+
+               $convert = new cubeCommandLine('composite');
+               $cmd.= '-compose Multiply ';
+               $cmd.=$tmp . ' ' . $orig . ' ';
+               $cmd.=$this->vdir . '/cover.jpg';
+               $convert->setManualArg($cmd);
+               $convert->execute();
+
+               unlink($tmp);
+       }
+
        protected function copy($s, $t) {
                if (!file_exists($s)) {
                        fb($s . ' dont exists');