merge default doc-dc
authorDamien Correia
Thu, 14 Jun 2018 17:50:28 +0200
branchdoc-dc
changeset 698 9d60cec4b172
parent 697 16c83f565a48 (current diff)
parent 684 8c9e0b4b8430 (diff)
child 699 49609728216b
merge default
src/pyams_content/portlet/__init__.py
src/pyams_content/portlet/content/__init__.py
src/pyams_content/portlet/content/interfaces/__init__.py
src/pyams_content/portlet/content/skin/__init__.py
src/pyams_content/portlet/content/zmi/__init__.py
src/pyams_content/portlet/content/zmi/preview.pt
--- a/src/pyams_content/component/illustration/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/component/illustration/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -17,7 +17,7 @@
 
 # import interfaces
 from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget, \
-    ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS
+    ILLUSTRATION_KEY, ILLUSTRATION_RENDERERS, IBasicIllustration, IBasicIllustrationTarget, BASIC_ILLUSTRATION_KEY
 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE
 from pyams_file.interfaces import IFileInfo, IImage, IResponsiveImage
 from pyams_i18n.interfaces import INegotiator, II18n, II18nManager
@@ -46,17 +46,14 @@
 from pyams_content import _
 
 
-@implementer(IIllustration)
-@factory_config(provided=IIllustration)
-class Illustration(RenderedContentMixin, Persistent, Contained):
+@implementer(IBasicIllustration)
+@factory_config(provided=IBasicIllustration)
+class BasicIllustration(Persistent, Contained):
     """Illustration persistent class"""
 
     _data = I18nFileProperty(IIllustration['data'])
     title = FieldProperty(IIllustration['title'])
     alt_title = FieldProperty(IIllustration['alt_title'])
-    description = FieldProperty(IIllustration['description'])
-    author = FieldProperty(IIllustration['author'])
-    renderer = FieldProperty(IIllustration['renderer'])
 
     @property
     def data(self):
@@ -70,6 +67,28 @@
                 alsoProvides(data, IResponsiveImage)
 
 
+@adapter_config(context=IBasicIllustrationTarget, provides=IIllustration)
+def basic_illustration_factory(context):
+    """Basic illustration factory"""
+
+    def illustration_callback(illustration):
+        get_current_registry().notify(ObjectAddedEvent(illustration, context, illustration.__name__))
+
+    return get_annotation_adapter(context, BASIC_ILLUSTRATION_KEY, BasicIllustration,
+                                  name='++illustration++',
+                                  callback=illustration_callback)
+
+
+@implementer(IIllustration)
+@factory_config(provided=IIllustration)
+class Illustration(RenderedContentMixin, BasicIllustration):
+    """Illustration persistent class"""
+
+    description = FieldProperty(IIllustration['description'])
+    author = FieldProperty(IIllustration['author'])
+    renderer = FieldProperty(IIllustration['renderer'])
+
+
 @adapter_config(context=IIllustrationTarget, provides=IIllustration)
 def illustration_factory(context):
     """Illustration factory"""
@@ -95,21 +114,21 @@
             info.description = II18n(illustration).get_attribute('alt_title', lang, request)
 
 
-@subscriber(IObjectAddedEvent, context_selector=IIllustration)
+@subscriber(IObjectAddedEvent, context_selector=IBasicIllustration)
 def handle_added_illustration(event):
     """Handle added illustration"""
     illustration = event.object
     update_illustration_properties(illustration)
 
 
-@subscriber(IObjectModifiedEvent, context_selector=IIllustration)
+@subscriber(IObjectModifiedEvent, context_selector=IBasicIllustration)
 def handle_modified_illustration(event):
     """Handle modified illustration"""
     illustration = event.object
     update_illustration_properties(illustration)
 
 
-@adapter_config(name='illustration', context=IIllustrationTarget, provides=ITraversable)
+@adapter_config(name='illustration', context=IBasicIllustrationTarget, provides=ITraversable)
 class IllustrationNamespace(ContextAdapter):
     """++illustration++ namespace adapter"""
 
@@ -118,12 +137,14 @@
         return registry.queryAdapter(self.context, IIllustration, name=name)
 
 
-@adapter_config(name='illustration', context=IIllustrationTarget, provides=ISublocations)
+@adapter_config(name='illustration', context=IBasicIllustrationTarget, provides=ISublocations)
 class IllustrationSublocations(ContextAdapter):
     """Illustration sub-locations adapter"""
 
     def sublocations(self):
-        return IIllustration(self.context),
+        registry = get_global_registry()
+        for name, adapter in registry.getAdapters((self, ), IBasicIllustration):
+            yield adapter
 
 
 @adapter_config(context=IIllustration, provides=IContentChecker)
--- a/src/pyams_content/component/illustration/interfaces/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/component/illustration/interfaces/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -22,6 +22,7 @@
 from zope.annotation.interfaces import IAttributeAnnotatable
 
 # import packages
+from zope.interface import Interface
 from zope.schema import Choice, TextLine
 
 from pyams_content import _
@@ -31,12 +32,14 @@
 # Illustration
 #
 
+BASIC_ILLUSTRATION_KEY = 'pyams_content.illustration.base'
+
 ILLUSTRATION_KEY = 'pyams_content.illustration'
 ILLUSTRATION_RENDERERS = 'PyAMS.illustration.renderers'
 
 
-class IIllustration(IRenderedContent):
-    """Illustration paragraph"""
+class IBasicIllustration(Interface):
+    """Basic illustration interface"""
 
     data = I18nThumbnailMediaField(title=_("Image or video data"),
                                    description=_("Image or video content"),
@@ -49,6 +52,10 @@
                                   description=_("Alternate title used to describe image content"),
                                   required=False)
 
+
+class IIllustration(IBasicIllustration, IRenderedContent):
+    """Illustration paragraph"""
+
     description = I18nTextField(title=_("Description"),
                                 description=_(""),
                                 required=False)
@@ -63,8 +70,12 @@
                       default='default')
 
 
-class IIllustrationTarget(IAttributeAnnotatable):
-    """Illustration target marker interface"""
+class IBasicIllustrationTarget(IAttributeAnnotatable):
+    """Basic illustration target marker interface"""
+
+
+class IIllustrationTarget(IBasicIllustrationTarget):
+    """Illustration target interface"""
 
 
 ILLUSTRATION_PARAGRAPH_TYPE = 'Illustration'
--- a/src/pyams_content/component/illustration/zmi/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/component/illustration/zmi/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -16,7 +16,8 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.illustration.interfaces import IIllustration, IIllustrationTarget
+from pyams_content.component.illustration.interfaces import IBasicIllustration, IBasicIllustrationTarget, \
+    IIllustration, IIllustrationTarget
 from pyams_content.component.paragraph import IBaseParagraph
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphContainerTable, IParagraphTitleToolbar
 from pyams_form.interfaces.form import IInnerSubForm, IWidgetsPrefixViewletsManager
@@ -64,10 +65,10 @@
         return ''
 
 
-@adapter_config(name='illustration', context=(IIllustrationTarget, IPyAMSLayer, IPropertiesEditForm),
+@adapter_config(name='illustration', context=(IBasicIllustrationTarget, IPyAMSLayer, IPropertiesEditForm),
                 provides=IInnerSubForm)
-class IllustrationPropertiesInnerEditForm(InnerAdminEditForm):
-    """Illustration properties inner edit form"""
+class BasicIllustrationPropertiesInnerEditForm(InnerAdminEditForm):
+    """Basic illustration properties inner edit form"""
 
     prefix = 'illustration_form.'
 
@@ -75,6 +76,43 @@
     padding_class = ''
     fieldset_class = 'margin-top-10 padding-y-5'
 
+    legend = _("Illustration")
+    legend_class = 'illustration switcher no-y-padding padding-right-10 pull-left width-auto'
+
+    fields = field.Fields(IBasicIllustration).omit('__parent__', '__name__')
+
+    weight = 10
+
+    def getContent(self):
+        return IIllustration(self.context)
+
+    def check_mode(self):
+        if self.parent_form is not None:
+            self.mode = self.parent_form.mode
+
+    @property
+    def switcher_state(self):
+        content = self.getContent()
+        for value in (content.data or {}).values():
+            if value:
+                return 'open'
+
+    def get_ajax_output(self, changes):
+        output = super(BasicIllustrationPropertiesInnerEditForm, self).get_ajax_output(changes)
+        updated = changes.get(IIllustration, ())
+        events = output.setdefault('events', [])
+        if 'data' in updated:
+            # we have to commit transaction to be able to handle blobs...
+            ITransactionManager(self.context).get().commit()
+            events.append(get_json_form_refresh_event(self.context, self.request, self.__class__))
+        return output
+
+
+@adapter_config(name='illustration', context=(IIllustrationTarget, IPyAMSLayer, IPropertiesEditForm),
+                provides=IInnerSubForm)
+class IllustrationPropertiesInnerEditForm(BasicIllustrationPropertiesInnerEditForm):
+    """Illustration properties inner edit form"""
+
     @property
     def legend(self):
         if IBaseParagraph.providedBy(self.context):
@@ -93,14 +131,6 @@
     fields['renderer'].widgetFactory = RendererFieldWidget
 
     hide_widgets_prefix_div = True
-    weight = 10
-
-    def getContent(self):
-        return IIllustration(self.context)
-
-    def check_mode(self):
-        if self.parent_form is not None:
-            self.mode = self.parent_form.mode
 
     def updateWidgets(self, prefix=None):
         super(IllustrationPropertiesInnerEditForm, self).updateWidgets(prefix)
@@ -112,10 +142,6 @@
         updated = changes.get(IIllustration, ())
         events = output.setdefault('events', [])
         if 'data' in updated:
-            # we have to commit transaction to be able to handle blobs...
-            ITransactionManager(self.context).get().commit()
-            events.append(get_json_form_refresh_event(self.context, self.request,
-                                                      IllustrationPropertiesInnerEditForm))
             if IBaseParagraph.providedBy(self.context):
                 if self.getContent().data:
                     events.append(get_json_paragraph_markers_refresh_event(self.context, self.request, self,
@@ -130,8 +156,8 @@
         return output
 
 
-@viewlet_config(name='illustration-thumbnail', context=IIllustrationTarget, layer=IPyAMSLayer,
-                view=IllustrationPropertiesInnerEditForm, manager=IWidgetsPrefixViewletsManager)
+@viewlet_config(name='illustration-thumbnail', context=IBasicIllustrationTarget, layer=IPyAMSLayer,
+                view=BasicIllustrationPropertiesInnerEditForm, manager=IWidgetsPrefixViewletsManager)
 @template_config(template='templates/illustration-thumbnail.pt', layer=IPyAMSLayer)
 class IllustrationThumbnail(Viewlet):
     """Paragraph illustration thumbnail"""
--- a/src/pyams_content/component/links/zmi/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/component/links/zmi/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -25,6 +25,7 @@
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+from pyams_zmi.interfaces import IPropertiesEditForm
 
 # import packages
 from pyams_content.component.association.zmi import AssociationItemAJAXAddForm, AssociationItemAJAXEditForm
@@ -39,6 +40,7 @@
 from pyams_viewlet.viewlet import viewlet_config
 from pyams_zmi.form import AdminDialogAddForm, AdminDialogEditForm
 from z3c.form import field
+from zope.interface import implementer
 
 from pyams_content import _
 
@@ -114,6 +116,7 @@
 @pagelet_config(name='properties.html', context=IInternalLink, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
 @ajax_config(name='properties.json', context=IInternalLink, layer=IPyAMSLayer,
              permission=MANAGE_CONTENT_PERMISSION, base=AssociationItemAJAXEditForm)
+@implementer(IPropertiesEditForm)
 class InternalLinkPropertiesEditForm(AdminDialogEditForm):
     """Internal link properties edit form"""
 
@@ -121,6 +124,7 @@
 
     legend = _("Edit internal link properties")
     icon_css_class = 'fa fa-fw fa-external-link-square fa-rotate-90'
+    dialog_class = 'modal-large'
 
     fields = field.Fields(IInternalLink).select('reference', 'title', 'description', 'pictogram_name')
     fields['pictogram_name'].widgetFactory = PictogramSelectFieldWidget
@@ -211,6 +215,7 @@
 @pagelet_config(name='properties.html', context=IExternalLink, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
 @ajax_config(name='properties.json', context=IExternalLink, layer=IPyAMSLayer,
              permission=MANAGE_CONTENT_PERMISSION, base=AssociationItemAJAXEditForm)
+@implementer(IPropertiesEditForm)
 class ExternalLinkPropertiesEditForm(AdminDialogEditForm):
     """External link properties edit form"""
 
@@ -308,6 +313,7 @@
 @pagelet_config(name='properties.html', context=IMailtoLink, layer=IPyAMSLayer, permission=VIEW_SYSTEM_PERMISSION)
 @ajax_config(name='properties.json', context=IMailtoLink, layer=IPyAMSLayer,
              permission=MANAGE_CONTENT_PERMISSION, base=AssociationItemAJAXEditForm)
+@implementer(IPropertiesEditForm)
 class MailtoLinkPropertiesEditForm(AdminDialogEditForm):
     """Mailto link properties edit form"""
 
--- a/src/pyams_content/features/renderer/zmi/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/features/renderer/zmi/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -56,10 +56,9 @@
 
 
 #
-# Base content renderer
+# Base content renderer edit form
 #
 
-
 @pagelet_config(name='renderer-properties.html', context=IRenderedContent, layer=IPyAMSLayer,
                 permission=MANAGE_CONTENT_PERMISSION)
 @ajax_config(name='renderer-properties.json', context=IRenderedContent, layer=IPyAMSLayer)
--- a/src/pyams_content/generations/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/generations/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -68,7 +68,13 @@
     'pyams_content.component.paragraph.keynumber KeyNumber':
         'pyams_content.component.keynumber KeyNumber',
     'pyams_content.component.paragraph.keynumber KeyNumberContainer':
-        'pyams_content.component.keynumber KeyNumberContainer'
+        'pyams_content.component.keynumber KeyNumberContainer',
+    'pyams_content.portlet.content SharedContentPortletSettings':
+        'pyams_content.shared.common.portlet.content SharedContentPortletSettings',
+    'pyams_content.portlet.navigation SimpleNavigationPortletSettings':
+        'pyams_content.features.menu.portlet.navigation.simple SimpleNavigationPortletSettings',
+    'pyams_content.portlet.navigation.interfaces ISimpleNavigationMenu':
+        'pyams_content.features.menu.portlet.navigation.interfaces.simple ISimpleNavigationMenu'
 }
 
 
Binary file src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo has changed
--- a/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Thu Jun 14 10:41:32 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Thu Jun 14 17:50:28 2018 +0200
@@ -183,7 +183,7 @@
 #: src/pyams_content/component/illustration/interfaces/__init__.py:41
 #: src/pyams_content/component/illustration/interfaces/__init__.py:77
 msgid "Image or video data"
-msgstr "Fichier (image ou vidéo)"
+msgstr "Fichier"
 
 #: src/pyams_content/component/gallery/interfaces/__init__.py:48
 #: src/pyams_content/component/illustration/interfaces/__init__.py:42
--- a/src/pyams_content/portlet/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-#
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-
-# import packages
--- a/src/pyams_content/portlet/content/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-#
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.portlet.content.interfaces import ISharedContentPortletSettings
-from pyams_utils.interfaces import VIEW_PERMISSION
-
-# import packages
-from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
-from zope.interface import implementer
-
-from pyams_content import _
-
-
-SHARED_CONTENT_PORTLET_NAME = 'pyams_content.portlet.content'
-
-
-@implementer(ISharedContentPortletSettings)
-class SharedContentPortletSettings(PortletSettings):
-    """Shared content portlet persistent settings"""
-
-
-@portlet_config(permission=VIEW_PERMISSION)
-class SharedContentPortlet(Portlet):
-    """Shared content portlet"""
-
-    name = SHARED_CONTENT_PORTLET_NAME
-    label = _("Context content")
-
-    settings_class = SharedContentPortletSettings
--- a/src/pyams_content/portlet/content/interfaces/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_portal.interfaces import IPortletSettings
-
-# import packages
-
-
-class ISharedContentPortletSettings(IPortletSettings):
-    """Shared content portlet settings interface"""
--- a/src/pyams_content/portlet/content/skin/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-# import standard library
-
-# import interfaces
-from pyams_content.portlet.content.interfaces import ISharedContentPortletSettings
-from pyams_content.features.renderer.interfaces import ISharedContentRenderer
-from pyams_portal.interfaces import IPortalContext, IPortletRenderer
-from pyams_skin.layer import IPyAMSLayer
-
-# import packages
-from pyams_portal.portlet import PortletRenderer
-from pyams_utils.adapter import adapter_config
-from zope.interface import Interface
-
-from pyams_content import _
-
-
-@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISharedContentPortletSettings),
-                provides=IPortletRenderer)
-class SharedContentPortletRenderer(PortletRenderer):
-    """Shared content portlet renderer"""
-
-    label = _("Default content renderer")
-
-    def __init__(self, context, request, view, settings):
-        super(SharedContentPortletRenderer, self).__init__(context, request, view, settings)
-        registry = self.request.registry
-        self.renderers = [adapter for name, adapter in sorted(registry.getAdapters((self.context, self.request),
-                                                                                   ISharedContentRenderer),
-                                                              key=lambda x: x[1].weight)]
-
-    def update(self):
-        super(SharedContentPortletRenderer, self).update()
-        [renderer.update() for renderer in self.renderers]
-
-    def render(self):
-        result = ''
-        for renderer in self.renderers:
-            if renderer is not None:
-                result += renderer.render()
-        return result
--- a/src/pyams_content/portlet/content/zmi/__init__.py	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-#
-# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.portlet.content.interfaces import ISharedContentPortletSettings
-from pyams_pagelet.interfaces import IPagelet
-from pyams_portal.interfaces import IPortletPreviewer
-from pyams_skin.layer import IPyAMSLayer
-from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
-
-# import packages
-from pyams_form.form import AJAXEditForm
-from pyams_pagelet.pagelet import pagelet_config
-from pyams_portal.portlet import PortletPreviewer
-from pyams_portal.zmi.portlet import PortletSettingsEditor
-from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config
-from zope.interface import Interface
-
-
-@pagelet_config(name='properties.html', context=ISharedContentPortletSettings, layer=IPyAMSLayer,
-                permission=VIEW_SYSTEM_PERMISSION)
-class SharedContentPortletSettingsEditor(PortletSettingsEditor):
-    """Shared content portlet settings editor"""
-
-    settings = ISharedContentPortletSettings
-
-
-@adapter_config(name='properties.json', context=(ISharedContentPortletSettings, IPyAMSLayer), provides=IPagelet)
-class SharedContentPortletConfigurationAJAXEditor(AJAXEditForm, SharedContentPortletSettingsEditor):
-    """Shared content portlet settings editor, JSON renderer"""
-
-
-@adapter_config(context=(Interface, IPyAMSLayer, Interface, ISharedContentPortletSettings),
-                provides=IPortletPreviewer)
-@template_config(template='preview.pt', layer=IPyAMSLayer)
-class SharedContentPortletPreviewer(PortletPreviewer):
-    """Shared content portlet previewer"""
--- a/src/pyams_content/portlet/content/zmi/preview.pt	Thu Jun 14 10:41:32 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-<tal:var define="settings view.settings" i18n:domain="pyams_content">
-	<span class="padding-5" i18n:translate="">This is where the content will be displayed!!</span>
-</tal:var>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,19 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+# import standard library
+
+# import interfaces
+
+# import packages
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.portlet.content.interfaces import ISharedContentPortletSettings
+from pyams_utils.interfaces import VIEW_PERMISSION
+
+# import packages
+from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
+from zope.interface import implementer
+
+from pyams_content import _
+
+
+SHARED_CONTENT_PORTLET_NAME = 'pyams_content.portlet.content'
+
+
+@implementer(ISharedContentPortletSettings)
+class SharedContentPortletSettings(PortletSettings):
+    """Shared content portlet persistent settings"""
+
+
+@portlet_config(permission=VIEW_PERMISSION)
+class SharedContentPortlet(Portlet):
+    """Shared content portlet"""
+
+    name = SHARED_CONTENT_PORTLET_NAME
+    label = _("Context content")
+
+    settings_class = SharedContentPortletSettings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/interfaces/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_portal.interfaces import IPortletSettings
+
+# import packages
+
+
+class ISharedContentPortletSettings(IPortletSettings):
+    """Shared content portlet settings interface"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/skin/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,54 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.portlet.content.interfaces import ISharedContentPortletSettings
+from pyams_content.features.renderer.interfaces import ISharedContentRenderer
+from pyams_portal.interfaces import IPortalContext, IPortletRenderer
+from pyams_skin.layer import IPyAMSLayer
+
+# import packages
+from pyams_portal.portlet import PortletRenderer
+from pyams_utils.adapter import adapter_config
+from zope.interface import Interface
+
+from pyams_content import _
+
+
+@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ISharedContentPortletSettings),
+                provides=IPortletRenderer)
+class SharedContentPortletRenderer(PortletRenderer):
+    """Shared content portlet renderer"""
+
+    label = _("Default content renderer")
+
+    def __init__(self, context, request, view, settings):
+        super(SharedContentPortletRenderer, self).__init__(context, request, view, settings)
+        registry = self.request.registry
+        self.renderers = [adapter for name, adapter in sorted(registry.getAdapters((self.context, self.request),
+                                                                                   ISharedContentRenderer),
+                                                              key=lambda x: x[1].weight)]
+
+    def update(self):
+        super(SharedContentPortletRenderer, self).update()
+        [renderer.update() for renderer in self.renderers]
+
+    def render(self):
+        result = ''
+        for renderer in self.renderers:
+            if renderer is not None:
+                result += renderer.render()
+        return result
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/zmi/__init__.py	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,52 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+# import standard library
+
+# import interfaces
+from pyams_content.shared.common.portlet.content.interfaces import ISharedContentPortletSettings
+from pyams_pagelet.interfaces import IPagelet
+from pyams_portal.interfaces import IPortletPreviewer
+from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+
+# import packages
+from pyams_form.form import AJAXEditForm
+from pyams_pagelet.pagelet import pagelet_config
+from pyams_portal.portlet import PortletPreviewer
+from pyams_portal.zmi.portlet import PortletSettingsEditor
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+from zope.interface import Interface
+
+
+@pagelet_config(name='properties.html', context=ISharedContentPortletSettings, layer=IPyAMSLayer,
+                permission=VIEW_SYSTEM_PERMISSION)
+class SharedContentPortletSettingsEditor(PortletSettingsEditor):
+    """Shared content portlet settings editor"""
+
+    settings = ISharedContentPortletSettings
+
+
+@adapter_config(name='properties.json', context=(ISharedContentPortletSettings, IPyAMSLayer), provides=IPagelet)
+class SharedContentPortletConfigurationAJAXEditor(AJAXEditForm, SharedContentPortletSettingsEditor):
+    """Shared content portlet settings editor, JSON renderer"""
+
+
+@adapter_config(context=(Interface, IPyAMSLayer, Interface, ISharedContentPortletSettings),
+                provides=IPortletPreviewer)
+@template_config(template='preview.pt', layer=IPyAMSLayer)
+class SharedContentPortletPreviewer(PortletPreviewer):
+    """Shared content portlet previewer"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/common/portlet/content/zmi/preview.pt	Thu Jun 14 17:50:28 2018 +0200
@@ -0,0 +1,3 @@
+<tal:var define="settings view.settings" i18n:domain="pyams_content">
+	<span class="padding-5" i18n:translate="">This is where the content will be displayed!!</span>
+</tal:var>