]> _ Git - cubeextranet.git/commitdiff
wip #2303 @2
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Oct 2018 16:38:28 +0000 (16:38 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 19 Oct 2018 16:38:28 +0000 (16:38 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php

index d2652f9057e066c0b6edc50dee920bd73bec889d..3d39dfabb99cea75a80e38ee87b8739ca1338755 100644 (file)
@@ -281,14 +281,20 @@ class wsUrl
                                $res .= '<li class="publication" data-publication="' . $pid . '"><div>';
                                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 .= '<a href="#" class="move"></a>';
-                               $res .= '<span class="lang">' . mb_strtoupper($book->lang) . '</span>';
+                               $res .= '<span class="lang">' . mb_strtoupper($completeLang) . '</span>';
                                $res .= '<span class="id"># ' . form::field(array($p . '[s]'), 64, 256, trim($publication['id'] . ' - ' . $book->nom, ' -'), 'publication_id') . form::hidden(array($p . '[id]'), $publication['id']) . '</span>';
                                $res .= '<span class="label">' . __('Label') . ' ' . form::field(array($p . '[label]'), 20, 64, $publication['label']) . '</span>';
                                $res .= '<a href="#" class="delete"></a>';
@@ -304,16 +310,32 @@ class wsUrl
 
                $res .= '</ul>';
 
+               $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 .= '<h3>' . __('Contenus') . ' [' . $l . ']</h3>';
                        $res .= '<table class="max">';
-                       $res .= '<tr><td class="min nowrap">' . __('Titre') . '</td><td>' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $collection->contents[$l]['titre']) . '</td></tr>';
-                       $res .= '<tr><td class="min nowrap">' . __("Titre sur l'écran d'accueil") . '</td><td>' . form::field(array('contents[' . $l . '][titrehome]', 'contents_' . $l . '_titrehome'), 64, 64, $collection->contents[$l]['titrehome']) . '</td></tr>';
-                       $res .= '<tr><td class="min nowrap">' . __('A propos') . '</td><td>' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $collection->contents[$l]['apropos']) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __('Titre') . '</td><td>' . form::field(array('contents[' . $l . '][titre]', 'contents_' . $l . '_titre'), 64, 64, $contents[$l]['titre']) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __("Titre sur l'écran d'accueil") . '</td><td>' . form::field(array('contents[' . $l . '][titrehome]', 'contents_' . $l . '_titrehome'), 64, 64, $contents[$l]['titrehome']) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __('A propos') . '</td><td>' . form::textarea(array('contents[' . $l . '][apropos]', 'contents_' . $l . '_apropos'), 60, 10, $contents[$l]['apropos']) . '</td></tr>';
                        //'splash' =>
-                       $res .= '<tr><td class="min nowrap">' . __('Ecran de lancement') . ' (2048x2048px)</td><td><input type="file" name="splash_' . $l . '" />' . form::hidden(array('theme[splash_' . $l . ']', 'splash_' . $l), $collection->theme['splash_' . $l]) . self::viewCollectionFile($collection->theme['splash_' . $l], $collection->collection_id) . '</td></tr>';
-                       $res .= '<tr><td class="min nowrap">' . __('Panneau publicité') . '</td><td><input type="file" name="ad_' . $l . '" />' . form::hidden(array('theme[ad_' . $l . ']', 'ad_' . $l), $collection->theme['ad_' . $l]) . self::viewCollectionFile($collection->theme['ad_' . $l], $collection->collection_id) . '</td></tr>';
-                       $res .= '<tr><td class="min nowrap">' . __('Lien publicité') . '</td><td>' . form::field(array('contents[' . $l . '][adlink]', 'adlink_' . $l), 64, 64, $collection->contents[$l]['adlink']) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __('Ecran de lancement') . ' (2048x2048px)</td><td><input type="file" name="splash_' . $l . '" />' . form::hidden(array('theme[splash_' . $l . ']', 'splash_' . $l), $theme['splash_' . $l]) . self::viewCollectionFile($theme['splash_' . $l], $collection->collection_id) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __('Panneau publicité') . '</td><td><input type="file" name="ad_' . $l . '" />' . form::hidden(array('theme[ad_' . $l . ']', 'ad_' . $l), $theme['ad_' . $l]) . self::viewCollectionFile($theme['ad_' . $l], $collection->collection_id) . '</td></tr>';
+                       $res .= '<tr><td class="min nowrap">' . __('Lien publicité') . '</td><td>' . form::field(array('contents[' . $l . '][adlink]', 'adlink_' . $l), 64, 64, $contents[$l]['adlink']) . '</td></tr>';
                        $res .= '</table>';
                }
 
index fd9e87b3b637993a4e5dac8fff33c029c3e76b94..112a9ad0bdb253de75028dde7d45b195a7d6d644 100644 (file)
@@ -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'])
index 77d0f5595333a2879acacb8b1d484ccdf9ea6940..c269631135d40bc89e4274d6487a67067c904be2 100644 (file)
@@ -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;
index af350ae197be8254566a75a8e7ef7f9b5bc9dba8..5bba1f46dc0348cd2e9383e347f58d53c798150a 100644 (file)
@@ -1,6 +1,7 @@
 <?php
 
-class wsHTML5AppCompiler {
+class wsHTML5AppCompiler
+{
 
        public $collectionId, $collection;
        public $assets;
@@ -12,7 +13,8 @@ class wsHTML5AppCompiler {
        public $langs;
        public $books = array();
 
-       public function __construct($collectionId) {
+       public function __construct($collectionId)
+       {
                global $core;
 
                $this->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()) {