From: Vincent Vanwaelscappel Date: Thu, 10 Nov 2022 19:56:20 +0000 (+0100) Subject: wip #5468 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=0552284b27d785bab87717ab9694a9cd10abf79b;p=fluidbook-toolbox.git wip #5468 @2 --- diff --git a/app/SubForms/Link/Audio.php b/app/SubForms/Link/Audio.php new file mode 100644 index 000000000..0bed180e0 --- /dev/null +++ b/app/SubForms/Link/Audio.php @@ -0,0 +1,25 @@ +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 index 000000000..57d36c1a7 --- /dev/null +++ b/app/SubForms/Link/Audiodescription.php @@ -0,0 +1,13 @@ +addField('to', FilesOrURL::class, __('Fichier audio ou texte'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptAudiodescription]); + } +} diff --git a/app/SubForms/Link/Base.php b/app/SubForms/Link/Base.php index 7a2cbed7b..c871b59ab 100644 --- a/app/SubForms/Link/Base.php +++ b/app/SubForms/Link/Base.php @@ -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 index 000000000..2fcaf1154 --- /dev/null +++ b/app/SubForms/Link/File.php @@ -0,0 +1,17 @@ +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 index 000000000..341bc95b3 --- /dev/null +++ b/app/SubForms/Link/Flipcard.php @@ -0,0 +1,18 @@ +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 index 000000000..ebbc8044d --- /dev/null +++ b/app/SubForms/Link/IFrame.php @@ -0,0 +1,17 @@ +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 index 000000000..5a83d15e0 --- /dev/null +++ b/app/SubForms/Link/Internal.php @@ -0,0 +1,17 @@ +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 index 000000000..d7c439567 --- /dev/null +++ b/app/SubForms/Link/Meta.php @@ -0,0 +1,10 @@ +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 index 000000000..ab59dfc60 --- /dev/null +++ b/app/SubForms/Link/Phone.php @@ -0,0 +1,13 @@ +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 index 000000000..76f93365b --- /dev/null +++ b/app/SubForms/Link/Slideshow.php @@ -0,0 +1,17 @@ +addField('to', FilesOrURL::class, __('Images'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptSlideshow]); + $this->addField('extra', Integer::class, __('Ouvrir à la slide')); + } +} diff --git a/app/SubForms/Link/Video.php b/app/SubForms/Link/Video.php index 8f39e4f26..8876b2da7 100644 --- a/app/SubForms/Link/Video.php +++ b/app/SubForms/Link/Video.php @@ -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 index 000000000..c95391ea2 --- /dev/null +++ b/app/SubForms/Link/WebVideo.php @@ -0,0 +1,22 @@ +addField('to', Text::class, __('Identifiant de la video')); + $this->addField('video_service', WebvideoService::class, __('Service')); + } + + public function addMultimediaSizeFields() + { + return; + } +}