From 0f8db30c2a1cf23bb41ed0c88f30d3d0e67e7315 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 12 Nov 2012 15:03:32 +0000 Subject: [PATCH] --- .htaccess | 2 + inc/ws/Controlleur/class.ws.url.php | 2 +- inc/ws/DAO/class.ws.dao.book.php | 9 ++- inc/ws/Util/html5/class.ws.html5.compiler.php | 8 ++- .../packager/class.ws.packager.phonegap.php | 69 ++++++++++++------- 5 files changed, 62 insertions(+), 28 deletions(-) diff --git a/.htaccess b/.htaccess index 6efd2ec64..32dcb4bc4 100644 --- a/.htaccess +++ b/.htaccess @@ -62,5 +62,7 @@ AddCharset UTF-8 log RewriteRule ^viewerht/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/js/(.+)$ fluidbook/compile/_html5/js/$4 [L] RewriteRule ^viewerht/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5/$1/$4 [L] + + RewriteRule ^viewerh([ai])/([0-9]+)_([0-9a-fA-F]+)_([0-9]+)/(.+)$ fluidbook/books/html5$1/$2/$5 [L] \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 653257fd5..89924e9ef 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -716,7 +716,7 @@ html{height:100%}' . "\n"; public static function viewerha($args) { global $core; - commonDroits::min(5); + $args = cubePage::getArgs($args); if (!isset($args[1])) { $args[1] = ''; diff --git a/inc/ws/DAO/class.ws.dao.book.php b/inc/ws/DAO/class.ws.dao.book.php index 5558af0e3..cf31c311b 100644 --- a/inc/ws/DAO/class.ws.dao.book.php +++ b/inc/ws/DAO/class.ws.dao.book.php @@ -793,8 +793,13 @@ class wsDAOBook extends commonDAO { } public function compileTemp($book_id, $version, $dir) { - if ($version == 'ha') { - $packager = new wsPackagerPhonegap($book_id, $dir, true, false, 'android'); + if ($version == 'ha' || $version == 'hi') { + if ($version == 'ha') { + $os = 'android'; + } elseif ($version == 'hi') { + $os = 'ios'; + } + $packager = new wsPackagerPhonegap($book_id, $dir, false, true, $os); $packager->makePackage(false); } } diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index dfff4ae2d..c81d682f9 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -292,7 +292,7 @@ class wsHTML5Compiler { } elseif ($this->phonegap == 'ios') { $res = array('mp4'); } else if ($this->phonegap == 'android') { - $res = array('ogv', 'webm'); + $res = array('webm'); } if ($poster) { @@ -302,6 +302,10 @@ class wsHTML5Compiler { } protected function writeCache() { + if ($this->phonegap) { + return; + } + $videosExtensions = $this->getVideosFormats(false); foreach ($videosExtensions as $e) { $videos[$e] = array(); @@ -650,7 +654,6 @@ class wsHTML5Compiler { } protected function writeConfig() { - $this->config->numerotation = explode(',', $this->book->numerotation); $this->config->id = $this->book->book_id; $this->config->cacheDate = TIME; @@ -661,6 +664,7 @@ class wsHTML5Compiler { $this->config->chapters = $this->book->chapters; $this->config->coquilletteBack = $this->colorToCSS($this->theme->parametres->couleurA); $this->config->coquilletteFront = $this->colorToCSS($this->theme->parametres->arrowsColor); + $this->config->videoFormats = $this->getVideosFormats(false); foreach ($this->additionalConfig as $k => $v) { $this->config->$k = $v; } diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index d6afc211f..c99c43131 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -4,9 +4,10 @@ class wsPackagerPhonegap extends wsPackager { protected $resources = ''; protected $makeResources = true; - protected $os = 'ios'; + protected $os = 'all'; + protected $supportedOS = array('ios', 'android'); - public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true, $os = 'ios') { + public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true, $os = 'all') { $this->makeResources = $makeResources; $this->os = $os; parent::__construct($book_id, $vdir, $whole); @@ -16,23 +17,35 @@ class wsPackagerPhonegap extends wsPackager { protected function preparePackage() { parent::preparePackage(); - $compiler = wsHTML5Compiler::factory($this->book_id, null, $this->os, $this->vdir); - $compiler->compile(); + if ($this->os == 'all') { + $oss = $this->supportedOS; + } else { + $oss = array($this->os); + } - unlink($this->vdir . '/indext.html'); - unlink($this->vdir . '/indexu.html'); - unlink($this->vdir . '/widget.html'); - unlink($this->vdir . '/cache.appcache'); + foreach ($oss as $os) { + $vdir = $this->vdir; + if (count($oss) > 1) { + $vdir.='/' . $os; + } + $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, $vdir); + $compiler->compile(); - if ($this->makeResources) { + unlink($vdir . '/indext.html'); + unlink($vdir . '/indexu.html'); + unlink($vdir . '/widget.html'); + unlink($vdir . '/cache.appcache'); - if ($this->os == 'ios') { - $this->resources = $this->vdir . '/Resources'; - $this->makeIOSResources(); - } elseif ($this->os == 'android') { - $this->resources = $this->vdir . '/Resources'; - $this->makeAndroidResources(); + + if ($this->makeResources) { + if ($this->os == 'ios') { + $this->resources = $vdir . '/Resources'; + $this->makeIOSResources(); + } elseif ($this->os == 'android') { + $this->resources = $vdir . '/Resources'; + $this->makeAndroidResources(); + } } } } @@ -45,19 +58,20 @@ class wsPackagerPhonegap extends wsPackager { 'drawable-xhdpi' => 96 ); - $splashs = array('drawable' => 'x', - 'drawable-hdpi' => 'x', - 'drawable-ldpi' => 'x', - 'drawable-mdpi' => 'x', - 'drawable-xhdpi' => 'x'); + + $splashs = array('drawable' => '1024x768', + 'drawable-hdpi' => '1024x768', + 'drawable-ldpi' => '320x480', + 'drawable-mdpi' => '640x960', + 'drawable-xhdpi' => '1280x1920'); foreach ($icons as $dir => $size) { $d = $this->resources . '/' . $dir; if (!file_exists($d)) { mkdir($d, 0777, true); } - $list($w, $h) = explode('x', $size); - $this->_makeIcon($w, $h, 'splash', $d); + + $this->_makeIcon($size, 'icon', $d); } foreach ($splashs as $dir => $size) { @@ -65,7 +79,16 @@ class wsPackagerPhonegap extends wsPackager { if (!file_exists($d)) { mkdir($d, 0777, true); } - $this->_makeSplash($size, 'splash', $d); + list($w, $h) = explode('x', $size); + + if ($w > $h) { + $memo = $h; + $h = $w; + $w = $memo; + } + + $this->_makeSplash($w, $h, 'splashportrait', $d); + $this->_makeSplash($h, $w, 'splashlandscape', $d); } } -- 2.39.5