From 4b8b6941ef2cae61c74f7700a73ef283109e0030 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Fri, 19 Oct 2018 16:38:28 +0000 Subject: [PATCH] wip #2303 @2 --- inc/ws/Controlleur/class.ws.url.php | 38 ++++++++++++---- inc/ws/Util/class.ws.exporter.php | 10 ++++- .../html5/3dflip/class.ws.html5.compiler.php | 2 +- .../html5/app/class.ws.html5.app.compiler.php | 43 +++++++++++++------ 4 files changed, 69 insertions(+), 24 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index d2652f905..3d39dfabb 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -281,14 +281,20 @@ class wsUrl $res .= '
  • '; if (isset($books[$publication['id']])) { $book = $books[$publication['id']]; - $langs[] = $book->lang; + $completeLang = $book->lang; + if ($book->parametres->country) { + $completeLang .= '_' . mb_strtoupper($book->parametres->country); + } + $langs[] = $completeLang; } else { $book = new stdClass(); $book->lang = ''; $book->nom = ''; } + + $res .= ''; - $res .= '' . mb_strtoupper($book->lang) . ''; + $res .= '' . mb_strtoupper($completeLang) . ''; $res .= '# ' . form::field(array($p . '[s]'), 64, 256, trim($publication['id'] . ' - ' . $book->nom, ' -'), 'publication_id') . form::hidden(array($p . '[id]'), $publication['id']) . ''; $res .= '' . __('Label') . ' ' . form::field(array($p . '[label]'), 20, 64, $publication['label']) . ''; $res .= ''; @@ -304,16 +310,32 @@ class wsUrl $res .= ''; + $contents=$collection->contents; + $theme=$collection->theme; + foreach ($langs as $l) { + $e = explode('_', $l); + $slang = $e[0]; + if (!isset($contents[$l]) && isset($contents[$slang])) { + $contents[$l] = $contents[$slang]; + } + + $files = ['splash', 'ad']; + foreach ($files as $file) { + if (!isset($theme[$file . '_' . $l]) && isset($theme[$file . '_' . $slang])) { + $theme[$file . '_' . $l] = $theme[$file . '_' . $slang]; + } + } + $res .= '

    ' . __('Contenus') . ' [' . $l . ']

    '; $res .= ''; - $res .= ''; - $res .= ''; - $res .= ''; + $res .= ''; + $res .= ''; + $res .= ''; //'splash' => - $res .= ''; - $res .= ''; - $res .= ''; + $res .= ''; + $res .= ''; + $res .= ''; $res .= '
    ' . __('Titre') . '' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $collection->contents[$l]['titre']) . '
    ' . __("Titre sur l'écran d'accueil") . '' . form::field(array('contents[' . $l . '][titrehome]', 'contents_' . $l . '_titrehome'), 64, 64, $collection->contents[$l]['titrehome']) . '
    ' . __('A propos') . '' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $collection->contents[$l]['apropos']) . '
    ' . __('Titre') . '' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $contents[$l]['titre']) . '
    ' . __("Titre sur l'écran d'accueil") . '' . form::field(array('contents[' . $l . '][titrehome]', 'contents_' . $l . '_titrehome'), 64, 64, $contents[$l]['titrehome']) . '
    ' . __('A propos') . '' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $contents[$l]['apropos']) . '
    ' . __('Ecran de lancement') . ' (2048x2048px)' . form::hidden(array('theme[splash_' . $l . ']', 'splash_' . $l), $collection->theme['splash_' . $l]) . self::viewCollectionFile($collection->theme['splash_' . $l], $collection->collection_id) . '
    ' . __('Panneau publicité') . '' . form::hidden(array('theme[ad_' . $l . ']', 'ad_' . $l), $collection->theme['ad_' . $l]) . self::viewCollectionFile($collection->theme['ad_' . $l], $collection->collection_id) . '
    ' . __('Lien publicité') . '' . form::field(array('contents[' . $l . '][adlink]', 'adlink_' . $l), 64, 64, $collection->contents[$l]['adlink']) . '
    ' . __('Ecran de lancement') . ' (2048x2048px)' . form::hidden(array('theme[splash_' . $l . ']', 'splash_' . $l), $theme['splash_' . $l]) . self::viewCollectionFile($theme['splash_' . $l], $collection->collection_id) . '
    ' . __('Panneau publicité') . '' . form::hidden(array('theme[ad_' . $l . ']', 'ad_' . $l), $theme['ad_' . $l]) . self::viewCollectionFile($theme['ad_' . $l], $collection->collection_id) . '
    ' . __('Lien publicité') . '' . form::field(array('contents[' . $l . '][adlink]', 'adlink_' . $l), 64, 64, $contents[$l]['adlink']) . '
    '; } diff --git a/inc/ws/Util/class.ws.exporter.php b/inc/ws/Util/class.ws.exporter.php index fd9e87b3b..112a9ad0b 100644 --- a/inc/ws/Util/class.ws.exporter.php +++ b/inc/ws/Util/class.ws.exporter.php @@ -76,9 +76,15 @@ class wsExporter $phonegap->setManifest(WS_COMPILE_ASSETS . '/_html5app/_android/AndroidManifest' . $manifestType . '.xml'); $phonegap->setMain(WS_COMPILE_ASSETS . '/_html5app/_android/Main' . $manifestType . '.java'); $phonegap->setMainDir(WS_COMPILE_ASSETS . '/_html5app/_android/'); - $phonegap->addLibrary(WS_COMPILE_ASSETS . '/_html5app/_android/lib'); + + if ($phonegap->getExpansion()) { + $phonegap->addLibrary(array('from' => WS_COMPILE_ASSETS . '/_html5app/_android/lib', 'to' => '/app/src/main/java')); + } else { + $phonegap->addLibrary(array('from' => WS_COMPILE_ASSETS . '/_html5app/_android/lib/com/fluidbook', 'to' => '/app/src/main/java/com/fluidbook')); + } $phonegap->addLibrary(array('from' => WS_COMPILE_ASSETS . '/_html5app/_android/fluidbook-dependencies', 'to' => '/fluidbook-dependencies')); - $phonegap->addLibrary(array('from' => WS_COMPILE_ASSETS . '/_html5app/_android/res', 'to' => '/res')); + $phonegap->addLibrary(array('from' => WS_COMPILE_ASSETS . '/_html5app/_android/res', 'to' => '/app/src/main/res')); + $phonegap->setDistantCompiler(self::VINCENT, 'Vincent', 's77vpo*wu5', 'h:/Phonegap/Projects/' . $d, '/mnt/vincent/cygdrive/h/Phonegap/Projects/' . $d, 22322, SSH_KEY); $phonegap->setSourceVariables(array('background' => '0xff' . $collection->settings['couleurD'], 'orientation' => $collection->settings['orientation']) diff --git a/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php b/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php index 77d0f5595..c26963113 100644 --- a/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php @@ -169,7 +169,7 @@ class wsHTML5Compiler public $logtime = null; public $beginBody = array(); public $seoArticles = []; - public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com']; + public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com', '*.googletagmanager.com']; protected $_indexVars = null; public $_signature; diff --git a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php index af350ae19..5bba1f46d 100644 --- a/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php +++ b/inc/ws/Util/html5/app/class.ws.html5.app.compiler.php @@ -1,6 +1,7 @@ collectionId = $collectionId; @@ -32,13 +34,19 @@ class wsHTML5AppCompiler { $this->langs = array(); foreach ($allbooks as $b) { - $this->langs[] = $b->lang; + $l = $b->lang; + if ($b->parametres->country) { + $l .= '_' . mb_strtoupper($b->parametres->country); + } + + $this->langs[] = $l; } $this->langs = array_unique($this->langs); } - public function createVersion() { + public function createVersion() + { $os = array('ios', 'android'); set_time_limit(0); $time = time(); @@ -63,7 +71,8 @@ class wsHTML5AppCompiler { return $time; } - protected function getPublicationsIds($onlyonline = false) { + protected function getPublicationsIds($onlyonline = false) + { $books = array(); foreach ($this->collection->datas as $group) { foreach ($group['publications'] as $p) { @@ -78,7 +87,8 @@ class wsHTML5AppCompiler { return $books; } - protected function copy($s, $t) { + protected function copy($s, $t) + { if (!file_exists($s)) { return; } @@ -93,7 +103,8 @@ class wsHTML5AppCompiler { touch($t, filemtime($s)); } - protected function copyRecursive($source, $dest) { + protected function copyRecursive($source, $dest) + { if (is_dir($source)) { $iterator = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS), RecursiveIteratorIterator::SELF_FIRST @@ -114,7 +125,8 @@ class wsHTML5AppCompiler { } } - function compile($os, $phonegapVersion = 'latest', $erase = false) { + function compile($os, $phonegapVersion = 'latest', $erase = false) + { /* if ($phonegapVersion == 'collection') { $phonegapVersion = $this->collection->settings['phonegap']; } @@ -141,7 +153,8 @@ class wsHTML5AppCompiler { return $this->vdir; } - function writeScript() { + function writeScript() + { $config = array(); $config['id'] = $this->collectionId; $config['couleurA'] = $this->collection->settings['couleurA']; @@ -168,17 +181,20 @@ class wsHTML5AppCompiler { file_put_contents($this->vdir . '/data/app.js', 'DATAS = ' . CubeIT_Util_Json::encode($config) . ';'); } - function writeIndex() { + function writeIndex() + { $index = file_get_contents($this->vdir . '/index.html'); $index = str_replace('$background', $this->collection->settings['couleurD'], $index); file_put_contents($this->vdir . '/index.html', $index); } - function writeConfig() { + function writeConfig() + { $xml = new simplexml_load_string(''); } - function writeStyle() { + function writeStyle() + { $c = array(); $imagesdir = $this->vdir . '/data/images/'; @@ -267,7 +283,8 @@ class wsHTML5AppCompiler { file_put_contents($this->vdir . '/data/app.css', implode("\n", $c)); } - public function getPublishedVersionPath($os, $version) { + public function getPublishedVersionPath($os, $version) + { global $core; $r = $core->con->select('SELECT * FROM book_collection_compile WHERE collection_id=\'' . $this->collectionId . '\' ORDER BY compile_date DESC'); while ($r->fetch()) { -- 2.39.5