]> _ Git - cubeextranet.git/commitdiff
wip #2475 @3
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jan 2019 16:58:18 +0000 (16:58 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Thu, 24 Jan 2019 16:58:18 +0000 (16:58 +0000)
inc/ws/Metier/class.ws.book.parametres.php
inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php
inc/ws/Util/html5/master/class.ws.html5.compiler.php

index 8bb9f908b21a00da0069a1e55583392ec3945482..268317a1b4298b5d026a920fdb2fc521c1165d6e 100644 (file)
@@ -242,7 +242,7 @@ class wsBookParametres extends wsParametres
                $this->fields['indexAutoScroll'] = array('type' => 'boolean', 'default' => false, 'editable' => true, 'label' => __('Activer le scroll automatique'));
                $this->fields['pdfThumbnails'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
                        'label' => __('PDF utilisé pour générer les miniatures'), 'grade' => 1, 'fileFilter' => $pdfFilter);
-        $this->fields['indexMessage'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Message en haut"), 'grade' => 1, 'hint' => __('Message en haut de la vue index'));
+               $this->fields['indexMessage'] = array('type' => 'textarea', 'default' => '', 'editable' => true, 'label' => __("Message en haut"), 'grade' => 1, 'hint' => __('Message en haut de la vue index'));
 
                $this->forms['index'] = array('label' => __('Vue d\'index (vignettes)'), 'fieldsnames' => array('indexAutoScroll', 'pdfThumbnails', 'indexMessage'));
 
@@ -398,6 +398,19 @@ class wsBookParametres extends wsParametres
                $this->forms['multimedia'] = array('label' => __('Liens et multimédia'),
                        'fieldsnames' => array('permanentLinks', 'linkBlinkTime', 'customLinkClass', 'ignoreLinksTypes', 'linkTooltipManager', 'linkCornerSize', 'linkTooltipMaxWidth', '|', 'linkTracker', 'linkTrackerRegexp', '|', 'linkFilePrefix', '|', 'linkMultimediaPerformanceMode', 'linkMultimediaQuality', '|', 'inlineSlideshowTransitionDuration', 'inlineSlideshowDuration', '|', 'videoReset', 'videoBigPlay', '|', 'brightcovePlayerId', 'brightcovePlayerSecret', '|', 'textPopupStylesheet', 'textPopupWidth', '|', 'iframePopupMaxWidth'));
                //.
+
+               $voices = [
+                       '' => '',
+                       __('Festival (en-US)') => 'festival:voice_cmu_us_slt_arctic_hts',
+               ];
+
+               $this->fields['audiodescriptionTexts'] = ['type' => 'freefile', 'default' => '', 'editable' => true, 'label' => __('Contenus textuels pour l\'audiodescription'), 'fileFilter' => $seoFilter];
+               $this->fields['audiodescriptionVoice'] = ['type' => 'combo', 'datas' => $voices, 'editable' => true, 'default' => true, 'label' => __('Voix pour l\'audiodescription')];
+               $this->forms['accessibility'] = ['label' => __('Accessibilité'),
+                       'fieldsnames' => ['audiodescriptionTexts', 'audiodescriptionVoice']
+               ];
+
+               //.
                $this->fields['externalArchives'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
                        'label' => __('Archives'), 'grade' => 3, 'fileFilter' => $imageFilter);
                $this->fields['externalArchivesBack'] = array('type' => 'freefile', 'default' => '', 'editable' => true,
@@ -413,7 +426,7 @@ class wsBookParametres extends wsParametres
                                'Bulle Groupe' => 'bulle',
                                'Bourbon / Suggestions' => 'bourbon',
                                'Avery' => 'avery',
-                       )
+                       ),
                );
                $this->forms['form'] = array('label' => __('Formulaire'),
                        'fieldsnames' => array('form'));
index 444b9eea052b3fa5f6ccbcfb74c069f0ae5e6538..d32e8e9d28431a10a4afe231a3facb6e958c9376 100644 (file)
@@ -1591,6 +1591,13 @@ class wsHTML5Compiler
 
                $lessVariables['z'] = $this->z;
                $lessVariables['book-page-width'] = $w;
+               if ($this->book->parametres->correctCenter) {
+                       $lessVariables['book-page-correct-width'] = ceil($w + 1);
+                       $lessVariables['book-page-correct-height'] = ceil($h + 1);
+               } else {
+                       $lessVariables['book-page-correct-width'] = $w;
+                       $lessVariables['book-page-correct-height'] = $h;
+               }
                $lessVariables['book-page-height'] = $h;
                $lessVariables['book-page-ratio'] = floatval($w) / floatval($h);
 
@@ -1606,7 +1613,6 @@ class wsHTML5Compiler
                $res[] = '.doublePage._2d.axis_y.next{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,' . $h . ',0)') . '}';
                $res[] = '.doublePage._2d.axis_y.prev{' . wsHTML5::writeCSSUA('transform', 'translate3d(0,-' . $h . ',0)') . '}';
 
-
                $left = $w;
 
                $res[] = '.doublePage._3d{left:' . $left . ';}';
@@ -1617,9 +1623,6 @@ class wsHTML5Compiler
                $lessVariables['display-page-number'] = $this->_lessBoolean($this->theme->parametres->displayPageNumber);
                $lessVariables['page-transition-duration'] = $this->book->parametres->mobileTransitionDuration . 's';
 
-
-               $res[] = '.background{width:100%;height:100%}';
-
                if ($this->cssSVGScale != 1) {
                        $texts = '.texts{' . wsHTML5::writeCSSUA('transform-origin', 'top left') . ';';
                        $texts .= wsHTML5::writeCSSUA('transform', 'scale(' . round((1 / $this->multiply) * $cssScale * $this->cssSVGScale, 3) . ')') . ';';
index fee62e37708e28c9e6546bb9904ca1654cd73afe..87b946ffa5a8d5c547a57605ad1ac500f0f67b24 100644 (file)
@@ -488,6 +488,8 @@ class wsHTML5Compiler
                $this->log('Widget written');
                $this->writeSounds();
                $this->log('Sound written');
+               $this->writeAccessibility();
+               $this->log('Sound accessibility');
                $this->writeTexts();
                $this->log('Texts written');
                $this->writeExtras();
@@ -598,6 +600,68 @@ class wsHTML5Compiler
                $this->vdir->copyDirectory(WS_SOUNDS . '/' . $this->book->parametres->soundTheme, 'data/sounds');
        }
 
+       protected function writeAccessibility()
+       {
+               if ($this->book->parametres->audiodescriptionTexts == '' || $this->book->parametres->audiodescriptionVoice == '') {
+                       return;
+               }
+               $file = $this->wdir . '/' . $this->book->parametres->audiodescriptionTexts;
+               new PHPExcel();
+               $reader = new PHPExcel_Reader_Excel2007();
+               $phpexcel = $reader->load($file);
+
+               $sheet = $phpexcel->getActiveSheet();
+               $maxRow = $sheet->getHighestRow(0);
+
+               for ($i = 0; $i <= $maxRow; $i++) {
+                       $page = trim($sheet->getCellByColumnAndRow(0, $i)->getValue());
+                       $text = trim($sheet->getCellByColumnAndRow(1, $i)->getValue());
+                       if ($page == '' || $text == '') {
+                               continue;
+                       }
+
+                       $replace = ['`' => "'",
+                               '“' => '"',
+                               '”' => '"',
+                               '’'=> "'",
+                               '—'=> " - ",
+                               ];
+
+                       $text = str_replace(array_keys($replace), array_values($replace), $text);
+
+                       $hash = hash('sha256', $this->book->parametres->audiodescriptionVoice . '_^_' . $text);
+                       $fname = $hash . '.mp3';
+                       $dir = WS_BOOKS . '/audiodescription/' . $this->book_id . '/';
+                       if (!file_exists($dir)) {
+                               mkdir($dir, 0777, true);
+                       }
+
+                       $file = $dir . $fname;
+                       if (!file_exists($file)) {
+                               $e = explode(':', $this->book->parametres->audiodescriptionVoice);
+
+                               $engine = $e[0];
+                               $voice = $e[1];
+
+                               if ($engine == 'festival') {
+                                       $tmp = CubeIT_Files::tempnam() . '.wav';
+                                       $tmptext = CubeIT_Files::tempnam() . '.txt';
+
+                                       file_put_contents($tmptext, $text);
+                                       $cmd = "text2wave -o $tmp $tmptext -eval \"($voice)\"";
+                                       `$cmd`;
+
+                                       `lame $tmp $file`;
+                                       unlink($tmp);
+                                       unlink($tmptext);
+                               }
+                       }
+
+                       $this->config->audiodescription[$page] = $fname;
+                       $this->vdir->copy($file, 'data/audiodescription/' . $fname);
+               }
+       }
+
        protected function _writeIndex($page)
        {
                if (!isset($this->seo->pages[$page])) {