]> _ Git - cubeextranet.git/commitdiff
#2277
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Oct 2018 16:07:28 +0000 (16:07 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Tue, 23 Oct 2018 16:07:28 +0000 (16:07 +0000)
inc/ws/Controlleur/class.ws.flash.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.links.php

index a0f9527a56b563d63c87c479c3adc0ebecbba4a6..38bd4f06fd82af341ccf6284961177941a59da67 100644 (file)
@@ -610,7 +610,7 @@ class wsFlash extends cubeFlashGateway
 
                $types = array(1, 2, 3, 4, 5, 6, 7, 11, 13, 14, 15, 16, 17, 18, 19, 24, 25);
                if (wsDroits::revendeur()) {
-                       $types = array(1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 31,33);
+                       $types = array(1, 2, 3, 4, 5, 6, 7, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 31, 33);
                }
                if (wsDroits::admin()) {
                        $types = range(1, 100);
index e7262e81d4d9e4a4c62708202c4b4f81511d89c7..86638ab2e9a9c00bc1eae4a7ba77c6e6c4770dcc 100644 (file)
@@ -55,6 +55,7 @@ class wsHTML5Compiler
                'js/libs/fluidbook/fluidbook.zoom.js',
                'js/libs/fluidbook/fluidbook.menu.js',
                'js/libs/fluidbook/fluidbook.sound.js',
+               'js/libs/fluidbook/fluidbook.contentlock.js',
                'js/libs/fluidbook/fluidbook.scorm.js',
                'js/libs/fluidbook/menu/fluidbook.chapters.js',
                'js/libs/fluidbook/menu/fluidbook.index.js',
@@ -163,7 +164,7 @@ class wsHTML5Compiler
        public $seoArticles = [];
        public $securityPolicyWhitelist = ['*.google-analytics.com', '*.youtube.com', '*.ytimg.com'];
        public $writeLinksData = false;
-       public $lock_contents = [];
+       public $content_lock = [];
        protected $_indexVars = null;
 
        public $_signature;
@@ -299,6 +300,9 @@ class wsHTML5Compiler
                if ($this->phonegap && ($this->book->parametres->offlineLink == '' || $this->book->parametres->offlineLink == 'http://')) {
                        $this->config->share = false;
                }
+               if ($this->config->maxPages > 0) {
+                       $this->addContentLock($this->config->maxPages);
+               }
 
                // We need to be able to reference both navOrder and navOrderH so convert both to arrays
                // We also make sure there are no empty items in the arrays (see: http://php.net/manual/en/function.array-filter.php#111091)
@@ -801,9 +805,9 @@ class wsHTML5Compiler
                $this->seo = new wsHTML5Seo($this);
        }
 
-       public function addLockContents($page, $unlockConditions)
+       public function addContentLock($page, $unlockConditions = '')
        {
-               $unlockConditions = trim(CubeIT_Text::explodeNewLines($unlockConditions));
+               $unlockConditions = CubeIT_Text::explodeNewLines($unlockConditions);
                $conditions = [];
                foreach ($unlockConditions as $unlockCondition) {
                        $e = explode(',', $unlockCondition);
@@ -812,7 +816,11 @@ class wsHTML5Compiler
                        }
                        $conditions[] = $e;
                }
-               $this->lock_contents[] = ['page' => $page, 'unlockConditions' => $conditions];
+               $page = max(1, $page);
+               if (!isset($this->content_lock[$page])) {
+                       $this->content_lock[$page] = ['unlocked' => 0, 'conditions' => []];
+               }
+               $this->content_lock[$page]['conditions'] = array_merge($this->content_lock[$page]['conditions'], $conditions);
        }
 
        protected function writeScorm()
@@ -1184,13 +1192,13 @@ class wsHTML5Compiler
 
        protected function beforeWriteConfig()
        {
-               usort($this->lock_contents, function ($a, $b) {
+               uasort($this->content_lock, function ($a, $b) {
                        return $a['page'] - $b['page'];
                });
 
-               $this->config->lock_contents = $this->lock_contents;
+               $this->config->content_lock = $this->content_lock;
        }
-       
+
        protected function writeJs()
        {
                $this->beforeWriteConfig();
index 7fc37d151a753d25266da2c4ea8a630559c89f6f..502ae374d9e0f8376828ad1c1477e9a991bfbc3c 100644 (file)
@@ -171,7 +171,7 @@ class wsHTML5Link
                        case 33:
                                return new zoomhdLink($id, $init, $compiler);
                        case 34:
-                               $compiler->addLockContents($init['page'], $init['to']);
+                               $compiler->addContentLock($init['page'], $init['to']);
                                break;
                        default:
                                return null;
@@ -766,6 +766,7 @@ class videoLink extends wsHTML5Link
                $attr['controls'] = ($data->video_controls ? '1' : '0');
                $attr['loop'] = ($data->video_loop ? '1' : '0');
                $attr['sound'] = ($data->video_sound_on ? '1' : '0');
+               $attr['link-id'] = $data->uid;
 
                if (!is_null($w) && !is_null($h)) {
                        $attr['width'] = $w;