]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 12 Sep 2012 17:08:08 +0000 (17:08 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Wed, 12 Sep 2012 17:08:08 +0000 (17:08 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/packager/class.ws.packager.phonegap.php

index 3c1ec8e7bdffc48896e906ce34244208e556ec2f..4c39b6a19a18c51887ebfb630cd035ecf1d17c0e 100644 (file)
@@ -245,6 +245,12 @@ class wsBookParametres extends wsParametres {
                $this->forms['mobile'] = array('label' => __('Version mobile'),\r
                        'fieldsnames' => array('mobileLVersion', '|', 'mobileVersion', 'mobileTransitions', 'mobileIconVector'));\r
 \r
+               $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');\r
+               $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');\r
+\r
+               $this->forms['phonegap'] = array('label' => __('Applications mobile'),\r
+                       'fieldsnames' => array('phonegapId', 'phonegapVersion'));\r
+\r
                $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'));\r
                $this->fields['secureURLRedirect'] = array('type' => 'text', 'default' => 'http://', 'editable' => true, 'label' => __('Redirection'), 'grade' => 5, 'hint' => __("Si l'authentification échoue, redirection vers cette adresse"));\r
                $this->forms['secure'] = array('label' => __('Sécurisation'),\r
index 0bf225d0ce6b711e8c0fedfe5cfaf095c9257f5d..383c87d40d65840c874e40cdb64bbb3e69fe9864 100644 (file)
@@ -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('<?xml version="1.0" encoding="UTF-8"?><widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" version="1.0.0" id="com.fluidbook.phonegap.' . $this->book_id . '" />');
-               $ns = $config->getNamespaces();
+
+               $appId = $this->book->parametres->phonegapId;
+               $appId = str_replace('$id', $this->book_id, $appId);
+
+               $config = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><widget xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0" version="' . $this->book->parametres->phonegapVersion . '" id="' . $appId . '" />');
+               $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);