Added button to paragraphs edit forms to get direct access to paragraph preview
authorThierry Florac <thierry.florac@onf.fr>
Fri, 18 May 2018 15:54:14 +0200
changeset 550 9658debb49a3
parent 549 7340e6c1429f
child 551 0856dfc5bab3
Added button to paragraphs edit forms to get direct access to paragraph preview
src/pyams_content/component/association/zmi/paragraph.py
src/pyams_content/component/gallery/zmi/paragraph.py
src/pyams_content/component/illustration/zmi/paragraph.py
src/pyams_content/component/links/__init__.py
src/pyams_content/component/links/zmi/__init__.py
src/pyams_content/component/paragraph/container.py
src/pyams_content/component/paragraph/interfaces/__init__.py
src/pyams_content/component/paragraph/zmi/__init__.py
src/pyams_content/component/paragraph/zmi/contact.py
src/pyams_content/component/paragraph/zmi/frame.py
src/pyams_content/component/paragraph/zmi/header.py
src/pyams_content/component/paragraph/zmi/html.py
src/pyams_content/component/paragraph/zmi/keynumber.py
src/pyams_content/component/paragraph/zmi/keypoint.py
src/pyams_content/component/paragraph/zmi/milestone.py
src/pyams_content/component/paragraph/zmi/pictogram.py
src/pyams_content/component/paragraph/zmi/preview.py
src/pyams_content/component/paragraph/zmi/verbatim.py
src/pyams_content/component/paragraph/zmi/video.py
src/pyams_content/component/video/zmi/paragraph.py
--- a/src/pyams_content/component/association/zmi/paragraph.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/association/zmi/paragraph.py	Fri May 18 15:54:14 2018 +0200
@@ -23,7 +23,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_form.interfaces.form import IInnerForm, IEditFormButtons
+from pyams_form.interfaces.form import IInnerForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -32,7 +32,7 @@
 # import packages
 from pyams_content.component.association.paragraph import AssociationParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
@@ -123,7 +123,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/gallery/zmi/paragraph.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/gallery/zmi/paragraph.py	Fri May 18 15:54:14 2018 +0200
@@ -22,7 +22,7 @@
     IParagraphRenderer
 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, IInnerSubForm
+from pyams_form.interfaces.form import IInnerForm, IInnerSubForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IWidgetTitleViewletManager
 from pyams_skin.layer import IPyAMSLayer
@@ -32,7 +32,7 @@
 # import packages
 from pyams_content.component.gallery.paragraph import Gallery
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_content.shared.common.zmi import WfSharedContentPermissionMixin
@@ -139,7 +139,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/illustration/zmi/paragraph.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/illustration/zmi/paragraph.py	Fri May 18 15:54:14 2018 +0200
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from zope.schema._schema import getFieldNamesInOrder
 
 __docformat__ = 'restructuredtext'
 
@@ -23,7 +22,7 @@
     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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from transaction.interfaces import ITransactionManager
@@ -32,7 +31,7 @@
 # import packages
 from pyams_content.component.illustration.paragraph import Illustration
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
@@ -141,7 +140,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/links/__init__.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/links/__init__.py	Fri May 18 15:54:14 2018 +0200
@@ -19,7 +19,8 @@
 from pyams_content.component.association.interfaces import IAssociationInfo, IAssociationTarget, IAssociationContainer
 from pyams_content.component.links.interfaces import IBaseLink, IInternalLink, IExternalLink, IMailtoLink
 from pyams_content.features.checker.interfaces import IContentChecker, ERROR_VALUE
-from pyams_content.interfaces import IBaseContent
+from pyams_content.interfaces import IBaseContent, MANAGE_CONTENT_PERMISSION
+from pyams_form.interfaces.form import IFormContextPermissionChecker
 from pyams_i18n.interfaces import II18n
 from pyams_sequence.interfaces import ISequentialIdInfo
 from pyams_workflow.interfaces import IWorkflow
@@ -120,6 +121,13 @@
             return ''
 
 
+@adapter_config(context=IInternalLink, provides=IFormContextPermissionChecker)
+class InternalLinkPermissionChecker(ContextAdapter):
+    """Internal link permission checker"""
+
+    edit_permission = MANAGE_CONTENT_PERMISSION
+
+
 @adapter_config(context=IInternalLink, provides=IAssociationInfo)
 class InternalLinkAssociationInfoAdapter(BaseLinkInfoAdapter):
     """Internal link association info adapter"""
@@ -187,6 +195,13 @@
         return self.url
 
 
+@adapter_config(context=IExternalLink, provides=IFormContextPermissionChecker)
+class ExternalLinkPermissionChecker(ContextAdapter):
+    """External link permission checker"""
+
+    edit_permission = MANAGE_CONTENT_PERMISSION
+
+
 @adapter_config(context=IExternalLink, provides=IAssociationInfo)
 class ExternalLinkAssociationInfoAdapter(BaseLinkInfoAdapter):
     """External link association info adapter"""
@@ -233,6 +248,13 @@
         return 'mailto:{0} &lt;{1}&gt;'.format(self.address_name, self.address)
 
 
+@adapter_config(context=IMailtoLink, provides=IFormContextPermissionChecker)
+class MailtoLinkPermissionChecker(ContextAdapter):
+    """Mailto link permission checker"""
+
+    edit_permission = MANAGE_CONTENT_PERMISSION
+
+
 @adapter_config(context=IMailtoLink, provides=IAssociationInfo)
 class MailtoLinkAssociationInfoAdapter(BaseLinkInfoAdapter):
     """Mailto link association info adapter"""
--- a/src/pyams_content/component/links/zmi/__init__.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/links/zmi/__init__.py	Fri May 18 15:54:14 2018 +0200
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event
 
 __docformat__ = 'restructuredtext'
 
@@ -30,6 +29,7 @@
 # import packages
 from pyams_content.component.association.zmi import AssociationItemAJAXAddForm, AssociationItemAJAXEditForm
 from pyams_content.component.links import InternalLink, ExternalLink, MailtoLink
+from pyams_content.component.paragraph.zmi import get_json_paragraph_markers_refresh_event
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerCounterBase
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
@@ -124,7 +124,7 @@
 
     fields = field.Fields(IInternalLink).select('reference', 'title', 'description')
     ajax_handler = 'properties.json'
-    edit_permission = MANAGE_CONTENT_PERMISSION
+    edit_permission = None  # defined by IFormContextPermissionChecker adapter
 
     def updateWidgets(self, prefix=None):
         super(InternalLinkPropertiesEditForm, self).updateWidgets(prefix)
@@ -227,7 +227,7 @@
 
     fields = field.Fields(IExternalLink).select('url', 'title', 'description', 'language')
     ajax_handler = 'properties.json'
-    edit_permission = MANAGE_CONTENT_PERMISSION
+    edit_permission = None  # defined by IFormContextPermissionChecker adapter
 
     def updateWidgets(self, prefix=None):
         super(ExternalLinkPropertiesEditForm, self).updateWidgets(prefix)
@@ -330,7 +330,7 @@
 
     fields = field.Fields(IMailtoLink).select('address', 'address_name', 'title', 'description')
     ajax_handler = 'properties.json'
-    edit_permission = MANAGE_CONTENT_PERMISSION
+    edit_permission = None  # defined by IFormContextPermissionChecker adapter
 
     def updateWidgets(self, prefix=None):
         super(MailtoLinkPropertiesEditForm, self).updateWidgets(prefix)
--- a/src/pyams_content/component/paragraph/container.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/container.py	Fri May 18 15:54:14 2018 +0200
@@ -19,18 +19,14 @@
 from pyams_content.component.paragraph.interfaces import IParagraphContainer, IParagraphContainerTarget, \
     PARAGRAPH_CONTAINER_KEY
 from pyams_content.features.checker.interfaces import IContentChecker
-from zope.annotation.interfaces import IAnnotations
 from zope.location.interfaces import ISublocations
 from zope.traversing.interfaces import ITraversable
 
 # import packages
 from pyams_content.features.checker import BaseContentChecker
-from pyams_utils.adapter import adapter_config, ContextAdapter
+from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
 from pyams_utils.container import BTreeOrderedContainer
-from pyramid.threadlocal import get_current_registry
 from zope.interface import implementer
-from zope.lifecycleevent import ObjectCreatedEvent
-from zope.location import locate
 
 from pyams_content import _
 
@@ -50,13 +46,8 @@
 @adapter_config(context=IParagraphContainerTarget, provides=IParagraphContainer)
 def paragraph_container_factory(target):
     """Paragraphs container factory"""
-    annotations = IAnnotations(target)
-    container = annotations.get(PARAGRAPH_CONTAINER_KEY)
-    if container is None:
-        container = annotations[PARAGRAPH_CONTAINER_KEY] = ParagraphContainer()
-        get_current_registry().notify(ObjectCreatedEvent(container))
-        locate(container, target, '++paras++')
-    return container
+    return get_annotation_adapter(target, PARAGRAPH_CONTAINER_KEY, ParagraphContainer,
+                                  name='++paras++')
 
 
 @adapter_config(name='paras', context=IParagraphContainerTarget, provides=ITraversable)
--- a/src/pyams_content/component/paragraph/interfaces/__init__.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/interfaces/__init__.py	Fri May 18 15:54:14 2018 +0200
@@ -58,7 +58,7 @@
         """Add given value to container"""
 
 
-class IParagraphContainerTarget(Interface):
+class IParagraphContainerTarget(IAttributeAnnotatable):
     """Paragraphs container marker interface"""
 
 
--- a/src/pyams_content/component/paragraph/zmi/__init__.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/__init__.py	Fri May 18 15:54:14 2018 +0200
@@ -21,7 +21,7 @@
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView
 from pyams_content.interfaces import MANAGE_TOOL_PERMISSION
 from pyams_content.shared.common.interfaces import IWfSharedContent
-from pyams_form.interfaces.form import IFormHelp
+from pyams_form.interfaces.form import IFormHelp, check_submit_button
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.container import ITableElementName
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
@@ -33,6 +33,7 @@
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerTable, ParagraphContainerBaseTable
 from pyams_form.form import AJAXEditForm, AJAXAddForm
 from pyams_form.help import FormHelp
+from pyams_form.schema import ActionButton, CloseButton
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.event import get_json_switched_table_refresh_event
@@ -46,7 +47,8 @@
 from pyams_zmi.form import AdminDialogEditForm
 from pyramid.location import lineage
 from pyramid.view import view_config
-from z3c.form import field
+from z3c.form import field, button
+from zope.interface import Interface
 
 from pyams_content import _
 
@@ -103,15 +105,16 @@
 def get_json_paragraph_refresh_event(context, request):
     """Get JSON response value for paragraph refresh event"""
     parent = get_parent(context, IParagraphContainerTarget)
-    return {
-        'event': 'myams.refresh',
-        'options': {
-            'handler': 'PyAMS_content.paragraphs.refreshParagraph',
-            'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
-            'title': II18n(context).query_attribute('title', request=request),
-            'visible': context.visible
+    if parent is not None:
+        return {
+            'event': 'myams.refresh',
+            'options': {
+                'handler': 'PyAMS_content.paragraphs.refreshParagraph',
+                'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
+                'title': II18n(context).query_attribute('title', request=request),
+                'visible': context.visible
+            }
         }
-    }
 
 
 def get_json_paragraph_toolbar_refresh_event(context, request, table_factory=None, viewlet_factory=None):
@@ -122,34 +125,36 @@
         from pyams_content.component.paragraph.zmi.container import ParagraphTitleToolbarViewletManager as viewlet_factory
 
     parent = get_parent(context, IParagraphContainerTarget)
-    table = table_factory(context, request)
-    viewlet = viewlet_factory(context, request, table)
-    viewlet.update()
-    return {
-        'event': 'myams.refresh',
-        'options': {
-            'handler': 'PyAMS_content.paragraphs.updateToolbar',
-            'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
-            'toolbar_tag': viewlet.render()
+    if parent is not None:
+        table = table_factory(context, request)
+        viewlet = viewlet_factory(context, request, table)
+        viewlet.update()
+        return {
+            'event': 'myams.refresh',
+            'options': {
+                'handler': 'PyAMS_content.paragraphs.updateToolbar',
+                'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
+                'toolbar_tag': viewlet.render()
+            }
         }
-    }
 
 
 def get_json_paragraph_markers_refresh_event(context, request, form, viewlet_factory, marker_type=None):
     """Get JSON response value for paragraph markers refresh event"""
     parent = get_parent(context, IParagraphContainerTarget)
-    marker = viewlet_factory(context, request, form, None)
-    if marker is not None:
-        marker.update()
-        return {
-            'event': 'myams.refresh',
-            'options': {
-                'handler': 'PyAMS_content.paragraphs.updateMarkers',
-                'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
-                'marker_type': marker_type or marker.marker_type,
-                'marker_tag': marker.render()
+    if parent is not None:
+        marker = viewlet_factory(context, request, form, None)
+        if marker is not None:
+            marker.update()
+            return {
+                'event': 'myams.refresh',
+                'options': {
+                    'handler': 'PyAMS_content.paragraphs.updateMarkers',
+                    'object_id': get_element_id(ParagraphContainerBaseTable, context, parent),
+                    'marker_type': marker_type or marker.marker_type,
+                    'marker_tag': marker.render()
+                }
             }
-        }
 
 
 class BaseParagraphAddMenu(ProtectedFormObjectMixin, ToolbarMenuItem):
@@ -196,10 +201,24 @@
         }
 
 
+class IParagraphEditFormButtons(Interface):
+    """Paragraph edit form buttons"""
+
+    preview = ActionButton(name='preview', title=_("Preview"),
+                           label_css_class='fa fa-fw fa-eye',
+                           url='preview.html',
+                           modal_target=True)
+
+    close = CloseButton(name='close', title=_("Cancel"))
+
+    submit = button.Button(name='submit', title=_("Submit"), condition=check_submit_button)
+
+
 class BaseParagraphPropertiesEditForm(AdminDialogEditForm):
     """Base paragraph edit form"""
 
     prefix = 'paragraph.'
+    buttons = button.Buttons(IParagraphEditFormButtons)
 
     @property
     def title(self):
--- a/src/pyams_content/component/paragraph/zmi/contact.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/contact.py	Fri May 18 15:54:14 2018 +0200
@@ -21,7 +21,7 @@
 from pyams_content.component.paragraph.interfaces.contact import CONTACT_PARAGRAPH_TYPE, IContactParagraph
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerView, IParagraphInnerEditor
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
-from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from transaction.interfaces import ITransactionManager
@@ -30,7 +30,8 @@
 # import packages
 from pyams_content.component.paragraph.contact import ContactParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \
-    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event
+    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event, \
+    IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
@@ -126,7 +127,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/frame.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/frame.py	Fri May 18 15:54:14 2018 +0200
@@ -23,7 +23,7 @@
 from pyams_content.component.paragraph.interfaces.frame import IFrameParagraph, FRAME_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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.tinymce import ITinyMCEConfiguration
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -34,7 +34,8 @@
 from pyams_content.component.association.zmi import AssociationsTable
 from pyams_content.component.paragraph.frame import FrameParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_toolbar_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_toolbar_refresh_event, \
+    IParagraphEditFormButtons
 from pyams_content.component.paragraph.zmi.container import ParagraphContainerTable, \
     ParagraphTitleToolbarViewletManager
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
@@ -182,7 +183,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/header.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/header.py	Fri May 18 15:54:14 2018 +0200
@@ -21,7 +21,7 @@
 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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from z3c.form.interfaces import INPUT_MODE
@@ -29,7 +29,7 @@
 # import packages
 from pyams_content.component.paragraph.header import HeaderParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
@@ -133,7 +133,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/html.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/html.py	Fri May 18 15:54:14 2018 +0200
@@ -25,7 +25,7 @@
     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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -36,7 +36,8 @@
 from pyams_content.component.association.zmi import AssociationsTable
 from pyams_content.component.paragraph.html import HTMLParagraph, RawParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_toolbar_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_toolbar_refresh_event, \
+    IParagraphEditFormButtons
 from pyams_form.security import ProtectedFormObjectMixin
 from pyams_pagelet.pagelet import pagelet_config
 from pyams_skin.event import get_json_switched_table_refresh_event
@@ -150,7 +151,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
@@ -286,7 +287,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/keynumber.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/keynumber.py	Fri May 18 15:54:14 2018 +0200
@@ -21,11 +21,11 @@
     IParagraphRenderer
 from pyams_content.component.paragraph.interfaces.keynumber import KEYNUMBER_PARAGRAPH_TYPE, IKeyNumberParagraph, \
     IKeyNumberContainer, IKeyNumberContainerTarget, IKeyNumber
-from pyams_content.component.paragraph.zmi import IParagraphContainerView
+from pyams_content.component.paragraph.zmi import IParagraphContainerView, IParagraphEditFormButtons
 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_form.interfaces.form import IInnerForm, IEditFormButtons, IInnerSubForm
+from pyams_form.interfaces.form import IInnerForm, IInnerSubForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IWidgetTitleViewletManager
 from pyams_skin.layer import IPyAMSLayer
@@ -145,7 +145,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/keypoint.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/keypoint.py	Fri May 18 15:54:14 2018 +0200
@@ -21,7 +21,7 @@
 from pyams_content.component.paragraph.interfaces.keypoint import IKeypointsParagraph, KEYPOINTS_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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from z3c.form.interfaces import INPUT_MODE
@@ -29,7 +29,7 @@
 # import packages
 from pyams_content.component.paragraph.keypoint import KeypointsParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, get_json_paragraph_refresh_event, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
@@ -134,7 +134,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/milestone.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/milestone.py	Fri May 18 15:54:14 2018 +0200
@@ -21,11 +21,11 @@
     IParagraphRenderer
 from pyams_content.component.paragraph.interfaces.milestone import MILESTONE_PARAGRAPH_TYPE, IMilestoneParagraph, \
     IMilestoneContainer, IMilestoneContainerTarget, IMilestone
-from pyams_content.component.paragraph.zmi import IParagraphContainerView
+from pyams_content.component.paragraph.zmi import IParagraphContainerView, IParagraphEditFormButtons
 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_form.interfaces.form import IInnerForm, IEditFormButtons, IInnerSubForm
+from pyams_form.interfaces.form import IInnerForm, IInnerSubForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IWidgetTitleViewletManager
 from pyams_skin.layer import IPyAMSLayer
@@ -146,7 +146,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/pictogram.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/pictogram.py	Fri May 18 15:54:14 2018 +0200
@@ -21,11 +21,11 @@
     IParagraphRenderer
 from pyams_content.component.paragraph.interfaces.pictogram import PICTOGRAM_PARAGRAPH_TYPE, IPictogramParagraph, \
     IPictogramContainer, IPictogramContainerTarget, IPictogramItem
-from pyams_content.component.paragraph.zmi import IParagraphContainerView
+from pyams_content.component.paragraph.zmi import IParagraphContainerView, IParagraphEditFormButtons
 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_form.interfaces.form import IInnerForm, IEditFormButtons, IInnerSubForm
+from pyams_form.interfaces.form import IInnerForm, IInnerSubForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu, IWidgetTitleViewletManager
 from pyams_skin.layer import IPyAMSLayer
@@ -148,7 +148,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/preview.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/preview.py	Fri May 18 15:54:14 2018 +0200
@@ -22,7 +22,7 @@
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
-from pyams_content.features.renderer.zmi import BaseContentRenderer
+from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_utils.adapter import adapter_config
 
 
--- a/src/pyams_content/component/paragraph/zmi/verbatim.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/verbatim.py	Fri May 18 15:54:14 2018 +0200
@@ -9,7 +9,6 @@
 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
 # FOR A PARTICULAR PURPOSE.
 #
-from pyams_skin.event import get_json_widget_refresh_event
 
 __docformat__ = 'restructuredtext'
 
@@ -23,7 +22,7 @@
 from pyams_content.component.paragraph.interfaces.verbatim import IVerbatimParagraph, VERBATIM_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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.interfaces import IPropertiesEditForm
@@ -32,10 +31,11 @@
 # import packages
 from pyams_content.component.paragraph.verbatim import VerbatimParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_pagelet.pagelet import pagelet_config
+from pyams_skin.event import get_json_widget_refresh_event
 from pyams_utils.adapter import adapter_config
 from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm
@@ -130,7 +130,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/paragraph/zmi/video.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/paragraph/zmi/video.py	Fri May 18 15:54:14 2018 +0200
@@ -22,7 +22,7 @@
 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
+from pyams_form.interfaces.form import IInnerForm
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_zmi.interfaces import IPropertiesEditForm
@@ -33,7 +33,7 @@
 from pyams_content.component.association.zmi import AssociationsTable
 from pyams_content.component.paragraph.video import VideoParagraph
 from pyams_content.component.paragraph.zmi import BaseParagraphAJAXAddForm, BaseParagraphAJAXEditForm, \
-    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm
+    BaseParagraphAddMenu, BaseParagraphPropertiesEditForm, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_form.group import NamedWidgetsGroup
@@ -172,7 +172,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/component/video/zmi/paragraph.py	Fri May 18 15:53:35 2018 +0200
+++ b/src/pyams_content/component/video/zmi/paragraph.py	Fri May 18 15:54:14 2018 +0200
@@ -22,7 +22,7 @@
 from pyams_content.component.video.interfaces import IExternalVideoProvider, IExternalVideoSettings, \
     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_form.interfaces.form import IWidgetsSuffixViewletsManager, IInnerForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -31,7 +31,8 @@
 
 # import packages
 from pyams_content.component.paragraph.zmi import BaseParagraphAddMenu, BaseParagraphAJAXAddForm, \
-    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event
+    BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, get_json_paragraph_refresh_event, \
+    IParagraphEditFormButtons
 from pyams_content.component.video.paragraph import ExternalVideoParagraph
 from pyams_form.group import NamedWidgetsGroup
 from pyams_pagelet.pagelet import pagelet_config
@@ -285,7 +286,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()