]> _ Git - cubeextranet.git/commitdiff
(no commit message)
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 12 Nov 2012 11:29:20 +0000 (11:29 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 12 Nov 2012 11:29:20 +0000 (11:29 +0000)
inc/ws/Controlleur/class.ws.url.php
inc/ws/DAO/class.ws.dao.book.php
inc/ws/Util/html5/class.ws.html5.compiler.php
inc/ws/Util/packager/class.ws.packager.phonegap.php
inc/ws/prepend.php

index 515cd1655f9d3ef47bb834dfdae7af0dbd383c88..653257fd564d324b1c437735362acbf80dcadd48 100644 (file)
@@ -243,7 +243,7 @@ class wsUrl {
                                array('version' => 'viewerh', 'title' => __('Version HTML5'), 'icon' => cubeMedia::image(IMG . '/html5.png')),\r
                                array('version' => 'vieweru', 'title' => __('Version Flash') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/flashbug.png')),\r
                                array('version' => 'viewerhu', 'title' => __('Version HTML5') . ' (' . __('debuggage') . ')', 'icon' => cubeMedia::image(IMG . '/html5bug.png')),\r
-                               array('version' => 'viewerhu', 'title' => __('Widget HTML5'), 'icon' => cubeMedia::image(IMG . '/html5bug.png'), 'file' => 'widget.html', 'pattern' => '$1_$2_$3'),\r
+                               //array('version' => 'viewerhu', 'title' => __('Widget HTML5'), 'icon' => cubeMedia::image(IMG . '/html5bug.png'), 'file' => 'widget.html', 'pattern' => '$1_$2_$3'),\r
                                array('version' => 'viewer1', 'title' => __('Version 1'), 'icon' => cubeMedia::image(IMG . '/flash.png'))\r
                        );\r
                }\r
@@ -713,6 +713,31 @@ html{height:100%}' . "\n";
                self::commonHTML5Viewer($book_id, $hash, 'u');\r
        }\r
 \r
+       public static function viewerha($args) {\r
+               global $core;\r
+\r
+               commonDroits::min(5);\r
+               $args = cubePage::getArgs($args);\r
+               if (!isset($args[1])) {\r
+                       $args[1] = '';\r
+               }\r
+\r
+               $dao = new wsDAOBook($core->con);\r
+               $e = explode('_', $args[0]);\r
+               $dao->compileTemp($e[0], 'ha', WS_BOOKS . '/html5a/' . $e[0]);\r
+               $time = time();\r
+\r
+               if (count($e) == 2 || $e[2] < $time - 20) {\r
+                       $e[2] = $time;\r
+                       http::redirect(SITE_PATH . 'viewerha/' . implode('_', $e) . '/' . $args[1]);\r
+                       exit;\r
+               }\r
+\r
+               $book_id = $e[0];\r
+               $hash = $e[1];\r
+               self::commonHTML5Viewer($book_id, $hash, 'a');\r
+       }\r
+\r
        public static function viewerht($args) {\r
                commonDroits::min(5);\r
                $args = cubePage::getArgs($args);\r
@@ -738,12 +763,17 @@ html{height:100%}' . "\n";
 \r
                $dao = new wsDAOBook($core->con);\r
 \r
+               if ($version == 'a') {\r
+                       $version = '';\r
+                       $dir = 'a';\r
+               }\r
+\r
                $book = $dao->selectById($book_id);\r
                if ($hash != 'bcf26f9cf4a795ec00b9a44f42750d58' && $book->hash != $hash) {\r
                        commonDroits::error();\r
                }\r
 \r
-               echo file_get_contents(WS_BOOKS . '/html5/' . $book_id . '/index' . $version . '.html');\r
+               echo file_get_contents(WS_BOOKS . '/html5' . $dir . '/' . $book_id . '/index' . $version . '.html');\r
                exit;\r
        }\r
 \r
index 117fd70c36946b7d8f86feade9c6df9cc29fc8f2..5558af0e357935cefa348e750d9425a51dd53fe8 100644 (file)
@@ -792,6 +792,13 @@ class wsDAOBook extends commonDAO {
                $pages = $this->getPagesOfBook($book_id);\r
        }\r
 \r
+       public function compileTemp($book_id, $version, $dir) {\r
+               if ($version == 'ha') {\r
+                       $packager = new wsPackagerPhonegap($book_id, $dir, true, false, 'android');\r
+                       $packager->makePackage(false);\r
+               }\r
+       }\r
+\r
        public function compile($book_id, $version = 'all', $complete = false, $force = false) {\r
                if (is_null($book_id) || !$book_id) {\r
                        return;\r
@@ -809,7 +816,6 @@ class wsDAOBook extends commonDAO {
                        $html5 = true;\r
                }\r
 \r
-\r
                $book = $this->selectById($book_id);\r
                $pages = $this->getPagesOfBook($book_id);\r
 \r
index 4953f50ec11a3c417bef7937e75f42275ba832ce..dfff4ae2da35ce3d4e8faecf3c01b1c27f465c0e 100644 (file)
@@ -123,8 +123,6 @@ class wsHTML5Compiler {
        function __construct($book_id, $version = 'stable', $phonegap = false, $dir = null) {
                global $core;
 
-               $this->videoPath = $videoPath;
-               $this->makeResources = $resources;
                if ($version == 'stable') {
                        $this->assets = WS_COMPILE_ASSETS . '/_html5prod';
                        wsMaintenance::updateHTML5Sources(array(), false);
index 665688f3ccfd8a835d2a2d2bdf615f67a30d862a..d6afc211fe4db05e209f4a9253c1069468c45306 100644 (file)
@@ -26,12 +26,50 @@ class wsPackagerPhonegap extends wsPackager {
 
 
                if ($this->makeResources) {
-                       $this->resources = $this->vdir . '/Resources';
-                       $this->makeResources();
+
+                       if ($this->os == 'ios') {
+                               $this->resources = $this->vdir . '/Resources';
+                               $this->makeIOSResources();
+                       } elseif ($this->os == 'android') {
+                               $this->resources = $this->vdir . '/Resources';
+                               $this->makeAndroidResources();
+                       }
+               }
+       }
+
+       protected function makeAndroidResources() {
+               $icons = array('drawable' => 96,
+                       'drawable-hdpi' => 72,
+                       'drawable-ldpi' => 36,
+                       'drawable-mdpi' => 48,
+                       'drawable-xhdpi' => 96
+               );
+
+               $splashs = array('drawable' => 'x',
+                       'drawable-hdpi' => 'x',
+                       'drawable-ldpi' => 'x',
+                       'drawable-mdpi' => 'x',
+                       'drawable-xhdpi' => 'x');
+
+               foreach ($icons as $dir => $size) {
+                       $d = $this->resources . '/' . $dir;
+                       if (!file_exists($d)) {
+                               mkdir($d, 0777, true);
+                       }
+                       $list($w, $h) = explode('x', $size);
+                       $this->_makeIcon($w, $h, 'splash', $d);
+               }
+
+               foreach ($splashs as $dir => $size) {
+                       $d = $this->resources . '/' . $dir;
+                       if (!file_exists($d)) {
+                               mkdir($d, 0777, true);
+                       }
+                       $this->_makeSplash($size, 'splash', $d);
                }
        }
 
-       protected function makeResources() {
+       protected function makeIOSResources() {
                $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');
                $icons = array(57 => 'icon', 72 => 'icon-72', 114 => 'icon@2x', 144 => 'icon-72@2x');
 
@@ -51,27 +89,36 @@ class wsPackagerPhonegap extends wsPackager {
                }
        }
 
-       protected function _makeSplash($width, $height, $name) {
+       protected function _makeSplash($width, $height, $name, $dir = null) {
                $im = imagecreatetruecolor($width, $height);
                // Draw Background
                $back = imagecolorhexallocate($im, $this->theme->parametres->backgroundColor);
                imagefill($im, 0, 0, $back);
                // Draw image
+
+               if (is_null($dir)) {
+                       $dir = $this->resources . '/splash';
+               }
+
                $this->_drawBackImage($im, $width, $height);
-               imagepng($im, $this->resources . '/splash/' . $name . '.png');
+               imagepng($im, $dir . '/' . $name . '.png');
        }
 
-       protected function _makeIcon($size, $name) {
+       protected function _makeIcon($size, $name, $dir = null) {
                if ($this->theme->parametres->favicon != '') {
                        $base = $this->themeRoot . '/' . $this->theme->parametres->favicon;
                } else {
                        $base = WS_COMPILE_ASSETS . '/_ico/phonegap.png';
                }
 
+               if (is_null($dir)) {
+                       $dir = $this->resources . '/icons';
+               }
+
                $it = new imageTools();
                $it->loadImage($base);
                $it->resize($size, $size, 'ratio');
-               $it->output('png', $this->resources . '/icons/' . $name . '.png');
+               $it->output('png', $dir . '/' . $name . '.png');
        }
 
        protected function _drawBackImage($im, $width, $height) {
index 0e6ea5844903dcaa471cb4e244d4ade521a5da25..c34e389b4963baff458130c1ce7f456fbaf52e91 100644 (file)
@@ -12,6 +12,8 @@ $core->url->register('viewerp', 'viewerp', '^viewerp/(.*)$', array('wsUrl', 'vie
 $core->url->register('viewerh', 'viewerh', '^viewerh/(.*)$', array('wsUrl', 'viewerh'));
 $core->url->register('viewerhu', 'viewerhu', '^viewerhu/(.*)$', array('wsUrl', 'viewerhu'));
 $core->url->register('viewerht', 'viewerht', '^viewerht/(.*)$', array('wsUrl', 'viewerht'));
+$core->url->register('viewerha', 'viewerha', '^viewerha/(.*)$', array('wsUrl', 'viewerha'));
+$core->url->register('viewerhi', 'viewerhi', '^viewerhi/(.*)$', array('wsUrl', 'viewerhi'));
 
 if (DEV) {
        $tools = ROOT . '/../inc/tools/';