|
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 try: |
|
17 from pyams_gis.schema import GeoPointField |
|
18 except ImportError: |
|
19 have_gis = False |
|
20 else: |
|
21 have_gis = True |
|
22 |
|
23 if have_gis: |
|
24 |
|
25 # import standard library |
|
26 |
|
27 # import interfaces |
|
28 from pyams_content.component.paragraph.interfaces import IBaseParagraph |
|
29 |
|
30 # import packages |
|
31 from zope.schema import Choice, Bool |
|
32 |
|
33 from pyams_content import _ |
|
34 |
|
35 |
|
36 # |
|
37 # Map paragraph |
|
38 # |
|
39 |
|
40 MAP_PARAGRAPH_TYPE = 'Map' |
|
41 MAP_PARAGRAPH_NAME = _("Location map") |
|
42 MAP_PARAGRAPH_RENDERERS = 'PyAMS.paragraph.map.renderers' |
|
43 |
|
44 |
|
45 class IMapParagraph(IBaseParagraph): |
|
46 """Map paragraph interface""" |
|
47 |
|
48 gps_location = GeoPointField(title=_("GPS location"), |
|
49 description=_("GPS coordinates used to locate map"), |
|
50 required=False) |
|
51 |
|
52 display_marker = Bool(title=_("Display location mark?"), |
|
53 description=_("If 'yes', a location marker will be displayed on map"), |
|
54 required=True, |
|
55 default=True) |
|
56 |
|
57 renderer = Choice(title=_("Map template"), |
|
58 description=_("Presentation template used for this map"), |
|
59 vocabulary=MAP_PARAGRAPH_RENDERERS, |
|
60 default='default') |