|
1 # |
|
2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net> |
|
3 # All Rights Reserved. |
|
4 # |
|
5 # This software is subject to the provisions of the Zope Public License, |
|
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
|
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
|
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
|
10 # FOR A PARTICULAR PURPOSE. |
|
11 # |
|
12 |
|
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent |
|
20 |
|
21 # import packages |
|
22 from zope.interface import Attribute |
|
23 from zope.schema import Choice, Datetime |
|
24 from zope.schema.vocabulary import SimpleVocabulary, SimpleTerm |
|
25 |
|
26 from pyams_content import _ |
|
27 |
|
28 |
|
29 NEWS_CONTENT_TYPE = 'news' |
|
30 NEWS_CONTENT_NAME = _("News topic") |
|
31 |
|
32 |
|
33 DISPLAY_FIRST_VERSION = 'first' |
|
34 DISPLAY_CURRENT_VERSION = 'current' |
|
35 |
|
36 VERSION_DISPLAY = {DISPLAY_FIRST_VERSION: _("Display first version date"), |
|
37 DISPLAY_CURRENT_VERSION: _("Display current version date")} |
|
38 |
|
39 VERSION_DISPLAY_VOCABULARY = SimpleVocabulary([SimpleTerm(v, title=t) |
|
40 for v, t in VERSION_DISPLAY.items()]) |
|
41 |
|
42 |
|
43 class INewsManager(ISharedTool): |
|
44 """News manager interface""" |
|
45 |
|
46 |
|
47 class IWfNewsEvent(IWfSharedContent): |
|
48 """News event interface""" |
|
49 |
|
50 displayed_publication_date = Choice(title=_("Displayed publication date"), |
|
51 description=_("The matching date will be displayed in front-office"), |
|
52 vocabulary=VERSION_DISPLAY_VOCABULARY, |
|
53 default=DISPLAY_FIRST_VERSION, |
|
54 required=True) |
|
55 |
|
56 publication_date = Attribute("Publication date") |
|
57 |
|
58 push_end_date = Datetime(title=_("Push end date"), |
|
59 description=_("Some contents can be pushed by components to front-office pages; if you " |
|
60 "set a date here, this content will not be pushed anymore passed this " |
|
61 "date, but will still be available via the search engine"), |
|
62 required=False) |
|
63 |
|
64 |
|
65 class INewsEvent(ISharedContent): |
|
66 """Workflow managed news event interface""" |