]> _ Git - cubeextranet.git/commitdiff
done #1053 @3
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 23 Dec 2016 14:49:55 +0000 (14:49 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Fri, 23 Dec 2016 14:49:55 +0000 (14:49 +0000)
fluidbook/compile/_js/fluidbook.js
fluidbook/compile/index.html
fluidbook/compile/style.css
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Metier/class.ws.document.php
inc/ws/Util/packager/class.ws.packager.html.php
inc/ws/Util/packager/class.ws.packager.phonegap.php

index a517847d2e3fe8eb461d1542d8f88823e6cc8c1a..495d1726964cf5c80e70a066916245481fee5328 100644 (file)
@@ -288,6 +288,16 @@ function getBackgroundColor() {
     }
 }
 
+function flashAlive() {
+    displayFlashFluidbook();
+    FLASH_ALIVE = true;
+    clearTimeout(FLASH_ALIVE_TIMEOUT);
+}
+
+function displayFlashFluidbook() {
+    document.getElementById('fluidbook').style.opacity = 1;
+}
+
 /** Initialization code.
  * If you use your own event management code, change it as required.
  */
index 4614abffa9a63188853006b26eca74bb236ababf..2f905cbdc20edc7ebacecd1a536f32f4280fe56d 100644 (file)
                visibility: hidden;
                display: none
        }</style>
+       <style type="text/css">body{background-color:#$bgcolor;}</style>
        <script type="text/javascript">
-               FB_DEFAULT_LANG = '$lang';
-               INDEX_EXT = '$index_ext';
-               var backgroundColor = "$bgcolor";
-               function redirect() {
+        FB_DEFAULT_LANG = '$lang';
+        INDEX_EXT = '$index_ext';
+        FLASH_ALIVE = false;
+        FLASH_ALIVE_TIMEOUT = 0;
 
+        var backgroundColor = "$bgcolor";
 
-                       if (isMobile() || $alwaysHTML5) {
-                               $redirectMobile
-                       } else if (isBadMobile()) {
-                               $redirectPDF
-                       } else {
-                               if ($html5priority && supportHTML5Version() && !swfobject.hasFlashPlayerVersion("$flashversion")) {
-                                       $redirectMobile
-                                       return;
-                               }
+        function redirect() {
+            if (isMobile() || $alwaysHTML5) {
+                $redirectMobile
+            } else if (isBadMobile()) {
+                $redirectPDF
+            } else {
+                if ($redirectIfFlashNotInstalled && supportHTML5Version() && !swfobject.hasFlashPlayerVersion("$flashversion")) {
+                    $redirectMobile
+                    return;
+                }
+                swfobject.embedSWF("$pathToIndex?junk=$junk", "fluidbook", "100%", "100%", "$flashversion", "", getFlashvars($junk, $fv), {
+                    "allowScriptAccess": "always",
+                    "quality": "high",
+                    "scale": "noscale",
+                    "wmode": getWmode(),
+                    "allowFullScreen": "true",
+                    "allowNetworking": "$allowNetworking",
+                    'allowFullScreenInteractive': 'true'
+                }, {"bgcolor": "#" + getBackgroundColor()});
 
-                               document.getElementById('fluidbook').style.opacity = 1;
-                               swfobject.embedSWF("$pathToIndex?junk=$junk", "fluidbook", "100%", "100%", "$flashversion", "", getFlashvars($junk, $fv), {
-                                       "allowScriptAccess": "always",
-                                       "quality": "high",
-                                       "scale": "noscale",
-                                       "wmode": getWmode(),
-                                       "allowFullScreen": "true",
-                                       "allowNetworking": "$allowNetworking",
-                                       'allowFullScreenInteractive': 'true'
-                               }, {"bgcolor": "#" + getBackgroundColor()});
-                       }
-               }
+                if ($redirectIfFlashBlocked) {
+                    if (swfobject.hasFlashPlayerVersion("$flashversion")) {
+                        FLASH_ALIVE_TIMEOUT = setTimeout(function () {
+                            if (!FLASH_ALIVE) {
+                                $redirectMobile
+                            }
+                        }, 1500);
+                    }
+                } else {
+                    displayFlashFluidbook();
+                }
+            }
+        }
        </script>
        <script type="text/javascript" src="$spfluidbook.js?junk=$junk"></script>
        $ga
index 33bded1d66cf0c8270b407c51a4d7f56fd3a4efb..a2d87b467fabf39aff502fe7aaf78e7868f275d3 100644 (file)
@@ -1,5 +1,6 @@
 html{height:100%;overflow:hidden;}
-#fluidbook{height:100%;}
+#fluidbook{height:100%;opacity: 0;}
+.flashalive #fluidbook{opacity: 1;}
 body{height:100%;margin:0;padding:0;font-family:Arial, Helvetica, sans-serif;color:#666;font-size:11px;}
 .center{margin:10px auto;text-align:center;}
 blockquote{width:75%;margin:auto;padding-top:150px;}
index 4b6a794c16a9799d9fb9277bbd116756e54605eb..e94ec14df745d635282dcc233765ab40748b6622 100644 (file)
@@ -304,7 +304,10 @@ class wsBookParametres extends wsParametres {
                                                                        __('Version HTML5') => 'html5',
                                                                        __("Version HTML5 en images") => 'html5-images')
                );
-               $this->fields['html5priority'] = array('type' => 'boolean', 'default' => 'true', 'editable' => true, 'label' => __("Si flash n'est pas installé, rediriger vers la version HTML5"), 'grade' => 1);
+               $this->fields['html5priority'] = array('type' => 'combo', 'default' => 'true', 'editable' => true, 'label' => __("Rediriger vers la version HTML5"), 'grade' => 1,
+                                                      'datas' => array(__('Si l\'utilisateur a un appareil tactile') => 'false',
+                                                                       __('Si flash n\'est pas installé') => 'notinstalled',
+                                                                       __("Si flash n'est pas pas installé ou bloqué") => 'true'));
 
 
                $this->fields['navOrderH'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __('Ordre des icônes dans la nav') . ' (' . __('Si différente') . ')', 'grade' => 3);
index 9dd6caf95b7cb4679c917641c3d84101eb3f3e87..2a764c5fc36980a0a5f7a8c963e9ac7d1627a77b 100644 (file)
@@ -591,7 +591,7 @@ class wsDocument extends cubeMetier {
 
        public function makeHTML5Files($page) {
                // Then make HD background shots
-               $resolutions = array(300 => 85, 150 => 85);
+               $resolutions = array(300 => 85, 150 => 85, 36 => 85);
                $rratio = $this->getResolutionRatio();
                foreach ($resolutions as $r => $q) {
                        $this->makeShotPNM($page, 'html/h' . $r . '-', $r * $rratio, $q, 4, null, false);
index ebd7e719353bc84f7e6406a2e3b452e97f994e38..07648e2eb41943d22bd7ebf7f55a6e04148de753 100644 (file)
@@ -110,9 +110,9 @@ class wsPackagerHTML extends wsPackager {
                }
 
                if (!isset($this->book->parametres->html5priority)) {
-                       $this->book->parametres->html5priority = true;
+                       $this->book->parametres->html5priority = 'true';
                }
-               $html5priority = CubeIT_Util_Bool::boolval($this->book->parametres->html5priority, false, true);
+               $html5priority = $this->book->parametres->html5priority;
 
 
                // Stuffs to replace in html
@@ -128,9 +128,11 @@ class wsPackagerHTML extends wsPackager {
                                   'flashversion' => $this->getMinFlashVersion(),
                                   'fv' => json_encode($this->getFlashvars()),
                                   'alwaysHTML5' => $alwaysHTML5,
-                                  'html5priority' => $html5priority,
                                   'keywords' => $keywords,
-                                  'allowNetworking' => $this->_allowNeworking);
+                                  'allowNetworking' => $this->_allowNeworking,
+                                  'redirectIfFlashNotInstalled' => in_array($html5priority, array('true', 'notinstalled')) ? 'true' : 'false',
+                                  'redirectIfFlashBlocked' => $html5priority == 'true' ? 'true' : 'false'
+               );
 
                $this->origHTML = $this->book->parametres->htmlPrepend . file_get_contents($this->vdir . '/index.html');
                unlink($this->vdir . '/index.html');
index f2db2a27d5a2abf6a3c7dcee100b5658e7ece289..81f752b047ad87ff3b5925b28b101c6eb8164d72 100644 (file)
@@ -28,7 +28,7 @@ class wsPackagerPhonegap extends wsPackager {
                foreach ($oss as $os) {
                        $vdir = $this->vdir;
                        if (count($oss) > 1) {
-                               $vdir.='/' . $os;
+                               $vdir .= '/' . $os;
                        }
 
                        $compiler = wsHTML5Compiler::factory($this->book_id, null, $os, 'latest', $vdir, false, !$this->ignoreCache, $this->home);
@@ -50,7 +50,13 @@ class wsPackagerPhonegap extends wsPackager {
        }
 
        protected function makeScreenshots() {
-               $resolutions = array('ipad' => array('width' => 1024, 'height' => 768, 'zoom' => 2), 'iphone3-5' => array('width' => 960, 'height' => 640, 'zoom' => 1), 'iphone-4' => array('width' => 1136, 'height' => 640, 'zoom' => 1));
+               $resolutions = array(
+                       'ipad' => array('width' => 1024, 'height' => 768, 'zoom' => 2),
+                       'ipad-pro' => array('width' => 1366, 'height' => 1024, 'zoom' => 2),
+                       //                      'iphone3-5' => array('width' => 960, 'height' => 640, 'zoom' => 1),
+                       //                      'iphone-4' => array('width' => 1136, 'height' => 640, 'zoom' => 1),
+                       'iphone-5-5' => array('width' => 2208, 'height' => 1242, 'zoom' => 1)
+               );
 
                $views = array();
                $s = str_replace("\r", "\n", $this->book->parametres->appScreenshots);
@@ -93,7 +99,7 @@ class wsPackagerPhonegap extends wsPackager {
                                        $screenHeight = $w;
                                }
                                $url = $baseUrl . $view['url'];
-                               $out = $dir . '/' . $k . '.png';
+                               $out = $dir . '/' . $k . '.jpeg';
 
                                $cl = new cubeCommandLine('xvfb-run');
                                $cl->setArg('server-args', '-screen 0, ' . $screenWidth . 'x' . $screenHeight . 'x24');
@@ -111,17 +117,17 @@ class wsPackagerPhonegap extends wsPackager {
 
        protected function makeAndroidResources($resources) {
                $icons = array('drawable' => 96,
-                       'drawable-hdpi' => 72,
-                       'drawable-ldpi' => 36,
-                       'drawable-mdpi' => 48,
-                       'drawable-xhdpi' => 96
+                              'drawable-hdpi' => 72,
+                              'drawable-ldpi' => 36,
+                              'drawable-mdpi' => 48,
+                              'drawable-xhdpi' => 96
                );
 
                $splashs = array('drawable' => '1024x768',
-                       'drawable-hdpi' => '1024x768',
-                       'drawable-ldpi' => '320x480',
-                       'drawable-mdpi' => '640x960',
-                       'drawable-xhdpi' => '1280x1920');
+                                'drawable-hdpi' => '1024x768',
+                                'drawable-ldpi' => '320x480',
+                                'drawable-mdpi' => '640x960',
+                                'drawable-xhdpi' => '1280x1920');
 
                foreach ($icons as $dir => $size) {
                        $d = $resources . '/' . $dir;
@@ -279,7 +285,8 @@ function imagecreatefromfile($file) {
                case 3:
                        $format = "png";
                        break;
-               default:;
+               default:
+                       ;
        } // switch
        $function = "imagecreatefrom" . $format;
        return $function($file);