]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6576 @0.75
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Dec 2023 10:48:35 +0000 (11:48 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 15 Dec 2023 10:48:35 +0000 (11:48 +0100)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Compiler/Sound.php
app/Models/Traits/PublicationSettings.php

index 6b9401f5d35738cf2623917b7570cd9923304d25..0a5c1603a58e9f77929d061b764dfba9c8da356a 100644 (file)
@@ -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');
index f0af0efcde8755f442865c612f0c12cbdb216619..70b5df0ae5045dabebd194e16f6c740c766c570f 100644 (file)
@@ -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);
+        }
+    }
 }
index 7105425f337cc58d66521d1ce66c59944f19afb4..dfc582043c71f565914d7276184c559f294f627f 100644 (file)
@@ -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()