src/pyams_content/component/paragraph/interfaces/audio.py
changeset 585 9fa8e9776bda
parent 555 8e8a14452567
child 765 56e1e94a6667
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/paragraph/interfaces/audio.py	Wed Jun 06 11:06:51 2018 +0200
@@ -0,0 +1,59 @@
+#
+# 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.paragraph.interfaces import IBaseParagraph
+
+# import packages
+from pyams_file.schema import AudioField
+from pyams_i18n.schema import I18nHTMLField, I18nTextField
+from zope.schema import TextLine, Choice
+
+from pyams_content import _
+
+
+#
+# Audio paragraph
+#
+
+AUDIO_PARAGRAPH_TYPE = 'Audio'
+AUDIO_PARAGRAPH_NAME = _("Audio")
+AUDIO_PARAGRAPH_RENDERERS = 'PyAMS.paragraph.audio.renderers'
+
+
+class IAudioParagraph(IBaseParagraph):
+    """Audio paragraph"""
+
+    body = I18nHTMLField(title=_("Body"),
+                         required=False)
+
+    description = I18nTextField(title=_("Description"),
+                                description=_("File description displayed by front-office template"),
+                                required=False)
+
+    author = TextLine(title=_("Author"),
+                      description=_("Name of document's author"),
+                      required=False)
+
+    data = AudioField(title=_("Audio data"),
+                      description=_("Audio file content"),
+                      required=True)
+
+    renderer = Choice(title=_("Audio template"),
+                      description=_("Presentation template used for this audio file"),
+                      vocabulary=AUDIO_PARAGRAPH_RENDERERS,
+                      default='default')