From 03741919103cf6872487b8bf1422e928010b1eb3 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Tue, 23 Oct 2018 16:07:28 +0000 Subject: [PATCH] #2277 --- inc/ws/Controlleur/class.ws.flash.php | 2 +- .../html5/master/class.ws.html5.compiler.php | 22 +++++++++++++------ .../html5/master/class.ws.html5.links.php | 3 ++- 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/inc/ws/Controlleur/class.ws.flash.php b/inc/ws/Controlleur/class.ws.flash.php index a0f9527a5..38bd4f06f 100644 --- a/inc/ws/Controlleur/class.ws.flash.php +++ b/inc/ws/Controlleur/class.ws.flash.php @@ -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); diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index e7262e81d..86638ab2e 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -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(); diff --git a/inc/ws/Util/html5/master/class.ws.html5.links.php b/inc/ws/Util/html5/master/class.ws.html5.links.php index 7fc37d151..502ae374d 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.links.php +++ b/inc/ws/Util/html5/master/class.ws.html5.links.php @@ -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; -- 2.39.5