From: vincent@cubedesigners.com Date: Thu, 24 Jan 2019 16:58:18 +0000 (+0000) Subject: wip #2475 @3 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=03ea2ff6e902aa4396dde8ac093cbe0ffd2a78ce;p=cubeextranet.git wip #2475 @3 --- diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 8bb9f908b..268317a1b 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -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')); diff --git a/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php b/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php index 444b9eea0..d32e8e9d2 100644 --- a/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/3dflip/class.ws.html5.compiler.php @@ -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) . ')') . ';'; 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 fee62e377..87b946ffa 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -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])) {