src/pyams_content/component/paragraph/interfaces/__init__.py
changeset 0 7c0001cacf8e
child 7 cbc55162b64e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/paragraph/interfaces/__init__.py	Thu Oct 08 13:37:29 2015 +0200
@@ -0,0 +1,93 @@
+#
+# 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 zope.annotation.interfaces import IAttributeAnnotatable
+from zope.container.interfaces import IOrderedContainer
+from zope.contentprovider.interfaces import IContentProvider
+
+# import packages
+from pyams_file.schema import ImageField
+from pyams_i18n.schema import I18nTextLineField, I18nHTMLField
+from zope.container.constraints import containers, contains
+from zope.interface import Interface, Attribute
+from zope.schema import Choice
+
+from pyams_content import _
+
+
+PARAGRAPH_CONTAINER_KEY = 'pyams_content.paragraph'
+
+
+class IBaseParagraph(IAttributeAnnotatable):
+    """Base paragraph interface"""
+
+    containers('.IParagraphContainer')
+
+    title = I18nTextLineField(title=_("Title"),
+                              description=_("Paragraph title"),
+                              required=False)
+
+
+class IParagraphContainer(IOrderedContainer):
+    """Paragraphs container"""
+
+    contains(IBaseParagraph)
+
+
+class IParagraphContainerTarget(Interface):
+    """Paragraphs container marker interface"""
+
+
+class IParagraphSummary(IContentProvider):
+    """Paragraph summary renderer"""
+
+    language = Attribute("Summary language")
+
+
+#
+# HTML paragraph
+#
+
+class IHTMLParagraph(IBaseParagraph):
+    """HTML body paragraph"""
+
+    body = I18nHTMLField(title=_("Body"),
+                         required=True)
+
+
+#
+# Illustration
+#
+
+class IIllustrationRenderer(IContentProvider):
+    """Illustration renderer utility interface"""
+
+    label = Attribute("Renderer label")
+
+
+class IIllustrationParagraph(IBaseParagraph):
+    """Illustration paragraph"""
+
+    data = ImageField(title=_("Image data"),
+                      required=True)
+
+    legend = I18nTextLineField(title=_("Legend"),
+                               required=False)
+
+    renderer = Choice(title=_("Image style"),
+                      vocabulary='PyAMS illustration renderers')