$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>';
$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>';
}
$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'])
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;
<?php
-class wsHTML5AppCompiler {
+class wsHTML5AppCompiler
+{
public $collectionId, $collection;
public $assets;
public $langs;
public $books = array();
- public function __construct($collectionId) {
+ public function __construct($collectionId)
+ {
global $core;
$this->collectionId = $collectionId;
$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();
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) {
return $books;
}
- protected function copy($s, $t) {
+ protected function copy($s, $t)
+ {
if (!file_exists($s)) {
return;
}
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
}
}
- function compile($os, $phonegapVersion = 'latest', $erase = false) {
+ function compile($os, $phonegapVersion = 'latest', $erase = false)
+ {
/* if ($phonegapVersion == 'collection') {
$phonegapVersion = $this->collection->settings['phonegap'];
}
return $this->vdir;
}
- function writeScript() {
+ function writeScript()
+ {
$config = array();
$config['id'] = $this->collectionId;
$config['couleurA'] = $this->collection->settings['couleurA'];
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/';
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()) {