From: vincent@cubedesigners.com Date: Fri, 21 Jun 2013 16:55:33 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=8780396f792a04b8e3cf0a9e45fdfc3a9247878f;p=cubeextranet.git --- diff --git a/.htaccess b/.htaccess index fcd44da24..e559b86a5 100644 --- a/.htaccess +++ b/.htaccess @@ -14,6 +14,20 @@ AddCharset UTF-8 log Header set Access-Control-Allow-Origin "*" + + SetOutputFilter DEFLATE + 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 + + + Header append Vary User-Agent + + + BrowserMatch ^Mozilla/4 gzip-only-text/html + BrowserMatch ^Mozilla/4\.0[678] no-gzip + BrowserMatch \bMSIE !no-gzip !gzip-only-text/html + + + RewriteEngine on RewriteBase / diff --git a/fluidbook/back.jpg b/fluidbook/back.jpg new file mode 100644 index 000000000..809d9b3d1 Binary files /dev/null and b/fluidbook/back.jpg differ diff --git a/inc/commons/class.common.tools.php b/inc/commons/class.common.tools.php index 9eb896a16..daebf438c 100644 --- a/inc/commons/class.common.tools.php +++ b/inc/commons/class.common.tools.php @@ -836,6 +836,27 @@ class commonTools { } } + public static function copyWsAssets() { + commonDroits::min(5); + global $core; + $res = commonPage::barre(); + $res .= commonPage::tMain(); + $res .= commonPage::bh(); + $res.='
'; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.=''; + $res.='
' . __("Copie de fichiers entre deux fluidbook") . '
Fluidbook source' . form::field('source', 5, 6) . '
Fluidbook destination' . form::field('dest', 5, 6) . '
Fichiers à transférerEntrez le numéro du fluidbook source pour sélectionner les fichiers à transférer
' . $core->typo->BoutonOK(__('Copier')) . '
'; + $res.='
'; + $res .= ''; + $res .= commonPage::bf(); + $res .= commonPage::bMain(); + return $res; + } + protected static function searchGoogle($q, $cx, $key) { global $core; diff --git a/inc/ws/Controlleur/class.ws.ajax.php b/inc/ws/Controlleur/class.ws.ajax.php index b2ea17c6b..f8b19ef68 100644 --- a/inc/ws/Controlleur/class.ws.ajax.php +++ b/inc/ws/Controlleur/class.ws.ajax.php @@ -24,7 +24,7 @@ class wsAjax extends cubeAjax { public static function saveClient($args, &$x) { global $core; $dao = new commonDAOEntreprise($core->con); - // Creation de l'entreprise +// Creation de l'entreprise if ($_POST['entreprise_id'] == 'new') { if (!isset($_POST['ws_admin']) || !$_POST['ws_admin']) { $_POST['ws_admin'] = $core->user->utilisateur_id; @@ -35,7 +35,7 @@ class wsAjax extends cubeAjax { $_POST['ws_admin'] = $core->user->utilisateur_id; } $entreprise = $dao->sauve($_POST); - // Si c'est une nouvelle entreprise, on crée également le contact +// Si c'est une nouvelle entreprise, on crée également le contact if ($_POST['entreprise_id'] == 'new') { $data = $_POST['contact']; $data['entreprise'] = $entreprise->entreprise_id; @@ -231,10 +231,12 @@ class wsAjax extends cubeAjax { if (isset($_FILES[$t]) && !$_FILES[$t]['error']) { $ext = CubeIT_Files::getExtension($_FILES[$t]['name']); move_uploaded_file($_FILES[$t]['tmp_name'], $wdir . '/' . $t . '.' . $ext); - $_POST['theme'][$t] = $t . '.' . $ext; + $save['theme'][$t] = $t . '.' . $ext; } } + + foreach ($_POST['group'] as $gid => $group) { if ($gid && $gid == 'new_') { continue; @@ -450,13 +452,13 @@ class wsAjax extends cubeAjax { if (!self::valideDemandeDevis($x)) { return; } - // L'utilisateur est-il déjà dans la base ? +// L'utilisateur est-il déjà dans la base ? $daoUtilisateur = new commonDAOUtilisateur($core->con); $utilisateur = $daoUtilisateur->selectByEmail($_POST['email']); if ($utilisateur != null) { $utilisateur_id = $utilisateur->utilisateur_id; } else { - // Création de l'entreprise +// Création de l'entreprise $daoEntreprise = new commonDAOEntreprise($core->con); $datas = array(); $datas['entreprise_id'] = 'new'; @@ -474,7 +476,7 @@ class wsAjax extends cubeAjax { $datas['ws_grade'] = 1; $datas['ws_admin'] = 1; $entreprise = $daoEntreprise->sauve($datas); - // Création de l'utilisateur +// Création de l'utilisateur $datas = array(); $datas['utilisateur_id'] = 'new'; $datas['prenom'] = $_POST['prenom']; @@ -574,7 +576,7 @@ class wsAjax extends cubeAjax { $_POST['site'] = $_POST['site_internet']; } file_put_contents(ROOT . '/cache/demandeDevis.txt', print_r($_POST, true)); - // Validation des champs de formulaires +// Validation des champs de formulaires $ok = true; return $ok; } @@ -643,14 +645,14 @@ class wsAjax extends cubeAjax { } elseif ($demande->status > 1) { $res = __("Cette demande est actuellement en cours de traitement"); } else { - // On place la demande comme en cours d'édition +// On place la demande comme en cours d'édition $dao->setAdministrateur($demande->demande_id, $core->user->utilisateur_id); - // On vérifie que l'utilisateur n'est pas déjà géré par un revendeur +// On vérifie que l'utilisateur n'est pas déjà géré par un revendeur $demandeur = $daoUtilisateur->selectById($demande->utilisateur, 'utilisateurs_entreprise'); $administrateurs = $daoUtilisateur->selectWSAdministrateursId(); if (!is_null($demandeur->ws_admin) && !in_array($demandeur->ws_admin, $administrateurs)) { - // Si déjà géré par un revendeur +// Si déjà géré par un revendeur $revendeur = $daoUtilisateur->selectById($demandeur->ws_admin, 'utilisateurs_entreprise'); $actions[__('Je confie la demande à') . ' ' . $revendeur->rs . ' (' . $revendeur->prenom . ' ' . $revendeur->nom . ')'] = $demandeur->ws_admin; } else { @@ -1053,7 +1055,7 @@ class wsAjax extends cubeAjax { $env = Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI; - // Notifications +// Notifications $apns = new Zend_Mobile_Push_Apns(); if ($env == Zend_Mobile_Push_Apns::SERVER_SANDBOX_URI) { @@ -1077,6 +1079,108 @@ class wsAjax extends cubeAjax { $apns->close(); } -} + public function fluidbookAssets($args, &$x) { + $id = $args[1]; + if (!$id) { + $c = __('Entrez le numéro du fluidbook source pour sélectionner les fichiers à transférer'); + } else { + $dr = opendir(WS_BOOKS . '/working/' . $id); + $files = array(); + while ($f = readdir($dr)) { + if ($f == '.' || $f == '..') { + continue; + } + + $files[$f] = $f; + $checked[] = $f; + } + + ksort($files); + + if (!count($files)) { + $c = __('Aucun fichier à transférer'); + } else { + $c = cubeForm::checkMultiple('files', $files, count($files), $checked); + } + } + + $x->addContent('f', $c); + } + + public function copywsassets($args, &$x) { + if (!isset($_POST['files']) || !count($_POST['files'])) { + $x->addAlert(__('Aucun fichier sélectionné')); + return; + } elseif (!isset($_POST['dest']) || !$_POST['dest']) { + $x->addAlert(__('Destination invalide')); + return; + } + + $d = WS_BOOKS . '/working/' . $_POST['dest']; + if (!file_exists($d)) { + mkdir($d, 0777, true); + } + $s = WS_BOOKS . '/working/' . $_POST['source']; + + foreach ($_POST['files'] as $f) { + copy($s . '/' . $f, $d . '/' . $f); + } + $x->addAlert(__('Copie effectuée')); + } + + public static function collectionVersionCreate($args, &$x) { + global $core; + $id = $args[1]; + $compiler = new wsHTML5AppCompiler($id); + $time = $compiler->createVersion(); + + file_put_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $time . '/composition.json', json_encode($compiler->collection->datas)); + + $c = $core->con->openCursor('book_collection_compile'); + $c->collection_id = $id; + $c->compile_date = $time; + $c->online = 0; + $c->insert(); + + $x->addReload(); + } + + public static function collectionVersionPublish($args, &$x) { + global $core; + + $id = $args[1]; + $date = $args[2]; + + $c = $core->con->openCursor('book_collection_compile'); + $c->online = 0; + $c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND online=1'); + + $c = $core->con->openCursor('book_collection_compile'); + $c->online = 1; + $c->update('WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\''); + + $cache = WS_COLLECTIONS . '/ws/' . $id . '.json'; + if (file_exists($cache)) { + unlink($cache); + } + + $x->addReload(); + } + + public static function collectionVersionDelete($args, &$x) { + global $core; + + $id = $args[1]; + $date = $args[2]; + + if ($id && $date) { + $d = WS_COLLECTIONS . '/versions/' . $id . '/' . $date; + `rm -rf $d`; + $core->con->execute('DELETE FROM book_collection_compile WHERE collection_id=\'' . $core->con->escape($id) . '\' AND compile_date=\'' . $core->con->escape($date) . '\''); + } + $x->addReload(); + } + +} ?> \ No newline at end of file diff --git a/inc/ws/Controlleur/class.ws.services.php b/inc/ws/Controlleur/class.ws.services.php index a4b65a299..d91e7757d 100644 --- a/inc/ws/Controlleur/class.ws.services.php +++ b/inc/ws/Controlleur/class.ws.services.php @@ -552,9 +552,40 @@ class wsServices extends cubeFlashGateway { } public function collection() { + global $core; + $id = $this->callArgs[0]; $this->outputXML = false; header('Content-type: application/json'); - echo '[]'; + + $cache = WS_COLLECTIONS . '/ws/' . $id . '.json'; + $limit = TIME - 7200; + if (!file_exists($cache) || filemtime($cache) < $limit) { + $r = $core->con->select('SELECT * FROM book_collection_compile WHERE online=1 AND collection_id=\'' . $core->con->escape($id) . '\''); + $r->fetch(); + $version = $r->compile_date; + + $composition = json_decode(file_get_contents(WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/composition.json')); + + $couvertures = array(); + foreach ($composition as $k => $g) { + foreach ($g->publications as $l => $p) { + $couv = WS_COLLECTIONS . '/versions/' . $id . '/' . $version . '/ios/' . $p->id . '/data/background/36/t1.jpg'; + $couvertures[$p->id] = base64_encode(file_get_contents($couv)); + } + } + + $d = array('id' => $id, 'time' => $version, 'datas' => $composition, 'couvertures' => $couvertures); + + $dao = new wsDAOCollection($core->con); + $col = $dao->selectById($id); + + $json = json_encode($d); + file_put_contents($cache, $json); + echo $json; + } else { + echo file_get_contents($cache); + } + exit; } diff --git a/inc/ws/Controlleur/class.ws.url.php b/inc/ws/Controlleur/class.ws.url.php index 761725406..c08d364af 100644 --- a/inc/ws/Controlleur/class.ws.url.php +++ b/inc/ws/Controlleur/class.ws.url.php @@ -214,7 +214,6 @@ class wsUrl { $collection = $dao->selectById($args[1]); $shortcuts = array(); - $shortcuts[] = '' . $core->typo->Ajouter('Nouveau groupe') . ''; $res = commonPage::barre(null, null, null, $shortcuts); $res .= commonPage::tMain(); @@ -231,13 +230,13 @@ class wsUrl { global $core; $res = '

Gestion de la collection « ' . $collection->nom . ' » # ' . $collection->collection_id . '

'; - $res.='
'; $res.=''; $res.=''; $res.=''; - $res.='
#' . form::hidden('collection_id', $collection->collection_id) . $collection->collection_id . '
' . __('Nom de la collection') . '' . form::field('nom', 20, 64, $collection->nom) . '
'; $res.='

' . __('Composition') . '

'; + $res.='' . $core->typo->Ajouter(__('Nouveau groupe')) . '

'; $res .= '
    '; @@ -315,8 +314,26 @@ class wsUrl { $res.=''; $res.='

    '; $res.='

    ' . __('Versions') . '

    '; - - $res.='' . $core->typo->Ajouter(__('Publier et notifier les utilisateurs')) . ''; + $res.='' . $core->typo->Ajouter(__('Créer une version')) . '

    '; + $r = $core->con->select('SELECT * FROM book_collection_compile WHERE collection_id=\'' . $collection->collection_id . '\' ORDER BY compile_date DESC'); + if (!$r->count()) { + $res.=__('Aucune version de la collection n\'a été crée'); + } else { + $res.=''; + $res.=''; + while ($r->fetch()) { + if (!$r->online) { + $publish = '
    ' . __('Publier') . '
    '; + $del = '
    ' . __('Effacer') . '
    '; + } else { + $publish = ''; + $del = ''; + } + $res.=''; + } + $res.='
    ' . __('Date') . '' . __('Publiée') . '
    ' . date('Y-m-d H:i:s', $r->compile_date) . '' . ($r->online ? __('Oui') : __('Non')) . '' . $publish . '' . $del . '
    '; + } + $res.='
    ' . $core->typo->Ajouter(__('Publier et notifier les utilisateurs')) . ''; $res.='

    ' . __('Export') . '

    '; $res.='' . $core->typo->Ajouter(__('Exporter pour Android')) . ' ' . $core->typo->Ajouter(__('Exporter pour iOS')) . ''; diff --git a/inc/ws/Util/class.ws.exporter.php b/inc/ws/Util/class.ws.exporter.php index cc3322824..2180570a0 100644 --- a/inc/ws/Util/class.ws.exporter.php +++ b/inc/ws/Util/class.ws.exporter.php @@ -16,17 +16,81 @@ class wsExporter { 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); @@ -101,6 +165,8 @@ class wsExporter { $this->_phonegap(); } else if ($this->metaAction == 'install') { $this->_install(); + } else if ($this->metaAction == 'phonegapcollection') { + $this->_phonegapcollection(); } } @@ -109,6 +175,14 @@ class wsExporter { 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()); @@ -155,6 +229,7 @@ class wsExporter { } $packager = new wsPackagerPhonegap($this->book_id, null, true, false, $os); + $packager->cleanOnDestruct = false; $package = $packager->makePackage(false); $this->_transfertPhonegap($os, $package, $this->destinationDir); @@ -232,7 +307,6 @@ class wsExporter { list($distServer, $distDir) = explode(':', $dest); } - if (!file_exists($dest)) { if (!$destDistant) { mkdir($dest, 0777, true); 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 97644c518..2e930b949 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 @@ -8,24 +8,42 @@ class wsHTML5AppCompiler { 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) { @@ -64,7 +82,18 @@ class wsHTML5AppCompiler { } } - 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(); @@ -88,7 +117,15 @@ class wsHTML5AppCompiler { 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)); } diff --git a/inc/ws/Util/html5/class.ws.html5.compiler.php b/inc/ws/Util/html5/class.ws.html5.compiler.php index 406c36c73..9df43eb93 100644 --- a/inc/ws/Util/html5/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/class.ws.html5.compiler.php @@ -2,7 +2,7 @@ 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); @@ -11,9 +11,9 @@ class wsHTML5Compiler { } 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); } } @@ -139,11 +139,13 @@ class wsHTML5Compiler { 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'; @@ -153,6 +155,7 @@ class wsHTML5Compiler { } $this->phonegap = $phonegap; $this->standalone = $standalone || $this->phonegap; + $this->appcache = $appcache; cubePHP::set_memory('4G'); @@ -344,7 +347,7 @@ class wsHTML5Compiler { } protected function writeCache() { - if ($this->phonegap) { + if (!$this->appcache) { return; } @@ -479,6 +482,11 @@ class wsHTML5Compiler { $pagesContents = ''; + $cache = ''; + if ($this->appcache) { + $cache = ' manifest="cache.appcache"'; + } + $script = ''; if ($this->phonegap) { $script .= '' . "\n"; @@ -542,7 +550,7 @@ class wsHTML5Compiler { } } - $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, $html); } @@ -570,7 +578,7 @@ class wsHTML5Compiler { $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, $uhtml); } diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 34ceffbbd..52b5276f1 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -6,6 +6,7 @@ class wsPackagerPhonegap extends wsPackager { 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; @@ -29,13 +30,12 @@ class wsPackagerPhonegap extends wsPackager { $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(); @@ -156,7 +156,7 @@ class wsPackagerPhonegap extends wsPackager { 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); } @@ -203,10 +203,14 @@ class wsPackagerPhonegap extends wsPackager { $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) { diff --git a/inc/ws/Util/packager/class.ws.packager.php b/inc/ws/Util/packager/class.ws.packager.php index 9b959dd98..398c5c306 100644 --- a/inc/ws/Util/packager/class.ws.packager.php +++ b/inc/ws/Util/packager/class.ws.packager.php @@ -14,6 +14,7 @@ class wsPackager { protected $zip; protected $workingDir; protected $whole = true; + public $cleanOnDestruct = true; public static function package($book_id, $version, $zip = true) { global $packager; @@ -189,6 +190,7 @@ class wsPackager { protected function cleanVdir() { if (file_exists($this->vdir)) { + return; // Suppression du répertoire si il existe $rm = new cubeCommandLine('rm'); $rm->setArg('r'); @@ -212,13 +214,13 @@ class wsPackager { } public function __destruct() { - if ($this->whole) { + if ($this->whole && $this->cleanOnDestruct) { $this->cleanVdir(); } } public function copy($source, $dest) { - if(!file_exists($source)){ + if (!file_exists($source)) { return; } copy($source, $dest); diff --git a/js/common.js b/js/common.js index b56a7c697..484c33d66 100644 --- a/js/common.js +++ b/js/common.js @@ -68,6 +68,8 @@ function load_common_extranet() { }); }); + + $("#dash .toggle").click(function() { var rel = $(this).attr('rel'); var div = $(this).parents('.dashboard').get(0); @@ -150,6 +152,16 @@ function load_common_extranet() { return true; }); + $("#copywsassets").off('change blur').on('change blur', "#source", function() { + $.ajax({ + url: SITE_PATH + 'ajax/fluidbookAssets/' + $(this).val(), + success: function(data) { + MyAjax(data); + } + }); + }); + + $(window).resize(function() { resize(); }); diff --git a/js/ws.js b/js/ws.js index d5b869c1f..c2237326c 100644 --- a/js/ws.js +++ b/js/ws.js @@ -3,7 +3,7 @@ TO_LOAD_ONCE[TO_LOAD_ONCE.length] = 'load_ws_once();'; FIRST_LOAD = true; function load_ws_once() { - $(document).on('change', 'form[action="exportbook"] select, form[action="exportbookExe"] select', function() { + $(document).on('change', 'form[action="exportbook"] select, form[action="exportbookExe"] select', function() { var form = $(this).parents('form'); $(form).find('#changed').val($(this).attr('name')); $(form).attr('action', 'exportbook').submit().attr('action', 'exportbookExe'); diff --git a/style/ws/style.css b/style/ws/style.css index 0bcf1ad5e..14dca5dfc 100644 --- a/style/ws/style.css +++ b/style/ws/style.css @@ -550,7 +550,7 @@ a.btbook{ a.btbook>div{ display:inline-block; width:16px; - height:16px; + height:16px !important; background-position: 0 0; }