src/pyams_content/shared/logo/interfaces/__init__.py
changeset 1059 34e6d07ea2e9
parent 1058 1fe028e17f70
child 1060 29b1aaf9e080
equal deleted inserted replaced
1058:1fe028e17f70 1059:34e6d07ea2e9
     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 from zope.interface import Interface
       
    19 from zope.schema import URI, Choice, TextLine
       
    20 
       
    21 from pyams_content import _
       
    22 # import interfaces
       
    23 from pyams_content.component.paragraph import IBaseParagraph
       
    24 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent
       
    25 # import packages
       
    26 from pyams_file.schema import ImageField
       
    27 from pyams_i18n.schema import I18nTextLineField
       
    28 from pyams_sequence.interfaces import IInternalReferencesList
       
    29 from pyams_sequence.schema import InternalReferencesListField
       
    30 
       
    31 LOGO_CONTENT_TYPE = 'logo'
       
    32 LOGO_CONTENT_NAME = _("Logo")
       
    33 
       
    34 
       
    35 class ILogosManager(ISharedTool):
       
    36     """Logos manager interface"""
       
    37 
       
    38 
       
    39 class ILogosManagerFactory(Interface):
       
    40     """Logos manager factory interface"""
       
    41 
       
    42 
       
    43 class IWfLogo(IWfSharedContent):
       
    44     """Logo interface"""
       
    45 
       
    46     title = I18nTextLineField(title=_("Title"),
       
    47                               description=_("Full name of logo organization"),
       
    48                               required=True)
       
    49 
       
    50     acronym = TextLine(title=_("Acronym"),
       
    51                        description=_("Matching logo acronym, without spaces or separators"),
       
    52                        required=False)
       
    53 
       
    54     url = URI(title=_("Target URL"),
       
    55               description=_("URL used to access external resource"),
       
    56               required=False)
       
    57 
       
    58     image = ImageField(title=_("Image (colored)"),
       
    59                        description=_("Image data"),
       
    60                        required=True)
       
    61 
       
    62     monochrome_image = ImageField(title=_("Image (monochrome)"),
       
    63                                   description=_("An alternate image which can be used by some "
       
    64                                                 "presentation templates"),
       
    65                                   required=False)
       
    66 
       
    67 
       
    68 class IWfLogoFactory(Interface):
       
    69     """Logo factory interface"""
       
    70 
       
    71 
       
    72 class ILogo(ISharedContent):
       
    73     """Workflow managed logo interface"""
       
    74 
       
    75 
       
    76 LOGOS_PARAGRAPH_TYPE = 'Logos'
       
    77 LOGOS_PARAGRAPH_NAME = _("Logos")
       
    78 LOGOS_PARAGRAPH_RENDERERS = 'PyAMS.shared.logos.renderers'
       
    79 
       
    80 
       
    81 class ILogosParagraph(IBaseParagraph, IInternalReferencesList):
       
    82     """Logos paragraph"""
       
    83 
       
    84     references = InternalReferencesListField(title=_("Logos references"),
       
    85                                              description=_("List of internal logos references"),
       
    86                                              content_type=LOGO_CONTENT_TYPE)
       
    87 
       
    88     renderer = Choice(title=_("Logos template"),
       
    89                       description=_("Presentation template used for this paragraph"),
       
    90                       vocabulary=LOGOS_PARAGRAPH_RENDERERS,
       
    91                       default='default')