src/pyams_content/features/menu/interfaces/__init__.py
branchdev-dc
changeset 1086 3d259e1718ef
parent 1079 a5e56749ca3d
parent 1084 6b6a884fa28a
child 1087 978a2b9123b9
equal deleted inserted replaced
1079:a5e56749ca3d 1086:3d259e1718ef
     1 #
       
     2 # Copyright (c) 2008-2018 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 from zope.container.constraints import containers, contains
       
    16 from zope.interface import Attribute, Interface
       
    17 from zope.schema import Bool, Choice
       
    18 
       
    19 from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget
       
    20 from pyams_content.reference.pictograms.interfaces import SELECTED_PICTOGRAM_VOCABULARY
       
    21 from pyams_i18n.schema import I18nTextLineField
       
    22 from pyams_sequence.interfaces import IInternalReference
       
    23 from pyams_sequence.schema import InternalReferenceField
       
    24 
       
    25 from pyams_content import _
       
    26 
       
    27 
       
    28 class IMenuLink(Interface):
       
    29     """Menu link marker interface"""
       
    30 
       
    31 
       
    32 class IMenuInternalLink(IMenuLink):
       
    33     """Menu internal link marker interface"""
       
    34 
       
    35 
       
    36 class IMenuExternalLink(IMenuLink):
       
    37     """Menu external link marker interface"""
       
    38 
       
    39 
       
    40 class IMenuLinksContainer(IAssociationContainer):
       
    41     """Menu links container interface"""
       
    42 
       
    43     contains(IMenuLink)
       
    44 
       
    45 
       
    46 class IMenuLinksContainerTarget(IAssociationContainerTarget):
       
    47     """Menu links container marker interface"""
       
    48 
       
    49 
       
    50 class IMenu(IMenuLinksContainer, IInternalReference):
       
    51     """Menu container interface"""
       
    52 
       
    53     containers('.IMenusContainer')
       
    54 
       
    55     visible = Bool(title=_("Visible?"),
       
    56                    description=_("Is this item visible in front-office?"),
       
    57                    required=True,
       
    58                    default=True)
       
    59 
       
    60     title = I18nTextLineField(title=_("Menu title"),
       
    61                               description=_("Displayed menu label"),
       
    62                               required=True)
       
    63 
       
    64     reference = InternalReferenceField(title=_("Internal reference"),
       
    65                                        description=_("Direct reference to menu target"),
       
    66                                        required=False)
       
    67 
       
    68     pictogram_name = Choice(title=_("Pictogram"),
       
    69                             description=_("Name of the pictogram associated with this menu"),
       
    70                             required=False,
       
    71                             vocabulary=SELECTED_PICTOGRAM_VOCABULARY)
       
    72 
       
    73     pictogram = Attribute("Pictogram object reference")
       
    74 
       
    75 
       
    76 class IMenusContainer(IAssociationContainer):
       
    77     """Menus container interface"""
       
    78 
       
    79     contains(IMenu)
       
    80 
       
    81 
       
    82 class IMenusContainerTarget(IAssociationContainerTarget):
       
    83     """Menus container target marker interface"""