From: vincent@cubedesigners.com Date: Wed, 22 Jun 2011 14:37:13 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=39e3c792fb982aa3881bbc87e800d59da2656cb8;p=cubeextranet.git --- diff --git a/fluidbook/tools/fwstk.jar b/fluidbook/tools/fwstk.jar index 03c2c1786..d29ab7854 100644 Binary files a/fluidbook/tools/fwstk.jar and b/fluidbook/tools/fwstk.jar differ diff --git a/fluidbook/tools/fwstk/.classpath b/fluidbook/tools/fwstk/.classpath index 5369522ec..e33b75030 100644 --- a/fluidbook/tools/fwstk/.classpath +++ b/fluidbook/tools/fwstk/.classpath @@ -3,8 +3,8 @@ - + diff --git a/inc/ws/Util/packager/class.ws.packager.mac.exe.php b/inc/ws/Util/packager/class.ws.packager.mac.exe.php index d1c1279d5..69d112f11 100644 --- a/inc/ws/Util/packager/class.ws.packager.mac.exe.php +++ b/inc/ws/Util/packager/class.ws.packager.mac.exe.php @@ -7,7 +7,7 @@ class wsPackagerMacEXE extends wsPackager { parent::__construct($book_id); $this->version = 'mac-exe'; - $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16)); + $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)); } protected function preparePackage() @@ -22,7 +22,9 @@ class wsPackagerMacEXE extends wsPackager { public function makePackage() { parent::makePackage(); - return $this->zip($this->vdir . 'Fluidbook.app.zip'); + $res=$this->zip($this->vdir . 'Fluidbook.app.zip'); + $this->postPackage(); + return $res; } } diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index c71d1a614..1f22c9ec1 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -1,5 +1,7 @@ makePackage(); } - public function __construct($book_id) - { + public function __construct($book_id) { global $core; $this->book_id = $book_id; @@ -47,20 +47,17 @@ class wsPackager { $this->theme = $daoTheme->getThemeOfBook($book_id, true); } - protected function preparePackage() - { + protected function preparePackage() { $this->initTempDir(); } - public function makePackage() - { + public function makePackage() { $this->preparePackage(); } - protected function replaceContents($str, $toReplace) - { + protected function replaceContents($str, $toReplace) { $res = $str; - foreach($toReplace as $k => $v) { + foreach ($toReplace as $k => $v) { if (is_null($v)) { return; } @@ -69,8 +66,7 @@ class wsPackager { return $res; } - protected function copyFluidbookFiles() - { + protected function copyFluidbookFiles() { // Copie du FB vers un répertoire temporaire $cp = new cubeCommandLine('cp'); $cp->setArg('R'); @@ -79,38 +75,47 @@ class wsPackager { $cp->execute(); } - protected function copyOtherFiles($files) - { - foreach($files as $source => $dest) { + protected function copyOtherFiles($files) { + foreach ($files as $source => $dest) { if (is_int($source)) { $source = $dest; } - copy(WS_COMPILE_ASSETS . '/' . $source, $this->vdir . $dest); + $s = WS_COMPILE_ASSETS . '/' . $source; + if (is_file($s)) { + copy($s, $this->vdir . $dest); + } else if (is_dir($s)) { + $cp = new cubeCommandLine('cp'); + $cp->setArg('R'); + $cp->setArg(null, $s); + $cp->setArg(null, $this->vdir); + $cp->execute(); + + $mv = new cubeCommandLine('mv'); + $mv->setArg($this->vdir . '/' . $source); + $mv->setArg($this->vdir . '/' . $dest); + $mv->execute(); + } } } - protected function getBaseFile() - { + protected function getBaseFile() { return $this->version . '-' . date('Ymdhis', TIME) . '-' . cubeText::str2URL($this->book->parametres->title); } - protected function getRelativeBase() - { + protected function getRelativeBase() { return '/packager/download/' . $this->getBaseFile(); } - protected function getURLBase($ext = '') - { - $res = '/fluidbook' . $this->getRelativeBase() ; + protected function getURLBase($ext = '') { + $res = '/fluidbook' . $this->getRelativeBase(); if ($ext != '') { $res .= '.' . $ext; } return $res; } - protected function getPathBase($ext = '') - { + protected function getPathBase($ext = '') { $res = WS_FILES . $this->getRelativeBase(); if ($ext != '') { $res .= '.' . $ext; @@ -119,8 +124,7 @@ class wsPackager { return $res; } - protected function zip($zipfile = null) - { + protected function zip($zipfile = null) { $url = $this->getURLBase('zip'); $final = $this->getPathBase('zip'); $rename = false; @@ -146,15 +150,13 @@ class wsPackager { return $url; } - protected function initTempDir() - { + protected function initTempDir() { $this->vdir = $this->dir . $this->version . '/'; $this->cleanVdir(); mkdir($this->vdir . '/data', 0777, true); } - protected function cleanVdir() - { + protected function cleanVdir() { if (file_exists($this->vdir)) { // Suppression du répertoire si il existe $rm = new cubeCommandLine('rm'); @@ -164,16 +166,20 @@ class wsPackager { $rm->execute(); } } - - protected function moveDatasSWF(){ - rename($this->vdir.'/FluidbookDatas.swf',$this->vdir.'/data/FluidbookDatas.swf'); - rename($this->vdir.'/FluidbookDatasLight.swf',$this->vdir.'/data/FluidbookDatasLight.swf'); + + protected function moveDatasSWF() { + rename($this->vdir . '/FluidbookDatas.swf', $this->vdir . '/data/FluidbookDatas.swf'); + rename($this->vdir . '/FluidbookDatasLight.swf', $this->vdir . '/data/FluidbookDatasLight.swf'); } - public function __destruct() - { + protected function postPackage() { + + } + + public function __destruct() { $this->cleanVdir(); } + } ?> \ No newline at end of file diff --git a/inc/ws/Util/packager/class.ws.packager.win.cd.php b/inc/ws/Util/packager/class.ws.packager.win.cd.php index 883db767f..60f1a1f29 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.cd.php +++ b/inc/ws/Util/packager/class.ws.packager.win.cd.php @@ -1,27 +1,35 @@ version = 'win-cd'; } - protected function preparePackage() - { + protected function preparePackage() { parent::preparePackage(); - $this->copyOtherFiles(array('fluidbook.ico'=>'data/fluidbook.ico', 'autorun.inf')); + $this->copyOtherFiles(array( + 'fluidbook.ico' => 'data/fluidbook.ico', ' + autorun.inf', + 'Fluidbook.exe' => 'Windows-PC-' . $this->exeName . '.exe', + 'Fluidbook.app.zip')); $this->replaceAutorun(); $this->moveDatasSWF(); } - public function replaceAutorun() - { + public function replaceAutorun() { $inf = file_get_contents($this->vdir . 'autorun.inf'); $toReplace = array('title' => $this->book->parametres->title, 'exe' => $this->exeName); $inf = $this->replaceContents($inf, $toReplace); file_put_contents($this->vdir . 'autorun.inf', $inf); } + + protected function postPackage() { + + } + } ?> \ No newline at end of file diff --git a/inc/ws/Util/packager/class.ws.packager.win.exe.php b/inc/ws/Util/packager/class.ws.packager.win.exe.php index 7491f1d80..f8efed8c0 100644 --- a/inc/ws/Util/packager/class.ws.packager.win.exe.php +++ b/inc/ws/Util/packager/class.ws.packager.win.exe.php @@ -1,17 +1,17 @@ version = 'win-exe'; - $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16)).'.exe'; + $this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 30)) . '.exe'; } - protected function preparePackage() - { + protected function preparePackage() { parent::preparePackage(); $this->copyFluidbookFiles(); @@ -19,11 +19,13 @@ class wsPackagerWinEXE extends wsPackager { $this->moveDatasSWF(); } - public function makePackage() - { + public function makePackage() { parent::makePackage(); - return $this->zip(); + $res = $this->zip(); + $this->postPackage(); + return $res; } + } ?> \ No newline at end of file