From: vincent@cubedesigners.com Date: Sun, 16 Oct 2011 03:47:16 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=7dcb36038ad870ef38609cd7d141a380b6f3eeac;p=cubeextranet.git --- diff --git a/fluidbook/tools/fwstk/nbproject/private/private.properties b/fluidbook/tools/fwstk/nbproject/private/private.properties index c85e5f3f2..75eb4042c 100644 --- a/fluidbook/tools/fwstk/nbproject/private/private.properties +++ b/fluidbook/tools/fwstk/nbproject/private/private.properties @@ -4,4 +4,4 @@ do.depend=false do.jar=true javac.debug=true javadoc.preview=true -user.properties.file=C:\\Users\\Vincent\\.netbeans\\7.0\\build.properties +user.properties.file=C:\\Users\\Cube\\.netbeans\\7.0\\build.properties diff --git a/inc/config.inc.php b/inc/config.inc.php index 9a9b95671..6fb0f4122 100644 --- a/inc/config.inc.php +++ b/inc/config.inc.php @@ -14,6 +14,7 @@ define('CONVERTER_PATH', '/bin:/usr/bin:/usr/local/bin:/home/extranet/www/fluidb define('MXMLC_PATH', '/usr/local/flex/bin/mxmlc'); define('MXMLC_PATH_3', '/usr/local/flex_sdk_3.6/bin/mxmlc'); define('AS3_SOURCES', '/home/ws/sources/as3'); +define('AS3_FLUIDBOOK_SOURCES', '/home/ws/sources/fluidbook'); define('MONITOR_PERFS', true); @@ -32,7 +33,7 @@ define('WS_CACHE', WS_FILES . '/cache'); define('WS_COMPILE_ASSETS', WS_FILES . '/compile'); define('WS_SOUNDS', WS_FILES . '/sounds'); define('WS_TOOLS', WS_FILES . '/tools'); -define('WS_SHM','/dev/shm'); +define('WS_SHM', '/dev/shm'); define('WORKER_PREFIX', 'worker.'); diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index fdddd347e..9b2ad9027 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -917,6 +917,22 @@ html{height:100%}' . "\n"; exit; } + public static function testAIR($args) { + global $core; + commonDroits::min(5); + if (!isset($args[1])) { + $args[1] = 2964; + } + self::checkDocumentVersionOfBook($args[1]); + cubePHP::neverStop(); + $dao = new wsDAOBook($core->con); + + header('Content-type: text/plain'); + ob_end_clean(); + echo $dao->compileAIR($args[1]); + exit; + } + public static function testLinksCSV($args) { global $core; commonDroits::min(5); diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 1bac59d51..f9e74551d 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -673,24 +673,99 @@ class wsDAOBook extends commonDAO { $this->touchCompile($book_id); } - /** - * wsDAOBook::compile3() - * - * @param mixed $book_id - * @param mixed $complete - * @return - */ public function compile3($book_id, $complete) { - cubePHP::neverStop(); - $filesToCopy = array(); - $finalDir = WS_BOOKS . '/final/' . $book_id . '/'; - $workingDir = WS_BOOKS . '/working/' . $book_id . '/'; + $res = ''; + $compilerDir = WS_BOOKS . '/datasCompiler/' . $book_id . '/'; + $finalDir = WS_BOOKS . '/final/' . $book_id . '/'; + + $book = $this->selectById($book_id); + $pages = $this->getPagesOfBook($book_id); + + $flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10); + $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10); + + $filesToCopy = array(); + + $this->compileFlex($book_id, $complete, $compilerDir, $finalDir, $filesToCopy, $book, $pages, $flex, $flexLight); + + $flexLight->addVariable('checksum', $hash, false, true, 'String'); + $res .= $flex->compile() . "\n\n-------------------\n\n"; + $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf')); + $res .= $flexLight->compile(); + + $filesToCopy['data/fd.swf'] = $compilerDir . '/FluidbookDatas.swf'; + $filesToCopy['data/fdl.swf'] = $compilerDir . '/FluidbookDatasLight.swf'; + // Copy of files + // Check if dest dir exists + if (!file_exists($finalDir . 'data')) { + mkdir($finalDir . 'data', 0777, true); + } + // Check working dir + if (file_exists($workingDir)) { + $dr = opendir($workingDir); + while ($file = readdir($dr)) { + if ($file == '.' || $file == '..') { + continue; + } + $filesToCopy['data/' . $file] = $workingDir . '/' . $file; + } + } + + foreach ($filesToCopy as $local => $source) { + $localPath = $finalDir . $local; + // if (!file_exists($localPath) || filemtime($localPath) < filemtime($source) || filesize($localPath) != filesize($source)) { + if (is_dir($source)) { + continue; + } + copy($source, $localPath); + // } + } + + $this->compilePDF($book, $pages); + $this->indexPDF($book, $pages); + $this->compileHTML5($book_id); + $this->compileWidget($book, $pages); + + $this->touchCompile($book_id); + + return $res; + } + + public function compileAir($book_id) { + $compilerDir = WS_BOOKS . '/air/' . $book_id . '/compiler'; + $finalDir = WS_BOOKS . '/air/' . $book_id . '/'; - $res = ''; $book = $this->selectById($book_id); $pages = $this->getPagesOfBook($book_id); + $src = AS3_FLUIDBOOK_SOURCES . '/_src/'; + $lib10 = AS3_FLUIDBOOK_SOURCES . '/lib10/'; + $libs = array( + $src, + $lib10, + AS3_SOURCES, + $src . 'lib/fluidbook3dLibrary.swc', + $src . 'lib/mdm.swc', + $lib10 . 'flash.swc', + $lib10 . 'flex.swc', + $lib10 . 'framework.swc', + ); + $flex = new cubeFlexCompiler('FluidbookAirProjector' . $book_id, $compilerDir, 'com.fluidbook.player.AIRMain', $libs, '/usr/local/flex_sdk_4.5/bin/mxmlc', 'air', 45,800,600,true); + + $this->compileFlex($book_id, true, $compilerDir, $finalDir, $filesToCopy, $book, $pages, $flex, $flex); + + return $flex->compile(); + } + + public function compileFlex($book_id, $complete, $compilerDir, $finalDir, &$filesToCopy, $book, $pages, $flex, $flexLight) { + cubePHP::neverStop(); + + + $workingDir = WS_BOOKS . '/working/' . $book_id . '/'; + + $res = ''; + $daoDoc = new wsDAODocument($this->con); $firstDoc = $daoDoc->selectById($pages[1]['document_id']); $size = $firstDoc->generalInfos['size']; @@ -722,8 +797,6 @@ class wsDAOBook extends commonDAO { $this->makeTextsIndexes($book_id, $index, $textes); $daoDoc->getLinksAndRulers($book_id, $links, $rulers); - $flex = new cubeFlexCompiler('FluidbookDatas', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10); - $flexLight = new cubeFlexCompiler('FluidbookDatasLight', $compilerDir, 'flash.display.Sprite', explode(';', AS3_SOURCES), MXMLC_PATH, 10); $imagesassets = array(); $id = 1; @@ -874,48 +947,6 @@ class wsDAOBook extends commonDAO { $flex->addFont(FONT_PATH . '/' . $lang->font, 'GeneralFont', $lang->charset); $flex->addFont(FONT_PATH . '/FluidbookCredits.ttf', 'CreditsFont', 'ASCII'); $flexLight->addFont(FONT_PATH . '/FluidbookLoader.ttf', 'LoaderFont', 'Numerals'); - $flexLight->addVariable('checksum', $hash, false, true, 'String'); - $res .= $flex->compile() . "\n\n-------------------\n\n"; - $flexLight->addVariable('datasSize', filesize($compilerDir . '/FluidbookDatas.swf')); - $res .= $flexLight->compile(); - - - $filesToCopy['data/fd.swf'] = $compilerDir . '/FluidbookDatas.swf'; - $filesToCopy['data/fdl.swf'] = $compilerDir . '/FluidbookDatasLight.swf'; - // Copy of files - // Check if dest dir exists - if (!file_exists($finalDir . 'data')) { - mkdir($finalDir . 'data', 0777, true); - } - // Check working dir - if (file_exists($workingDir)) { - $dr = opendir($workingDir); - while ($file = readdir($dr)) { - if ($file == '.' || $file == '..') { - continue; - } - $filesToCopy['data/' . $file] = $workingDir . '/' . $file; - } - } - - foreach ($filesToCopy as $local => $source) { - $localPath = $finalDir . $local; - // if (!file_exists($localPath) || filemtime($localPath) < filemtime($source) || filesize($localPath) != filesize($source)) { - if (is_dir($source)) { - continue; - } - copy($source, $localPath); - // } - } - - $this->compilePDF($book, $pages); - $this->indexPDF($book, $pages); - $this->compileHTML5($book_id); - $this->compileWidget($book, $pages); - - $this->touchCompile($book_id); - - return $res; } public function compileWidget($book, $pages) { @@ -1018,7 +1049,7 @@ class wsDAOBook extends commonDAO { public function compilePDF($book, $pages) { $finalPDF = WS_BOOKS . '/final/' . $book->book_id . '/data/document.pdf'; - if (!$book->parametres->pdf && $book->parametres->mobileVersion!='pdf') { + if (!$book->parametres->pdf && $book->parametres->mobileVersion != 'pdf') { // Si l'export PDF n'est pas activé on supprime le fichier si il existe if (file_exists($finalPDF)) { unlink($finalPDF); diff --git a/inc/ws/Util/packager/_common.php b/inc/ws/Util/packager/_common.php index 1014e7e83..31f24a4ab 100644 --- a/inc/ws/Util/packager/_common.php +++ b/inc/ws/Util/packager/_common.php @@ -5,5 +5,5 @@ $__autoload['wsPackagerHTML'] = dirname(__FILE__) . '/class.ws.packager.html.php $__autoload['wsPackagerWinEXE'] = dirname(__FILE__) . '/class.ws.packager.win.exe.php'; $__autoload['wsPackagerWinCD'] = dirname(__FILE__) . '/class.ws.packager.win.cd.php'; $__autoload['wsPackagerMacEXE'] = dirname(__FILE__) . '/class.ws.packager.mac.exe.php'; -$__autoload['wsPackagerWinINST'] = dirname(__FILE__) . '/class.ws.packager.win.inst.php'; +$__autoload['wsPackagerAIR'] = dirname(__FILE__) . '/class.ws.packager.air.php'; ?> \ No newline at end of file