]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 14 Nov 2013 10:43:12 +0000 (10:43 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 14 Nov 2013 10:43:12 +0000 (10:43 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/Util/class.ws.exporter.php
inc/ws/Util/html5/app/class.ws.html5.app.compiler.php

index ec97bf9f6242684ced43fa28dd92d44a3d118136..af535e6214906d706b6ee9cbe53da38e0b7c1cae 100644 (file)
@@ -312,6 +312,12 @@ class wsUrl {
                $res.='<tr><td class="min nowrap">' . __('Certificat APNS') . ' Prod (' . __('Fichier .pem') . ')</td><td><input type="file" name="apns_prod" /></td></tr>';\r
                $res.='</table>';\r
 \r
+               $res.='<h3>' . __('Applications offline') . '</h3>';\r
+               $res.='<table class="max">';\r
+               $res.='<tr><td class="min nowrap">' . __("Filtres d'exclusion") . '</td><td>' . form::textarea(array('settings[offline_exclude]', 'offline_exclude'), 30, 3, $collection->settings['offline_exclude']) . '</td></tr>';\r
+               $res.='<tr><td class="min nowrap">' . __("Synchronisations supplémentaires") . '</td><td>' . form::textarea(array('settings[offline_syncs]', 'offline_syncs'), 30, 3, $collection->settings['offline_syncs']) . '</td></tr>';\r
+               $res.='</table>';\r
+\r
                $res.='<h3>' . __('Thème') . '</h3>';\r
                $res.='<table class="max">';\r
                $images = array('back' => __('Image de fond'), 'etagere' => __("Image de l'étagère"), 'icon' => __("Icône de l'application") . ' (1024x1024px)');\r
index 23f38e67bedd52e72999e221f01032a6dc31e4c0..a49f1d6959b1f8d853d0a45185b5ee7425a1d597 100644 (file)
@@ -61,8 +61,37 @@ class wsExporter {
                                )
                );
 
+               $allpub = $compiler->books;
+
                if (isset($collection->settings['offline']) && $collection->settings['offline']) {
-                       $phonegap->addAdditionalSource('publications', $compiler->getPublishedVersionPath($os));
+                       $p = $compiler->getPublishedVersionPath($os);
+                       $phonegap->addAdditionalSource('publications', $p);
+
+                       $exs = explode("\n", $collection->settings['offline_exclude']);
+                       foreach ($exs as $e) {
+                               $e = trim($e);
+                               if ($e == '') {
+                                       continue;
+                               }
+
+                               if (stristr($e, '$id$')) {
+                                       foreach ($allpub as $i) {
+                                               $phonegap->addExclude('"' . str_replace('$id$', $i, $e) . '"');
+                                       }
+                               } else {
+                                       $phonegap->addExclude('"' . $e . '"');
+                               }
+                       }
+
+                       $add = explode("\n", $collection->settings['offline_syncs']);
+                       foreach ($add as $a) {
+                               $a = trim($a);
+                               if ($a == '') {
+                                       continue;
+                               }
+                               list($to, $source) = explode(':', $a);
+                               $phonegap->addAdditionalSource('publications' . '/' . $to, $p . $source);
+                       }
                }
 
                $ctrl = isset($_GET['ctrl']) && $_GET['ctrl'] == 'true';
@@ -77,10 +106,6 @@ class wsExporter {
                }
 
                $phonegap->run($run);
-
-               /* $this->_createProject($os, $collection->nom, $collection->settings['namespace']);
-                 $this->_collectionAssets($os, $compiler);
-                 $this->_transfertPhonegap($os, $dir, $dest); */
        }
 
        /**
index cacaf46dd8f79155ccbbbe0296f026a7846a8c7e..99dff1fdcd5ef7bb2dccb6ec193463dcb9adb9ae 100644 (file)
@@ -8,6 +8,7 @@ class wsHTML5AppCompiler {
        public $os;
        public $phonegapVersion;
        public $langs;
+       public $books=array();
 
        public function __construct($collectionId) {
 
@@ -19,12 +20,12 @@ class wsHTML5AppCompiler {
 
                foreach ($this->collection->datas as $group) {
                        foreach ($group['publications'] as $p) {
-                               $books[] = $p['id'];
+                               $this->books[] = $p['id'];
                        }
                }
 
                $daoBook = new wsDAOBook($core->con);
-               $allbooks = $daoBook->selectByIds($books);
+               $allbooks = $daoBook->selectByIds($this->books);
 
                $this->langs = array();
                foreach ($allbooks as $b) {
@@ -40,12 +41,7 @@ class wsHTML5AppCompiler {
 
                $dir = WS_COLLECTIONS . '/versions/' . $this->collectionId . '/' . $time . '/';
 
-               $books = array();
-               foreach ($this->collection->datas as $group) {
-                       foreach ($group['publications'] as $p) {
-                               $books[] = $p['id'];
-                       }
-               }
+               $books = $this->getPublicationsIds();
 
                $exporter = new wsExporter();
                foreach ($os as $o) {
@@ -63,6 +59,16 @@ class wsHTML5AppCompiler {
                return $time;
        }
 
+       protected function getPublicationsIds() {
+               $books = array();
+               foreach ($this->collection->datas as $group) {
+                       foreach ($group['publications'] as $p) {
+                               $books[] = $p['id'];
+                       }
+               }
+               return $books;
+       }
+
        protected function copy($s, $t) {
                if (!file_exists($s)) {
                        return;