From: vincent@cubedesigners.com Date: Wed, 7 Nov 2012 16:58:53 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0049d62a9fbfd19cea4ddc4946115b567580fd2c;p=cubeextranet.git --- diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index ae0d64672..514d1c9d4 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -249,17 +249,19 @@ class wsAjax extends cubeAjax { return; } + fb(time(), 'start making package'); $version = 'html'; if ($book->parametres->version == 1) { $version = 'v1'; } if (stristr($server, 'phonegap')) { $version = 'phonegap'; + $packager = new wsPackagerPhonegap($book_id, null, true, false); + $package = $packager->makePackage(false); + } else { + $package = wsPackager::package($book_id, $version, false); } - fb(time(), 'start making package'); - $package = wsPackager::package($book_id, $version, false); - fb(time(), 'start transfert'); if ($server == 'references') { $root = '/home/fluidbook/dev/references'; diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 91e33f46b..76d07a189 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -334,7 +334,7 @@ class wsUrl { $res .= commonPage::bf(); $res .= commonPage::bh(); - $res .= cubeLang::translationForm(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5/js'), $lang_id, null, 'liste', array(), '' . $core->typo->Ajouter(__('Enregistrer')) . '', $lang->traductions); + $res .= cubeLang::translationForm(array(PLAYER_SOURCES, WS_COMPILE_ASSETS . '/_html5'), $lang_id, null, 'liste', array(), '' . $core->typo->Ajouter(__('Enregistrer')) . '', $lang->traductions); $res .= commonPage::bf(); $res .= ''; return $res; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 7b6b3b7f2..aed944343 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -894,7 +894,7 @@ class wsDAOBook extends commonDAO { if (is_dir($source)) { continue; } - copy($source, $localPath); + $this->copy($source, $localPath); } } @@ -903,6 +903,7 @@ class wsDAOBook extends commonDAO { $cp = new cubeCommandLine('cp'); $cp->setPath(CONVERTER_PATH); $cp->setArg('r'); + $cp->setArg('p'); $cp->setArg(null, $workingDir . 'media'); $cp->setArg(null, $finalDir . 'data'); $cp->execute(); @@ -911,6 +912,11 @@ class wsDAOBook extends commonDAO { return $res; } + public function copy($source, $dest) { + copy($source, $dest); + touch($dest, filemtime($dest)); + } + public function compileAir($book_id) { $compilerDir = WS_BOOKS . '/air/' . $book_id . '/compiler'; $finalDir = WS_BOOKS . '/air/' . $book_id . '/'; @@ -1331,7 +1337,7 @@ class wsDAOBook extends commonDAO { $replace = WS_BOOKS . '/working/' . $book->book_id . '/' . $book->parametres->pdfReplace; if (file_exists($replace)) { if (!file_exists($finalPDF) || filemtime($finalPDF) < filemtime($replace) || filesize($finalPDF) != filesize($replace)) { - copy($replace, $finalPDF); + $this->copy($replace, $finalPDF); } return; } @@ -1382,7 +1388,7 @@ class wsDAOBook extends commonDAO { } if ($original) { - copy(WS_DOCS . '/' . $firstDoc . '/crop.pdf', $finalPDF); + $this->copy(WS_DOCS . '/' . $firstDoc . '/crop.pdf', $finalPDF); return; } @@ -1429,7 +1435,7 @@ class wsDAOBook extends commonDAO { $alldocs = array_keys($pdfList); $doc = array_pop($alldocs); if ($nb_pages[$doc] == $ranges[0]['end']) { - copy($doc, $finalPDF); + $this->copy($doc, $finalPDF); return; } } @@ -1448,13 +1454,13 @@ class wsDAOBook extends commonDAO { $cached = WS_BOOKS . '/pdf/' . $hash . '.pdf'; if (file_exists($cached)) { - copy($cached, $finalPDF); + $this->copy($cached, $finalPDF); } else { $pdftk = new cubeCommandLine('pdftk'); $pdftk->setPath(CONVERTER_PATH); $pdftk->setManualArg($args); $pdftk->execute(); - copy($finalPDF, $cached); + $this->copy($finalPDF, $cached); } } diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 20a60aecc..f333abff5 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -256,8 +256,10 @@ class wsBookParametres extends wsParametres { $this->fields['mobilePlugins'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Plugin'), 'grade' => 5); + $this->fields['mobileVideosPath'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Chemin vers les vidéos'), 'grade' => 5); + $this->forms['mobile'] = array('label' => __('Version mobile'), - 'fieldsnames' => array('mobileLVersion', 'mobileVersion', '|', 'mobileTransitions', 'mobileTransitionDuration', '|', 'mobileIconVector', 'mobilePlugins')); + 'fieldsnames' => array('mobileLVersion', 'mobileVersion', '|', 'mobileTransitions', 'mobileTransitionDuration', '|', 'mobileIconVector', 'mobilePlugins', '|', 'mobileVideosPath')); $this->fields['phonegapId'] = array('type' => 'text', 'default' => 'com.fluidbook.phonegap.$id', 'editable' => true, 'label' => __("Identifiant de l'identifiant"), 'grade' => 5, 'hint' => __('De la forme') . ' com.fluidbook.phonegap.xxxxx'); $this->fields['phonegapVersion'] = array('type' => 'text', 'default' => '1.0.0', 'editable' => true, 'label' => __("Version de l'application"), 'grade' => 5, 'hint' => __('De la forme') . ' 1.2.3'); diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 44e7dabd1..d9b5fec8a 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -17,7 +17,7 @@ class wsHTML5Compiler { } } - protected static $resolutions = array(150, 36); + protected static $resolutions = array(150); protected static $uaPrefixes = array('-moz-', '-webkit-', '-o-', '-ms-', ''); public $jsFiles = array( 'js/libs/fix/ios-orientation.js', @@ -123,6 +123,8 @@ class wsHTML5Compiler { function __construct($book_id, $version = 'stable', $phonegap = false, $dir = null) { global $core; + $this->videoPath = $videoPath; + $this->makeResources = $resources; if ($version == 'stable') { $this->assets = WS_COMPILE_ASSETS . '/_html5prod'; wsMaintenance::updateHTML5Sources(array(), false); @@ -458,6 +460,9 @@ class wsHTML5Compiler { foreach ($this->jsFiles as $js) { $scripts[] = ''; } + foreach ($this->pluginJs as $js) { + $scripts[] = ''; + } $scripts[] = ''; $script = implode("\n\t\t", $scripts); @@ -933,6 +938,10 @@ class wsHTML5Compiler { } public function copyLinkFile($source, $dest, $video = false) { + if ($video && $this->book->parametres->mobileVideosPath != '') { + return; + } + $origDir = WS_BOOKS . '/working/' . $this->book_id . '/'; $types = $this->getVideosFormats(); if ($video) { @@ -946,6 +955,7 @@ class wsHTML5Compiler { } } + if (!is_array($source)) { $source = array($source); } diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 03415cd2a..b7a5b2293 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -3,8 +3,10 @@ class wsPackagerPhonegap extends wsPackager { protected $resources = ''; + protected $makeResources = true; - public function __construct($book_id, $vdir = null, $whole = true) { + public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true) { + $this->makeResources = $makeResources; parent::__construct($book_id, $vdir, $whole); $this->version = 'phonegap'; } @@ -20,9 +22,11 @@ class wsPackagerPhonegap extends wsPackager { unlink($this->vdir . '/widget.html'); unlink($this->vdir . '/cache.appcache'); - $this->resources = $this->vdir . '/Resources'; - $this->makeResources(); + if ($this->makeResources) { + $this->resources = $this->vdir . '/Resources'; + $this->makeResources(); + } } protected function makeResources() {