From: Vincent Vanwaelscappel Date: Mon, 14 Nov 2022 17:15:21 +0000 (+0100) Subject: wip #5468 @4 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=60446c9e2afe1bd9f9a4cb1c0c239714715f4b1f;p=fluidbook-toolbox.git wip #5468 @4 --- diff --git a/app/Fields/FluidbookLinkEditor/Action.php b/app/Fields/FluidbookLinkEditor/Action.php index 599ec9788..f19a1b071 100644 --- a/app/Fields/FluidbookLinkEditor/Action.php +++ b/app/Fields/FluidbookLinkEditor/Action.php @@ -12,7 +12,7 @@ class Action extends SelectFromArray { return [ - 'index' => __("Basculer entre la publication et l'index"), + 'index' => __("Afficher l'index"), 'chapters' => __('Afficher le sommaire'), 'print' => __('Imprimer'), 'share' => __('Partager par e-mail'), diff --git a/app/SubForms/Link/Anchor.php b/app/SubForms/Link/Anchor.php new file mode 100644 index 000000000..c1aff03d7 --- /dev/null +++ b/app/SubForms/Link/Anchor.php @@ -0,0 +1,15 @@ +addField('to', \Cubist\Backpack\Magic\Fields\Text::class, __('Label de la page / Nom de l\'ancre')); + } +} diff --git a/app/SubForms/Link/Animated.php b/app/SubForms/Link/Animated.php new file mode 100644 index 000000000..208659e7e --- /dev/null +++ b/app/SubForms/Link/Animated.php @@ -0,0 +1,18 @@ +addField('image_rollover', Textarea::class, __('Animation')); + } +} diff --git a/app/SubForms/Link/Article.php b/app/SubForms/Link/Article.php new file mode 100644 index 000000000..64838a5da --- /dev/null +++ b/app/SubForms/Link/Article.php @@ -0,0 +1,18 @@ +addField('to', \Cubist\Backpack\Magic\Fields\Text::class, __('Titre de l\'article')); + $this->addField('image', FilesOrURL::class, __('Image'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]); + $this->addField('extra', Textarea::class, __('Contenu de l\'article')); + } +} diff --git a/app/SubForms/Link/ArticleOpen.php b/app/SubForms/Link/ArticleOpen.php new file mode 100644 index 000000000..2d0e37d6a --- /dev/null +++ b/app/SubForms/Link/ArticleOpen.php @@ -0,0 +1,15 @@ +addField('to', FilesOrURL::class, __('Identifiant de l\'article ou PDF'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptPDF]); + } +} diff --git a/app/SubForms/Link/Audiodescription.php b/app/SubForms/Link/Audiodescription.php index 57d36c1a7..06e0bc5d9 100644 --- a/app/SubForms/Link/Audiodescription.php +++ b/app/SubForms/Link/Audiodescription.php @@ -6,6 +6,8 @@ use Cubist\Backpack\Magic\Fields\FilesOrURL; class Audiodescription extends Meta { + public $type = self::AUDIODESCRIPTION; + public function addDestinationField() { $this->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 c871b59ab..ea1279526 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\Hidden; use Cubist\Backpack\Magic\Fields\Number; use Cubist\Backpack\Magic\Fields\Text; use Cubist\Backpack\Magic\Fields\Textarea; @@ -66,6 +67,11 @@ class Base extends Form const FLIPCARD = 41; + /** + * @var int + */ + public $type = 0; + /** * @var int */ @@ -76,6 +82,8 @@ class Base extends Form protected $_multimedia = false; protected $_addedContents = true; protected $_tooltip = true; + protected $_extra = true; + protected $_uid = true; protected static $_acceptImage = ['.jpg', '.jpeg', '.png', '.svg', '.gif']; protected static $_acceptImageAZip = ['.jpg', '.jpeg', '.png', '.svg', '.gif', '.zip']; @@ -96,47 +104,45 @@ class Base extends Form public static function types() { $res = [ - ['type' => self::WEB, 'label' => __('Lien web'), 'color' => '#3399cc', 'class' => Web::class, 'order' => 1], + ['type' => self::WEB, 'label' => __('Adresse Web (URL)'), 'color' => '#3399cc', 'class' => Web::class, 'order' => 1], ['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::WEB_INFOS, 'label' => __('Adresse web « plus d\'infos »'), 'color' => '#ff0000', 'class' => WebInfos::class], + ['type' => self::COLOR, 'label' => __('Couleur'), 'color' => '#8C5E24', 'class' => Color::class, 'order' => 4], ['type' => self::VIDEO, 'label' => __('Vidéo'), 'color' => '#33ff00', 'class' => Video::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::CUSTOM, 'label' => __('Personnalisé'), 'color' => '#14511a', 'class' => Custom::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::ACTION, 'label' => __('Action'), 'color' => '#880000', 'class' => Action::class], + ['type' => self::CART, 'label' => __('Panier'), 'color' => '#F2A4B7', 'class' => Cart::class], + ['type' => self::ZOOM, 'label' => __('Zone de zoom'), 'color' => '#322280', 'class' => ZoomArea::class], + ['type' => self::IMAGE, 'label' => __('Image'), 'color' => '#BE418D', 'class' => Image::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::TOOLTIP, 'label' => __('Infobulle / Texte'), 'color' => '#20c45b', 'class' => Tooltip::class], + ['type' => self::BOOKMARKGROUP, 'label' => __('Groupe de marque-pages'), 'color' => '#d6520f', 'class' => BookmarkGroup::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' => Phone::class], + ['type' => self::STATSTAG, 'label' => __('Tag statistique'), 'color' => '#dddddd', 'class' => StatsTag::class], + ['type' => self::PHONE, 'label' => __('Téléphone'), 'color' => '#333333', '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::ANCHOR, 'label' => __('Ancre / Label de page'), 'color' => '#00E6D7', 'class' => Anchor::class], + ['type' => self::EVENT_OVERLAY, 'label' => __('Capter les évenements'), 'color' => '#ffcc00', 'class' => EventOverlay::class], + ['type' => self::ARTICLE, 'label' => __('Article (définition)'), 'color' => '#ACC152', 'class' => Article::class], + ['type' => self::LIKE, 'label' => __('Like'), 'color' => '#4267B2', 'class' => Like::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], - ['type' => self::TEXT, 'label' => __('Texte'), 'color' => '#9090FF', 'class' => Web::class], - ['type' => self::ARTICLE_OPEN, 'label' => __('Afficher un article'), 'color' => '#ffcc00', 'class' => Web::class], - ['type' => self::DOWNLOAD_PORTION, 'label' => __('Télécharger un extrait'), 'color' => '#AAAAAA', 'class' => Web::class], - ['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::SHOWLINK, 'label' => __('Afficher un lien'), 'color' => '#125C70', 'class' => ShowLink::class], + ['type' => self::ZOOMHD, 'label' => __('Zoom HD'), 'color' => '#E80C95', 'class' => ZoomHD::class], + ['type' => self::LOCK_CONTENTS, 'label' => __('Blocage des contenus'), 'color' => '#69D670', 'class' => LockContents::class], + ['type' => self::TEXT, 'label' => __('Texte'), 'color' => '#9090FF', 'class' => \App\SubForms\Link\Text::class], + ['type' => self::ARTICLE_OPEN, 'label' => __('Article (afficher)'), 'color' => '#ffcc00', 'class' => ArticleOpen::class], + ['type' => self::DOWNLOAD_PORTION, 'label' => __('Télécharger un extrait'), 'color' => '#AAAAAA', 'class' => DownloadPortion::class], + ['type' => self::TRIGGERSLINK, 'label' => __('Déclencher un lien'), 'color' => '#cc0000', 'class' => TriggerLink::class], + ['type' => self::LAYER, 'label' => __('Animation de calque'), 'color' => '#3D0254', 'class' => Layer::class], ['type' => self::FLIPCARD, 'label' => __('Flipcard'), 'color' => '#460e3f', 'class' => Flipcard::class], ]; @@ -181,7 +187,7 @@ class Base extends Form if (!$this->_tooltip) { return; } - $this->addField('header_tooltip', FormSection::class, __('Infobulles')); + $this->addField('header_tooltip', FormSection::class, __('Infobulle')); $this->addField('tooltip', Text::class, __('Texte de l\'infobulle'), ['hint' => __('Laisser vide pour conserver le texte par défaut')]); $this->addField('display_area', Checkbox::class, __('Afficher la zone de couleur au survol'), ['default' => true]); } @@ -198,7 +204,7 @@ class Base extends Form public function addUIDField() { - $this->addField('uid', Text::class, __('Identifiant unique')); + $this->addField('uid', $this->_uid ? Text::class : Hidden::class, __('Identifiant unique')); } public function addSettingsFields() @@ -270,7 +276,7 @@ class Base extends Form public function addExtraFields() { - if ($this->hasField('extra')) { + if ($this->hasField('extra') || !$this->_extra) { return; } $this->addField('header_extra', FormSection::class, __('Autres paramètres')); diff --git a/app/SubForms/Link/BookmarkGroup.php b/app/SubForms/Link/BookmarkGroup.php new file mode 100644 index 000000000..1609b9362 --- /dev/null +++ b/app/SubForms/Link/BookmarkGroup.php @@ -0,0 +1,16 @@ +addField('to', Integer::class, __('Nombre de pages du groupe')); + $this->addField('extra', \Cubist\Backpack\Magic\Fields\Text::class, __('Nom du groupe')); + } +} diff --git a/app/SubForms/Link/Cart.php b/app/SubForms/Link/Cart.php new file mode 100644 index 000000000..9b6873b3b --- /dev/null +++ b/app/SubForms/Link/Cart.php @@ -0,0 +1,15 @@ +addField('to', Text::class, __('Référence produit')); + } +} diff --git a/app/SubForms/Link/Color.php b/app/SubForms/Link/Color.php new file mode 100644 index 000000000..06913b894 --- /dev/null +++ b/app/SubForms/Link/Color.php @@ -0,0 +1,15 @@ +addField('to', \Cubist\Backpack\Magic\Fields\Color::class, __('Couleur')); + parent::addDestinationField(); + } +} diff --git a/app/SubForms/Link/Custom.php b/app/SubForms/Link/Custom.php new file mode 100644 index 000000000..9eec1d456 --- /dev/null +++ b/app/SubForms/Link/Custom.php @@ -0,0 +1,15 @@ +addField('to', FilesOrURL::class, __(' Contenu'), $this->getFilesOrURLEntry()); + } +} diff --git a/app/SubForms/Link/DownloadPortion.php b/app/SubForms/Link/DownloadPortion.php new file mode 100644 index 000000000..6390cb9ee --- /dev/null +++ b/app/SubForms/Link/DownloadPortion.php @@ -0,0 +1,15 @@ +addField('to', Text::class, __('Nom du fichier téléchargé')); + } +} diff --git a/app/SubForms/Link/Email.php b/app/SubForms/Link/Email.php index 04b6cda96..3c47e4aee 100644 --- a/app/SubForms/Link/Email.php +++ b/app/SubForms/Link/Email.php @@ -2,7 +2,6 @@ namespace App\SubForms\Link; -use Cubist\Backpack\Magic\Fields\URL; class Email extends Web { diff --git a/app/SubForms/Link/EventOverlay.php b/app/SubForms/Link/EventOverlay.php new file mode 100644 index 000000000..6d9a61377 --- /dev/null +++ b/app/SubForms/Link/EventOverlay.php @@ -0,0 +1,8 @@ +addField('to', FilesOrURL::class, __('Image'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]); + parent::addDestinationField(); + } +} diff --git a/app/SubForms/Link/Layer.php b/app/SubForms/Link/Layer.php new file mode 100644 index 000000000..82aeba3b2 --- /dev/null +++ b/app/SubForms/Link/Layer.php @@ -0,0 +1,16 @@ +addField("to", Hidden::class, __('Animer le(s) calque(s)')); + parent::addDestinationField(); + } +} diff --git a/app/SubForms/Link/Like.php b/app/SubForms/Link/Like.php new file mode 100644 index 000000000..7289b7abf --- /dev/null +++ b/app/SubForms/Link/Like.php @@ -0,0 +1,18 @@ +addField('to', URL::class, __('URL à liker')); + } +} diff --git a/app/SubForms/Link/LockContents.php b/app/SubForms/Link/LockContents.php new file mode 100644 index 000000000..1c495a5f3 --- /dev/null +++ b/app/SubForms/Link/LockContents.php @@ -0,0 +1,15 @@ +addField('to', Textarea::class, __('Conditions de déblocage')); + } +} diff --git a/app/SubForms/Link/Meta.php b/app/SubForms/Link/Meta.php index d7c439567..7e280dbf7 100644 --- a/app/SubForms/Link/Meta.php +++ b/app/SubForms/Link/Meta.php @@ -7,4 +7,6 @@ class Meta extends Base protected $_displayedOnFluidbook = false; protected $_addedContents = false; protected $_tooltip = false; + protected $_extra = false; + protected $_uid = false; } diff --git a/app/SubForms/Link/ShowLink.php b/app/SubForms/Link/ShowLink.php new file mode 100644 index 000000000..c0ce78542 --- /dev/null +++ b/app/SubForms/Link/ShowLink.php @@ -0,0 +1,19 @@ +addField('to', Text::class, __('Identifiant du lien à afficher')); + $this->addField('target', ShowLinkMode::class, __('Mode')); + $this->addField('video_service', ShowLinkCloseMode::class, __('Placer un bouton de fermeture')); + } +} diff --git a/app/SubForms/Link/StatsTag.php b/app/SubForms/Link/StatsTag.php new file mode 100644 index 000000000..3f10d9ca0 --- /dev/null +++ b/app/SubForms/Link/StatsTag.php @@ -0,0 +1,17 @@ +addField('to', \Cubist\Backpack\Magic\Fields\Text::class, __('Tag')); + } +} diff --git a/app/SubForms/Link/Text.php b/app/SubForms/Link/Text.php new file mode 100644 index 000000000..cddccaca9 --- /dev/null +++ b/app/SubForms/Link/Text.php @@ -0,0 +1,18 @@ +addField('to', \Cubist\Backpack\Magic\Fields\Text::class, __('Texte')); + $this->addField('extra', \Cubist\Backpack\Magic\Fields\Color::class, __('Couleur du texte')); + $this->addField('image', FilesOrURL::class, __('Police'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptFont]); + parent::addDestinationField(); + } +} diff --git a/app/SubForms/Link/Tooltip.php b/app/SubForms/Link/Tooltip.php new file mode 100644 index 000000000..ebc00e767 --- /dev/null +++ b/app/SubForms/Link/Tooltip.php @@ -0,0 +1,29 @@ +addTypeField(); + $this->addTooltipFields(); + $this->addPositionFields(); + $this->addExtraFields(); + } + + public function addTooltipFields() + { + if (!$this->_tooltip) { + return; + } + $this->addField('header_tooltip', FormSection::class, __('Paramètres')); + $this->addField('tooltip', Textarea::class, __('Texte de l\'infobulle')); + $this->addField('display_area', Checkbox::class, __('Afficher la zone de couleur au survol'), ['default' => true]); + $this->addUIDField(); + } +} diff --git a/app/SubForms/Link/TriggerLink.php b/app/SubForms/Link/TriggerLink.php new file mode 100644 index 000000000..52583c790 --- /dev/null +++ b/app/SubForms/Link/TriggerLink.php @@ -0,0 +1,17 @@ +addField('to', Text::class, __('Identifiant du lien à déclencher')); + $this->addField('target', TriggerLinkEvent::class, __('Événement déclencheur')); + } +} diff --git a/app/SubForms/Link/ZoomArea.php b/app/SubForms/Link/ZoomArea.php new file mode 100644 index 000000000..f525ee4cd --- /dev/null +++ b/app/SubForms/Link/ZoomArea.php @@ -0,0 +1,16 @@ +addField('group', \Cubist\Backpack\Magic\Fields\Text::class, __('Groupe')); + $this->addField('to', Number::class, __('Niveau de zoom maximal')); + } +} diff --git a/app/SubForms/Link/ZoomHD.php b/app/SubForms/Link/ZoomHD.php new file mode 100644 index 000000000..a0e0754fc --- /dev/null +++ b/app/SubForms/Link/ZoomHD.php @@ -0,0 +1,15 @@ +addField('to', FilesOrURL::class, __('Image HD'), $this->getFilesOrURLEntry() + ['accept' => self::$_acceptImage]); + } +}