|
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 from zope.annotation.interfaces import IAttributeAnnotatable |
|
16 from zope.interface import Interface |
|
17 from zope.schema import Choice, TextLine |
|
18 |
|
19 from pyams_content import _ |
|
20 from pyams_content.component.paragraph.interfaces import IBaseParagraph |
|
21 from pyams_content.features.renderer.interfaces import IRenderedContent |
|
22 from pyams_i18n.schema import I18nTextField, I18nTextLineField, I18nThumbnailMediaField |
|
23 |
|
24 |
|
25 # |
|
26 # Illustration |
|
27 # |
|
28 |
|
29 BASIC_ILLUSTRATION_KEY = 'pyams_content.illustration.base' |
|
30 |
|
31 ILLUSTRATION_KEY = 'pyams_content.illustration' |
|
32 ILLUSTRATION_RENDERERS = 'PyAMS.illustration.renderers' |
|
33 |
|
34 LINK_ILLUSTRATION_KEY = '{0}::link'.format(ILLUSTRATION_KEY) |
|
35 |
|
36 |
|
37 class IBasicIllustration(Interface): |
|
38 """Basic illustration interface""" |
|
39 |
|
40 data = I18nThumbnailMediaField(title=_("Image or video data"), |
|
41 description=_("Image or video content"), |
|
42 required=False) |
|
43 |
|
44 def has_data(self): |
|
45 """Check if data is provided in any language""" |
|
46 |
|
47 title = I18nTextLineField(title=_("Legend"), |
|
48 required=False) |
|
49 |
|
50 alt_title = I18nTextLineField(title=_("Accessibility title"), |
|
51 description=_("Alternate title used to describe image content"), |
|
52 required=False) |
|
53 |
|
54 author = TextLine(title=_("Author"), |
|
55 description=_("Name of picture's author"), |
|
56 required=False) |
|
57 |
|
58 |
|
59 class IIllustration(IBasicIllustration, IRenderedContent): |
|
60 """Illustration paragraph""" |
|
61 |
|
62 description = I18nTextField(title=_("Associated text"), |
|
63 description=_("Illustration description displayed in front-office templates"), |
|
64 required=False) |
|
65 |
|
66 renderer = Choice(title=_("Illustration template"), |
|
67 description=_("Presentation template used for illustration"), |
|
68 vocabulary=ILLUSTRATION_RENDERERS, |
|
69 default='default') |
|
70 |
|
71 |
|
72 class ILinkIllustration(IBasicIllustration): |
|
73 """Navigation link illustration interface""" |
|
74 |
|
75 |
|
76 class IIllustrationTargetBase(IAttributeAnnotatable): |
|
77 """Illustration target base interface""" |
|
78 |
|
79 |
|
80 class IBasicIllustrationTarget(IIllustrationTargetBase): |
|
81 """Basic illustration target marker interface""" |
|
82 |
|
83 |
|
84 class IIllustrationTarget(IBasicIllustrationTarget): |
|
85 """Illustration target interface""" |
|
86 |
|
87 |
|
88 class ILinkIllustrationTarget(IIllustrationTargetBase): |
|
89 """Link illustration target interface""" |
|
90 |
|
91 |
|
92 # |
|
93 # Illustration paragraph |
|
94 # |
|
95 |
|
96 ILLUSTRATION_PARAGRAPH_TYPE = 'Illustration' |
|
97 ILLUSTRATION_PARAGRAPH_NAME = _("Illustration") |
|
98 |
|
99 |
|
100 class IIllustrationParagraph(IIllustration, IBaseParagraph): |
|
101 """Illustration paragraph""" |
|
102 |
|
103 data = I18nThumbnailMediaField(title=_("Image or video data"), |
|
104 description=_("Image or video content"), |
|
105 required=True) |