src/pyams_portal/portlets/context/__init__.py
changeset 0 6f99128c6d48
child 2 619200513bbc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_portal/portlets/context/__init__.py	Wed Jun 17 09:58:33 2015 +0200
@@ -0,0 +1,57 @@
+#
+# 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 .interfaces import IContextPortletConfiguration
+from pyams_portal.interfaces import IPortletRenderer, IPortalContext
+from pyams_skin.layer import IPyAMSLayer
+
+# import packages
+from pyams_portal.portlet import Portlet, portlet_config, PortletRenderer, PortletConfiguration
+from pyams_template.template import template_config
+from pyams_utils.adapter import adapter_config
+from zope.interface import implementer, Interface
+
+from pyams_portal import _
+
+
+CONTEXT_PORTLET_NAME = 'pyams_portal.portlet.context'
+
+
+@portlet_config(permission='view')
+class ContextPortlet(Portlet):
+    """Context portlet
+
+    The goal of this portlet is to provide context content
+    """
+
+    name = CONTEXT_PORTLET_NAME
+    label = _("Context content")
+
+
+@adapter_config(context=ContextPortlet, provides=IContextPortletConfiguration)
+@implementer(IContextPortletConfiguration)
+class ContextPortletConfiguration(PortletConfiguration):
+    """Context portlet configuration"""
+
+
+@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, ContextPortlet), provides=IPortletRenderer)
+@template_config(template='context.pt', layer=IPyAMSLayer)
+class ContextPortletRenderer(PortletRenderer):
+    """Context portlet renderer"""
+
+