Use constants for paragraph types
authorThierry Florac <thierry.florac@onf.fr>
Thu, 22 Feb 2018 15:58:28 +0100
changeset 407 0ef5de2d5674
parent 406 5527bc086216
child 408 e1d40ed27899
Use constants for paragraph types
src/pyams_content/component/association/interfaces/__init__.py
src/pyams_content/component/association/paragraph.py
src/pyams_content/component/association/zmi/paragraph.py
src/pyams_content/component/gallery/interfaces/__init__.py
src/pyams_content/component/gallery/paragraph.py
src/pyams_content/component/gallery/zmi/paragraph.py
src/pyams_content/component/illustration/interfaces/__init__.py
src/pyams_content/component/illustration/paragraph.py
src/pyams_content/component/illustration/zmi/paragraph.py
src/pyams_content/component/paragraph/__init__.py
src/pyams_content/component/paragraph/header.py
src/pyams_content/component/paragraph/html.py
src/pyams_content/component/paragraph/interfaces/header.py
src/pyams_content/component/paragraph/interfaces/html.py
src/pyams_content/component/paragraph/interfaces/video.py
src/pyams_content/component/paragraph/video.py
src/pyams_content/component/paragraph/zmi/__init__.py
src/pyams_content/component/paragraph/zmi/header.py
src/pyams_content/component/paragraph/zmi/html.py
src/pyams_content/component/paragraph/zmi/video.py
src/pyams_content/component/video/interfaces/__init__.py
src/pyams_content/component/video/paragraph.py
src/pyams_content/component/video/zmi/paragraph.py
src/pyams_content/shared/imagemap/interfaces/__init__.py
src/pyams_content/shared/imagemap/paragraph.py
src/pyams_content/shared/imagemap/zmi/paragraph.py
src/pyams_content/shared/logo/interfaces/__init__.py
src/pyams_content/shared/logo/paragraph.py
src/pyams_content/shared/logo/zmi/paragraph.py
--- a/src/pyams_content/component/association/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/association/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -79,5 +79,8 @@
     """Association renderer adapter interface"""
 
 
+ASSOCIATION_PARAGRAPH_TYPE = 'Associations'
+
+
 class IAssociationParagraph(IBaseParagraph):
     """Associations paragraph interface"""
--- a/src/pyams_content/component/association/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/association/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationParagraph
+from pyams_content.component.association.interfaces import IAssociationParagraph, ASSOCIATION_PARAGRAPH_TYPE
 from pyams_content.component.extfile.interfaces import IExtFileContainerTarget
 from pyams_content.component.links.interfaces import ILinkContainerTarget
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
@@ -42,7 +42,7 @@
     icon_hint = _("Associations paragraph")
 
 
-@utility_config(name='Associations', provides=IParagraphFactory)
+@utility_config(name=ASSOCIATION_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class AssociationParagraphFactory(BaseParagraphFactory):
     """Associations paragraph factory"""
 
--- a/src/pyams_content/component/association/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/association/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_content.component.association.interfaces import IAssociationParagraph, IAssociationContainer, \
-    IAssociationInfo
+    IAssociationInfo, ASSOCIATION_PARAGRAPH_TYPE
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
     IParagraphPreview
@@ -55,7 +55,7 @@
     label = _("Add associations paragraph...")
     label_css_class = 'fa fa-fw fa-link'
     url = 'add-association-paragraph.html'
-    paragraph_type = 'Associations'
+    paragraph_type = ASSOCIATION_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-association-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/gallery/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -125,5 +125,8 @@
     """Gallery container target marker interface"""
 
 
+GALLERY_PARAGRAPH_TYPE = 'Gallery'
+
+
 class IGalleryParagraph(IGallery, IBaseParagraph):
     """Gallery paragraph"""
--- a/src/pyams_content/component/gallery/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/gallery/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.gallery.interfaces import IGalleryParagraph
+from pyams_content.component.gallery.interfaces import IGalleryParagraph, GALLERY_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_i18n.interfaces import II18n, INegotiator, II18nManager
@@ -40,7 +40,7 @@
     icon_hint = _("Medias gallery")
 
 
-@utility_config(name='Gallery', provides=IParagraphFactory)
+@utility_config(name=GALLERY_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class GalleryFactory(BaseParagraphFactory):
     """Gallery paragraph factory"""
 
--- a/src/pyams_content/component/gallery/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery
+from pyams_content.component.gallery.interfaces import IGalleryParagraph, IBaseGallery, GALLERY_PARAGRAPH_TYPE
 from pyams_content.component.gallery.zmi.interfaces import IGalleryContentsView
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
     IParagraphPreview
@@ -57,7 +57,7 @@
     label = _("Add medias gallery...")
     label_css_class = 'fa fa-fw fa-picture-o'
     url = 'add-gallery.html'
-    paragraph_type = 'Gallery'
+    paragraph_type = GALLERY_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-gallery.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/illustration/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/illustration/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -75,6 +75,9 @@
     """Illustration target marker interface"""
 
 
+ILLUSTRATION_PARAGRAPH_TYPE = 'Illustration'
+
+
 class IIllustrationParagraph(IIllustration, IBaseParagraph):
     """Illustration paragraph"""
 
--- a/src/pyams_content/component/illustration/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/illustration/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -16,7 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.illustration.interfaces import IIllustrationParagraph
+from pyams_content.component.illustration.interfaces import IIllustrationParagraph, ILLUSTRATION_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
 from pyams_content.features.checker.interfaces import IContentChecker
 from pyams_i18n.interfaces import II18n
@@ -40,7 +40,7 @@
     icon_hint = _("Illustration")
 
 
-@utility_config(name='Illustration', provides=IParagraphFactory)
+@utility_config(name=ILLUSTRATION_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class IllustrationFactory(BaseParagraphFactory):
     """Illustration paragraph factory"""
 
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -18,7 +18,8 @@
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, \
     IParagraphContainer, IParagraphPreview
-from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationParagraph
+from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationParagraph, \
+    ILLUSTRATION_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
@@ -56,7 +57,7 @@
     label = _("Add illustration...")
     label_css_class = 'fa fa-fw fa-file-image-o'
     url = 'add-illustration.html'
-    paragraph_type = 'Illustration'
+    paragraph_type = ILLUSTRATION_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-illustration.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/paragraph/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -89,7 +89,7 @@
 
     name = None
     content_type = None
-    custom_menu = False
+    secondary_menu = False
 
 
 class BaseParagraphContentChecker(BaseContentChecker):
--- a/src/pyams_content/component/paragraph/header.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/header.py	Thu Feb 22 15:58:28 2018 +0100
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph
+from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph, HEADER_PARAGRAPH_TYPE
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
 
@@ -48,7 +48,7 @@
     header = FieldProperty(IHeaderParagraph['header'])
 
 
-@utility_config(name='Header', provides=IParagraphFactory)
+@utility_config(name=HEADER_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class HTMLParagraphFactory(BaseParagraphFactory):
     """HTML paragraph factory"""
 
--- a/src/pyams_content/component/paragraph/html.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/html.py	Thu Feb 22 15:58:28 2018 +0100
@@ -22,7 +22,8 @@
 from pyams_content.component.illustration.interfaces import IIllustrationTarget
 from pyams_content.component.links.interfaces import ILinkContainerTarget, IInternalLink, IExternalLink, IMailtoLink
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.paragraph.interfaces.html import IRawParagraph, IHTMLParagraph
+from pyams_content.component.paragraph.interfaces.html import RAW_PARAGRAPH_TYPE, IRawParagraph, HTML_PARAGRAPH_TYPE, \
+    IHTMLParagraph
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent
@@ -59,13 +60,12 @@
     body = FieldProperty(IRawParagraph['body'])
 
 
-@utility_config(name='raw', provides=IParagraphFactory)
+@utility_config(name=RAW_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class RawParagraphFactory(BaseParagraphFactory):
     """Raw paragraph factory"""
 
     name = _("Raw HTML paragraph")
     content_type = RawParagraph
-    custom_menu = True
 
 
 @adapter_config(context=IRawParagraph, provides=IContentChecker)
@@ -107,7 +107,7 @@
     body = FieldProperty(IHTMLParagraph['body'])
 
 
-@utility_config(name='HTML', provides=IParagraphFactory)
+@utility_config(name=HTML_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class HTMLParagraphFactory(BaseParagraphFactory):
     """HTML paragraph factory"""
 
--- a/src/pyams_content/component/paragraph/interfaces/header.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/interfaces/header.py	Thu Feb 22 15:58:28 2018 +0100
@@ -28,6 +28,9 @@
 # HTML paragraph
 #
 
+HEADER_PARAGRAPH_TYPE = 'Header'
+
+
 class IHeaderParagraph(IBaseParagraph):
     """Header paragraph"""
 
--- a/src/pyams_content/component/paragraph/interfaces/html.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/interfaces/html.py	Thu Feb 22 15:58:28 2018 +0100
@@ -28,6 +28,9 @@
 # Raw HTML paragraph
 #
 
+RAW_PARAGRAPH_TYPE = 'raw'
+
+
 class IRawParagraph(IBaseParagraph):
     """Raw HTML paragraph interface"""
 
@@ -41,6 +44,9 @@
 # HTML paragraph
 #
 
+HTML_PARAGRAPH_TYPE = 'HTML'
+
+
 class IHTMLParagraph(IBaseParagraph):
     """Rich text paragraph interface"""
 
--- a/src/pyams_content/component/paragraph/interfaces/video.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/interfaces/video.py	Thu Feb 22 15:58:28 2018 +0100
@@ -30,6 +30,9 @@
 # HTML paragraph
 #
 
+VIDEO_PARAGRAPH_TYPE = 'Video'
+
+
 class IVideoParagraph(IBaseParagraph):
     """Video paragraph"""
 
--- a/src/pyams_content/component/paragraph/video.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/video.py	Thu Feb 22 15:58:28 2018 +0100
@@ -19,7 +19,7 @@
 from pyams_content.component.extfile.interfaces import IExtFileContainerTarget
 from pyams_content.component.links.interfaces import ILinkContainerTarget
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.paragraph.interfaces.video import IVideoParagraph
+from pyams_content.component.paragraph.interfaces.video import IVideoParagraph, VIDEO_PARAGRAPH_TYPE
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_i18n.interfaces import II18nManager, INegotiator, II18n
 from zope.lifecycleevent.interfaces import IObjectAddedEvent, IObjectModifiedEvent
@@ -51,7 +51,7 @@
     data = FileProperty(IVideoParagraph['data'])
 
 
-@utility_config(name='Video', provides=IParagraphFactory)
+@utility_config(name=VIDEO_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class VideoParagraphFactory(BaseParagraphFactory):
     """Video paragraph factory"""
 
--- a/src/pyams_content/component/paragraph/zmi/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -120,7 +120,7 @@
             return MenuDivider.__new__(cls)
         for factory_name in settings.allowed_paragraphs or ():
             factory = query_utility(IParagraphFactory, name=factory_name)
-            if factory.custom_menu:
+            if factory.secondary_menu:
                 return MenuDivider.__new__(cls)
         return None
 
--- a/src/pyams_content/component/paragraph/zmi/header.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/header.py	Thu Feb 22 15:58:28 2018 +0100
@@ -18,7 +18,7 @@
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
     IParagraphPreview
-from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph
+from pyams_content.component.paragraph.interfaces.header import IHeaderParagraph, HEADER_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
@@ -51,7 +51,7 @@
     label = _("Add header paragraph...")
     label_css_class = 'fa fa-fw fa-header'
     url = 'add-header-paragraph.html'
-    paragraph_type = 'Header'
+    paragraph_type = HEADER_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-header-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/paragraph/zmi/html.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/html.py	Thu Feb 22 15:58:28 2018 +0100
@@ -19,9 +19,10 @@
 from pyams_content.component.association.interfaces import IAssociationTarget
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
 from pyams_content.component.illustration.interfaces import IIllustration
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
-    IParagraphPreview
-from pyams_content.component.paragraph.interfaces.html import IHTMLParagraph, IRawParagraph
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphFactorySettings, \
+    IParagraphContainer, IParagraphPreview
+from pyams_content.component.paragraph.interfaces.html import IHTMLParagraph, IRawParagraph, RAW_PARAGRAPH_TYPE, \
+    HTML_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
@@ -39,6 +40,7 @@
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerTable, \
     ParagraphTitleToolbarViewletManager
 from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.viewlet.menu import MenuDivider
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
@@ -55,6 +57,18 @@
 # Raw HTML paragraph
 #
 
+@viewlet_config(name='add-raw-paragraph.divider', context=IParagraphContainerTarget, view=IParagraphContainerView,
+                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=990)
+class RawParagraphAddMenuDivider(MenuDivider):
+    """Raw paragraph add menu divider"""
+
+    def __new__(cls, context, request, view, manager):
+        settings = get_parent(context, IParagraphFactorySettings)
+        if (settings is not None) and (RawParagraphAddMenu.paragraph_type not in (settings.allowed_paragraphs or ())):
+            return None
+        return MenuDivider.__new__(cls)
+
+
 @viewlet_config(name='add-raw-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
                 layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=999)
 class RawParagraphAddMenu(BaseParagraphAddMenu):
@@ -63,7 +77,7 @@
     label = _("Add raw HTML paragraph...")
     label_css_class = 'fa fa-fw fa-code'
     url = 'add-raw-paragraph.html'
-    paragraph_type = 'raw'
+    paragraph_type = RAW_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-raw-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
@@ -178,7 +192,7 @@
     label = _("Add rich text paragraph...")
     label_css_class = 'fa fa-fw fa-html5'
     url = 'add-html-paragraph.html'
-    paragraph_type = 'HTML'
+    paragraph_type = HTML_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-html-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/paragraph/zmi/video.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/paragraph/zmi/video.py	Thu Feb 22 15:58:28 2018 +0100
@@ -19,7 +19,7 @@
 from pyams_content.component.association.zmi.interfaces import IAssociationsParentForm
 from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
     IParagraphPreview
-from pyams_content.component.paragraph.interfaces.video import IVideoParagraph
+from pyams_content.component.paragraph.interfaces.video import IVideoParagraph, VIDEO_PARAGRAPH_TYPE
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
@@ -56,7 +56,7 @@
     label = _("Add video paragraph...")
     label_css_class = 'fa fa-fw fa-film'
     url = 'add-video-paragraph.html'
-    paragraph_type = 'Video'
+    paragraph_type = VIDEO_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-video-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/component/video/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/video/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -60,6 +60,9 @@
     settings = Attribute("Video settings")
 
 
+EXTERNAL_VIDEO_PARAGRAPH_TYPE = 'External video'
+
+
 class IExternalVideoParagraph(IExternalVideo, IBaseParagraph):
     """External video paragraph"""
 
--- a/src/pyams_content/component/video/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/video/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_utils.traversing import get_parent
 
 __docformat__ = 'restructuredtext'
 
@@ -18,7 +17,7 @@
 
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
-from pyams_content.component.video.interfaces import IExternalVideoParagraph
+from pyams_content.component.video.interfaces import IExternalVideoParagraph, EXTERNAL_VIDEO_PARAGRAPH_TYPE
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator
 
@@ -28,6 +27,7 @@
 from pyams_utils.adapter import adapter_config
 from pyams_utils.registry import utility_config, get_utility
 from pyams_utils.request import check_request
+from pyams_utils.traversing import get_parent
 from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
 
@@ -44,7 +44,7 @@
     body = FieldProperty(IExternalVideoParagraph['body'])
 
 
-@utility_config(name='External video', provides=IParagraphFactory)
+@utility_config(name=EXTERNAL_VIDEO_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class ExternalVideoParagraphFactory(BaseParagraphFactory):
     """External video paragraph factory"""
 
--- a/src/pyams_content/component/video/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/component/video/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -20,7 +20,7 @@
     IBaseParagraph, IParagraphPreview
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor
 from pyams_content.component.video.interfaces import IExternalVideoProvider, IExternalVideoSettings, \
-    IExternalVideoParagraph, IExternalVideoRenderer
+    IExternalVideoParagraph, IExternalVideoRenderer, EXTERNAL_VIDEO_PARAGRAPH_TYPE
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_form.interfaces.form import IWidgetsSuffixViewletsManager, IInnerForm, IEditFormButtons
 from pyams_i18n.interfaces import II18n
@@ -60,7 +60,7 @@
     label = _("External video...")
     label_css_class = 'fa fa-fw fa-youtube-play'
     url = 'add-external-video.html'
-    paragraph_type = 'External video'
+    paragraph_type = EXTERNAL_VIDEO_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-external-video.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/shared/imagemap/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/imagemap/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -75,6 +75,9 @@
     """Workflow managed image map interface"""
 
 
+IMAGEMAP_PARAGRAPH_TYPE = 'ImageMap'
+
+
 class IImageMapParagraph(IBaseParagraph):
     """Image map paragraph"""
 
--- a/src/pyams_content/shared/imagemap/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/imagemap/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -18,7 +18,7 @@
 # import interfaces
 from pyams_content.component.paragraph.interfaces import IParagraphFactory
 from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE, MISSING_VALUE, MISSING_LANG_VALUE
-from pyams_content.shared.imagemap.interfaces import IImageMapParagraph
+from pyams_content.shared.imagemap.interfaces import IImageMapParagraph, IMAGEMAP_PARAGRAPH_TYPE
 from pyams_i18n.interfaces import II18nManager, INegotiator, II18n
 from pyams_workflow.interfaces import IWorkflow, IWorkflowState
 
@@ -47,12 +47,13 @@
         return get_reference_target(self.reference, state)
 
 
-@utility_config(name='ImageMap', provides=IParagraphFactory)
+@utility_config(name=IMAGEMAP_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class ImageMapParagraphFactory(BaseParagraphFactory):
     """Image map paragraph factory"""
 
     name = _("Image map")
     content_type = ImageMapParagraph
+    secondary_menu = True
 
 
 @adapter_config(context=IImageMapParagraph, provides=IContentChecker)
--- a/src/pyams_content/shared/imagemap/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/imagemap/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -22,7 +22,7 @@
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_content.shared.imagemap.interfaces import IImageMapParagraph
+from pyams_content.shared.imagemap.interfaces import IImageMapParagraph, IMAGEMAP_PARAGRAPH_TYPE
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons, IWidgetsSuffixViewletsManager
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
@@ -47,14 +47,14 @@
 
 
 @viewlet_config(name='add-imagemap-paragraph.menu', context=IParagraphContainerTarget, view=IParagraphContainerView,
-                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=80)
+                layer=IPyAMSLayer, manager=IToolbarAddingMenu, weight=610)
 class ImagemapParagraphAddMenu(BaseParagraphAddMenu):
     """Image map paragraph add menu"""
 
     label = _("Add image map...")
     label_css_class = 'fa fa-fw fa-location-arrow'
     url = 'add-imagemap-paragraph.html'
-    paragraph_type = 'ImageMap'
+    paragraph_type = IMAGEMAP_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-imagemap-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,
--- a/src/pyams_content/shared/logo/interfaces/__init__.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/logo/interfaces/__init__.py	Thu Feb 22 15:58:28 2018 +0100
@@ -50,6 +50,9 @@
     """Workflow managed logo interface"""
 
 
+LOGOS_PARAGRAPH_TYPE = 'Logos'
+
+
 class ILogosParagraph(IBaseParagraph):
     """Logos paragraph"""
 
--- a/src/pyams_content/shared/logo/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/logo/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE
-from pyams_content.shared.logo.interfaces import ILogosParagraph
+from pyams_content.shared.logo.interfaces import ILogosParagraph, LOGOS_PARAGRAPH_TYPE
 from pyams_i18n.interfaces import II18nManager, INegotiator, II18n
 from pyams_workflow.interfaces import IWorkflow, IWorkflowState
 
@@ -51,12 +51,13 @@
                 yield get_reference_target(reference, state)
 
 
-@utility_config(name='Logos', provides=IParagraphFactory)
+@utility_config(name=LOGOS_PARAGRAPH_TYPE, provides=IParagraphFactory)
 class LogosParagraphFactory(BaseParagraphFactory):
     """Logos paragraph factory"""
 
     name = _("Logos")
     content_type = LogosParagraph
+    secondary_menu = True
 
 
 @adapter_config(context=ILogosParagraph, provides=IContentChecker)
--- a/src/pyams_content/shared/logo/zmi/paragraph.py	Thu Feb 22 12:00:05 2018 +0100
+++ b/src/pyams_content/shared/logo/zmi/paragraph.py	Thu Feb 22 15:58:28 2018 +0100
@@ -21,7 +21,7 @@
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common import IWfSharedContent
-from pyams_content.shared.logo.interfaces import ILogosParagraph
+from pyams_content.shared.logo.interfaces import ILogosParagraph, LOGOS_PARAGRAPH_TYPE
 from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
@@ -53,7 +53,7 @@
     label = _("Add logos...")
     label_css_class = 'fa fa-fw fa-th-large'
     url = 'add-logos-paragraph.html'
-    paragraph_type = 'Logos'
+    paragraph_type = LOGOS_PARAGRAPH_TYPE
 
 
 @pagelet_config(name='add-logos-paragraph.html', context=IParagraphContainerTarget, layer=IPyAMSLayer,