$__autoload['wsPackagerWinEXE'] = dirname(__FILE__) . '/class.ws.packager.win.exe.php';\r
$__autoload['wsPackagerWinCD'] = dirname(__FILE__) . '/class.ws.packager.win.cd.php';\r
$__autoload['wsPackagerMacEXE'] = dirname(__FILE__) . '/class.ws.packager.mac.exe.php';\r
+$__autoload['wsPackagerWinINST'] = dirname(__FILE__) . '/class.ws.packager.win.inst.php';\r
\r
?>
\ No newline at end of file
$this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16));\r
}\r
\r
- public function preparePackage()\r
+ protected function preparePackage()\r
{\r
parent::preparePackage();\r
\r
$packager = new wsPackagerWinEXE($book_id);\r
} elseif ($version == 'win-cd') {\r
$packager = new wsPackagerWinCD($book_id);\r
+ } elseif ($version == 'win-ins') {\r
+ $packager = new wsPackagerWinINST($book_id);\r
} elseif ($version == 'mac-exe') {\r
$packager = new wsPackagerMacEXE($book_id);\r
}\r
}\r
}\r
\r
+ protected function getBaseFile()\r
+ {\r
+ return $this->version . '-' . date('Ymdhis', TIME) . '-' . cubeText::str2URL($this->book->parametres->title);\r
+ }\r
+\r
+ protected function getRelativeBase()\r
+ {\r
+ return '/packager/download/' . $this->getBaseFile();\r
+ }\r
+\r
+ protected function getURLBase($ext = '')\r
+ {\r
+ $res = '/fluidbook' . $this->getRelativeBase() ;\r
+ if ($ext != '') {\r
+ $res .= '.' . $ext;\r
+ }\r
+ return $res;\r
+ }\r
+\r
+ protected function getPathBase($ext = '')\r
+ {\r
+ $res = WS_FILES . $this->getRelativeBase();\r
+ if ($ext != '') {\r
+ $res .= '.' . $ext;\r
+ }\r
+\r
+ return $res;\r
+ }\r
+\r
protected function zip($zipfile = null)\r
{\r
- $base = '/packager/download/' . $this->version . '-' . date('Ymdhis') . '-' . cubeText::str2URL($this->book->parametres->title) . '.zip';\r
- $url = '/fluidbook' . $base;\r
- $final = WS_FILES . $base ;\r
+ $url = $this->getURLBase('zip');\r
+ $final = $this->getPathBase('zip');\r
$rename = false;\r
if (is_null($zipfile)) {\r
$zipfile = $final;\r
$this->version = 'win-cd';\r
}\r
\r
- public function preparePackage()\r
+ protected function preparePackage()\r
{\r
parent::preparePackage();\r
\r
$this->exeName = cubeText::str2URL(mb_substr($this->book->parametres->title, 0, 16)).'.exe';\r
}\r
\r
- public function preparePackage()\r
+ protected function preparePackage()\r
{\r
parent::preparePackage();\r
\r
--- /dev/null
+<?php\r
+class wsPackagerWinINST extends wsPackagerWinEXE {\r
+ protected $nsi;\r
+\r
+ public function __construct($book_id)\r
+ {\r
+ parent::__construct($book_id);\r
+ $this->version = 'win-ins';\r
+ }\r
+\r
+ protected function preparePackage()\r
+ {\r
+ parent::preparePackage();\r
+\r
+ $this->copyFluidbookFiles();\r
+ $this->copyOtherFiles(array('Fluidbook.exe' => $this->exeName));\r
+\r
+ $this->makeNSI();\r
+ }\r
+\r
+ protected function makeNSI()\r
+ {\r
+ $winvdir = trim($this->vdir, '/');\r
+ $winvdir = str_replace('/', '\\' , $winvdir);\r
+ $winvdir = "\\" . $winvdir;\r
+\r
+ $nsi = file_get_contents(WS_COMPILE_ASSETS . '/script.nsi');\r
+ $nsi = str_replace('$name', utf8_decode($this->book->parametres->title), $nsi);\r
+ $nsi = str_replace('$htmldir', utf8_decode(WS_COMPILE_ASSETS), $nsi);\r
+ $nsi = str_replace('$fname', str_replace('.exe', '', $this->exeName), $nsi);\r
+ $nsi = str_replace('$fdir', $winvdir, $nsi);\r
+ $nsi = str_replace('$titre', utf8_decode($this->book->parametres->title), $nsi);\r
+ $nsi = str_replace('$lang', 'English', $nsi);\r
+ $nsi = str_replace('$nsisdir', '/usr/local/nsis/nsis-2.46/share/nsis', $nsi);\r
+ $nsi = str_replace('$output', $this->getPathBase('exe'), $nsi);\r
+\r
+ $this->nsi = $nsi;\r
+ }\r
+ public function makePackage()\r
+ {\r
+ $this->preparePackage();\r
+ $url = 'http://installer.fluidbook.com/make.php?nsi=' . base64_encode($this->nsi) ;\r
+ fb($url);\r
+\r
+ file_get_contents('http://installer.fluidbook.com/make.php?nsi=' . base64_encode($this->nsi) . '&junk=' . TIME);\r
+ return $this->getURLBase('exe');\r
+ }\r
+\r
+ public function __destruct()\r
+ {\r
+ }\r
+}\r
+\r
+?>
\ No newline at end of file
\r
$filesToCopy['FluidbookDatas.swf'] = $compilerDir . '/FluidbookDatas.swf';\r
$filesToCopy['FluidbookDatasLight.swf'] = $compilerDir . '/FluidbookDatasLight.swf';\r
- $filesToCopy['index.swf'] = WS_COMPILE_ASSETS . '/index.swf';\r
// Copy of files\r
// Check if dest dir exists\r
if (!file_exists($finalDir . 'data')) {\r