From: Vincent Vanwaelscappel Date: Fri, 15 Dec 2023 10:48:35 +0000 (+0100) Subject: wip #6576 @0.75 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fdfa6661a3d4722495c972638912ae641fd2165e;p=fluidbook-toolbox.git wip #6576 @0.75 --- diff --git a/app/Fluidbook/Compiler/Compiler.php b/app/Fluidbook/Compiler/Compiler.php index 6b9401f5d..0a5c1603a 100644 --- a/app/Fluidbook/Compiler/Compiler.php +++ b/app/Fluidbook/Compiler/Compiler.php @@ -731,6 +731,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError $this->writeSEO(); $this->log('SEO written'); $this->writeSounds(); + $this->writeAmbientSound(); $this->log('Sound written'); $this->writeSearch(); $this->log('Search written'); diff --git a/app/Fluidbook/Compiler/Sound.php b/app/Fluidbook/Compiler/Sound.php index f0af0efcd..70b5df0ae 100644 --- a/app/Fluidbook/Compiler/Sound.php +++ b/app/Fluidbook/Compiler/Sound.php @@ -19,4 +19,11 @@ trait Sound $this->config->set('simpleSoundTheme', file_exists($dir . '/flip.mp3')); $this->vdir->copyDirectory($dir, 'data/sounds'); } + + protected function writeAmbientSound() + { + if ($this->fluidbookSettings->ambientSound) { + $this->vdir->copy($this->wdir . $this->fluidbookSettings->ambientSound, 'data/sounds/' . $this->fluidbookSettings->ambientSound); + } + } } diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index 7105425f3..dfc582043 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -9,6 +9,7 @@ use App\Fields\FluidbookLocaleCurrent; use App\Fields\FluidbookSignature; use App\Fields\FluidbookTTSVoice; use App\Fields\SCORMVersion; +use App\Models\File; use App\Models\FluidbookExternalInstallServer; use Cubist\Backpack\Magic\Fields\Checkbox; use Cubist\Backpack\Magic\Fields\Code; @@ -22,6 +23,7 @@ use Cubist\Backpack\Magic\Fields\Hidden; use Cubist\Backpack\Magic\Fields\Integer; use Cubist\Backpack\Magic\Fields\LongText; use Cubist\Backpack\Magic\Fields\Number; +use Cubist\Backpack\Magic\Fields\Percent; use Cubist\Backpack\Magic\Fields\ReadOnlyValue; use Cubist\Backpack\Magic\Fields\SelectFromArray; use Cubist\Backpack\Magic\Fields\Text; @@ -70,8 +72,7 @@ trait PublicationSettings protected function _disabled() { - $this->addSettingField('ambientSound', Hidden::class, $this->__('Ambiance sonore')); - $this->addSettingField('ambientSoundVolume', Hidden::class, $this->__('Volume de l\'ambiance sonore')); + } protected function _mainSettings() @@ -926,12 +927,10 @@ trait PublicationSettings 'v2' => '{"type":"boolean","default":true,"editable":true,"label":"\\u00a7!\\u00a7Activer les effets sonores \\u00e0 l\'ouverture!\\u00a7!"}', 'default' => true, ]); - $this->addSettingField('soundVolume', Integer::class, $this->__('Volume des effets sonores'), [ - 'min' => 0, - 'max' => 100, - 'default' => 100, - 'suffix' => '%', - ]); + $this->addSettingField('soundVolume', Percent::class, $this->__('Volume des effets sonores'), ['default' => 100]); + $this->addSettingField('sep_ambientSound', FormSeparator::class); + $this->addSettingField('ambientSound', FilesOrURL::class, $this->__('Ambiance sonore')); + $this->addSettingField('ambientSoundVolume', Percent::class, $this->__('Volume de l\'ambiance sonore'), ['default' => 50]); } protected function _downloadpdf()