src/pyams_content/component/paragraph/interfaces/map.py
changeset 861 36f6bb152718
child 956 a8723fffbaf6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/pyams_content/component/paragraph/interfaces/map.py	Wed Jul 18 15:50:14 2018 +0200
@@ -0,0 +1,60 @@
+#
+# Copyright (c) 2008-2018 Thierry Florac <tflorac AT ulthar.net>
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+
+__docformat__ = 'restructuredtext'
+
+
+try:
+    from pyams_gis.schema import GeoPointField
+except ImportError:
+    have_gis = False
+else:
+    have_gis = True
+
+if have_gis:
+
+    # import standard library
+
+    # import interfaces
+    from pyams_content.component.paragraph.interfaces import IBaseParagraph
+
+    # import packages
+    from zope.schema import Choice, Bool
+
+    from pyams_content import _
+
+
+    #
+    # Map paragraph
+    #
+
+    MAP_PARAGRAPH_TYPE = 'Map'
+    MAP_PARAGRAPH_NAME = _("Location map")
+    MAP_PARAGRAPH_RENDERERS = 'PyAMS.paragraph.map.renderers'
+
+
+    class IMapParagraph(IBaseParagraph):
+        """Map paragraph interface"""
+
+        gps_location = GeoPointField(title=_("GPS location"),
+                                     description=_("GPS coordinates used to locate map"),
+                                     required=False)
+
+        display_marker = Bool(title=_("Display location mark?"),
+                              description=_("If 'yes', a location marker will be displayed on map"),
+                              required=True,
+                              default=True)
+
+        renderer = Choice(title=_("Map template"),
+                          description=_("Presentation template used for this map"),
+                          vocabulary=MAP_PARAGRAPH_RENDERERS,
+                          default='default')