]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5468 @2
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Nov 2022 19:56:20 +0000 (20:56 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 10 Nov 2022 19:56:20 +0000 (20:56 +0100)
13 files changed:
app/SubForms/Link/Audio.php [new file with mode: 0644]
app/SubForms/Link/Audiodescription.php [new file with mode: 0644]
app/SubForms/Link/Base.php
app/SubForms/Link/File.php [new file with mode: 0644]
app/SubForms/Link/Flipcard.php [new file with mode: 0644]
app/SubForms/Link/IFrame.php [new file with mode: 0644]
app/SubForms/Link/Internal.php [new file with mode: 0644]
app/SubForms/Link/Meta.php [new file with mode: 0644]
app/SubForms/Link/Multimedia.php [new file with mode: 0644]
app/SubForms/Link/Phone.php [new file with mode: 0644]
app/SubForms/Link/Slideshow.php [new file with mode: 0644]
app/SubForms/Link/Video.php
app/SubForms/Link/WebVideo.php [new file with mode: 0644]

diff --git a/app/SubForms/Link/Audio.php b/app/SubForms/Link/Audio.php
new file mode 100644 (file)
index 0000000..0bed180
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\Checkbox;
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class Audio extends Base
+{
+    public $type = self::AUDIO;
+    public $_integration = true;
+    public $_multimedia = true;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Fichier audio'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAudio]);
+    }
+
+    public function addMultimediaFields()
+    {
+        parent::addMultimediaFields();
+        $this->addField('video_auto_start', Checkbox::class, __('Jouer l\'audio automatiquement'), ['default' => true]);
+        $this->addField('video_loop', Checkbox::class, __('Jouer l\'audio en boucle'), ['default' => false]);
+    }
+}
diff --git a/app/SubForms/Link/Audiodescription.php b/app/SubForms/Link/Audiodescription.php
new file mode 100644 (file)
index 0000000..57d36c1
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class Audiodescription extends Meta
+{
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Fichier audio ou texte'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAudiodescription]);
+    }
+}
index 7a2cbed7b3a5338f2139651acfac574ef9541a39..c871b59ab0fff9d39b3dd65feb393753365f617c 100644 (file)
@@ -12,6 +12,7 @@ use Cubist\Backpack\Magic\Fields\FieldGroupEnd;
 use Cubist\Backpack\Magic\Fields\FieldGroupStart;
 use Cubist\Backpack\Magic\Fields\FilesOrURL;
 use Cubist\Backpack\Magic\Fields\FormSection;
+use Cubist\Backpack\Magic\Fields\Number;
 use Cubist\Backpack\Magic\Fields\Text;
 use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\Form;
@@ -64,6 +65,7 @@ class Base extends Form
     const ANCHOR = 40;
     const FLIPCARD = 41;
 
+
     /**
      * @var int
      */
@@ -75,6 +77,19 @@ class Base extends Form
     protected $_addedContents = true;
     protected $_tooltip = true;
 
+    protected static $_acceptImage = ['.jpg', '.jpeg', '.png', '.svg', '.gif'];
+    protected static $_acceptImageAZip = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip'];
+    protected static $_acceptAnimation = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip', '.oam', '.html', '.json'];
+    protected static $_acceptVideo = ['.mp4'];
+    protected static $_acceptFont = ['.otf', '.ttf'];
+    protected static $_acceptAudiodescription = ['.mp3', '.txt'];
+    protected static $_acceptAudio = ['.mp3'];
+    protected static $_acceptHtml = ['.html'];
+    protected static $_acceptIframe = ['.oam', '.zip', '.html', '.pdf'];
+    protected static $_acceptSlideshow = ['.zip'];
+    protected static $_acceptPDF = ['.pdf'];
+
+
     /**
      * @return array[]
      */
@@ -82,37 +97,37 @@ class Base extends Form
     {
         $res = [
             ['type' => self::WEB, 'label' => __('Lien web'), 'color' => '#3399cc', 'class' => Web::class, 'order' => 1],
-            ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405', 'class' => Web::class, 'order' => 2],
+            ['type' => self::INTERNAL, 'label' => __('Lien vers une page'), 'color' => '#c7b405', 'class' => Internal::class, 'order' => 2],
             ['type' => self::EMAIL, 'label' => __('Adresse e-mail'), 'color' => '#6c6360', 'class' => Email::class, 'order' => 3],
             ['type' => self::WEB_INFOS, 'label' => __('Lien web « plus d\'infos »'), 'color' => '#ff0000', 'class' => WebInfos::class],
             ['type' => self::COLOR, 'label' => __('Couleur'), 'color' => '#8C5E24', 'class' => Web::class, 'order' => 4],
             ['type' => self::VIDEO, 'label' => __('Vidéo'), 'color' => '#33ff00', 'class' => Video::class],
-            ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff', 'class' => Web::class],
+            ['type' => self::MULTIMEDIA, 'label' => __('Multimédia'), 'color' => '#ff00ff', 'class' => Multimedia::class],
             ['type' => 'separator', 'order' => 5],
             ['type' => self::CUSTOM, 'label' => __('Lien personnalisé'), 'color' => '#14511a', 'class' => Web::class],
-            ['type' => self::PAGE_CORNER, 'label' => __('Coin de page'), 'color' => '#f19043', 'disabled' => true, 'class' => Web::class],
-            ['type' => self::OBJECT3D, 'label' => __('Objet 3D'), 'color' => '#00ffff', 'disabled' => true, 'class' => Web::class],
-            ['type' => self::WEBVIDEO, 'label' => __('Vidéo web'), 'color' => '#ffff00', 'class' => Web::class],
+            //['type' => self::PAGE_CORNER, 'label' => __('Coin de page'), 'color' => '#f19043', 'disabled' => true, 'class' => Web::class],
+            //['type' => self::OBJECT3D, 'label' => __('Objet 3D'), 'color' => '#00ffff', 'disabled' => true, 'class' => Web::class],
+            ['type' => self::WEBVIDEO, 'label' => __('Vidéo web'), 'color' => '#ffff00', 'class' => WebVideo::class],
             ['type' => self::ACTION, 'label' => __('Action'), 'color' => '#880000', 'class' => Web::class],
             ['type' => self::CART, 'label' => __('Panier'), 'color' => '#F2A4B7', 'class' => Web::class],
             ['type' => self::ZOOM, 'label' => __('Zone de zoom'), 'color' => '#322280', 'class' => Web::class],
             ['type' => self::IMAGE, 'label' => __('Image'), 'color' => '#BE418D', 'class' => Web::class],
-            ['type' => self::FILE, 'label' => __('Fichier'), 'color' => '#F19043', 'class' => Web::class],
-            ['type' => self::AUDIO, 'label' => __('Audio'), 'color' => '#0065AE', 'class' => Web::class],
+            ['type' => self::FILE, 'label' => __('Fichier'), 'color' => '#F19043', 'class' => File::class],
+            ['type' => self::AUDIO, 'label' => __('Audio'), 'color' => '#0065AE', 'class' => Audio::class],
             ['type' => self::TOOLTIP, 'label' => __('Texte / Infobulle'), 'color' => '#000000', 'class' => Web::class],
             ['type' => self::CALL, 'label' => __('Appel'), 'color' => '#333333', 'class' => Web::class],
             ['type' => self::BOOKMARKGROUP, 'label' => __('Groupe de marque-pages'), 'color' => '#d6520f', 'class' => Web::class],
-            ['type' => self::HTML5MULTIMEDIA, 'label' => __('Lien Multimédia (HTML)'), 'color' => '#34A853', 'disabled' => true, 'class' => Web::class],
-            ['type' => self::BOOKMARK_CORNER, 'label' => __('Lien marque-page sur coin de page'), 'color' => '#000000', 'disabled' => true, 'class' => Web::class],
+            //['type' => self::HTML5MULTIMEDIA, 'label' => __('Lien Multimédia (HTML)'), 'color' => '#34A853', 'disabled' => true, 'class' => Web::class],
+            //['type' => self::BOOKMARK_CORNER, 'label' => __('Lien marque-page sur coin de page'), 'color' => '#000000', 'disabled' => true, 'class' => Web::class],
             ['type' => self::STATSTAG, 'label' => __('Tag statistique'), 'color' => '#000000', 'class' => Web::class],
-            ['type' => self::PHONE, 'label' => __('Téléphone'), 'color' => '#000000', 'class' => Web::class],
-            ['type' => self::AUDIODESCRIPTION, 'label' => __('Audiodescription'), 'color' => '#00535b', 'class' => Web::class],
+            ['type' => self::PHONE, 'label' => __('Téléphone'), 'color' => '#000000', 'class' => Phone::class],
+            ['type' => self::AUDIODESCRIPTION, 'label' => __('Audiodescription'), 'color' => '#00535b', 'class' => Audiodescription::class],
             ['type' => self::PAGE_LABEL, 'label' => __('Label de page'), 'color' => '#00E6D7', 'class' => Web::class],
             ['type' => self::EVENT_OVERLAY, 'label' => __('Capter les évenements'), 'color' => '#ffcc00', 'class' => Web::class],
             ['type' => self::ARTICLE, 'label' => __('Article (définition)'), 'color' => '#ACC152', 'class' => Web::class],
             ['type' => self::LIKE, 'label' => __('Like'), 'color' => '#4267B2', 'class' => Web::class],
-            ['type' => self::SLIDESHOW, 'label' => __('Diaporama'), 'color' => '#07b57a', 'class' => Web::class],
-            ['type' => self::IFRAME, 'label' => __('iFrame'), 'color' => '#fcae25', 'class' => Web::class],
+            ['type' => self::SLIDESHOW, 'label' => __('Diaporama'), 'color' => '#07b57a', 'class' => Slideshow::class],
+            ['type' => self::IFRAME, 'label' => __('iFrame'), 'color' => '#fcae25', 'class' => IFrame::class],
             ['type' => self::SHOWLINK, 'label' => __('Afficher un lien'), 'color' => '#125C70', 'class' => Web::class],
             ['type' => self::ZOOMHD, 'label' => __('Zoom HD'), 'color' => '#E80C95', 'class' => Web::class],
             ['type' => self::LOCK_CONTENTS, 'label' => __('Blocage des contenus'), 'color' => '#69D670', 'class' => Web::class],
@@ -122,7 +137,7 @@ class Base extends Form
             ['type' => self::TRIGGERSLINK, 'label' => __('Déclencher un lien'), 'color' => '#cc0000', 'class' => Web::class],
             ['type' => self::LAYER, 'label' => __('Animation de calque'), 'color' => '#3D0254', 'class' => Web::class],
             ['type' => self::ANCHOR, 'label' => __('Ancre'), 'color' => '#330000', 'class' => Web::class],
-            ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Web::class],
+            ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Flipcard::class],
         ];
 
         usort($res, function ($a, $b) {
@@ -156,7 +171,6 @@ class Base extends Form
     {
         $this->addTypeField();
         $this->addSettingsFields();
-        $this->addAppearanceFields();
         $this->addTooltipFields();
         $this->addPositionFields();
         $this->addExtraFields();
@@ -191,20 +205,20 @@ class Base extends Form
     {
         $this->addField('header_settings', FormSection::class, __('Paramètres'));
         $this->addDestinationField();
-        $this->addUIDField();
         $this->addBasicSettingsFields();
     }
 
     public function addBasicSettingsFields()
     {
+        if ($this->_integration) {
+            $this->addField('inline', MultimediaIntegration::class, __('Intégration'));
+        }
+        $this->addUIDField();
         if ($this->_addedContents) {
             $this->addField('header_contents', FormSection::class, __('Contenus superposés'));
-            $this->addField('image', FilesOrURL::class, __('Image'), array_merge($this->getFilesOrURLEntry(), ['accept' => ['.jpg', '.jpeg', '.png', '.svg', '.gif']]));
+            $this->addField('image', FilesOrURL::class, __('Image'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]);
             $this->addField('image_rollover', RolloverAnimation::class, __('Animation de l\'image au survol'));
-            $this->addField('animation', FilesOrURL::class, __('Animation'), array_merge($this->getFilesOrURLEntry(), ['accept' => ['.html']]));
-        }
-        if ($this->_integration) {
-            $this->addField('inline', MultimediaIntegration::class, __('Intégration'));
+            $this->addField('animation', FilesOrURL::class, __('Animation'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptHtml]);
         }
         if ($this->_multimedia) {
             $this->addMultimediaFields();
@@ -223,13 +237,16 @@ class Base extends Form
     public function addMultimediaFields()
     {
         $this->addField('header_video', FormSection::class, __('Paramètres multimedia'));
+
     }
 
-    public function addAppearanceFields()
+    public function addMultimediaSizeFields()
     {
-        $this->addField('header_appearance', FormSection::class, __('Apparence'));
+        $this->addField('video_width', Number::class, __('Largeur de la vidéo'));
+        $this->addField('video_height', Number::class, __('Hauteur de la vidéo'));
     }
 
+
     public function addPositionFields()
     {
         $this->addField('header_disposition', FormSection::class, __('Disposition'));
@@ -253,6 +270,9 @@ class Base extends Form
 
     public function addExtraFields()
     {
+        if ($this->hasField('extra')) {
+            return;
+        }
         $this->addField('header_extra', FormSection::class, __('Autres paramètres'));
         $this->addField('extra', Textarea::class, '');
     }
diff --git a/app/SubForms/Link/File.php b/app/SubForms/Link/File.php
new file mode 100644 (file)
index 0000000..2fcaf11
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use App\Fields\FluidbookLinkEditor\Target;
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class File extends Web
+{
+    public $type = self::FILE;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Fichier'), $this->getFilesOrURLEntry());
+        $this->addField('target', Target::class, __('Ouvrir le fichier dans'));
+    }
+}
diff --git a/app/SubForms/Link/Flipcard.php b/app/SubForms/Link/Flipcard.php
new file mode 100644 (file)
index 0000000..341bc95
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class Flipcard extends Base
+{
+    public $type = self::FLIPCARD;
+
+    protected $_addedContents = false;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Face A'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]);
+        $this->addField('alternative', FilesOrURL::class, __('Face B'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]);
+    }
+}
diff --git a/app/SubForms/Link/IFrame.php b/app/SubForms/Link/IFrame.php
new file mode 100644 (file)
index 0000000..ebbc804
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class IFrame extends Web
+{
+    public $type = self::IFRAME;
+
+    protected $_integration = true;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('URL ou contenu de l\'iframe'), $this->getFilesOrURLEntry());
+    }
+}
diff --git a/app/SubForms/Link/Internal.php b/app/SubForms/Link/Internal.php
new file mode 100644 (file)
index 0000000..5a83d15
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use App\Fields\FluidbookLinkEditor\NumberingType;
+use Cubist\Backpack\Magic\Fields\Text;
+
+class Internal extends Web
+{
+    public $type = self::INTERNAL;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', Text::class, __('Page'));
+        $this->addField('numerotation', NumberingType::class, __('Type de numérotation'));
+    }
+}
diff --git a/app/SubForms/Link/Meta.php b/app/SubForms/Link/Meta.php
new file mode 100644 (file)
index 0000000..d7c4395
--- /dev/null
@@ -0,0 +1,10 @@
+<?php
+
+namespace App\SubForms\Link;
+
+class Meta extends Base
+{
+    protected $_displayedOnFluidbook = false;
+    protected $_addedContents = false;
+    protected $_tooltip = false;
+}
diff --git a/app/SubForms/Link/Multimedia.php b/app/SubForms/Link/Multimedia.php
new file mode 100644 (file)
index 0000000..0774f95
--- /dev/null
@@ -0,0 +1,26 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\Checkbox;
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+
+class Multimedia extends Base
+{
+    public $type = self::MULTIMEDIA;
+    public $_integration = true;
+    public $_multimedia = true;
+
+    public function addDestinationField()
+    {
+        $this->addField('alternative', FilesOrURL::class, __('Animation'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAnimation]);
+    }
+
+    public function addMultimediaFields()
+    {
+        parent::addMultimediaFields();
+        $this->addField('interactive', Checkbox::class, __('Animation interactive'), ['default' => false]);
+        $this->addField('read_mode', Checkbox::class, __('Mode lecture'), ['hint' => __('Scroll vertical possible'), 'default' => false]);
+        $this->addMultimediaSizeFields();
+    }
+}
diff --git a/app/SubForms/Link/Phone.php b/app/SubForms/Link/Phone.php
new file mode 100644 (file)
index 0000000..ab59dfc
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace App\SubForms\Link;
+
+class Phone extends Web
+{
+    public $type = self::PHONE;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', \Cubist\Backpack\Magic\Fields\Phone::class, __('Numéro de téléphone'));
+    }
+}
diff --git a/app/SubForms/Link/Slideshow.php b/app/SubForms/Link/Slideshow.php
new file mode 100644 (file)
index 0000000..76f9336
--- /dev/null
@@ -0,0 +1,17 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
+use Cubist\Backpack\Magic\Fields\Integer;
+
+class Slideshow extends Web
+{
+    public $type = self::SLIDESHOW;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Images'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptSlideshow]);
+        $this->addField('extra', Integer::class, __('Ouvrir à la slide'));
+    }
+}
index 8f39e4f2628752db683852e5bcaaff8df503521b..8876b2da73c71109ec30f68b74357e9138de4aae 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\SubForms\Link;
 
 use Cubist\Backpack\Magic\Fields\Checkbox;
+use Cubist\Backpack\Magic\Fields\FilesOrURL;
 
 class Video extends Base
 {
@@ -10,6 +11,11 @@ class Video extends Base
     public $_integration = true;
     public $_multimedia = true;
 
+    public function addDestinationField()
+    {
+        $this->addField('to', FilesOrURL::class, __('Fichier vidéo'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptVideo]);
+    }
+
     public function addMultimediaFields()
     {
         parent::addMultimediaFields();
@@ -17,5 +23,7 @@ class Video extends Base
         $this->addField('video_controls', Checkbox::class, __('Afficher les contrôles de la vidéo'), ['default' => true]);
         $this->addField('video_sound_on', Checkbox::class, __('Activer le son de la vidéo'), ['default' => true]);
         $this->addField('video_loop', Checkbox::class, __('Jouer la vidéo en boucle'), ['default' => false]);
+
+        $this->addMultimediaSizeFields();
     }
 }
diff --git a/app/SubForms/Link/WebVideo.php b/app/SubForms/Link/WebVideo.php
new file mode 100644 (file)
index 0000000..c95391e
--- /dev/null
@@ -0,0 +1,22 @@
+<?php
+
+namespace App\SubForms\Link;
+
+use App\Fields\FluidbookLinkEditor\WebvideoService;
+use Cubist\Backpack\Magic\Fields\Text;
+
+class WebVideo extends Video
+{
+    public $type = self::WEBVIDEO;
+
+    public function addDestinationField()
+    {
+        $this->addField('to', Text::class, __('Identifiant de la video'));
+        $this->addField('video_service', WebvideoService::class, __('Service'));
+    }
+
+    public function addMultimediaSizeFields()
+    {
+        return;
+    }
+}