]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 7 Nov 2012 14:30:45 +0000 (14:30 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 7 Nov 2012 14:30:45 +0000 (14:30 +0000)
14 files changed:
inc/commons/class.common.core.php
inc/commons/class.common.tools.php
inc/ws/Controlleur/class.ws.ajax.php
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Metier/class.ws.book.php
inc/ws/Util/class.ws.tools.php
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/html5/class.ws.html5.links.php
inc/ws/Util/packager/class.ws.packager.html.php
inc/ws/Util/packager/class.ws.packager.phonegap.php
inc/ws/Util/packager/class.ws.packager.php
inc/ws/Util/packager/class.ws.packager.v1.php
inc/ws/Util/packager/class.ws.packager.win.inst.php

index 2efe43ba7399bfe4f7bfbb49a7de559978a53291..9ce5c9055a75859fa98f18270fdf71b5d06eba49 100644 (file)
@@ -379,6 +379,7 @@ class commonCore extends cubeCore {
                $db->books->composition_update('integer', 0, false);\r
                $db->books->dir_references('varchar', 256, false);\r
                $db->books->dir_hosting('varchar', 256, false);\r
+               $db->books->dir_macbook_phonegap_ios('varchar', 256, false);\r
                $db->books->lucene_time('integer', 0, false);\r
                // Clés\r
                $db->books->primary('pk_books', 'book_id');\r
index 72fd7c4261c1c282fdf8b687536a983002b6be61..f7b816c44e7f02c90f671c66f64e3f3e3f436d9f 100644 (file)
@@ -539,7 +539,7 @@ class commonTools {
 
                header('Content-type: application/json');
                ob_end_clean();
-               $geocoder = new CubeIT_Services_Google_Geocoder();
+               $geocoder = new CubeIT_Services_Google_Geocoder(864000, false);
                $r = $geocoder->geocode(urldecode($_GET['address']), $_GET['region'], true);
                echo CubeIT_Util_Json::encode($r);
                exit;
index 62ba48614f3f7c91a8a43e0301a3b9c7d07489fe..ae0d6467233666e01de4c4a6367d218e1ffa5e15 100644 (file)
@@ -253,6 +253,10 @@ class wsAjax extends cubeAjax {
                if ($book->parametres->version == 1) {\r
                        $version = 'v1';\r
                }\r
+               if (stristr($server, 'phonegap')) {\r
+                       $version = 'phonegap';\r
+               }\r
+\r
                fb(time(), 'start making package');\r
                $package = wsPackager::package($book_id, $version, false);\r
 \r
@@ -263,6 +267,9 @@ class wsAjax extends cubeAjax {
                } else if ($server == 'hosting') {\r
                        $root = '/home/fluidbook/hosting';\r
                        $url = 'http://hosting.fluidbook.com/';\r
+               } else if ($server == 'macbook_phonegap_ios') {\r
+                       $root = '/mnt/macbook/Phonegap/Projects/';\r
+                       $url = null;\r
                }\r
 \r
                $e = explode('/', $_POST['dir']);\r
@@ -282,17 +289,27 @@ class wsAjax extends cubeAjax {
                        mkdir($finalDir, 0777, true);\r
                }\r
 \r
-               $cp = new cubeCommandLine('cp');\r
+               /**  --del -r -z -v * */\r
+               $cp = new cubeCommandLine('rsync');\r
                $cp->setPath(CONVERTER_PATH);\r
+               $cp->setArg('del');\r
+               $cp->setArg('t');\r
                $cp->setArg('r');\r
+               $cp->setArg('z');\r
+               $cp->setArg('v');\r
                $cp->setArg(null, $package . '*');\r
                $cp->setArg(null, $finalDir);\r
                $cp->execute();\r
 \r
+               fb($cp->commande);\r
+               fb($cp->output);\r
+\r
                fb(time(), 'end transfert');\r
 \r
                $x->addClosePopup();\r
-               $x->addTruePopup($url . $dir . '/');\r
+               if (!is_null($url)) {\r
+                       $x->addTruePopup($url . $dir . '/');\r
+               }\r
        }\r
 \r
        public static function statusBook($args, &$x) {\r
index 58a1cf3ffbee419ce732ae05aa07ca4abc08c58a..91e33f46b8bd83755d51824cfd0b7fef79a8a583 100644 (file)
@@ -201,6 +201,7 @@ class wsUrl {
                        $versions = array();\r
                        $versions['hosting'] = array('title' => __("Le serveur d'hébergement"), 'icon' => cubeMedia::silk('server_go.png'));\r
                        $versions['references'] = array('title' => __("L'espace références"), 'icon' => cubeMedia::silk('server_add.png'));\r
+                       $versions['macbook_phonegap_ios'] = array('title' => __("Projet Phonegap IOS"), 'icon' => cubeMedia::silk('server_add.png'));\r
 \r
                        foreach ($versions as $k => $v) {\r
                                $res .= '<li><a href="#" rel="instbook/$1/' . $k . '" class="ajax">' . $v['icon'] . $v['title'] . '</a></li>';\r
@@ -1013,6 +1014,9 @@ html{height:100%}' . "\n";
                } elseif ($server == 'hosting') {\r
                        $s = __("Serveur d'hébergement");\r
                        $dir = $book->dir_hosting;\r
+               } elseif ($server == 'macbook_phonegap_ios') {\r
+                       $s = __("Projet Phonegap iOS");\r
+                       $dir = $book->dir_macbook_phonegap_ios;\r
                }\r
 \r
                if ($dir == '') {\r
index e1756fc0482e7f82518715b1fc5f25c693b87dde..7b6b3b7f293f187e6decfb82404b69a3931cbd68 100644 (file)
@@ -44,6 +44,7 @@ class wsDAOBook extends commonDAO {
                $book->composition_update = $r->composition_update;\r
                $book->dir_references = $r->dir_references;\r
                $book->dir_hosting = $r->dir_hosting;\r
+               $book->dir_macbook_phonegap_ios = $r->dir_macbook_phonegap_ios;\r
 \r
                return $book;\r
        }\r
index 110eb45a156b2fcd00e9b56d22f704ebb3d5c3b2..043c8f6888d0cc238f13c083d11cd7990fcd2ed1 100644 (file)
@@ -34,6 +34,7 @@ class wsBook extends cubeMetier {
        protected $version;\r
        protected $dir_references;\r
        protected $dir_hosting;\r
+       protected $dir_macbook_phonegap_ios;\r
 \r
        public function __get($varname) {\r
                if (!property_exists($this, $varname)) {\r
index c1749b5ee10cb942ba86fbc8b76f1d24c2296f11..08e3486fb5eb2b2a3c62f36d6a070a67e17de01e 100644 (file)
@@ -41,7 +41,7 @@ class wsTools {
                        $svg = str_replace('$colorize', '#' . $color, $svg);
                        file_put_contents($svgColorized, $svg);
                }
-               copy($svgColorized, $dest . '/' . $icon . '.svg');
+               self::copy($svgColorized, $dest . '/' . $icon . '.svg');
 
                // PNG
                $png = $dirColorized . '/' . $icon . '.png';
@@ -62,7 +62,15 @@ class wsTools {
                        $batik->setManualArg($svgColorized);
                        $batik->execute();
                }
-               copy($png, $dest . '/' . $icon . '.png');
+               self::copy($png, $dest . '/' . $icon . '.png');
+       }
+       
+       public static function copy($source, $dest) {
+               if(!file_exists($source)){
+                       return;
+               }
+               copy($source, $dest);
+               touch($dest, filemtime($source));
        }
 
 }
index 532a226a745e8b72fae343b36fd9888b17a744ae..44e7dabd17d231c1dbfd401011a1bbc2350fdc93 100644 (file)
@@ -70,6 +70,7 @@ class wsHTML5Compiler {
                'js/widget.js'
        );
        public $pluginCSS = array();
+       public $pluginJs = array();
        protected $cssX = array();
        protected $cssY = array();
        protected $cssWidths = array();
@@ -90,7 +91,7 @@ class wsHTML5Compiler {
        protected $pages;
        protected $theme;
        protected $version;
-       protected $book_id;
+       public $book_id;
        protected $themeRoot;
 
        /**
@@ -224,15 +225,15 @@ class wsHTML5Compiler {
                // Copy style folder
                $from = $this->assets . '/style';
                $to = $this->vdir;
-               `cp -r $from $to`;
+               `cp -p -r $from $to`;
 
                // Copy images folder
                $from = $this->assets . '/images';
-               `cp -r $from $to`;
+               `cp -p -r $from $to`;
 
                // Copy swf
                if (file_exists($this->vdir . '/swf')) {
-                       copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
+                       $this->copy($this->assets . '/swf/video.swf', $this->vdir . '/swf/video.swf');
                }
 
                $this->loadPlugins();
@@ -270,7 +271,7 @@ class wsHTML5Compiler {
 
                        if (file_exists($dir . '/plugin.js')) {
                                $f = $d . '/plugin.js';
-                               $this->jsFiles[] = $f;
+                               $this->pluginJs[] = $f;
                                $this->copy($dir . '/plugin.js', $this->vdir . '/' . $f);
                        }
                        if (file_exists($dir . '/plugin.css')) {
@@ -286,17 +287,18 @@ class wsHTML5Compiler {
        }
 
        protected function getVideosFormats($poster = true) {
-               if ($this->phoenag == 'ios') {
+               if (!$this->phonegap) {
+                       $res = array('mp4', 'ogv', 'webm', 'flv');
+               } elseif ($this->phonegap == 'ios') {
                        $res = array('mp4');
                } else if ($this->phonegap == 'android') {
                        $res = array('ogv', 'webm');
                }
-               if (!$this->phonegap) {
-                       $res[] = 'flv';
-               }
+
                if ($poster) {
                        $res[] = 'jpg';
                }
+               return $res;
        }
 
        protected function writeCache() {
@@ -435,6 +437,9 @@ class wsHTML5Compiler {
                }
                $script .= '<script type="text/javascript" src="data/fluidbook.js"></script>' . "\n";
                $script .= '<script type="text/javascript" src="data/search.js"></script>' . "\n";
+               foreach ($this->pluginJs as $p) {
+                       $script .= '<script type="text/javascript" src="' . $p . '"></script>' . "\n";
+               }
 
                $description = '';
                if ($this->book->parametres->seoDescription) {
@@ -522,7 +527,7 @@ class wsHTML5Compiler {
                                $l = explode(',', $l1);
                                $flag = $l[1];
 
-                               copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
+                               $this->copy(cubeMedia::getFlagFile($flag), $flagsDir . '/' . $flag . '.png');
                                $l[3] = cubeText::ucfirst($iso[$l[0]]);
                                $m[] = implode(',', $l);
                        }
@@ -533,7 +538,7 @@ class wsHTML5Compiler {
 
        protected function writeExtras() {
                if ($this->theme->parametres->afterSearch != '') {
-                       copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, $this->vdir . '/data/images/' . $this->theme->parametres->afterSearch);
+                       $this->copy($this->themeRoot . '/' . $this->theme->parametres->afterSearch, $this->vdir . '/data/images/' . $this->theme->parametres->afterSearch);
                }
        }
 
@@ -715,12 +720,12 @@ class wsHTML5Compiler {
                if (file_exists($t) && filemtime($t) >= filemtime($s) && filesize($s) == filesize($t)) {
                        return;
                }
-
                if (!file_exists(dirname($t))) {
                        mkdir(dirname($t), 0777, true);
                }
 
                copy($s, $t);
+               touch($t, filemtime($s));
        }
 
        protected function writeCSS($file, $links) {
@@ -810,7 +815,7 @@ class wsHTML5Compiler {
                                break;
                }
                if ($this->theme->parametres->backgroundImage != '') {
-                       copy($this->themeRoot . '/' . $this->theme->parametres->backgroundImage, $this->vdir . '/data/images/' . $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:';
 
@@ -848,7 +853,7 @@ class wsHTML5Compiler {
                $header.='height:' . $this->theme->parametres->menuHeight . 'px;';
                $header.='background-color:' . self::colorToCSS($this->theme->parametres->menuColor) . ';';
                if ($this->theme->parametres->menuImage != '') {
-                       copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);
+                       $this->copy($this->themeRoot . '/' . $this->theme->parametres->menuImage, $this->vdir . '/data/images/' . $this->theme->parametres->menuImage);
                        $header.='background-image:url(../images/' . $this->theme->parametres->menuImage . ');';
                        $header.='background-repeat:no-repeat;';
                        $header.='background-size:100% ' . $this->theme->parametres->menuHeight . 'px;';
@@ -863,7 +868,7 @@ class wsHTML5Compiler {
                // Logo
                $logo = '#logo{';
                if ($this->theme->parametres->logo) {
-                       copy($this->themeRoot . '/' . $this->theme->parametres->logo, $this->vdir . '/data/images/' . $this->theme->parametres->logo);
+                       $this->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;';
                }
@@ -955,7 +960,7 @@ class wsHTML5Compiler {
                                if (file_exists($d) && filemtime($d) >= filemtime($s) && filesize($d) == filesize($s)) {
                                        continue;
                                }
-                               copy($s, $d);
+                               $this->copy($s, $d);
                        }
                }
        }
index 7a270c03fe1f27bbf483df339e7a9925f3a03c4a..a243977c40b4ace9304a5c6437b9a5c4411324a4 100644 (file)
@@ -103,7 +103,7 @@ class wsHTML5Link {
 
        public function getCSSContainer() {
 
-               
+
                if (!($this instanceof contentLink) && $this->page % 2 == 1) {
                        $this->page--;
                        $this->left+=$this->compiler->width;
@@ -233,10 +233,10 @@ class videoLink extends wsHTML5Link {
                $w = round($this->width * $this->compiler->getCssScale());
                $h = round($this->height * $this->compiler->getCssScale());
 
-               return self::makeVideoTag($this, $w, $h);
+               return self::makeVideoTag($this, $w, $h, $this->compiler);
        }
 
-       public static function makeVideoTag($linkDatas, $w = null, $h = null) {
+       public static function makeVideoTag($linkDatas, $w = null, $h = null, $compiler = null) {
                $file = $linkDatas->to;
                $e = explode('.', $file);
                $ext = array_pop($e);
@@ -250,6 +250,11 @@ class videoLink extends wsHTML5Link {
                $res = '<div class="videoContainer" ';
                if (!is_null($w) && !is_null($h)) {
                        $res.='data-width="' . $w . '" data-height="' . $h . '" ';
+               } else if (!is_null($compiler)) {
+
+                       $path = WS_BOOKS . '/working/' . $compiler->book_id . '/' . $basename . '.jpg';
+                       $dim = getimagesize($path);
+                       $res.='data-width="' . $dim[0] . '" data-height="' . $dim[1] . '" ';
                }
                $res.=' data-autoplay="' . $autoplay . '"';
                $res.=' data-controls="' . $controls . '"';
@@ -275,7 +280,7 @@ class videoPopupLink extends normalLink {
        }
 
        public function getAdditionnalContent() {
-               return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this)) . '" ';
+               return ' data-video="' . rawurlencode(videoLink::makeVideoTag($this, null, null, $this->compiler)) . '" ';
        }
 
 }
index 538694e4bd9db373fee9107262187bffc4374898..0554ac599156c377fca3fc82af4d56814c690bd4 100644 (file)
@@ -192,13 +192,14 @@ class wsPackagerHTML extends wsPackager {
                $cp = new cubeCommandLine('cp');\r
                $cp->setPath(CONVERTER_PATH);\r
                $cp->setArg('r');\r
+               $cp->setArg('p');\r
                $cp->setArg(null, WS_BOOKS . '/html5/' . $this->book_id . '/*');\r
                $cp->setArg(null, $dest);\r
                $cp->execute();\r
 \r
                $filesToAdd = array('.htaccess', 'web.config');\r
                foreach ($filesToAdd as $f) {\r
-                       copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);\r
+                       $this->copy(WS_COMPILE_ASSETS . '/_html5/' . $f, $dest . '/' . $f);\r
                }\r
 \r
                $filesToDelete = array('indext.html', 'indexu.html', 'data/datas.js');\r
index 2d310b9289f8f6231eed85f23066d64d769f7ddb..03415cd2aadd66cda44cf4fe2263021d1ad01aed 100644 (file)
@@ -19,7 +19,6 @@ class wsPackagerPhonegap extends wsPackager {
                unlink($this->vdir . '/indexu.html');
                unlink($this->vdir . '/widget.html');
                unlink($this->vdir . '/cache.appcache');
-               //rmdir($this->vdir . '/data');
 
                $this->resources = $this->vdir . '/Resources';
 
@@ -88,9 +87,10 @@ class wsPackagerPhonegap extends wsPackager {
 
        public function makePackage($zip) {
                parent::makePackage($zip);
-               $res = $this->zip();
-               $this->postPackage();
-               return $res;
+               if ($zip) {
+                       return $this->zip();
+               }
+               return $this->vdir;
        }
 
 }
index c6be5fc5707c9a9c510d215d329ade9e0efa5269..8e9b84afb0b7ccb391e6819fd6b71747db645b21 100644 (file)
@@ -91,6 +91,7 @@ class wsPackager {
                // Copie du FB vers un répertoire temporaire\r
                $cp = new cubeCommandLine('cp');\r
                $cp->setArg('R');\r
+               $cp->setArg('p');\r
                $cp->setArg(null, WS_BOOKS . '/final/' . $this->book->book_id . '/*');\r
                $cp->setArg(null, $this->vdir);\r
                $cp->execute();\r
@@ -104,10 +105,11 @@ class wsPackager {
 \r
                        $s = WS_COMPILE_ASSETS . '/' . $source;\r
                        if (is_file($s) && !file_exists($this->vdir . $dest)) {\r
-                               copy($s, $this->vdir . $dest);\r
+                               $this->copy($s, $this->vdir . $dest);\r
                        } else if (is_dir($s)) {\r
                                $cp = new cubeCommandLine('cp');\r
                                $cp->setArg('R');\r
+                               $cp->setArg('p');\r
                                $cp->setArg(null, $s);\r
                                $cp->setArg(null, $this->vdir);\r
                                $cp->execute();\r
@@ -166,11 +168,11 @@ class wsPackager {
                $zip->setArg('u');\r
                $zip->setArg(null, '.');\r
                $zip->execute();\r
-               \r
-               if(!file_exists(WS_FILES.'/packager/download')){\r
-                       mkdir(WS_FILES.'/packager/download',0777,true);\r
+\r
+               if (!file_exists(WS_FILES . '/packager/download')) {\r
+                       mkdir(WS_FILES . '/packager/download', 0777, true);\r
                }\r
-               \r
+\r
                fb($zip->commande);\r
                fb($zip->output);\r
 \r
@@ -218,6 +220,14 @@ class wsPackager {
                }\r
        }\r
 \r
+       public function copy($source, $dest) {\r
+               if(!file_exists($source)){\r
+                       return;\r
+               }\r
+               copy($source, $dest);\r
+               touch($dest, filemtime($source));\r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index ee89e31b33233b23e409669ec911cba0f09e794a..9090e2a7a91073f6e3428135be32ce01f83ffaf9 100644 (file)
@@ -42,7 +42,7 @@ class wsPackagerV1 extends wsPackagerHTML {
 
        protected function copyThumbnails() {
                foreach ($this->pages as $book_page => $infos) {
-                       copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg');
+                       $this->copy(WS_DOCS . '/' . $infos['document_id'] . '/p' . $infos['document_page'] . '.jpg', $this->vdir . '/data/p' . $book_page . '.jpg');
                }
        }
 
@@ -248,7 +248,7 @@ class wsPackagerV1 extends wsPackagerHTML {
                        if (!file_exists($src) || !is_file($src)) {
                                $src = WS_THEMES . '/spacer.png';
                        }
-                       copy($src, $images . '/' . $file);
+                       $this->copy($src, $images . '/' . $file);
                }
 
                $cp = new cubeCommandLine('cp');
@@ -278,7 +278,7 @@ class wsPackagerV1 extends wsPackagerHTML {
 
                $src = $this->workingDir . '/' . $file;
                if (file_exists($src) && is_file($src)) {
-                       $res= copy($src, $dir . $file);
+                       $res= $this->copy($src, $dir . $file);
                        return $res;
                }
                return false;
index 886ff7dd2b1b898289017996662654942c620694..b9805857dec341ded26a228364c45b2056409cc2 100644 (file)
@@ -39,7 +39,7 @@ class wsPackagerWinINST extends wsPackagerWinEXE {
                $nsi = str_replace('$output', $this->getPathBase('exe'), $nsi);\r
                $favicon = $this->vdir . '/data/fluidbook.ico';\r
                if ($this->theme->parametres->favicon == '') {\r
-                       copy(WS_COMPILE_ASSETS . '/fluidbook.ico',$favicon);\r
+                       $this->copy(WS_COMPILE_ASSETS . '/fluidbook.ico',$favicon);\r
                }\r
                $nsi = str_replace('$favicon', $favicon, $nsi);\r
 \r