|
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 # import interfaces |
|
19 from pyams_content.shared.common.interfaces import ISharedTool, IWfSharedContent, ISharedContent |
|
20 from zope.annotation.interfaces import IAttributeAnnotatable |
|
21 |
|
22 # import packages |
|
23 from pyams_content.shared.imagemap.schema import MapArea |
|
24 from pyams_i18n.schema import I18nTextLineField, I18nImageField |
|
25 from pyams_utils.schema import PersistentDict |
|
26 from zope.schema import Object, Choice |
|
27 |
|
28 from pyams_content import _ |
|
29 |
|
30 |
|
31 IMAGEMAP_CONTENT_TYPE = 'imagemap' |
|
32 IMAGEMAP_CONTENT_NAME = _("Image map") |
|
33 |
|
34 |
|
35 class IImageMapManager(ISharedTool): |
|
36 """Image maps manager interface""" |
|
37 |
|
38 |
|
39 class IImageMapArea(IAttributeAnnotatable): |
|
40 """Image map area interface""" |
|
41 |
|
42 title = I18nTextLineField(title=_("Area title"), |
|
43 description=_("Label associated with this area"), |
|
44 required=True) |
|
45 |
|
46 link = Choice(title=_("Link target"), |
|
47 description=_("Internal or external link associated with this map area"), |
|
48 vocabulary="PyAMS content links", |
|
49 required=True) |
|
50 |
|
51 area = MapArea(title=_("Map area coordinates"), |
|
52 description=_("List of coordinates of image area"), |
|
53 required=True) |
|
54 |
|
55 |
|
56 class IWfImageMap(IWfSharedContent): |
|
57 """Image map interface""" |
|
58 |
|
59 image = I18nImageField(title=_("Image"), |
|
60 description=_("Image supporting map areas"), |
|
61 required=True) |
|
62 |
|
63 areas = PersistentDict(title=_("Image map areas"), |
|
64 description=_("List of defined map areas"), |
|
65 value_type=Object(schema=IImageMapArea), |
|
66 required=False) |
|
67 |
|
68 |
|
69 class IImageMap(ISharedContent): |
|
70 """Workflow managed image map interface""" |