]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 22 Jun 2011 14:37:13 +0000 (14:37 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 22 Jun 2011 14:37:13 +0000 (14:37 +0000)
fluidbook/tools/fwstk.jar
fluidbook/tools/fwstk/.classpath
inc/ws/Util/packager/class.ws.packager.mac.exe.php
inc/ws/Util/packager/class.ws.packager.php
inc/ws/Util/packager/class.ws.packager.win.cd.php
inc/ws/Util/packager/class.ws.packager.win.exe.php

index 03c2c17861c67c92147316b85faebebeae4d5dc2..d29ab78541fd530fa1dcfdf1b662fa1e46f0f4c6 100644 (file)
Binary files a/fluidbook/tools/fwstk.jar and b/fluidbook/tools/fwstk.jar differ
index 5369522ecce0dd5e68b8b76df02158a7edf80f16..e33b75030a86d2ba82a25f59866d49aefb180f1c 100644 (file)
@@ -3,8 +3,8 @@
        <classpathentry kind="src" path="src"/>\r
        <classpathentry kind="src" path="project_resources"/>\r
        <classpathentry kind="src" path="resources"/>\r
-       <classpathentry kind="src" path="Java"/>\r
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
        <classpathentry kind="lib" path="Java/jar/icu4j-4_6_1.jar"/>\r
+       <classpathentry excluding="com/fluidbook/fwstk/|com/fluidbook/fwstk/geom/" kind="src" path="Java"/>\r
        <classpathentry kind="output" path="bin"/>\r
 </classpath>\r
index d1c1279d51a94c7baebf54a81c9deeebcb17316b..69d112f11000993ddaa7a6ac723d6e07fd50baf9 100644 (file)
@@ -7,7 +7,7 @@ class wsPackagerMacEXE extends wsPackager {
                parent::__construct($book_id);\r
                $this->version = 'mac-exe';\r
 \r
-               $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16));\r
+               $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30));\r
        }\r
 \r
        protected function preparePackage()\r
@@ -22,7 +22,9 @@ class wsPackagerMacEXE extends wsPackager {
        public function makePackage()\r
        {\r
                parent::makePackage();\r
-               return $this->zip($this->vdir . 'Fluidbook.app.zip');\r
+               $res=$this->zip($this->vdir . 'Fluidbook.app.zip');\r
+               $this->postPackage();\r
+               return $res;\r
        }\r
 }\r
 \r
index c71d1a614d44873924e4056aafce6d6dec8f2b02..1f22c9ec186dbd80232a94f5a529bfdcd46ef996 100644 (file)
@@ -1,5 +1,7 @@
 <?php\r
+\r
 class wsPackager {\r
+\r
        protected $dir;\r
        protected $vdir;\r
        protected $book;\r
@@ -8,8 +10,7 @@ class wsPackager {
        protected $version;\r
        protected $book_id;\r
 \r
-       public static function package($book_id, $version)\r
-       {\r
+       public static function package($book_id, $version) {\r
                if ($version == 'html') {\r
                        $packager = new wsPackagerHTML($book_id);\r
                } elseif ($version == 'win-exe') {\r
@@ -27,8 +28,7 @@ class wsPackager {
                return $packager->makePackage();\r
        }\r
 \r
-       public function __construct($book_id)\r
-       {\r
+       public function __construct($book_id) {\r
                global $core;\r
 \r
                $this->book_id = $book_id;\r
@@ -47,20 +47,17 @@ class wsPackager {
                $this->theme = $daoTheme->getThemeOfBook($book_id, true);\r
        }\r
 \r
-       protected function preparePackage()\r
-       {\r
+       protected function preparePackage() {\r
                $this->initTempDir();\r
        }\r
 \r
-       public function makePackage()\r
-       {\r
+       public function makePackage() {\r
                $this->preparePackage();\r
        }\r
 \r
-       protected function replaceContents($str, $toReplace)\r
-       {\r
+       protected function replaceContents($str, $toReplace) {\r
                $res = $str;\r
-               foreach($toReplace as $k => $v) {\r
+               foreach ($toReplace as $k => $v) {\r
                        if (is_null($v)) {\r
                                return;\r
                        }\r
@@ -69,8 +66,7 @@ class wsPackager {
                return $res;\r
        }\r
 \r
-       protected function copyFluidbookFiles()\r
-       {\r
+       protected function copyFluidbookFiles() {\r
                // Copie du FB vers un rĂ©pertoire temporaire\r
                $cp = new cubeCommandLine('cp');\r
                $cp->setArg('R');\r
@@ -79,38 +75,47 @@ class wsPackager {
                $cp->execute();\r
        }\r
 \r
-       protected function copyOtherFiles($files)\r
-       {\r
-               foreach($files as $source => $dest) {\r
+       protected function copyOtherFiles($files) {\r
+               foreach ($files as $source => $dest) {\r
                        if (is_int($source)) {\r
                                $source = $dest;\r
                        }\r
 \r
-                       copy(WS_COMPILE_ASSETS . '/' . $source, $this->vdir . $dest);\r
+                       $s = WS_COMPILE_ASSETS . '/' . $source;\r
+                       if (is_file($s)) {\r
+                               copy($s, $this->vdir . $dest);\r
+                       } else if (is_dir($s)) {\r
+                               $cp = new cubeCommandLine('cp');\r
+                               $cp->setArg('R');\r
+                               $cp->setArg(null, $s);\r
+                               $cp->setArg(null, $this->vdir);\r
+                               $cp->execute();\r
+\r
+                               $mv = new cubeCommandLine('mv');\r
+                               $mv->setArg($this->vdir . '/' . $source);\r
+                               $mv->setArg($this->vdir . '/' . $dest);\r
+                               $mv->execute();\r
+                       }\r
                }\r
        }\r
 \r
-       protected function getBaseFile()\r
-       {\r
+       protected function getBaseFile() {\r
                return $this->version . '-' . date('Ymdhis', TIME) . '-' . cubeText::str2URL($this->book->parametres->title);\r
        }\r
 \r
-       protected function getRelativeBase()\r
-       {\r
+       protected function getRelativeBase() {\r
                return '/packager/download/' . $this->getBaseFile();\r
        }\r
 \r
-       protected function getURLBase($ext = '')\r
-       {\r
-               $res = '/fluidbook' . $this->getRelativeBase() ;\r
+       protected function getURLBase($ext = '') {\r
+               $res = '/fluidbook' . $this->getRelativeBase();\r
                if ($ext != '') {\r
                        $res .= '.' . $ext;\r
                }\r
                return $res;\r
        }\r
 \r
-       protected function getPathBase($ext = '')\r
-       {\r
+       protected function getPathBase($ext = '') {\r
                $res = WS_FILES . $this->getRelativeBase();\r
                if ($ext != '') {\r
                        $res .= '.' . $ext;\r
@@ -119,8 +124,7 @@ class wsPackager {
                return $res;\r
        }\r
 \r
-       protected function zip($zipfile = null)\r
-       {\r
+       protected function zip($zipfile = null) {\r
                $url = $this->getURLBase('zip');\r
                $final = $this->getPathBase('zip');\r
                $rename = false;\r
@@ -146,15 +150,13 @@ class wsPackager {
                return $url;\r
        }\r
 \r
-       protected function initTempDir()\r
-       {\r
+       protected function initTempDir() {\r
                $this->vdir = $this->dir . $this->version . '/';\r
                $this->cleanVdir();\r
                mkdir($this->vdir . '/data', 0777, true);\r
        }\r
 \r
-       protected function cleanVdir()\r
-       {\r
+       protected function cleanVdir() {\r
                if (file_exists($this->vdir)) {\r
                        // Suppression du rĂ©pertoire si il existe\r
                        $rm = new cubeCommandLine('rm');\r
@@ -164,16 +166,20 @@ class wsPackager {
                        $rm->execute();\r
                }\r
        }\r
-       \r
-       protected function moveDatasSWF(){\r
-               rename($this->vdir.'/FluidbookDatas.swf',$this->vdir.'/data/FluidbookDatas.swf');\r
-               rename($this->vdir.'/FluidbookDatasLight.swf',$this->vdir.'/data/FluidbookDatasLight.swf');\r
+\r
+       protected function moveDatasSWF() {\r
+               rename($this->vdir . '/FluidbookDatas.swf', $this->vdir . '/data/FluidbookDatas.swf');\r
+               rename($this->vdir . '/FluidbookDatasLight.swf', $this->vdir . '/data/FluidbookDatasLight.swf');\r
        }\r
 \r
-       public function __destruct()\r
-       {\r
+       protected function postPackage() {\r
+               \r
+       }\r
+\r
+       public function __destruct() {\r
                $this->cleanVdir();\r
        }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 883db767f397d2f9a9878ff255f5dec9aa68fd55..60f1a1f2913ce34adabb2fd1b3acef105eedf0e2 100644 (file)
@@ -1,27 +1,35 @@
 <?php\r
-class wsPackagerWinCD extends wsPackagerWinEXE {\r
-       public function __construct($book_id)\r
-       {\r
+\r
+class wsPackagerWinCD extends wsPackagerMacEXE {\r
+\r
+       public function __construct($book_id) {\r
                parent::__construct($book_id);\r
                $this->version = 'win-cd';\r
        }\r
 \r
-       protected function preparePackage()\r
-       {\r
+       protected function preparePackage() {\r
                parent::preparePackage();\r
 \r
-               $this->copyOtherFiles(array('fluidbook.ico'=>'data/fluidbook.ico', 'autorun.inf'));\r
+               $this->copyOtherFiles(array(\r
+                       'fluidbook.ico' => 'data/fluidbook.ico', '\r
+                       autorun.inf',\r
+                       'Fluidbook.exe' => 'Windows-PC-' . $this->exeName . '.exe',\r
+                       'Fluidbook.app.zip'));\r
                $this->replaceAutorun();\r
                $this->moveDatasSWF();\r
        }\r
 \r
-       public function replaceAutorun()\r
-       {\r
+       public function replaceAutorun() {\r
                $inf = file_get_contents($this->vdir . 'autorun.inf');\r
                $toReplace = array('title' => $this->book->parametres->title, 'exe' => $this->exeName);\r
                $inf = $this->replaceContents($inf, $toReplace);\r
                file_put_contents($this->vdir . 'autorun.inf', $inf);\r
        }\r
+\r
+       protected function postPackage() {\r
+               \r
+       }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file
index 7491f1d80baeb74662fe6c40c5659512eda69d4c..f8efed8c0a364672e4e47a00268ed61c6afafa39 100644 (file)
@@ -1,17 +1,17 @@
 <?php\r
+\r
 class wsPackagerWinEXE extends wsPackager {\r
+\r
        protected $exeName;\r
 \r
-       public function __construct($book_id)\r
-       {\r
+       public function __construct($book_id) {\r
                parent::__construct($book_id);\r
                $this->version = 'win-exe';\r
 \r
-               $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16)).'.exe';\r
+               $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)) . '.exe';\r
        }\r
 \r
-       protected function preparePackage()\r
-       {\r
+       protected function preparePackage() {\r
                parent::preparePackage();\r
 \r
                $this->copyFluidbookFiles();\r
@@ -19,11 +19,13 @@ class wsPackagerWinEXE extends wsPackager {
                $this->moveDatasSWF();\r
        }\r
 \r
-       public function makePackage()\r
-       {\r
+       public function makePackage() {\r
                parent::makePackage();\r
-               return $this->zip();\r
+               $res = $this->zip();\r
+               $this->postPackage();\r
+               return $res;\r
        }\r
+\r
 }\r
 \r
 ?>
\ No newline at end of file