|
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 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from pyams_content.component.association.interfaces import IAssociationContainer, IAssociationContainerTarget |
|
20 from zope.annotation.interfaces import IAttributeAnnotatable |
|
21 |
|
22 # import packages |
|
23 from pyams_i18n.schema import I18nTextLineField |
|
24 from zope.container.constraints import containers, contains |
|
25 from zope.interface import Interface |
|
26 from zope.schema import Bool |
|
27 |
|
28 from pyams_content import _ |
|
29 |
|
30 |
|
31 class IMenuLink(Interface): |
|
32 """Menu link marker interface""" |
|
33 |
|
34 |
|
35 class IMenuInternalLink(IMenuLink): |
|
36 """Menu internal link marker interface""" |
|
37 |
|
38 |
|
39 class IMenuExternalLink(IMenuLink): |
|
40 """Menu external link marker interface""" |
|
41 |
|
42 |
|
43 class IMenuLinksContainer(IAssociationContainer): |
|
44 """Menu links container interface""" |
|
45 |
|
46 contains(IMenuLink) |
|
47 |
|
48 |
|
49 class IMenuLinksContainerTarget(IAssociationContainerTarget): |
|
50 """Menu links container marker interface""" |
|
51 |
|
52 |
|
53 class IMenu(IMenuLinksContainer): |
|
54 """Menu container interface""" |
|
55 |
|
56 containers('.IMenusContainer') |
|
57 |
|
58 visible = Bool(title=_("Visible?"), |
|
59 description=_("Is this item visible in front-office?"), |
|
60 required=True, |
|
61 default=True) |
|
62 |
|
63 title = I18nTextLineField(title=_("Menu title"), |
|
64 description=_("Displayed menu label"), |
|
65 required=True) |
|
66 |
|
67 |
|
68 class IMenusContainer(IAssociationContainer): |
|
69 """Menus container interface""" |
|
70 |
|
71 contains(IMenu) |
|
72 |
|
73 |
|
74 class IMenusContainerTarget(IAttributeAnnotatable): |
|
75 """Menus container target marker interface""" |