]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6954 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2024 12:51:28 +0000 (14:51 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 11 Jun 2024 12:51:28 +0000 (14:51 +0200)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Compiler/Screensaver.php [new file with mode: 0644]
app/Fluidbook/Farm.php
app/Models/Traits/PublicationSettings.php

index f5671841b2cb568cbe8fab82c8e854b18be5f9bb..777d231c4e1fe5b83b5acf267bca37a20092a1ce 100644 (file)
@@ -52,6 +52,7 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
     use Accessibility;
     use Tabs;
     use PDF;
+    use Screensaver;
 
     /** @var Lock */
     protected $lock;
@@ -730,6 +731,8 @@ class Compiler extends Base implements CompilerInterface, IVirtualDirectoryError
                 $this->log('XML Articles written');
                 $this->writeSlider();
                 $this->log('Slider written');
+                $this->writeScreensaver();
+                $this->log('Screensaver written');
                 $linksCSS = $this->writeLinks();
                 $this->log('Links written');
                 $this->writeArticles();
diff --git a/app/Fluidbook/Compiler/Screensaver.php b/app/Fluidbook/Compiler/Screensaver.php
new file mode 100644 (file)
index 0000000..262ea1d
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\Fluidbook\Compiler;
+
+use App\Fluidbook\Link\Link;
+
+trait Screensaver
+{
+    public function writeScreensaver()
+    {
+        if (!$this->config->screensaver) {
+            return false;
+        }
+        $this->addJsLib('screensaver', ['js/libs/fluidbook/fluidbook.screensaver.js']);
+        $this->vdir->copy($this->wdir . '/' . $this->config->screensaver, 'data/screensaver/' . $this->config->screensaver);
+    }
+}
index cf753ab677423f0bbc3429b54c3fd3a127a8bddc..3e4eea05d48dffedd0d03d3197bcb9c816623857 100644 (file)
@@ -22,7 +22,7 @@ class Farm
     protected static $_farmServers = [
         ['name' => 'alphaville', 'host' => 'fluidbook-processfarm', 'port' => 9000, 'weight' => 12, 'region' => Region::EUROPE, 'local' => false],
         ['name' => 'brazil', 'host' => 'brazil.cubedesigners.com', 'weight' => 6, 'region' => Region::USA, 'local' => false],
-        ['name' => 'cloudatlats', 'host' => 'cloudatlas.cubedesigners.com', 'weight' => 4, 'region' => Region::EUROPE, 'local' => false],
+        ['name' => 'cloudatlas', 'host' => 'cloudatlas.cubedesigners.com', 'weight' => 4, 'region' => Region::EUROPE, 'local' => false],
         ['name' => 'dracula', 'host' => 'dracula.cubedesigners.com', 'weight' => 1, 'region' => Region::EUROPE, 'local' => true],
         ['name' => 'dobermann', 'host' => 'dobermann.cubedesigners.com', 'weight' => 6, 'region' => Region::EUROPE, 'local' => false],
         ['name' => 'elephantman', 'host' => 'paris.cubedesigners.com', 'weight' => 2, 'region' => Region::EUROPE, 'local' => false],
index c9e82c7b9380c3317e7fcaad346a9faffe2c4895..a03f402d612dd1bb389ab8b864427602d89044b5 100644 (file)
@@ -51,6 +51,8 @@ trait PublicationSettings
     protected static $acceptPDF = ['.pdf'];
     protected static $acceptZip = ['.zip'];
     protected static $acceptFont = ['.ttf', '.otf', '.woff', '.woff2'];
+    protected static $acceptLottie = ['.zip', '.html', '.json', '.lottie'];
+    protected static $acceptVideo = ['.mp4'];
 
 
     public function setSettingsFields()
@@ -152,6 +154,7 @@ trait PublicationSettings
         $this->_archives();
         $this->_form();
         $this->_plv();
+        $this->_screensaver();
         $this->_performances();
     }
 
@@ -1916,6 +1919,15 @@ trait PublicationSettings
 
     }
 
+    protected function _screensaver()
+    {
+        $this->addSettingField('section_screensaver', FormSection::class, $this->__('Économiseur d\'écran'));
+        $this->addSettingField('screensaver', FilesOrURL::class, __('Animation'), ['accept' => static::$acceptVideo]);
+        $this->addSettingField('screensaver_sleep_time', Integer::class, __('Activer après un temps d\'inactivité'), ['when' => ['screensaver' => '_not_empty_'], 'suffix' => __('secondes'), 'default' => 60, 'min' => 1]);
+        $this->addSettingField('screensaver_wake_action', SelectFromArray::class, __('Action à effectuer au réveil'), ['when' => ['screensaver' => '_not_empty_'], 'default' => 'none', 'options' => ['none' => __('Aucune action'), 'page' => __('Aller à une page')]]);
+        $this->addSettingField('screensaver_wake_page', Text::class, __('Au réveil, aller à la page'), ['when' => ['screensaver' => '_not_empty_', 'screensaver_wake_action' => 'page'], 'default' => 1]);
+    }
+
     protected function _theme()
     {
         $this->addSettingField('section_theme', FormSection::class, $this->__('Options du thème'));