Reorganized portlets
authorThierry Florac <thierry.florac@onf.fr>
Thu, 14 Jun 2018 17:38:57 +0200
changeset 684 8c9e0b4b8430
parent 683 20acd0a6d5a5
child 685 081cb4c45d29
child 698 9d60cec4b172
Reorganized portlets
src/pyams_content/features/renderer/zmi/__init__.py
src/pyams_content/generations/__init__.py
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.mo
src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po
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
src/pyams_content/shared/common/portlet/__init__.py
src/pyams_content/shared/common/portlet/content/__init__.py
src/pyams_content/shared/common/portlet/content/interfaces/__init__.py
src/pyams_content/shared/common/portlet/content/skin/__init__.py
src/pyams_content/shared/common/portlet/content/zmi/__init__.py
src/pyams_content/shared/common/portlet/content/zmi/preview.pt
--- a/src/pyams_content/features/renderer/zmi/__init__.py	Thu Jun 14 14:03:59 2018 +0200
+++ b/src/pyams_content/features/renderer/zmi/__init__.py	Thu Jun 14 17:38:57 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 14:03:59 2018 +0200
+++ b/src/pyams_content/generations/__init__.py	Thu Jun 14 17:38:57 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 14:03:59 2018 +0200
+++ b/src/pyams_content/locales/fr/LC_MESSAGES/pyams_content.po	Thu Jun 14 17:38:57 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 14:03:59 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 14:03:59 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 14:03:59 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 14:03:59 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 14:03:59 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 14:03:59 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:38:57 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:38:57 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:38:57 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:38:57 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:38:57 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:38:57 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>