From: vincent@cubedesigners.com Date: Wed, 12 Sep 2012 17:08:08 +0000 (+0000) Subject: (no commit message) X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=b19ca779f10c9fbb14265002a40961b2212fcb1b;p=cubeextranet.git --- diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 3c1ec8e7b..4c39b6a19 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -245,6 +245,12 @@ class wsBookParametres extends wsParametres { $this->forms['mobile'] = array('label' => __('Version mobile'), 'fieldsnames' => array('mobileLVersion', '|', 'mobileVersion', 'mobileTransitions', 'mobileIconVector')); + $this->fields['phonegapId'] = array('type' => 'text', 'default' => 'com.fluidbook.phonegap.$id', 'editable' => true, 'label' => __("Identifiant de l'identifiant"), 'grade' => 5, 'hint' => __('De la forme') . ' com.fluidbook.phonegap.xxxxx'); + $this->fields['phonegapVersion'] = array('type' => 'text', 'default' => '1.0.0', 'editable' => true, 'label' => __("Version de l'application"), 'grade' => 5, 'hint' => __('De la forme') . ' 1.2.3'); + + $this->forms['phonegap'] = array('label' => __('Applications mobile'), + 'fieldsnames' => array('phonegapId', 'phonegapVersion')); + $this->fields['secureURL'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('URL de sécurisation'), 'grade' => 5, 'hint' => __('URL intérrogé pour vérifier si le visiteur à les droits pour consulter la publication')); $this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse")); $this->forms['secure'] = array('label' => __('Sécurisation'), diff --git a/inc/ws/Util/packager/class.ws.packager.phonegap.php b/inc/ws/Util/packager/class.ws.packager.phonegap.php index 0bf225d0c..383c87d40 100644 --- a/inc/ws/Util/packager/class.ws.packager.phonegap.php +++ b/inc/ws/Util/packager/class.ws.packager.phonegap.php @@ -12,21 +12,25 @@ class wsPackagerPhonegap extends wsPackager { protected function preparePackage() { parent::preparePackage(); - $compiler = wsHTML5Compiler::factory($this->book_id, null, true, $this->vdir . '/www'); + $compiler = wsHTML5Compiler::factory($this->book_id, null, true, $this->vdir); $compiler->compile(); - unlink($this->vdir . '/www/indext.html'); - unlink($this->vdir . '/www/indexu.html'); - unlink($this->vdir . '/www/widget.html'); - unlink($this->vdir . '/www/cache.appcache'); - rmdir($this->vdir . '/data'); + unlink($this->vdir . '/indext.html'); + unlink($this->vdir . '/indexu.html'); + unlink($this->vdir . '/widget.html'); + unlink($this->vdir . '/cache.appcache'); + //rmdir($this->vdir . '/data'); $this->makeConfig(); } protected function makeConfig() { - $config = simplexml_load_string(''); - $ns = $config->getNamespaces(); + + $appId = $this->book->parametres->phonegapId; + $appId = str_replace('$id', $this->book_id, $appId); + + $config = new SimpleXMLElement(''); + $ns = $config->getDocNamespaces(); $config->addChild('name', $this->book->parametres->title); $config->addChild('description'); $author = $config->addChild('author', 'Fluidbook'); @@ -70,8 +74,8 @@ class wsPackagerPhonegap extends wsPackager { list($width, $height) = explode('x', $size); $this->_makeSplash($width, $height); - $s = $config->addChild('splash'); - $s->addAttribute('src', 'splash/' . $size . '.png', $ns['gap']); + $s = $config->addChild('gap:splash', null, $ns['gap']); + $s->addAttribute('src', 'splash/' . $size . '.png'); $s->addAttribute('width', $width); $s->addAttribute('height', $height); } @@ -80,10 +84,10 @@ class wsPackagerPhonegap extends wsPackager { list($width, $height) = explode('x', $size); $this->_makeSplash($width, $height); - $s = $config->addChild('splash', null, $ns['gap']); + $s = $config->addChild('gap:splash', null, $ns['gap']); $s->addAttribute('src', 'splash/' . $size . '.png'); - $s->addAttribute('platform', 'android', $ns['gap']); - $s->addAttribute('density', $density, $ns['gap']); + $s->addAttribute('gap:platform', 'android', $ns['gap']); + $s->addAttribute('gap:density', $density, $ns['gap']); } copy($this->vdir . '/splash/768x1024.png', $this->vdir . '/splash.png'); file_put_contents($this->vdir . '/config.xml', $config->asXML()); @@ -96,7 +100,7 @@ class wsPackagerPhonegap extends wsPackager { $im = imagecreatetruecolor($width, $height); // Draw Background - $back = imagecolorhexallocate($this->theme->parametres->backgroundColor); + $back = imagecolorhexallocate($im, $this->theme->parametres->backgroundColor); imagefill($im, 0, 0, $back); // Draw image $this->_drawBackImage($im, $width, $height);