From: vincent@cubedesigners.com Date: Mon, 7 Sep 2020 15:00:18 +0000 (+0000) Subject: wip #3869 @1.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=bb6c3673e6975969cd39ef9d54a5ebefd15b402a;p=cubeextranet.git wip #3869 @1.5 --- diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 6d48bf172..44b24ff8c 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -187,8 +187,9 @@ class wsBookParametres extends wsParametres $this->fields['centerBook'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Centrer la publication sur les couvertures'), 'grade' => 2); $this->fields['correctCenter'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Corriger les lignes blanches entre les pages'), 'grade' => 2); $this->fields['maxResolution'] = array('type' => 'combo', 'default' => 300, 'editable' => true, 'datas' => array('300dpi' => 300, '150dpi' => 150), 'grade' => 2, 'label' => __('Résolution maximale des pages')); + $this->fields['dynamicBackgroundColor'] = ['type' => 'textarea', 'default' => '', 'editable' => true, 'label' => 'Couleur de fond dynamique', 'grade' => 3]; $this->forms['3d_mode'] = array('label' => __('Options de visualisation'), - 'fieldsnames' => array('visualisationMode', 'antialiasReading', 'correctCenter', 'pagesBaseAngle', 'centerBook', '|', 'extraXSpace', 'extraYSpace', '|', 'viewMode', '|', 'maxResolution')); + 'fieldsnames' => array('visualisationMode', 'antialiasReading', 'correctCenter', 'pagesBaseAngle', 'centerBook', '|', 'extraXSpace', 'extraYSpace', '|', 'viewMode', '|', 'dynamicBackgroundColor', '|', 'maxResolution')); $this->fields['preload'] = array('type' => 'integer', 'default' => 16, 'editable' => true, 'label' => __('Nombre de pages à précharger'), 'grade' => 3); 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 ac2ae1538..6d6e72218 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -926,7 +926,7 @@ class wsHTML5Compiler $style = array(); foreach ($sheets as $sheet) { - $style[] = ''; + $style[] = ''; } $style = implode("\n\t\t", $style); @@ -936,7 +936,7 @@ class wsHTML5Compiler $beginbody = implode("\n", array_unique($this->beginBody)); - $jstime="?j=".TIME; + $jstime = "?j=" . TIME; $iscript = ''; if (count($this->htmlmultimedia)) { @@ -945,18 +945,18 @@ class wsHTML5Compiler $iscript .= '' . "\n"; } - $script = '' . "\n"; + $script = '' . "\n"; foreach ($this->jsLibs as $jsLib => $files) { - $script .= "\t" . '' . "\n"; + $script .= "\t" . '' . "\n"; } if ($this->book->parametres->scorm_enable) { - $script .= "\t" . '' . "\n"; + $script .= "\t" . '' . "\n"; } if (count($this->specialJsFiles)) { - $script .= "\t" . '' . "\n"; + $script .= "\t" . '' . "\n"; } foreach ($this->pluginJs as $p) { - $script .= "\t" . '' . "\n"; + $script .= "\t" . '' . "\n"; } $script .= $iscript; @@ -1611,6 +1611,18 @@ class wsHTML5Compiler protected function beforeWriteConfig() { + // Dynamic background + $dbc = []; + $p = $this->parseVariables($this->book->parametres->dynamicBackgroundColor); + foreach ($p as $range => $color) { + $pages = cubeArray::parseRange($range); + foreach ($pages as $page) { + $dbc[$page] = $color; + } + } + $this->config->dynamicBackgroundColor = $dbc; + + // Content locks uasort($this->content_lock, function ($a, $b) { return $a['page'] - $b['page']; }); @@ -1623,6 +1635,7 @@ class wsHTML5Compiler $this->beforeWriteConfig(); $config = $this->writeConfig(); + $this->vdir->file_put_contents('data/datas.js', $config); $finals = $this->jsLibs; if ($this->book->parametres->scorm_enable) {