src/pyams_content/shared/news/interfaces/__init__.py
changeset 114 7799437055f1
parent 17 eb468be7c127
child 492 04503227569d
equal deleted inserted replaced
113:05caef75bac3 114:7799437055f1
    17 
    17 
    18 # import interfaces
    18 # import interfaces
    19 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent
    19 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent
    20 
    20 
    21 # import packages
    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 
    22 
    26 from pyams_content import _
    23 from pyams_content import _
    27 
    24 
    28 
    25 
    29 NEWS_CONTENT_TYPE = 'news'
    26 NEWS_CONTENT_TYPE = 'news'
    30 NEWS_CONTENT_NAME = _("News topic")
    27 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 
    28 
    42 
    29 
    43 class INewsManager(ISharedTool):
    30 class INewsManager(ISharedTool):
    44     """News manager interface"""
    31     """News manager interface"""
    45 
    32 
    46 
    33 
    47 class IWfNewsEvent(IWfSharedContent):
    34 class IWfNewsEvent(IWfSharedContent):
    48     """News event interface"""
    35     """News event interface"""
    49 
    36 
    50     displayed_publication_date = Choice(title=_("Displayed publication date"),
       
    51                                         description=_("The matching date will be displayed in front-office"),
       
    52                                         vocabulary='PyAMS news publication date',
       
    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 
    37 
    65 class INewsEvent(ISharedContent):
    38 class INewsEvent(ISharedContent):
    66     """Workflow managed news event interface"""
    39     """Workflow managed news event interface"""