src/pyams_content/shared/news/interfaces/__init__.py
changeset 0 7c0001cacf8e
child 17 eb468be7c127
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/shared/news/interfaces/__init__.py	Thu Oct 08 13:37:29 2015 +0200
@@ -0,0 +1,66 @@
+#
+# 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.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent
+
+# import packages
+from zope.interface import Attribute
+from zope.schema import Choice, Datetime
+from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm
+
+from pyams_content import _
+
+
+NEWS_CONTENT_TYPE = 'news'
+NEWS_CONTENT_NAME = _("News topic")
+
+
+DISPLAY_FIRST_VERSION = 'first'
+DISPLAY_CURRENT_VERSION = 'current'
+
+VERSION_DISPLAY = {DISPLAY_FIRST_VERSION: _("Display first version date"),
+                   DISPLAY_CURRENT_VERSION: _("Display current version date")}
+
+VERSION_DISPLAY_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t)
+                                               for v, t in VERSION_DISPLAY.items()])
+
+
+class INewsManager(ISharedTool):
+    """News manager interface"""
+
+
+class IWfNewsEvent(IWfSharedContent):
+    """News event interface"""
+
+    displayed_publication_date = Choice(title=_("Displayed publication date"),
+                                        description=_("The matching date will be displayed in front-office"),
+                                        vocabulary=VERSION_DISPLAY_VOCABULARY,
+                                        default=DISPLAY_FIRST_VERSION,
+                                        required=True)
+
+    publication_date = Attribute("Publication date")
+
+    push_end_date = Datetime(title=_("Push end date"),
+                             description=_("Some contents can be pushed by components to front-office pages; if you "
+                                           "set a date here, this content will not be pushed anymore passed this "
+                                           "date, but will still be available via the search engine"),
+                             required=False)
+
+
+class INewsEvent(ISharedContent):
+    """Workflow managed news event interface"""