Include keynumber portlet (merge dev-dc)
authortflorac@dagon.home
Sun, 17 Jun 2018 16:41:24 +0200
changeset 705 6490cb72a126
parent 704 9a84fae4ec97 (current diff)
parent 702 5d1e4e777dbc (diff)
child 706 010346ccded0
Include keynumber portlet (merge dev-dc)
src/pyams_content.egg-info/PKG-INFO
src/pyams_content.egg-info/SOURCES.txt
src/pyams_content/component/keynumber/portlet/__init__.py
src/pyams_content/component/keynumber/portlet/interfaces/__init__.py
src/pyams_content/component/keynumber/portlet/zmi/__init__.py
src/pyams_content/component/keynumber/portlet/zmi/templates/keynumber-preview.pt
src/pyams_content/component/keynumber/portlet/zmi/templates/preview.pt
src/pyams_content/root/__init__.py
--- a/src/pyams_content.egg-info/PKG-INFO	Fri Jun 15 22:17:34 2018 +0200
+++ b/src/pyams_content.egg-info/PKG-INFO	Sun Jun 17 16:41:24 2018 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: pyams-content
-Version: 0.1.14
+Version: 0.1.15
 Summary: PyAMS base content interfaces and classes
 Home-page: http://hg.ztfy.org/pyams/pyams_content
 Author: Thierry Florac
@@ -73,6 +73,13 @@
         History
         =======
         
+        0.1.15
+        ------
+         - added "basic" illustration component
+         - added pictogram selection widget
+         - added optional pictogram to links
+         - added generic menu feature
+        
         0.1.14
         ------
          - added header and footer management features
--- a/src/pyams_content.egg-info/SOURCES.txt	Fri Jun 15 22:17:34 2018 +0200
+++ b/src/pyams_content.egg-info/SOURCES.txt	Sun Jun 17 16:41:24 2018 +0200
@@ -43,6 +43,13 @@
 src/pyams_content/component/illustration/zmi/paragraph.py
 src/pyams_content/component/illustration/zmi/templates/illustration-thumbnail.pt
 src/pyams_content/component/illustration/zmi/templates/paragraph-illustration-icon.pt
+src/pyams_content/component/keynumber/__init__.py
+src/pyams_content/component/keynumber/interfaces/__init__.py
+src/pyams_content/component/keynumber/portlet/__init__.py
+src/pyams_content/component/keynumber/portlet/interfaces/__init__.py
+src/pyams_content/component/keynumber/portlet/zmi/__init__.py
+src/pyams_content/component/keynumber/portlet/zmi/templates/keynumber-preview.pt
+src/pyams_content/component/keynumber/zmi/__init__.py
 src/pyams_content/component/links/__init__.py
 src/pyams_content/component/links/interfaces/__init__.py
 src/pyams_content/component/links/zmi/__init__.py
@@ -136,6 +143,22 @@
 src/pyams_content/features/header/skin/__init__.py
 src/pyams_content/features/header/zmi/__init__.py
 src/pyams_content/features/header/zmi/templates/renderer-settings.pt
+src/pyams_content/features/menu/__init__.py
+src/pyams_content/features/menu/interfaces/__init__.py
+src/pyams_content/features/menu/portlet/__init__.py
+src/pyams_content/features/menu/portlet/navigation/__init__.py
+src/pyams_content/features/menu/portlet/navigation/double.py
+src/pyams_content/features/menu/portlet/navigation/simple.py
+src/pyams_content/features/menu/portlet/navigation/interfaces/__init__.py
+src/pyams_content/features/menu/portlet/navigation/interfaces/double.py
+src/pyams_content/features/menu/portlet/navigation/interfaces/simple.py
+src/pyams_content/features/menu/portlet/navigation/zmi/__init__.py
+src/pyams_content/features/menu/portlet/navigation/zmi/double.py
+src/pyams_content/features/menu/portlet/navigation/zmi/simple.py
+src/pyams_content/features/menu/portlet/navigation/zmi/templates/double-preview.pt
+src/pyams_content/features/menu/portlet/navigation/zmi/templates/simple-preview.pt
+src/pyams_content/features/menu/zmi/__init__.py
+src/pyams_content/features/menu/zmi/templates/menu-name-cell.pt
 src/pyams_content/features/preview/__init__.py
 src/pyams_content/features/preview/interfaces.py
 src/pyams_content/features/preview/zmi/__init__.py
@@ -160,12 +183,6 @@
 src/pyams_content/locales/pyams_content.pot
 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.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/profile/__init__.py
 src/pyams_content/profile/admin.py
 src/pyams_content/profile/interfaces/__init__.py
@@ -177,6 +194,7 @@
 src/pyams_content/reference/pictograms/interfaces/__init__.py
 src/pyams_content/reference/pictograms/zmi/__init__.py
 src/pyams_content/reference/pictograms/zmi/manager.py
+src/pyams_content/reference/pictograms/zmi/widget.py
 src/pyams_content/reference/pictograms/zmi/templates/manager-selection.pt
 src/pyams_content/reference/pictograms/zmi/templates/pictogram-header.pt
 src/pyams_content/reference/zmi/__init__.py
@@ -204,6 +222,12 @@
 src/pyams_content/shared/common/interfaces/__init__.py
 src/pyams_content/shared/common/interfaces/types.py
 src/pyams_content/shared/common/interfaces/zmi.py
+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
 src/pyams_content/shared/common/zmi/__init__.py
 src/pyams_content/shared/common/zmi/dashboard.py
 src/pyams_content/shared/common/zmi/header.py
@@ -300,9 +324,7 @@
 src/pyams_content/shared/view/zmi/__init__.py
 src/pyams_content/shared/view/zmi/properties.py
 src/pyams_content/shared/view/zmi/reference.py
-src/pyams_content/shared/view/zmi/render.py
 src/pyams_content/shared/view/zmi/theme.py
-src/pyams_content/shared/view/zmi/templates/render.pt
 src/pyams_content/skin/__init__.py
 src/pyams_content/skin/routes.py
 src/pyams_content/skin/resources/css/pyams_content.css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/portlet/__init__.py	Sun Jun 17 16:41:24 2018 +0200
@@ -0,0 +1,57 @@
+#
+# 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.component.keynumber.interfaces import IKeyNumberContainerTarget, IKeyNumberContainer
+from pyams_content.component.keynumber.portlet.interfaces import IKeyNumberPortletSettings
+from pyams_utils.interfaces import VIEW_PERMISSION
+
+# import packages
+from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
+from pyams_utils.factory import factory_config
+from zope.interface import implementer
+from zope.schema.fieldproperty import FieldProperty
+
+from pyams_content import _
+
+
+KEYNUMBER_PORTLET_NAME = "pyams_portal.portlet.keynumber"
+
+
+@implementer(IKeyNumberPortletSettings, IKeyNumberContainerTarget)
+@factory_config(provided=IKeyNumberPortletSettings)
+class KeyNumberPortletSettings(PortletSettings):
+    """Key Number portlet settings"""
+
+    title = FieldProperty(IKeyNumberPortletSettings['title'])
+    teaser = FieldProperty(IKeyNumberPortletSettings['teaser'])
+
+    @property
+    def keynumbers(self):
+        return IKeyNumberContainer(self)
+
+
+@portlet_config(permission=VIEW_PERMISSION)
+class KeyNumberPortlet(Portlet):
+    """Key number portlet"""
+
+    name = KEYNUMBER_PORTLET_NAME
+    label = _("Key Numbers")
+
+    toolbar_image = None
+    toolbar_css_class = 'fa fa-fw fa-2x fa-dashboard'
+
+    settings_factory = IKeyNumberPortletSettings
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/portlet/interfaces/__init__.py	Sun Jun 17 16:41:24 2018 +0200
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2008-2015 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
+from pyams_i18n.schema import I18nTextLineField, I18nTextField
+
+from pyams_content import _
+
+
+class IKeyNumberPortletSettings(IPortletSettings):
+    """Key numbers portlet settings interface"""
+
+    title = I18nTextLineField(title=_("Title"),
+                              description=_("Portlet title"),
+                              required=False)
+
+    teaser = I18nTextField(title=_("Teaser"),
+                           description=_("Short text displayed above key numbers"),
+                           required=False)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/portlet/zmi/__init__.py	Sun Jun 17 16:41:24 2018 +0200
@@ -0,0 +1,74 @@
+#
+# Copyright (c) 2008-2015 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.component.keynumber.portlet.interfaces import IKeyNumberPortletSettings
+from pyams_portal.interfaces import IPortletPreviewer
+from pyams_form.interfaces.form import IInnerSubForm, IInnerTabForm
+from pyams_pagelet.interfaces import IPagelet
+from pyams_skin.layer import IPyAMSLayer
+from pyams_utils.interfaces import VIEW_SYSTEM_PERMISSION
+
+# import packages
+from pyams_content.component.keynumber.zmi import KeyNumbersView
+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, PortletSettingsPropertiesEditor
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+from zope.interface import Interface
+
+from pyams_content import _
+
+
+@adapter_config(context=(Interface, IPyAMSLayer, Interface, IKeyNumberPortletSettings), provides=IPortletPreviewer)
+@template_config(template='templates/keynumber-preview.pt', layer=IPyAMSLayer)
+class KeyNumberPortletPreview(PortletPreviewer):
+    """Key number portlet previewer"""
+
+
+@pagelet_config(name='properties.html', context=IKeyNumberPortletSettings, layer=IPyAMSLayer,
+                permission=VIEW_SYSTEM_PERMISSION)
+class KeyNumberPortletEditor(PortletSettingsEditor):
+    """Key number portlet settings editor"""
+
+    settings = IKeyNumberPortletSettings
+
+
+@adapter_config(name='properties', context=(Interface, IPyAMSLayer, KeyNumberPortletEditor), provides=IInnerTabForm)
+class KeyNumberPortletSettingsPropertiesEditor(PortletSettingsPropertiesEditor):
+    """Key number portlet settings properties editor"""
+
+    def updateWidgets(self, prefix=None):
+        super().updateWidgets(prefix)
+        if 'teaser' in self.widgets:
+            self.widgets['teaser'].widget_css_class = 'textarea'
+
+
+@adapter_config(name='properties.json', context=(IKeyNumberPortletSettings, IPyAMSLayer), provides=IPagelet)
+class KeyNumberPortletAJAXEditor(AJAXEditForm, KeyNumberPortletEditor):
+    """Key number portlet settings editor, JSON renderer"""
+
+
+@adapter_config(name='keynumber-portlet-numbers',
+                context=(IKeyNumberPortletSettings, IPyAMSLayer, PortletSettingsPropertiesEditor),
+                provides=IInnerSubForm)
+class PortletKeynumberLinksView(KeyNumbersView):
+    """Portlet key numbers view"""
+
+    title = _("Key numbers")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/keynumber/portlet/zmi/templates/keynumber-preview.pt	Sun Jun 17 16:41:24 2018 +0200
@@ -0,0 +1,20 @@
+<div tal:define="settings view.settings" i18n:domain="pyams_content">
+	<strong tal:define="title i18n:settings.title"
+			tal:condition="title">
+		<tal:var content="title"/> :<br /></strong>
+	<div tal:content="structure html:settings.teaser">Teaser</div>
+	<ul>
+		<li tal:repeat="number settings.keynumbers.get_visible_items()">
+			<span tal:define="label i18n:number.label"
+				  tal:condition="label">
+				<tal:var content="label" /> : </span>
+			<span class="badge"
+				  tal:content="i18n:number.number">Number</span>
+			<span tal:define="unit i18n:number.unit"
+				  tal:condition="unit"
+				  tal:content="unit">Unit</span>
+			<span tal:content="i18n:number.text">text</span>
+		</li>
+	</ul>
+</div>
+
--- a/src/pyams_content/root/__init__.py	Fri Jun 15 22:17:34 2018 +0200
+++ b/src/pyams_content/root/__init__.py	Sun Jun 17 16:41:24 2018 +0200
@@ -29,8 +29,9 @@
 from pyams_form.interfaces.form import IFormContextPermissionChecker
 from pyams_portal.interfaces import IPortalContext
 from pyams_security.interfaces import IDefaultProtectionPolicy, IGrantedRoleEvent, ISecurityManager
+from pyams_skin.interfaces.configuration import IConfiguration, IBackOfficeConfiguration
 from pyams_utils.interfaces import MANAGE_SYSTEM_PERMISSION
-from pyams_utils.interfaces.site import IConfigurationFactory, IBackOfficeConfigurationFactory, ISiteRootFactory
+from pyams_utils.interfaces.site import ISiteRootFactory
 
 # import packages
 from persistent import Persistent
@@ -39,6 +40,7 @@
 from pyams_skin.configuration import Configuration, BackOfficeConfiguration
 from pyams_skin.skin import UserSkinnableContent
 from pyams_utils.adapter import adapter_config, ContextAdapter, get_annotation_adapter
+from pyams_utils.factory import factory_config
 from pyams_utils.registry import get_utility, utility_config
 from pyams_utils.site import BaseSiteRoot
 from pyams_utils.traversing import get_parent
@@ -70,25 +72,17 @@
 
 
 @implementer(ISiteRootConfiguration)
+@factory_config(provided=IConfiguration)
 class SiteRootConfiguration(Configuration):
     """Site root configuration"""
 
 
-@adapter_config(context=ISiteRoot, provides=IConfigurationFactory)
-def site_root_configuration_factory(context):
-    return SiteRootConfiguration
-
-
 @implementer(ISiteRootBackOfficeConfiguration)
+@factory_config(provided=IBackOfficeConfiguration)
 class SiteRootBackOfficeConfiguration(BackOfficeConfiguration):
     """Site root back-office configuration"""
 
 
-@adapter_config(context=ISiteRoot, provides=IBackOfficeConfigurationFactory)
-def site_root_back_office_configuration_factory(context):
-    return SiteRootBackOfficeConfiguration
-
-
 @subscriber(IGrantedRoleEvent)
 def handle_granted_role(event):
     """Add principals to operators group when a role is granted"""