Header set Access-Control-Allow-Origin "*"\r
</IfModule>\r
\r
+<IfModule mod_deflate.c>\r
+ SetOutputFilter DEFLATE\r
+ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|zip|exe|mp3|f4v|ogv|ogg|ogm|webm|mp4|flv|gz|pdf|swc)$ no-gzip dont-vary\r
+ \r
+ <IfModule mod_headers.c>\r
+ Header append Vary User-Agent\r
+ </IfModule>\r
+ \r
+ BrowserMatch ^Mozilla/4 gzip-only-text/html\r
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip\r
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html\r
+</IfModule>\r
+\r
+\r
<IfModule mod_rewrite.c>\r
RewriteEngine on\r
RewriteBase /\r
}
}
+ public static function copyWsAssets() {
+ commonDroits::min(5);
+ global $core;
+ $res = commonPage::barre();
+ $res .= commonPage::tMain();
+ $res .= commonPage::bh();
+ $res.='<form id="copywsassets" action="copywsassets" method="post">';
+ $res.='<table class="liste">';
+ $res.='<tr><th><strong>' . __("Copie de fichiers entre deux fluidbook") . '</strong></th></tr>';
+ $res.='<tr><td>Fluidbook source</td><td>' . form::field('source', 5, 6) . '</td></tr>';
+ $res.='<tr><td>Fluidbook destination</td><td>' . form::field('dest', 5, 6) . '</td></tr>';
+ $res.='<tr><td>Fichiers à transférer</td><td id="f">Entrez le numéro du fluidbook source pour sélectionner les fichiers à transférer</td></tr>';
+ $res.='<tr><td class="right" colspan="2"><a href="#" class="submit">' . $core->typo->BoutonOK(__('Copier')) . '</a></td></td>';
+ $res.='</table>';
+ $res.='</form>';
+ $res .= '</div>';
+ $res .= commonPage::bf();
+ $res .= commonPage::bMain();
+ return $res;
+ }
+
protected static function searchGoogle($q, $cx, $key) {
global $core;
public static function saveClient($args, &$x) {\r
global $core;\r
$dao = new commonDAOEntreprise($core->con);\r
- // Creation de l'entreprise\r
+// Creation de l'entreprise\r
if ($_POST['entreprise_id'] == 'new') {\r
if (!isset($_POST['ws_admin']) || !$_POST['ws_admin']) {\r
$_POST['ws_admin'] = $core->user->utilisateur_id;\r
$_POST['ws_admin'] = $core->user->utilisateur_id;\r
}\r
$entreprise = $dao->sauve($_POST);\r
- // Si c'est une nouvelle entreprise, on crée également le contact\r
+// Si c'est une nouvelle entreprise, on crée également le contact\r
if ($_POST['entreprise_id'] == 'new') {\r
$data = $_POST['contact'];\r
$data['entreprise'] = $entreprise->entreprise_id;\r
if (isset($_FILES[$t]) && !$_FILES[$t]['error']) {\r
$ext = CubeIT_Files::getExtension($_FILES[$t]['name']);\r
move_uploaded_file($_FILES[$t]['tmp_name'], $wdir . '/' . $t . '.' . $ext);\r
- $_POST['theme'][$t] = $t . '.' . $ext;\r
+ $save['theme'][$t] = $t . '.' . $ext;\r
}\r
}\r
\r
+\r
+\r
foreach ($_POST['group'] as $gid => $group) {\r
if ($gid && $gid == 'new_') {\r
continue;\r
if (!self::valideDemandeDevis($x)) {\r
return;\r
}\r
- // L'utilisateur est-il déjà dans la base ?\r
+// L'utilisateur est-il déjà dans la base ?\r
$daoUtilisateur = new commonDAOUtilisateur($core->con);\r
$utilisateur = $daoUtilisateur->selectByEmail($_POST['email']);\r
if ($utilisateur != null) {\r
$utilisateur_id = $utilisateur->utilisateur_id;\r
} else {\r
- // Création de l'entreprise\r
+// Création de l'entreprise\r
$daoEntreprise = new commonDAOEntreprise($core->con);\r
$datas = array();\r
$datas['entreprise_id'] = 'new';\r
$datas['ws_grade'] = 1;\r
$datas['ws_admin'] = 1;\r
$entreprise = $daoEntreprise->sauve($datas);\r
- // Création de l'utilisateur\r
+// Création de l'utilisateur\r
$datas = array();\r
$datas['utilisateur_id'] = 'new';\r
$datas['prenom'] = $_POST['prenom'];\r
$_POST['site'] = $_POST['site_internet'];\r
}\r
file_put_contents(ROOT . '/cache/demandeDevis.txt', print_r($_POST, true));\r
- // Validation des champs de formulaires\r
+// Validation des champs de formulaires\r
$ok = true;\r
return $ok;\r
}\r
} elseif ($demande->status > 1) {\r
$res = __("Cette demande est actuellement en cours de traitement");\r
} else {\r
- // On place la demande comme en cours d'édition\r
+// On place la demande comme en cours d'édition\r
$dao->setAdministrateur($demande->demande_id, $core->user->utilisateur_id);\r
\r
- // On vérifie que l'utilisateur n'est pas déjà géré par un revendeur\r
+// On vérifie que l'utilisateur n'est pas déjà géré par un revendeur\r
$demandeur = $daoUtilisateur->selectById($demande->utilisateur, 'utilisateurs_entreprise');\r
$administrateurs = $daoUtilisateur->selectWSAdministrateursId();\r
if (!is_null($demandeur->ws_admin) && !in_array($demandeur->ws_admin, $administrateurs)) {\r
- // Si déjà géré par un revendeur\r
+// Si déjà géré par un revendeur\r
$revendeur = $daoUtilisateur->selectById($demandeur->ws_admin, 'utilisateurs_entreprise');\r
$actions[__('Je confie la demande à') . ' ' . $revendeur->rs . ' (' . $revendeur->prenom . ' ' . $revendeur->nom . ')'] = $demandeur->ws_admin;\r
} else {\r
\r
$env = Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI;\r
\r
- // Notifications\r
+// Notifications\r
\r
$apns = new Zend_Mobile_Push_Apns();\r
if ($env == Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI) {\r
$apns->close();\r
}\r
\r
-}\r
+ public function fluidbookAssets($args, &$x) {\r
+ $id = $args[1];\r
+ if (!$id) {\r
+ $c = __('Entrez le numéro du fluidbook source pour sélectionner les fichiers à transférer');\r
+ } else {\r
+ $dr = opendir(WS_BOOKS . '/working/' . $id);\r
+ $files = array();\r
+ while ($f = readdir($dr)) {\r
+ if ($f == '.' || $f == '..') {\r
+ continue;\r
+ }\r
+\r
+ $files[$f] = $f;\r
+ $checked[] = $f;\r
+ }\r
+\r
+ ksort($files);\r
+\r
+ if (!count($files)) {\r
+ $c = __('Aucun fichier à transférer');\r
+ } else {\r
+ $c = cubeForm::checkMultiple('files', $files, count($files), $checked);\r
+ }\r
+ }\r
+\r
+ $x->addContent('f', $c);\r
+ }\r
+\r
+ public function copywsassets($args, &$x) {\r
+ if (!isset($_POST['files']) || !count($_POST['files'])) {\r
+ $x->addAlert(__('Aucun fichier sélectionné'));\r
+ return;\r
+ } elseif (!isset($_POST['dest']) || !$_POST['dest']) {\r
+ $x->addAlert(__('Destination invalide'));\r
+ return;\r
+ }\r
+\r
+ $d = WS_BOOKS . '/working/' . $_POST['dest'];\r
+ if (!file_exists($d)) {\r
+ mkdir($d, 0777, true);\r
+ }\r
+ $s = WS_BOOKS . '/working/' . $_POST['source'];\r
+\r
+ foreach ($_POST['files'] as $f) {\r
+ copy($s . '/' . $f, $d . '/' . $f);\r
+ }\r
+ $x->addAlert(__('Copie effectuée'));\r
+ }\r
+\r
+ public static function collectionVersionCreate($args, &$x) {\r
+ global $core;\r
+ $id = $args[1];\r
\r
+ $compiler = new wsHTML5AppCompiler($id);\r
+ $time = $compiler->createVersion();\r
+\r
+ file_put_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $time . '/composition.json', json_encode($compiler->collection->datas));\r
+\r
+ $c = $core->con->openCursor('book_collection_compile');\r
+ $c->collection_id = $id;\r
+ $c->compile_date = $time;\r
+ $c->online = 0;\r
+ $c->insert();\r
+\r
+ $x->addReload();\r
+ }\r
+\r
+ public static function collectionVersionPublish($args, &$x) {\r
+ global $core;\r
+\r
+ $id = $args[1];\r
+ $date = $args[2];\r
+\r
+ $c = $core->con->openCursor('book_collection_compile');\r
+ $c->online = 0;\r
+ $c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND online=1');\r
+\r
+ $c = $core->con->openCursor('book_collection_compile');\r
+ $c->online = 1;\r
+ $c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\'');\r
+\r
+ $cache = WS_COLLECTIONS . '/ws/' . $id . '.json';\r
+ if (file_exists($cache)) {\r
+ unlink($cache);\r
+ }\r
+\r
+ $x->addReload();\r
+ }\r
+\r
+ public static function collectionVersionDelete($args, &$x) {\r
+ global $core;\r
+\r
+ $id = $args[1];\r
+ $date = $args[2];\r
+\r
+ if ($id && $date) {\r
+ $d = WS_COLLECTIONS . '/versions/' . $id . '/' . $date;\r
+ `rm -rf $d`;\r
+ $core->con->execute('DELETE FROM book_collection_compile WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\'');\r
+ }\r
+ $x->addReload();\r
+ }\r
+\r
+}\r
?>
\ No newline at end of file
}\r
\r
public function collection() {\r
+ global $core;\r
+ $id = $this->callArgs[0];\r
$this->outputXML = false;\r
header('Content-type: application/json');\r
- echo '[]';\r
+\r
+ $cache = WS_COLLECTIONS . '/ws/' . $id . '.json';\r
+ $limit = TIME - 7200;\r
+ if (!file_exists($cache) || filemtime($cache) < $limit) {\r
+ $r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\'');\r
+ $r->fetch();\r
+ $version = $r->compile_date;\r
+\r
+ $composition = json_decode(file_get_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json'));\r
+\r
+ $couvertures = array();\r
+ foreach ($composition as $k => $g) {\r
+ foreach ($g->publications as $l => $p) {\r
+ $couv = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/ios/' . $p->id . '/data/background/36/t1.jpg';\r
+ $couvertures[$p->id] = base64_encode(file_get_contents($couv));\r
+ }\r
+ }\r
+\r
+ $d = array('id' => $id, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures);\r
+\r
+ $dao = new wsDAOCollection($core->con);\r
+ $col = $dao->selectById($id);\r
+\r
+ $json = json_encode($d);\r
+ file_put_contents($cache, $json);\r
+ echo $json;\r
+ } else {\r
+ echo file_get_contents($cache);\r
+ }\r
+\r
exit;\r
}\r
\r
$collection = $dao->selectById($args[1]);\r
\r
$shortcuts = array();\r
- $shortcuts[] = '<a href="#" id="newGroup">' . $core->typo->Ajouter('Nouveau groupe') . '</a>';\r
\r
$res = commonPage::barre(null, null, null, $shortcuts);\r
$res .= commonPage::tMain();\r
global $core;\r
\r
$res = '<h1>Gestion de la collection « ' . $collection->nom . ' » <em># ' . $collection->collection_id . '</em></h1>';\r
- $res.='<form method="post" action="saveCollectionComposition" enctype="multipart/form-data>';\r
+ $res.='<form method="post" action="saveCollectionComposition" enctype="multipart/form-data">';\r
$res.='<table class="max">';\r
$res.='<tr><td class="min nowrap">#</td><td>' . form::hidden('collection_id', $collection->collection_id) . $collection->collection_id . '</td></tr>';\r
$res.='<tr><td class="min nowrap">' . __('Nom de la collection') . '</td><td>' . form::field('nom', 20, 64, $collection->nom) . '</td></tr>';\r
-\r
$res.='</table>';\r
$res.='<h3>' . __('Composition') . '</h3>';\r
+ $res.='<a href="#" id="newGroup">' . $core->typo->Ajouter(__('Nouveau groupe')) . '</a><br /><br />';\r
$res .= '<ul>';\r
\r
\r
$res.='</form>';\r
$res.='<p class="clear"></p>';\r
$res.='<h3>' . __('Versions') . '</h3>';\r
-\r
- $res.='<a href="#" class="right ajax" rel="publishCollection/' . $collection->collection_id . '">' . $core->typo->Ajouter(__('Publier et notifier les utilisateurs')) . '</a>';\r
+ $res.='<a href="#" class="ajax" rel="collectionVersionCreate/' . $collection->collection_id . '">' . $core->typo->Ajouter(__('Créer une version')) . '</a><br /><br />';\r
+ $r = $core->con->select('SELECT * FROM book_collection_compile WHERE collection_id=\'' . $collection->collection_id . '\' ORDER BY compile_date DESC');\r
+ if (!$r->count()) {\r
+ $res.=__('Aucune version de la collection n\'a été crée');\r
+ } else {\r
+ $res.='<table class="max">';\r
+ $res.='<tr><th class="left">' . __('Date') . '</th><th class="left">' . __('Publiée') . '</th><th class="min nowrap"></th><th class="min nowrap"></th></tr>';\r
+ while ($r->fetch()) {\r
+ if (!$r->online) {\r
+ $publish = '<a class="ajax download btbook" rel="collectionVersionPublish/' . $r->collection_id . '/' . $r->compile_date . '" href="#"><div></div><span>' . __('Publier') . '</span></a>';\r
+ $del = '<a class="ajax suppr btbook" rel="collectionVersionDelete/' . $r->collection_id . '/' . $r->compile_date . '" href="#" title="' . __('Êtes-vous certain de vouloir supprimer cette version ?') . '"><div></div><span>' . __('Effacer') . '</span></a>';\r
+ } else {\r
+ $publish = '';\r
+ $del = '';\r
+ }\r
+ $res.='<tr><td>' . date('Y-m-d H:i:s', $r->compile_date) . '</td><td>' . ($r->online ? __('Oui') : __('Non')) . '</td><td class="min nowrap">' . $publish . '</td><td class="min nowrap">' . $del . '</td></tr>';\r
+ }\r
+ $res.='</table>';\r
+ }\r
+ $res.='<br /><a href="#" class="right ajax" rel="publishCollection/' . $collection->collection_id . '">' . $core->typo->Ajouter(__('Publier et notifier les utilisateurs')) . '</a>';\r
\r
$res.='<h3>' . __('Export') . '</h3>';\r
$res.='<a href="#" class="right ajax" rel="exportCollection/' . $collection->collection_id . '/android">' . $core->typo->Ajouter(__('Exporter pour Android')) . '</a> <a href="#" class="right ajax" rel="exportCollection/' . $collection->collection_id . '/ios">' . $core->typo->Ajouter(__('Exporter pour iOS')) . '</a>';\r
public function exportCollection($collectionId, $os) {
global $core;
- $compiler = new wsHTML5AppCompiler($collectionId, $os, 'collection');
- $dir = $compiler->compile();
+ $compiler = new wsHTML5AppCompiler($collectionId);
+ $dir = $compiler->compile($os, 'collection');
$collection = $compiler->collection;
$d = str_replace('.', '/', $collection->settings['namespace']);
$dest = $d . '/www/';
$this->_createProject($os, $collection->nom, $collection->settings['namespace']);
+ $this->_collectionAssets($os, $compiler);
$this->_transfertPhonegap($os, $dir, $dest);
}
+ /**
+ *
+ * @param string $os
+ * @param wsHTML5AppCompiler $compiler
+ */
+ protected function _collectionAssets($os, $compiler) {
+ if ($os == 'ios') {
+ $collection = $compiler->collection;
+ $src = $compiler->wdir . '/' . $collection->theme['icon'];
+ // icones
+ $icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
+ $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/icons/';
+ if (!file_exists($d)) {
+ mkdir($d, 0777, true);
+ }
+ foreach ($icons as $s => $n) {
+
+ $dest = $d . $n . '.png';
+ if (!$this->_testFile($src, $dest)) {
+ wsPackagerPhonegap::__makeIcon($src, $dest, $s);
+ }
+ }
+
+ // splashs
+ $splashs = array('320x480' => 'Default~iphone', '640x960' => 'Default@2x~iphone', '1024x748' => 'Default-Landscape~ipad', '768x1004' => 'Default-Portrait~ipad', '2048x1496' => 'Default-Landscape@2x~ipad', '1536x2008' => 'Default-Portrait@2x~ipad', '640x1136' => 'Default-568h@2x~iphone');
+
+ $d = WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os . '/splash/';
+ if (!file_exists($d)) {
+ mkdir($d, 0777, true);
+ }
+
+ $src = $compiler->wdir . '/' . $collection->theme['splash'];
+ foreach ($splashs as $size => $name) {
+ list($width, $height) = explode('x', $size);
+
+ $dest = $d . $name . '.png';
+
+ if (!$this->_testFile($src, $dest)) {
+ $it = new cubeImageTools();
+ $it->loadImage($src);
+ $it->resize($width, $height, 'crop', false, 'C', 'M', 'transparent');
+ $it->output('png', $dest);
+ }
+ }
+
+
+ // Transfert
+ `sudo /usr/local/bin/remountmac`;
+
+ $this->_rsync(WS_COLLECTIONS . '/resources/' . $collection->collection_id . '/' . $os, "/mnt/macbox" . $this->_iosProjectDir($collection->settings['namespace']) . '/' . CubeIT_Text::str2URL($collection->nom) . '/Resources', false);
+ }
+ }
+
+ protected function _testFile($ref, $dest) {
+ if (!file_exists($dest)) {
+ return false;
+ }
+ if (filemtime($ref) > filemtime($dest)) {
+ return false;
+ }
+ return true;
+ }
+
protected function _createProject($os, $name, $ns) {
if ($os == 'ios') {
$dir = $this->_iosProjectDir($ns);
$this->_phonegap();
} else if ($this->metaAction == 'install') {
$this->_install();
+ } else if ($this->metaAction == 'phonegapcollection') {
+ $this->_phonegapcollection();
}
}
return in_array($this->version, $yes);
}
+ protected function _phonegapcollection() {
+ $d = '/' . $this->destinationDir;
+
+ $packager = new wsPackagerPhonegap($this->book_id, $d, true, false, $this->version);
+ $packager->ignoreCache = false;
+ return $packager->makePackage(false);
+ }
+
protected function _install() {
$package = wsPackager::package($this->book_id, $this->version, $this->_haveToZip());
}
$packager = new wsPackagerPhonegap($this->book_id, null, true, false, $os);
+ $packager->cleanOnDestruct = false;
$package = $packager->makePackage(false);
$this->_transfertPhonegap($os, $package, $this->destinationDir);
list($distServer, $distDir) = explode(':', $dest);
}
-
if (!file_exists($dest)) {
if (!$destDistant) {
mkdir($dest, 0777, true);
public $os;
public $phonegapVersion;
- public function __construct($collectionId, $os, $phonegapVersion = 'latest') {
+ public function __construct($collectionId) {
global $core;
$this->collectionId = $collectionId;
$dao = new wsDAOCollection($core->con);
$this->collection = $dao->selectById($this->collectionId);
+ }
- if ($phonegapVersion == 'collection') {
- $phonegapVersion = $this->collection->settings['phonegap'];
+ public function createVersion() {
+ $os = array('ios', 'android');
+ $time = time();
+
+ $dir = WS_COLLECTIONS . '/versions/' . $this->collectionId . '/' . $time . '/';
+
+ $books = array();
+ foreach ($this->collection->datas as $group) {
+ foreach ($group['publications'] as $p) {
+ $books[] = $p['id'];
+ }
}
- $this->phonegapVersion = wsHTML5Compiler::getPhonegapVersion($phonegapVersion);
- $this->os = $os;
+ $exporter = new wsExporter();
+ foreach ($os as $o) {
+ $d = $dir . $o . '/';
+ foreach ($books as $bid) {
+ $dd = $d . $bid;
- $this->vdir = $this->dir = WS_COLLECTIONS . '/app/' . $this->collectionId . '/';
- $this->wdir = WS_COLLECTIONS . '/working/' . $this->collectionId;
- $this->sdir = WS_COMPILE_ASSETS . '/_html5app/';
+ if (!file_exists($dd)) {
+ mkdir($dd, 0777, true);
+ }
+ $exporter->export($bid, $x, 'phonegapcollection', $o, $dd);
+ }
+ }
+
+ return $time;
}
protected function copy($s, $t) {
}
}
- function compile() {
+ function compile($os, $phonegapVersion = 'latest') {
+ if ($phonegapVersion == 'collection') {
+ $phonegapVersion = $this->collection->settings['phonegap'];
+ }
+
+ $this->phonegapVersion = wsHTML5Compiler::getPhonegapVersion($phonegapVersion);
+ $this->os = $os;
+
+ $this->vdir = $this->dir = WS_COLLECTIONS . '/app/' . $this->collectionId . '/';
+ $this->wdir = WS_COLLECTIONS . '/working/' . $this->collectionId;
+ $this->sdir = WS_COMPILE_ASSETS . '/_html5app/';
+
$this->copyRecursive($this->sdir, $this->vdir);
$this->writeStyle();
function writeStyle() {
$c = array();
- $c[] = 'body{background-image:url("data/images/' . $this->collection->theme['back'] . '");}';
+
+ $imagesdir = $this->vdir . '/data/images/';
+ if (!file_exists($imagesdir)) {
+ mkdir($imagesdir, 0777, true);
+ }
+
+ $this->copy($this->wdir . '/' . $this->collection->theme['back'], $imagesdir . '/' . $this->collection->theme['back']);
+
+ $c[] = 'body{background-image:url("images/' . $this->collection->theme['back'] . '");}';
file_put_contents($this->vdir . '/data/app.css', implode("\n", $c));
}
class wsHTML5Compiler {
- public static function factory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false) {
+ public static function factory($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false) {
if (is_null($version)) {
global $core;
$dao = new wsDAOBook($core->con);
}
if ($version == 'stable') {
- return new wsHTML5Compiler($book_id, 'stable', $phonegap, $phonegapVersion, $dir, $standalone);
+ return new wsHTML5Compiler($book_id, 'stable', $phonegap, $phonegapVersion, $dir, $standalone, $appcache);
} else {
- return new wsHTML5CompilerDev($book_id, 'dev', $phonegap, $phonegapVersion, $dir, $standalone);
+ return new wsHTML5CompilerDev($book_id, 'dev', $phonegap, $phonegapVersion, $dir, $standalone, $appcache);
}
}
protected $phonegapVersion;
protected $standalone = false;
protected $hiddenContents = array();
+ protected $appcache;
- function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false) {
+ function __construct($book_id, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false) {
global $core;
$this->phonegapVersion = self::getPhonegapVersion($phonegapVersion);
+ $this->appcache = $appcache;
if ($version == 'stable') {
$this->assets = WS_COMPILE_ASSETS . '/_html5prod';
}
$this->phonegap = $phonegap;
$this->standalone = $standalone || $this->phonegap;
+ $this->appcache = $appcache;
cubePHP::set_memory('4G');
}
protected function writeCache() {
- if ($this->phonegap) {
+ if (!$this->appcache) {
return;
}
$pagesContents = '';
+ $cache = '';
+ if ($this->appcache) {
+ $cache = ' manifest="cache.appcache"';
+ }
+
$script = '';
if ($this->phonegap) {
$script .= '<script type="text/javascript" charset="utf-8" src="data/cordova.js"></script>' . "\n";
}
}
- $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash');
+ $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'description', 'print', 'hiddenContents', 'splash','cache');
foreach ($vars as $v) {
$html = str_replace('<!-- $' . $v . ' -->', $$v, $html);
}
$thtml = $uhtml;
- $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash');
+ $vars = array('titre', 'credits', 'ga', 'style', 'script', 'pagesContents', 'print', 'hiddenContents', 'splash','cache');
foreach ($vars as $v) {
$uhtml = str_replace('<!-- $' . $v . ' -->', $$v, $uhtml);
}
protected $makeResources = true;
protected $os = 'all';
protected $supportedOS = array('ios', 'android');
+ public $ignoreCache = true;
public function __construct($book_id, $vdir = null, $whole = true, $makeResources = true, $os = 'all') {
$this->makeResources = $makeResources;
$vdir.='/' . $os;
}
- $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, 'latest', $vdir);
+ $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, 'latest', $vdir,false,!$this->ignoreCache);
$compiler->compile();
unlink($vdir . '/indext.html');
unlink($vdir . '/indexu.html');
unlink($vdir . '/widget.html');
- unlink($vdir . '/cache.appcache');
if ($this->makeResources) {
$this->makeScreenshots();
if (!file_exists($resources . '/splash')) {
mkdir($resources . '/splash', 0777, true);
}
- if (!file_exists($this->resources . '/icons')) {
+ if (!file_exists($resources . '/icons')) {
mkdir($resources . '/icons', 0777, true);
}
$base = WS_COMPILE_ASSETS . '/_ico/phonegap.png';
}
+ self::__makeIcon($base, $dir . '/' . $name . '.png', $size);
+ }
+
+ public static function __makeIcon($src, $dest, $size) {
$it = new cubeImageTools();
- $it->loadImage($base);
+ $it->loadImage($src);
$it->resize($size, $size, 'ratio', false, 'C', 'M', 'transparent');
- $it->output('png', $dir . '/' . $name . '.png');
+ $it->output('png', $dest);
}
protected function _drawBackImage($im, $width, $height) {
protected $zip;\r
protected $workingDir;\r
protected $whole = true;\r
+ public $cleanOnDestruct = true;\r
\r
public static function package($book_id, $version, $zip = true) {\r
global $packager;\r
\r
protected function cleanVdir() {\r
if (file_exists($this->vdir)) {\r
+ return;\r
// Suppression du répertoire si il existe\r
$rm = new cubeCommandLine('rm');\r
$rm->setArg('r');\r
}\r
\r
public function __destruct() {\r
- if ($this->whole) {\r
+ if ($this->whole && $this->cleanOnDestruct) {\r
$this->cleanVdir();\r
}\r
}\r
\r
public function copy($source, $dest) {\r
- if(!file_exists($source)){\r
+ if (!file_exists($source)) {\r
return;\r
}\r
copy($source, $dest);\r
});\r
});\r
\r
+\r
+\r
$("#dash .toggle").click(function() {\r
var rel = $(this).attr('rel');\r
var div = $(this).parents('.dashboard').get(0);\r
return true;\r
});\r
\r
+ $("#copywsassets").off('change blur').on('change blur', "#source", function() {\r
+ $.ajax({\r
+ url: SITE_PATH + 'ajax/fluidbookAssets/' + $(this).val(),\r
+ success: function(data) {\r
+ MyAjax(data);\r
+ }\r
+ });\r
+ });\r
+\r
+\r
$(window).resize(function() {\r
resize();\r
});\r
FIRST_LOAD = true;\r
\r
function load_ws_once() {\r
- $(document).on('change', 'form[action="exportbook"] select, form[action="exportbookExe"] select', function() {\r
+ $(document).on('change', 'form[action="exportbook"] select, form[action="exportbookExe"] select', function() {\r
var form = $(this).parents('form');\r
$(form).find('#changed').val($(this).attr('name'));\r
$(form).attr('action', 'exportbook').submit().attr('action', 'exportbookExe');\r
a.btbook>div{\r
display:inline-block;\r
width:16px;\r
- height:16px;\r
+ height:16px !important;\r
background-position: 0 0;\r
}\r
\r