Skip to content
Browse files

Move trunk.

  • Loading branch information...
0 parents commit b725712e3e146ed762577eec517fc08fbcee1fdf fschulze committed
Showing with 3,459 additions and 0 deletions.
  1. +44 −0 Products/Maps/__init__.py
  2. +198 −0 Products/Maps/adapters.py
  3. +1 −0 Products/Maps/browser/__init__.py
  4. +109 −0 Products/Maps/browser/config.py
  5. +147 −0 Products/Maps/browser/controlpanel.py
  6. +63 −0 Products/Maps/browser/map.py
  7. +46 −0 Products/Maps/browser/widgets.py
  8. +12 −0 Products/Maps/config.py
  9. +156 −0 Products/Maps/configure.zcml
  10. +150 −0 Products/Maps/content/Location.py
  11. +1 −0 Products/Maps/content/__init__.py
  12. +72 −0 Products/Maps/field.py
  13. +6 −0 Products/Maps/interfaces/__init__.py
  14. +17 −0 Products/Maps/interfaces/config.py
  15. +5 −0 Products/Maps/interfaces/content.py
  16. +4 −0 Products/Maps/interfaces/fields.py
  17. +20 −0 Products/Maps/interfaces/geolocation.py
  18. +37 −0 Products/Maps/interfaces/map.py
  19. +29 −0 Products/Maps/interfaces/marker.py
  20. +109 −0 Products/Maps/locales/de/LC_MESSAGES/maps.po
  21. BIN Products/Maps/locales/el/LC_MESSAGES/maps.mo
  22. +108 −0 Products/Maps/locales/el/LC_MESSAGES/maps.po
  23. +109 −0 Products/Maps/locales/en/LC_MESSAGES/maps.po
  24. +36 −0 Products/Maps/locales/manual.pot
  25. +109 −0 Products/Maps/locales/maps.pot
  26. +110 −0 Products/Maps/locales/no/LC_MESSAGES/maps.po
  27. +3 −0 Products/Maps/permissions.py
  28. +7 −0 Products/Maps/profiles/default/actionicons.xml
  29. +9 −0 Products/Maps/profiles/default/controlpanel.xml
  30. +6 −0 Products/Maps/profiles/default/cssregistry.xml
  31. +6 −0 Products/Maps/profiles/default/factorytool.xml
  32. +9 −0 Products/Maps/profiles/default/jsregistry.xml
  33. +34 −0 Products/Maps/profiles/default/propertiestool.xml
  34. +9 −0 Products/Maps/profiles/default/skins.xml
  35. +9 −0 Products/Maps/profiles/default/types.xml
  36. +8 −0 Products/Maps/profiles/default/types/Folder.xml
  37. +52 −0 Products/Maps/profiles/default/types/GeoLocation.xml
  38. +8 −0 Products/Maps/profiles/default/types/Topic.xml
  39. BIN Products/Maps/skins/Maps/location_icon.gif
  40. +3 −0 Products/Maps/skins/Maps/location_icon.gif.metadata
  41. +25 −0 Products/Maps/skins/Maps/maps-config.js.pt
  42. +496 −0 Products/Maps/skins/Maps/maps-googlemaps.js
  43. +19 −0 Products/Maps/skins/Maps/maps.css
  44. +52 −0 Products/Maps/skins/Maps/maps_location.pt
  45. +2 −0 Products/Maps/skins/Maps/maps_location.pt.metadata
  46. +84 −0 Products/Maps/skins/Maps/maps_map.pt
  47. +2 −0 Products/Maps/skins/Maps/maps_map.pt.metadata
  48. +59 −0 Products/Maps/skins/Maps/maps_map_widget.pt
  49. BIN Products/Maps/skins/Maps/marker-blue.png
  50. +3 −0 Products/Maps/skins/Maps/marker-blue.png.metadata
  51. BIN Products/Maps/skins/Maps/marker-green.png
  52. +3 −0 Products/Maps/skins/Maps/marker-green.png.metadata
  53. BIN Products/Maps/skins/Maps/marker-magenta.png
  54. +3 −0 Products/Maps/skins/Maps/marker-magenta.png.metadata
  55. BIN Products/Maps/skins/Maps/marker-red.png
  56. +3 −0 Products/Maps/skins/Maps/marker-red.png.metadata
  57. BIN Products/Maps/skins/Maps/marker-yellow.png
  58. +3 −0 Products/Maps/skins/Maps/marker-yellow.png.metadata
  59. BIN Products/Maps/skins/Maps/shadow50.png
  60. +3 −0 Products/Maps/skins/Maps/shadow50.png.metadata
  61. +13 −0 Products/Maps/tests/MapsTestCase.py
  62. +1 −0 Products/Maps/tests/__init__.py
  63. +51 −0 Products/Maps/tests/testAdaption.py
  64. +77 −0 Products/Maps/tests/testConfig.py
  65. +49 −0 Products/Maps/tests/testLocation.py
  66. +58 −0 Products/Maps/tests/testSetup.py
  67. +21 −0 Products/Maps/validator.py
  68. +1 −0 Products/Maps/version.txt
  69. +2 −0 Products/__init__.py
  70. +99 −0 README.txt
  71. +52 −0 bootstrap.py
  72. +36 −0 buildout.cfg
  73. +114 −0 docs/HISTORY.txt
  74. +222 −0 docs/LICENSE.GPL
  75. +14 −0 docs/LICENSE.txt
  76. +1 −0 docs/TODO.txt
  77. +30 −0 setup.py
44 Products/Maps/__init__.py
@@ -0,0 +1,44 @@
+from Products.CMFCore.utils import ContentInit
+from Products.CMFCore.DirectoryView import registerDirectory
+
+from Products.Archetypes.public import listTypes
+from Products.Archetypes.public import process_types
+
+from Products.GenericSetup import EXTENSION
+from Products.GenericSetup import profile_registry
+from Products.CMFPlone.interfaces import IPloneSiteRoot
+
+from Products.Maps import config
+from Products.Maps import permissions
+
+from Products.validation import validation
+
+from Products.Maps.validator import LocationFieldValidator
+
+validation.register(LocationFieldValidator('isGeoLocation'))
+
+registerDirectory(config.SKINS_DIR, config.GLOBALS)
+
+def initialize(context):
+
+ from Products.Maps import content
+
+ content_types, constructors, ftis = process_types(
+ listTypes(config.PROJECTNAME), config.PROJECTNAME)
+
+ ContentInit(
+ config.PROJECTNAME + ' Content',
+ content_types = content_types,
+ permission = permissions.ADD_CONTENT_PERMISSION,
+ extra_constructors = constructors,
+ fti = ftis,
+ ).initialize(context)
+
+ # Register the extension profile
+ profile_registry.registerProfile('default',
+ 'Maps',
+ 'maps',
+ 'profiles/default',
+ 'Maps',
+ EXTENSION,
+ IPloneSiteRoot)
198 Products/Maps/adapters.py
@@ -0,0 +1,198 @@
+from zope.interface import implements
+from zope.component import adapts
+
+from Products.Maps.interfaces import IGeoLocation, IMarker, IRichMarker, IMap
+
+from Products.CMFPlone.utils import base_hasattr
+from Products.ATContentTypes.interface import IATTopic, IATFolder
+
+class BaseMap(object):
+ implements(IMap)
+
+ def __init__(self, context):
+ self.context = context
+
+ def getMarkers(self):
+ results = []
+ for item in self._getItems():
+ marker = IMarker(item, None)
+ if marker is None:
+ if base_hasattr(item, 'getObject'):
+ marker = IMarker(item.getObject(), None)
+ if marker is not None:
+ results.append(marker)
+ return results
+
+
+class SmartFolderMap(BaseMap):
+ adapts(IATTopic)
+
+ def _getItems(self):
+ return self.context.queryCatalog()
+
+
+class FolderMap(BaseMap):
+ adapts(IATFolder)
+
+ def _getItems(self):
+ return self.context.getFolderContents()
+
+
+class GeoLocation(object):
+ implements(IGeoLocation)
+
+ def __init__(self, context):
+ self.context = context
+
+ @property
+ def latitude(self):
+ location = self.context.getRawGeolocation()
+ return location[0]
+
+ @property
+ def longitude(self):
+ location = self.context.getRawGeolocation()
+ return location[1]
+
+
+class ContextMap(object):
+ implements(IMap)
+
+ def __init__(self, context):
+ self.context = context
+
+ def getMarkers(self):
+ yield IGeoLocation(self.context)
+
+
+class RichMarker(object):
+ implements(IRichMarker)
+ adapts(IMarker)
+
+ def __init__(self, context):
+ self.context = context
+
+ @property
+ def latitude(self):
+ return self.context.latitude
+
+ @property
+ def longitude(self):
+ return self.context.longitude
+
+ @property
+ def title(self):
+ return self.context.title
+
+ @property
+ def description(self):
+ return self.context.description
+
+ @property
+ def layers(self):
+ return self.context.layers
+
+ @property
+ def icon(self):
+ return self.context.icon
+
+ @property
+ def url(self):
+ return self.context.url
+
+ @property
+ def related_items(self):
+ return tuple()
+
+ @property
+ def contents(self):
+ return tuple()
+
+
+class qPloneGoogleMapsMarker(object):
+ implements(IGeoLocation, IMarker)
+
+ def __init__(self, context):
+ self.context = context
+
+ @property
+ def latitude(self):
+ location = self.context.getRawLocation()
+ return location[0]
+
+ @property
+ def longitude(self):
+ location = self.context.getRawLocation()
+ return location[1]
+
+ @property
+ def title(self):
+ return self.context.Title()
+
+ @property
+ def description(self):
+ return self.context.Description()
+
+ @property
+ def layers(self):
+ return self.context.Subject()
+
+ @property
+ def icon(self):
+ color = self.context.getColor()
+ if color == 'green':
+ return "Green Marker"
+ elif color == 'blue':
+ return "Blue Marker"
+ else:
+ return "Red Marker"
+
+ @property
+ def url(self):
+ return self.context.absolute_url()
+
+
+try:
+ from Products.geolocation.interfaces.geolocation import IGEOLocated
+except ImportError:
+ IGEOLocated = None
+
+class GEOLocatedMarker(object):
+ implements(IGeoLocation, IMarker)
+
+ def __init__(self, context):
+ self.context = context
+ if IGEOLocated is not None:
+ self.adapter = IGEOLocated(context, None)
+ else:
+ self.adapter = None
+
+ @property
+ def latitude(self):
+ if self.adapter is not None:
+ return self.adapter.getLatitude()
+
+ @property
+ def longitude(self):
+ if self.adapter is not None:
+ return self.adapter.getLongitude()
+
+ @property
+ def title(self):
+ return self.context.Title()
+
+ @property
+ def description(self):
+ return self.context.Description()
+
+ @property
+ def layers(self):
+ return self.context.Subject()
+
+ @property
+ def icon(self):
+ return "Red Marker"
+
+ @property
+ def url(self):
+ return self.context.absolute_url()
1 Products/Maps/browser/__init__.py
@@ -0,0 +1 @@
+#
109 Products/Maps/browser/config.py
@@ -0,0 +1,109 @@
+from zope.interface import implements
+
+from Products.Five.browser import BrowserView
+
+from Products.Maps.config import *
+from Products.Maps.interfaces import IMapsConfig
+from Products.Maps.validator import LocationFieldValidator
+
+from Products.CMFCore.utils import getToolByName
+
+
+def getSizeFromString(s):
+ values = s.split(",")
+ # return a list so the data can be used unchanged in javascript
+ return [int(values[0]), int(values[1])]
+
+
+class MapsConfig(BrowserView):
+
+ implements(IMapsConfig)
+
+ def __init__(self, context, request):
+ """ init view """
+ self.context = context
+ self.request = request
+ portal_props = getToolByName(context, 'portal_properties')
+ self.properties = getattr(portal_props, PROPERTY_SHEET, None)
+
+ def _search_key(self, property_id):
+ if self.properties is None:
+ return None
+ keys_list = getattr(self.properties, property_id, None)
+ if keys_list is None:
+ return None
+ keys = {}
+ for key in keys_list:
+ url, key = key.split('|')
+ url = url.strip()
+ # remove trailing slashes
+ url = url.strip('/')
+ key = key.strip()
+ keys[url] = key
+ portal_url_tool = getToolByName(self.context, 'portal_url')
+ portal_url = portal_url_tool()
+ portal_url = portal_url.split('/')
+ while len(portal_url) > 2:
+ url = '/'.join(portal_url)
+ if keys.has_key(url):
+ return keys[url]
+ portal_url = portal_url[:-1]
+ return None
+
+ @property
+ def googlemaps_key(self):
+ return self._search_key(PROPERTY_GOOGLE_KEYS_FIELD)
+
+ @property
+ def googleajaxsearch_key(self):
+ return self._search_key(PROPERTY_GOOGLE_AJAXSEARCH_KEYS_FIELD)
+
+ @property
+ def marker_icons(self):
+ if self.properties is None:
+ return {}
+ icons_list = getattr(self.properties, PROPERTY_MARKERS_FIELD, None)
+ if icons_list is None:
+ return {}
+ portal_url_tool = getToolByName(self.context, 'portal_url')
+ portal_url = portal_url_tool()
+ icons = []
+ for icon in icons_list:
+ parts = icon.split("|")
+ if parts[0].strip() == "Name":
+ continue
+ data = {
+ 'name': parts[0].strip(),
+ 'icon': "%s/%s" % (portal_url, parts[1].strip()),
+ 'iconSize': getSizeFromString(parts[2]),
+ 'iconAnchor': getSizeFromString(parts[3]),
+ 'infoWindowAnchor': getSizeFromString(parts[4]),
+ 'shadow': "%s/%s" % (portal_url, parts[5].strip()),
+ 'shadowSize': getSizeFromString(parts[6]),
+ 'infoShadowAnchor': getSizeFromString(parts[7]),
+ }
+ icons.append(data)
+ return icons
+
+ @property
+ def default_location(self):
+ if self.properties is None:
+ return (0.0, 0.0)
+ default_location = getattr(self.properties,
+ PROPERTY_DEFAULT_LOCATION_FIELD,
+ (0.0, 0.0))
+ if isinstance(default_location, basestring):
+ default_location = default_location.split(',')
+ validator = LocationFieldValidator('default_location')
+ if validator(default_location) != 1:
+ return (0.0, 0.0)
+ return default_location
+
+ @property
+ def default_maptype(self):
+ if self.properties is None:
+ return "normal"
+ default_maptype = getattr(self.properties,
+ PROPERTY_DEFAULT_MAPTYPE_FIELD,
+ "normal")
+ return default_maptype
147 Products/Maps/browser/controlpanel.py
@@ -0,0 +1,147 @@
+from zope.interface import Interface
+from zope.component import adapts
+from zope.interface import implements
+from zope.formlib.form import FormFields
+
+from zope.i18nmessageid import MessageFactory
+
+from zope.schema import Choice
+from zope.schema import Tuple
+from zope.schema import TextLine
+
+from zope.schema.vocabulary import SimpleTerm, SimpleVocabulary
+
+from plone.app.controlpanel.form import ControlPanelForm
+
+from Products.CMFCore.utils import getToolByName
+from Products.CMFDefault.formlib.schema import SchemaAdapterBase
+from Products.CMFPlone.interfaces import IPloneSiteRoot
+
+from Products.Maps.config import *
+from Products.Maps.field import GoogleAPIKey
+
+
+_ = MessageFactory('maps')
+
+
+DEFAULT_MAPTYPE_CHOICES = SimpleVocabulary((
+ SimpleTerm('normal', 'normal',
+ _('label_schematic_map',
+ default=u"Schematic map")),
+ SimpleTerm('satellite', 'satellite',
+ _('label_satellite_map',
+ default=u"Satellite images")),
+ SimpleTerm('hybrid', 'hybrid',
+ _('label_satellite_schematic_map',
+ default=u"Satellite images with schematic overlay")),
+))
+
+
+class IMapsSchema(Interface):
+ googlemaps_keys = Tuple(
+ title=_('label_google_maps_api_keys',
+ default=u'Google Maps API Keys'),
+ description=_('help_google_maps_api_keys',
+ default=u"Add Google Maps API keys. "
+ "You have to use the client "
+ "side url at which your site "
+ "is visible."),
+ unique=True,
+ value_type=GoogleAPIKey(
+ title=_(u'Key'),
+ ),
+ )
+
+ googleajaxsearch_keys = Tuple(
+ title=_('label_google_ajax_search_api_keys',
+ default=u'Google AJAX Search API Keys'),
+ description=_('help_google_ajax_search_api_keys',
+ default=u"Add Google AJAX Search API "
+ "keys. You have to use the "
+ "client side url at which "
+ "your site is visible. This "
+ "key is used to search for "
+ "locations which weren't "
+ "found with the default "
+ "geocoding from Google Maps."),
+ unique=True,
+ value_type=GoogleAPIKey(
+ title=_(u'Key'),
+ ),
+ )
+
+ default_maptype = Choice(
+ title=_('label_default_map_type',
+ default=u'Default map type'),
+ description=_('help_default_map_type',
+ default=u"Select the default map type "
+ "initially used on maps."),
+ required=True,
+ vocabulary=DEFAULT_MAPTYPE_CHOICES,
+ )
+
+ default_location = TextLine(
+ title=_('label_default_coordinates',
+ default=u'Default coordinates'),
+ description=_('help_default_coordinated',
+ default=u"Specify the default "
+ "coordinates for new "
+ "locations."),
+ default=u'0.0, 0.0',
+ required=True,
+ )
+
+
+class MapsControlPanelAdapter(SchemaAdapterBase):
+
+ adapts(IPloneSiteRoot)
+ implements(IMapsSchema)
+
+ def __init__(self, context):
+ super(MapsControlPanelAdapter, self).__init__(context)
+ properties = getToolByName(context, 'portal_properties')
+ self.context = properties.maps_properties
+
+ def get_googlemaps_keys(self):
+ return getattr(self.context, PROPERTY_GOOGLE_KEYS_FIELD, '')
+
+ def set_googlemaps_keys(self, value):
+ self.context._updateProperty(PROPERTY_GOOGLE_KEYS_FIELD, value)
+
+ googlemaps_keys = property(get_googlemaps_keys, set_googlemaps_keys)
+
+ def get_googleajaxsearch_keys(self):
+ return getattr(self.context, PROPERTY_GOOGLE_AJAXSEARCH_KEYS_FIELD, '')
+
+ def set_googleajaxsearch_keys(self, value):
+ self.context._updateProperty(PROPERTY_GOOGLE_AJAXSEARCH_KEYS_FIELD, value)
+
+ googleajaxsearch_keys = property(get_googleajaxsearch_keys, set_googleajaxsearch_keys)
+
+ def get_default_maptype(self):
+ return getattr(self.context,
+ PROPERTY_DEFAULT_MAPTYPE_FIELD,
+ "normal")
+
+ def set_default_maptype(self, value):
+ self.context._updateProperty(PROPERTY_DEFAULT_MAPTYPE_FIELD, value)
+
+ default_maptype = property(get_default_maptype,set_default_maptype)
+
+ def get_default_location(self):
+ return getattr(self.context,
+ PROPERTY_DEFAULT_LOCATION_FIELD,
+ "0.0, 0.0")
+
+ def set_default_location(self, value):
+ self.context._updateProperty(PROPERTY_DEFAULT_LOCATION_FIELD, value)
+
+ default_location = property(get_default_location,set_default_location)
+
+
+class MapsControlPanel(ControlPanelForm):
+
+ form_fields = FormFields(IMapsSchema)
+ label = _("Maps settings")
+ description = None
+ form_name = _("Maps settings")
63 Products/Maps/browser/map.py
@@ -0,0 +1,63 @@
+from cgi import escape
+
+from zope.interface import implements
+from zope.component import adapts, getMultiAdapter
+
+from Products.Five.browser import BrowserView
+
+from Products.Maps.interfaces import IRichMarker, IMap, IMapView
+from Products.Maps.interfaces import IMapEnabled, IMapEnabledView
+
+
+class BaseMapView(BrowserView):
+ def __init__(self, context, request):
+ """ init view """
+ self.context = context
+ self.request = request
+ self.map = IMap(self.context)
+ self.config = getMultiAdapter((context, request), name="maps_configuration")
+ marker_icons = self.config.marker_icons
+ icons = {}
+ for icon in marker_icons:
+ icons[icon['name']] = icon
+ icons['default'] = marker_icons[0]
+ self.icons = icons
+
+ def getMarkers(self):
+ if self.map is None:
+ return
+ for x in self.map.getMarkers():
+ if x.longitude is not None:
+ yield IRichMarker(x)
+
+ def iconTagForMarker(self, marker):
+ icon = self.icons.get(marker.icon, None)
+ if icon is None:
+ icon = self.icons['default']
+ tag = '<img src="%s" alt="%s"' % (icon['icon'], escape(icon['name']))
+ tag = tag + ' width="%i" height="%i"' % (icon['iconSize'][0], icon['iconSize'][1])
+ tag = tag + ' class="marker" />'
+ return tag
+
+
+class DefaultMapView(BaseMapView):
+ implements(IMapView)
+ adapts(IMapEnabled)
+
+ @property
+ def enabled(self):
+ if self.map is None:
+ return False
+ return True
+
+
+class FolderMapView(BaseMapView):
+ implements(IMapView)
+
+ @property
+ def enabled(self):
+ if self.map is None:
+ return False
+ if self.context.getLayout() == "maps_map":
+ return True
+ return False
46 Products/Maps/browser/widgets.py
@@ -0,0 +1,46 @@
+from zope.app.form.browser.widget import renderElement
+from zope.app.form.browser.textwidgets import ASCIIWidget
+
+class GoogleAPIKey(ASCIIWidget):
+ """Google API Key widget"""
+
+ type = 'google_api_key'
+
+ def hasInput(self):
+ return (self.name+'.url' in self.request.form and
+ self.name+'.key' in self.request.form)
+
+ def _getFormInput(self):
+ url = self.request.get(self.name+'.url').strip()
+ key = self.request.get(self.name+'.key').strip()
+ return "%s | %s" % (url, key)
+
+ def __call__(self):
+ value = self._getFormValue()
+ if value is None or value == self.context.missing_value:
+ value = ''
+ value = value.split("|")
+ if len(value) == 2:
+ value = (value[0].strip(), value[1].strip())
+ else:
+ value = ('', '')
+
+ url = renderElement(self.tag,
+ type=self.type,
+ name=self.name+'.url',
+ id=self.name+'.url',
+ value=value[0],
+ cssClass=self.cssClass,
+ size=85,
+ extra=self.extra)
+
+ key = renderElement(self.tag,
+ type=self.type,
+ name=self.name+'.key',
+ id=self.name+'.key',
+ value=value[1],
+ cssClass=self.cssClass,
+ size=85,
+ extra=self.extra)
+
+ return "%s %s" % (url, key)
12 Products/Maps/config.py
@@ -0,0 +1,12 @@
+PROJECTNAME = 'Maps'
+
+GLOBALS = globals()
+
+SKINS_DIR = 'skins'
+
+PROPERTY_SHEET = 'maps_properties'
+PROPERTY_GOOGLE_KEYS_FIELD = 'map_google_api_keys'
+PROPERTY_GOOGLE_AJAXSEARCH_KEYS_FIELD = 'google_ajaxsearch_api_keys'
+PROPERTY_MARKERS_FIELD = 'map_markers'
+PROPERTY_DEFAULT_LOCATION_FIELD = 'map_default_location'
+PROPERTY_DEFAULT_MAPTYPE_FIELD = 'map_default_maptype'
156 Products/Maps/configure.zcml
@@ -0,0 +1,156 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ xmlns:five="http://namespaces.zope.org/five"
+ xmlns:i18n="http://namespaces.zope.org/i18n"
+ >
+
+ <i18n:registerTranslations directory="locales" />
+
+ <adapter factory=".adapters.RichMarker" />
+
+ <class class=".adapters.RichMarker">
+ <allow interface=".interfaces.marker.IRichMarker" />
+ </class>
+
+ <adapter
+ factory=".content.Location.LocationMarker"
+ provides=".interfaces.marker.IRichMarker"
+ />
+
+ <class class=".content.Location.LocationMarker">
+ <allow interface=".interfaces.marker.IRichMarker" />
+ </class>
+
+ <adapter
+ for=".interfaces.ILocation"
+ factory=".adapters.ContextMap"
+ />
+
+ <adapter factory=".adapters.SmartFolderMap" />
+
+ <adapter factory=".adapters.FolderMap" />
+
+ <browser:page
+ for="*"
+ name="maps_configuration"
+ class=".browser.config.MapsConfig"
+ permission="zope2.View"
+ allowed_interface=".interfaces.config.IMapsConfig"
+ />
+
+ <browser:page
+ for="Products.Maps.interfaces.IMapEnabled"
+ name="maps_googlemaps_enabled_view"
+ class=".browser.map.DefaultMapView"
+ permission="zope.Public"
+ allowed_interface=".interfaces.map.IMapEnabledView"
+ />
+
+ <browser:page
+ for="Products.ATContentTypes.interface.IATTopic"
+ name="maps_googlemaps_enabled_view"
+ class=".browser.map.FolderMapView"
+ permission="zope.Public"
+ allowed_interface=".interfaces.map.IMapEnabledView"
+ />
+
+ <browser:page
+ for="Products.ATContentTypes.interface.IATFolder"
+ name="maps_googlemaps_enabled_view"
+ class=".browser.map.FolderMapView"
+ permission="zope.Public"
+ allowed_interface=".interfaces.map.IMapEnabledView"
+ />
+
+ <browser:page
+ for="Products.Maps.interfaces.ILocation"
+ name="maps_googlemaps_view"
+ class=".browser.map.DefaultMapView"
+ permission="zope2.View"
+ allowed_interface=".interfaces.map.IMapView"
+ />
+
+ <browser:page
+ for="Products.ATContentTypes.interface.IATTopic"
+ name="maps_googlemaps_view"
+ class=".browser.map.FolderMapView"
+ permission="zope2.View"
+ allowed_interface=".interfaces.map.IMapView"
+ />
+
+ <browser:page
+ for="Products.ATContentTypes.interface.IATFolder"
+ name="maps_googlemaps_view"
+ class=".browser.map.FolderMapView"
+ permission="zope2.View"
+ allowed_interface=".interfaces.map.IMapView"
+ />
+
+ <!-- widgets -->
+
+ <view
+ type="zope.publisher.interfaces.browser.IBrowserRequest"
+ for=".interfaces.IGoogleAPIKey"
+ provides="zope.app.form.interfaces.IInputWidget"
+ factory=".browser.widgets.GoogleAPIKey"
+ permission="zope.Public"
+ />
+
+ <!-- configlet -->
+
+ <adapter
+ zcml:condition="installed plone.app.controlpanel"
+ factory=".browser.controlpanel.MapsControlPanelAdapter" />
+
+ <browser:page
+ zcml:condition="installed plone.app.controlpanel"
+ name="maps-controlpanel"
+ for="Products.CMFPlone.interfaces.IPloneSiteRoot"
+ class=".browser.controlpanel.MapsControlPanel"
+ permission="cmf.ManagePortal"
+ />
+
+ <!-- geolocation -->
+
+ <adapter
+ zcml:condition="installed Products.geolocation"
+ for="Products.ATContentTypes.interface.document.IATDocument"
+ factory=".adapters.GEOLocatedMarker"
+ />
+ <adapter
+ zcml:condition="installed Products.geolocation"
+ for="Products.ATContentTypes.interface.event.IATEvent"
+ factory=".adapters.GEOLocatedMarker"
+ />
+ <adapter
+ zcml:condition="installed Products.geolocation"
+ for="Products.ATContentTypes.interface.link.IATLink"
+ factory=".adapters.GEOLocatedMarker"
+ />
+ <adapter
+ zcml:condition="installed Products.geolocation"
+ for="Products.ATContentTypes.interface.image.IATImage"
+ factory=".adapters.GEOLocatedMarker"
+ />
+ <adapter
+ zcml:condition="installed Products.geolocation"
+ for="Products.ATContentTypes.interface.news.IATNewsItem"
+ factory=".adapters.GEOLocatedMarker"
+ />
+
+ <!-- qPloneGoogleMaps -->
+ <class
+ zcml:condition="installed Products.qPloneGoogleMaps"
+ class=".adapters.qPloneGoogleMapsMarker">
+ <allow interface=".interfaces.marker.IMarker" />
+ </class>
+
+ <adapter
+ zcml:condition="installed Products.qPloneGoogleMaps"
+ for="Products.qPloneGoogleMaps.content.Marker.Marker"
+ factory=".adapters.qPloneGoogleMapsMarker"
+ />
+
+</configure>
150 Products/Maps/content/Location.py
@@ -0,0 +1,150 @@
+from zope.interface import implements
+from zope.component import adapts, getMultiAdapter
+
+from AccessControl import ClassSecurityInfo
+try:
+ from Products.LinguaPlone.public import *
+except ImportError:
+ # No multilingual support
+ from Products.Archetypes.public import *
+from Products.Maps.config import *
+from Products.ATContentTypes.atct import *
+from Products.ATContentTypes.content.schemata import finalizeATCTSchema
+from Products.ATContentTypes.configuration import zconf
+from Products.CMFPlone import PloneMessageFactory as _
+
+from Products.Maps.adapters import GeoLocation
+from Products.Maps.field import LocationWidget, LocationField
+from Products.Maps.interfaces import IGeoLocation, ILocation
+from Products.Maps.interfaces import IMarker, IRichMarker, IMap, IMapEnabled
+
+
+LocationSchema = ATContentTypeSchema.copy() + Schema(
+ (
+ LocationField(
+ 'geolocation',
+ languageIndependent = 1,
+ default_method="getDefaultLocation",
+ required=True,
+ validators=('isGeoLocation',),
+ widget=LocationWidget(
+ label='Location',
+ label_msgid='label_geolocation',
+ description_msgid='help_geolocation',
+ i18n_domain='maps',
+ ),
+ ),
+
+ StringField(
+ 'markerIcon',
+ languageIndependent = 1,
+ vocabulary="getMarkerIconVocab",
+ enforceVocabulary=True,
+ widget=SelectionWidget(
+ format="select",
+ label='Marker icon',
+ label_msgid='label_markericon',
+ description_msgid='help_markericon',
+ i18n_domain='maps',
+ ),
+ ),
+
+ TextField('text',
+ searchable=True,
+ primary=True,
+ storage = AnnotationStorage(migrate=True),
+ validators = ('isTidyHtmlWithCleanup',),
+ default_content_type = zconf.ATDocument.default_content_type,
+ default_output_type = 'text/x-html-safe',
+ allowable_content_types = zconf.ATDocument.allowed_content_types,
+ widget = RichWidget(
+ description = "",
+ description_msgid = "help_body_text",
+ label = "Body Text",
+ label_msgid = "label_body_text",
+ rows = 25,
+ i18n_domain = "plone",
+ allow_file_upload = zconf.ATDocument.allow_document_upload
+ ),
+ ),
+ ), marshall = RFC822Marshaller()
+)
+finalizeATCTSchema(LocationSchema)
+
+
+class Location(ATCTContent):
+ """Location content type.
+ """
+
+ implements(IMapEnabled, ILocation)
+
+ schema = LocationSchema
+
+ meta_type = portal_type = archetype_name = 'Location'
+ content_icon = 'location_icon.gif'
+ meta_type = 'GeoLocation'
+ portal_type = 'GeoLocation'
+ archetype_name = 'Location'
+ default_view = 'maps_map'
+ immediate_view = 'maps_map'
+ suppl_views = ()
+
+ security = ClassSecurityInfo()
+
+ security.declarePublic("getMarkerIconVocab")
+ def getMarkerIconVocab(self):
+ config = getMultiAdapter((self, self.REQUEST), name="maps_configuration")
+ marker_icons = config.marker_icons
+ result = DisplayList()
+ for icon in marker_icons:
+ result.add(icon['name'], icon['name'])
+ return result
+
+ security.declarePublic("getDefaultLocation")
+ def getDefaultLocation(self):
+ config = getMultiAdapter((self, self.REQUEST), name="maps_configuration")
+ return config.default_location
+
+registerType(Location, PROJECTNAME)
+
+
+class LocationMarker(GeoLocation):
+ implements(IRichMarker)
+ adapts(ILocation)
+
+ @property
+ def title(self):
+ return self.context.Title()
+
+ @property
+ def description(self):
+ return self.context.Description()
+
+ @property
+ def layers(self):
+ return self.context.Subject()
+
+ @property
+ def icon(self):
+ return self.context.getMarkerIcon()
+
+ @property
+ def url(self):
+ return self.context.absolute_url()
+
+ @property
+ def related_items(self):
+ related = self.context.computeRelatedItems()
+ result = []
+ for obj in related:
+ result.append({'title': obj.Title(),
+ 'url': obj.absolute_url(),
+ 'description': obj.Description()})
+ return tuple(result)
+
+ @property
+ def contents(self):
+ text = self.context.getText(mimetype="text/plain").strip()
+ if text:
+ return ({'title': _("Info"),
+ 'text': self.context.getText()},)
1 Products/Maps/content/__init__.py
@@ -0,0 +1 @@
+import Location
72 Products/Maps/field.py
@@ -0,0 +1,72 @@
+from AccessControl import ClassSecurityInfo
+
+from Products.Archetypes import atapi
+from Products.Archetypes.Widget import TypesWidget
+from Products.Archetypes.Field import ObjectField
+from Products.Archetypes.Registry import registerWidget, registerField
+
+
+class LocationWidget(TypesWidget):
+
+ _properties = TypesWidget._properties.copy()
+ _properties.update({
+ 'type': 'map',
+ 'macro': 'maps_map_widget',
+ })
+
+ security = ClassSecurityInfo()
+
+registerWidget(
+ LocationWidget,
+ title='Geological coordinates',
+ used_for=('Products.Archetypes.Field.StringField',)
+)
+
+
+class LocationField(ObjectField):
+ """A field that stores strings"""
+ _properties = ObjectField._properties.copy()
+ _properties.update({
+ 'type' : 'string',
+ 'widget' : LocationWidget,
+ 'default': (0.0, 0.0),
+ 'default_content_type' : 'text/plain',
+ })
+
+ security = ClassSecurityInfo()
+
+ security.declarePrivate('get')
+ def get(self, instance, **kwargs):
+ return ObjectField.get(self, instance, **kwargs)
+
+ security.declarePrivate('getRaw')
+ def getRaw(self, instance, **kwargs):
+ return self.get(instance, **kwargs)
+
+ security.declarePrivate('set')
+ def set(self, instance, value, **kwargs):
+ """Convert passed-in value to a float. If failure, set value to
+ None."""
+ if value is not None:
+ # should really blow if value is not valid
+ __traceback_info__ = (self.getName(), instance, value, kwargs)
+ value = (float(value[0]), float(value[1]))
+ self.getStorage(instance).set(self.getName(), instance, value, **kwargs)
+
+
+registerField(LocationField,
+ title="LocationField",
+ description=("Field that can store coordinate information")
+)
+
+# Zope 3
+
+from zope.interface import implements
+from zope.schema import ASCIILine
+
+from Products.Maps.interfaces import IGoogleAPIKey
+
+
+class GoogleAPIKey(ASCIILine):
+ __doc__ = IGoogleAPIKey.__doc__
+ implements(IGoogleAPIKey)
6 Products/Maps/interfaces/__init__.py
@@ -0,0 +1,6 @@
+from config import IMapsConfig
+from content import ILocation
+from fields import IGoogleAPIKey
+from geolocation import IGeoLocation
+from marker import IMarker, IRichMarker
+from map import IMapEnabled, IMapEnabledView, IMap, IMapView
17 Products/Maps/interfaces/config.py
@@ -0,0 +1,17 @@
+from zope.interface import Interface
+from zope.interface import Attribute
+
+
+class IMapsConfig(Interface):
+ """Interface to the configuration of Maps
+ """
+
+ googlemaps_key = Attribute("The API key for Google Maps for the current portal URL")
+
+ googleajaxsearch_key = Attribute("The API key for Google AJAX Search for the current portal URL")
+
+ marker_icons = Attribute("A list of dictionaries with infos about marker icons")
+
+ default_location = Attribute("The default coordinates for new locations.")
+
+ default_maptype = Attribute("The default maptype (normal, satellite, hybrid).")
5 Products/Maps/interfaces/content.py
@@ -0,0 +1,5 @@
+from zope.interface import Interface
+
+
+class ILocation(Interface):
+ """Interface for content with a 'geolocation' field."""
4 Products/Maps/interfaces/fields.py
@@ -0,0 +1,4 @@
+from zope.schema.interfaces import IASCIILine
+
+class IGoogleAPIKey(IASCIILine):
+ u"""Field for a google api key."""
20 Products/Maps/interfaces/geolocation.py
@@ -0,0 +1,20 @@
+from zope.interface import Interface
+from zope.interface import Attribute
+from zope.schema import Float
+
+
+class IGeoLocation(Interface):
+ """ geographic location cordinates
+ """
+
+ latitude = Float(
+ title=u"Latitude",
+ description=u"",
+ required = False,
+ )
+
+ longitude = Float(
+ title=u"Longitude",
+ description=u"",
+ required = False,
+ )
37 Products/Maps/interfaces/map.py
@@ -0,0 +1,37 @@
+from zope.interface import Interface
+from zope.interface import Attribute
+
+
+class IMapEnabled(Interface):
+ """Marker interface for content which should have the Maps JavaScript
+ enabled.
+
+ This is used for the default adapter, a more specific adapter may
+ override the 'enabled' implementation for IMapEnabledView.
+ """
+
+
+class IMapEnabledView(Interface):
+ """ View to determine whether the map view is enabled
+ """
+
+ enabled = Attribute("True if maps display is enabled")
+
+
+class IMap(Interface):
+ """ Interface for maps
+ """
+
+ def getMarkers():
+ """Returns an iterable of markers."""
+
+
+class IMapView(IMapEnabledView):
+ """ View for maps
+ """
+
+ def getMarkers():
+ """Returns an iterable of markers."""
+
+ def iconTagForMarker(marker):
+ """Returns the img tag for the icon of the marker."""
29 Products/Maps/interfaces/marker.py
@@ -0,0 +1,29 @@
+from zope.interface import Interface
+from zope.interface import Attribute
+
+from Products.Maps.interfaces import IGeoLocation
+
+
+class IMarker(IGeoLocation):
+ """Interface for a map marker
+ """
+
+ title = Attribute("Title of this marker")
+
+ description = Attribute("Short description of this marker")
+
+ layers = Attribute("A tuple of names of the layers this marker is in")
+
+ icon = Attribute("Icon for this marker")
+
+ url = Attribute("URL used on the title")
+
+
+class IRichMarker(IMarker):
+ """Interface for a map marker with additional content"""
+
+ related_items = Attribute("Returns a tuple of dictionaries with the keys "
+ "'title', 'url' and an optional 'description'.")
+
+ contents = Attribute("Returns a tuple of dictionaries with the keys "
+ "'title', and 'text', where text is a HTML string.")
109 Products/Maps/locales/de/LC_MESSAGES/maps.po
@@ -0,0 +1,109 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-05-17 14:08+0000\n"
+"PO-Revision-Date: 2007-04-12 17:21+0000\n"
+"Last-Translator: Florian Schulze <florian.schulze@gmx.net>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: de\n"
+"Language-Name: Deutsch\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+"X-Is-Fallback-For: de-at de-li de-lu de-ch de-de\n"
+
+#. Default: "Dummy to get i18ndude working"
+#: ./skins/Maps/maps-config.js.pt:6
+msgid "Dummy to get i18ndude working"
+msgstr ""
+
+#: ./content/Location.py:158
+msgid "Info"
+msgstr ""
+
+#: ./browser/controlpanel.py:51
+msgid "Key"
+msgstr "Schlüssel"
+
+msgid "Map view"
+msgstr "Kartensicht"
+
+#: ./browser/controlpanel.py:145
+msgid "Maps settings"
+msgstr "Maps Einstellungen"
+
+#. Default: "Specify the default coordinates for new locations."
+#: ./browser/controlpanel.py:86
+msgid "help_default_coordinated"
+msgstr "Geben Sie die Koordinaten an, die beim Erstellen neuer Ortsangaben genutzt werden."
+
+#. Default: "Select the default map type initially used on maps."
+#: ./browser/controlpanel.py:76
+msgid "help_default_map_type"
+msgstr "Wählen Sie die Standard-Sicht für Karten aus."
+
+msgid "help_geolocation"
+msgstr "Sie können nach einer Adresse suchen, wobei die Addressteile durch Komma getrennt sind (Straße 123, 12345 Stadt). Eventuell müssen Sie den Namen des Landes angeben, in dem Sie suchen (Deutschland). Sie können auch Koordinaten in der Form 'Breitengrad, Längengrad' angeben, wobei ein Punkt statt einem Komma für die Abtrennung der Nachkommastellen benutzt werden muss."
+
+#. Default: "Add Google AJAX Search API keys. You have to use the client side url at which your site is visible. This key is used to search for locations which weren't found with the default geocoding from Google Maps."
+#: ./browser/controlpanel.py:58
+msgid "help_google_ajax_search_api_keys"
+msgstr ""
+
+#. Default: "Add Google Maps API keys. You have to use the client side url at which your site is visible."
+#: ./browser/controlpanel.py:44
+msgid "help_google_maps_api_keys"
+msgstr ""
+
+msgid "help_markericon"
+msgstr "Wählen Sie ein Symbol als Markierung auf der Karte."
+
+#. Default: "Default coordinates"
+#: ./browser/controlpanel.py:84
+msgid "label_default_coordinates"
+msgstr "Standard-Koordinaten"
+
+#. Default: "Default map type"
+#: ./browser/controlpanel.py:74
+msgid "label_default_map_type"
+msgstr "Standard-Kartensicht"
+
+msgid "label_geolocation"
+msgstr "Ortsangabe"
+
+#. Default: "Google AJAX Search API Keys"
+#: ./browser/controlpanel.py:56
+msgid "label_google_ajax_search_api_keys"
+msgstr "Google AJAX Search API Schlüssel"
+
+#. Default: "Google Maps API Keys"
+#: ./browser/controlpanel.py:42
+msgid "label_google_maps_api_keys"
+msgstr "Google Maps API Schlüssel"
+
+msgid "label_markericon"
+msgstr "Markierungssymbol"
+
+#. Default: "Satellite images"
+#: ./browser/controlpanel.py:32
+msgid "label_satellite_map"
+msgstr "Satellitenbilder"
+
+#. Default: "Satellite images with schematic overlay"
+#: ./browser/controlpanel.py:35
+msgid "label_satellite_schematic_map"
+msgstr "Satellitenbilder mit schematischer Überlagerung"
+
+#. Default: "Schematic map"
+#: ./browser/controlpanel.py:29
+msgid "label_schematic_map"
+msgstr "Schematische Karte"
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr "Die Adresse '[LOCATION]' konnte nicht gefunden werden."
+
BIN Products/Maps/locales/el/LC_MESSAGES/maps.mo
Binary file not shown.
108 Products/Maps/locales/el/LC_MESSAGES/maps.po
@@ -0,0 +1,108 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-05-17 14:08+0000\n"
+"PO-Revision-Date: 2007-04-12 17:21+0000\n"
+"Last-Translator: George Gozadinos <ggozad@qiweb.net>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: el\n"
+"Language-Name: Ελληνικά\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+
+#. Default: "Dummy to get i18ndude working"
+#: ./skins/Maps/maps-config.js.pt:6
+msgid "Dummy to get i18ndude working"
+msgstr ""
+
+#: ./content/Location.py:158
+msgid "Info"
+msgstr "Πληροφορία"
+
+#: ./browser/controlpanel.py:51
+msgid "Key"
+msgstr "Κλειδί"
+
+msgid "Map view"
+msgstr "Προβολή χάρτη"
+
+#: ./browser/controlpanel.py:145
+msgid "Maps settings"
+msgstr "Ρυθμίσεις χαρτών"
+
+#. Default: "Specify the default coordinates for new locations."
+#: ./browser/controlpanel.py:86
+msgid "help_default_coordinated"
+msgstr "Καθορίστε τις προκαθορισμένες συντεταγμένες για καινούργιες τοποθεσίες"
+
+#. Default: "Select the default map type initially used on maps."
+#: ./browser/controlpanel.py:76
+msgid "help_default_map_type"
+msgstr "Διαλέξτε τον προκαθορισμένο τύπο χάρτη που θα χρησιμοποιείται αρχικά."
+
+msgid "help_geolocation"
+msgstr "Μπορείτε να ψάξετε για μια διεύθυνση της οποίας τα μέρη χωρίζονται με κόμμα (Οδός 123, Πόλη). Ίσως χρειαστεί να εισάγετε και το όνομα της χώρας για να έχετε αποτελέσματα. Μπορείτε επίσης να καθορίσετε συντεταγμένες στη μορφή 'πλάτος, μήκος'"
+
+#. Default: "Add Google AJAX Search API keys. You have to use the client side url at which your site is visible. This key is used to search for locations which weren't found with the default geocoding from Google Maps."
+#: ./browser/controlpanel.py:58
+msgid "help_google_ajax_search_api_keys"
+msgstr "Προσθέστε τα κλειδιά από το Google AJAX Search API. Αυτό το κλειδί χρησιμποιείται για να βρεθούν τοποθεσίες που δεν στάθηκε δυνατό να βρεθούν από τα Google Maps."
+
+#. Default: "Add Google Maps API keys. You have to use the client side url at which your site is visible."
+#: ./browser/controlpanel.py:44
+msgid "help_google_maps_api_keys"
+msgstr "Προσθέστε τα κλειδιά από το Google Maps API."
+
+msgid "help_markericon"
+msgstr "Επιλέξτε το εικονίδιο που θα φαίνεται σαν δείκτης στο χάρτη."
+
+#. Default: "Default coordinates"
+#: ./browser/controlpanel.py:84
+msgid "label_default_coordinates"
+msgstr "Προκαθορισμένες συντεταγμένες"
+
+#. Default: "Default map type"
+#: ./browser/controlpanel.py:74
+msgid "label_default_map_type"
+msgstr "Προκαθορισμένος τύπος χάρτη"
+
+msgid "label_geolocation"
+msgstr "Τοποθεσία"
+
+#. Default: "Google AJAX Search API Keys"
+#: ./browser/controlpanel.py:56
+msgid "label_google_ajax_search_api_keys"
+msgstr "Κλειδιά για Google AJAX Search API"
+
+#. Default: "Google Maps API Keys"
+#: ./browser/controlpanel.py:42
+msgid "label_google_maps_api_keys"
+msgstr "Κλειδιά για Google Maps API Keys"
+
+msgid "label_markericon"
+msgstr "Εικονίδιο δείκτη"
+
+#. Default: "Satellite images"
+#: ./browser/controlpanel.py:32
+msgid "label_satellite_map"
+msgstr "Δορυφορικές εικόνες"
+
+#. Default: "Satellite images with schematic overlay"
+#: ./browser/controlpanel.py:35
+msgid "label_satellite_schematic_map"
+msgstr "Δορυφορικές εικόνες με σχηματική επικάλυψη"
+
+#. Default: "Schematic map"
+#: ./browser/controlpanel.py:29
+msgid "label_schematic_map"
+msgstr "Σχηματικός χάρτης"
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr "Η τοποθεσία '[LOCATION]' δέν βρέθηκε."
+
109 Products/Maps/locales/en/LC_MESSAGES/maps.po
@@ -0,0 +1,109 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-05-17 14:08+0000\n"
+"PO-Revision-Date: 2007-04-12 17:21+0000\n"
+"Last-Translator: Florian Schulze <florian.schulze@gmx.net>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: en\n"
+"Language-Name: English\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+"X-Is-Fallback-For: en-au en-bz en-ca en-ie en-jm en-nz en-ph en-za en-tt en-gb en-us en-zw\n"
+
+#. Default: "Dummy to get i18ndude working"
+#: ./skins/Maps/maps-config.js.pt:6
+msgid "Dummy to get i18ndude working"
+msgstr ""
+
+#: ./content/Location.py:158
+msgid "Info"
+msgstr ""
+
+#: ./browser/controlpanel.py:51
+msgid "Key"
+msgstr ""
+
+msgid "Map view"
+msgstr ""
+
+#: ./browser/controlpanel.py:145
+msgid "Maps settings"
+msgstr ""
+
+#. Default: "Specify the default coordinates for new locations."
+#: ./browser/controlpanel.py:86
+msgid "help_default_coordinated"
+msgstr ""
+
+#. Default: "Select the default map type initially used on maps."
+#: ./browser/controlpanel.py:76
+msgid "help_default_map_type"
+msgstr ""
+
+msgid "help_geolocation"
+msgstr "You can search for an address were each part is seperated by a comma (street 123, City). You may have to append the country name behind the address to get a result. You can also enter 'latitude, longitude' coordinates."
+
+#. Default: "Add Google AJAX Search API keys. You have to use the client side url at which your site is visible. This key is used to search for locations which weren't found with the default geocoding from Google Maps."
+#: ./browser/controlpanel.py:58
+msgid "help_google_ajax_search_api_keys"
+msgstr ""
+
+#. Default: "Add Google Maps API keys. You have to use the client side url at which your site is visible."
+#: ./browser/controlpanel.py:44
+msgid "help_google_maps_api_keys"
+msgstr ""
+
+msgid "help_markericon"
+msgstr "Select the icon which is used as the marker on the map."
+
+#. Default: "Default coordinates"
+#: ./browser/controlpanel.py:84
+msgid "label_default_coordinates"
+msgstr ""
+
+#. Default: "Default map type"
+#: ./browser/controlpanel.py:74
+msgid "label_default_map_type"
+msgstr ""
+
+msgid "label_geolocation"
+msgstr "Location"
+
+#. Default: "Google AJAX Search API Keys"
+#: ./browser/controlpanel.py:56
+msgid "label_google_ajax_search_api_keys"
+msgstr ""
+
+#. Default: "Google Maps API Keys"
+#: ./browser/controlpanel.py:42
+msgid "label_google_maps_api_keys"
+msgstr ""
+
+msgid "label_markericon"
+msgstr "Marker icon"
+
+#. Default: "Satellite images"
+#: ./browser/controlpanel.py:32
+msgid "label_satellite_map"
+msgstr ""
+
+#. Default: "Satellite images with schematic overlay"
+#: ./browser/controlpanel.py:35
+msgid "label_satellite_schematic_map"
+msgstr ""
+
+#. Default: "Schematic map"
+#: ./browser/controlpanel.py:29
+msgid "label_schematic_map"
+msgstr ""
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr "The location '[LOCATION]' couldn't be found."
+
36 Products/Maps/locales/manual.pot
@@ -0,0 +1,36 @@
+# Gettext Message File for Maps
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-01-23 18:17+0200\n"
+"PO-Revision-Date: 2007-01-23 18:17+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: en\n"
+"Language-Name: English\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr ""
+
+msgid "label_geolocation"
+msgstr ""
+
+msgid "help_geolocation"
+msgstr ""
+
+msgid "label_markericon"
+msgstr ""
+
+msgid "help_markericon"
+msgstr ""
+
+msgid "Map view"
+msgstr ""
109 Products/Maps/locales/maps.pot
@@ -0,0 +1,109 @@
+# Gettext Message File for Maps
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-05-17 14:08+0000\n"
+"PO-Revision-Date: 2007-01-23 18:17+0200\n"
+"Last-Translator: \n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: en\n"
+"Language-Name: English\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+
+#. Default: "Dummy to get i18ndude working"
+#: ./skins/Maps/maps-config.js.pt:6
+msgid "Dummy to get i18ndude working"
+msgstr ""
+
+#: ./content/Location.py:158
+msgid "Info"
+msgstr ""
+
+#: ./browser/controlpanel.py:51
+msgid "Key"
+msgstr ""
+
+msgid "Map view"
+msgstr ""
+
+#: ./browser/controlpanel.py:145
+msgid "Maps settings"
+msgstr ""
+
+#. Default: "Specify the default coordinates for new locations."
+#: ./browser/controlpanel.py:86
+msgid "help_default_coordinated"
+msgstr ""
+
+#. Default: "Select the default map type initially used on maps."
+#: ./browser/controlpanel.py:76
+msgid "help_default_map_type"
+msgstr ""
+
+msgid "help_geolocation"
+msgstr ""
+
+#. Default: "Add Google AJAX Search API keys. You have to use the client side url at which your site is visible. This key is used to search for locations which weren't found with the default geocoding from Google Maps."
+#: ./browser/controlpanel.py:58
+msgid "help_google_ajax_search_api_keys"
+msgstr ""
+
+#. Default: "Add Google Maps API keys. You have to use the client side url at which your site is visible."
+#: ./browser/controlpanel.py:44
+msgid "help_google_maps_api_keys"
+msgstr ""
+
+msgid "help_markericon"
+msgstr ""
+
+#. Default: "Default coordinates"
+#: ./browser/controlpanel.py:84
+msgid "label_default_coordinates"
+msgstr ""
+
+#. Default: "Default map type"
+#: ./browser/controlpanel.py:74
+msgid "label_default_map_type"
+msgstr ""
+
+msgid "label_geolocation"
+msgstr ""
+
+#. Default: "Google AJAX Search API Keys"
+#: ./browser/controlpanel.py:56
+msgid "label_google_ajax_search_api_keys"
+msgstr ""
+
+#. Default: "Google Maps API Keys"
+#: ./browser/controlpanel.py:42
+msgid "label_google_maps_api_keys"
+msgstr ""
+
+msgid "label_markericon"
+msgstr ""
+
+#. Default: "Satellite images"
+#: ./browser/controlpanel.py:32
+msgid "label_satellite_map"
+msgstr ""
+
+#. Default: "Satellite images with schematic overlay"
+#: ./browser/controlpanel.py:35
+msgid "label_satellite_schematic_map"
+msgstr ""
+
+#. Default: "Schematic map"
+#: ./browser/controlpanel.py:29
+msgid "label_schematic_map"
+msgstr ""
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr ""
+
110 Products/Maps/locales/no/LC_MESSAGES/maps.po
@@ -0,0 +1,110 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: Maps\n"
+"POT-Creation-Date: 2007-05-17 14:08+0000\n"
+"PO-Revision-Date: 2007-05-17 11:12+0100\n"
+"Last-Translator: Thor Arne Johansen <thora@plonesolutions.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=1; plural=0\n"
+"Language-Code: no\n"
+"Language-Name: Norsk\n"
+"Preferred-Encodings: utf-8 latin1\n"
+"Domain: maps\n"
+"X-Is-Fallback-For: nb nb-no no-bok\n"
+
+#. Default: "Dummy to get i18ndude working"
+#: ./skins/Maps/maps-config.js.pt:6
+msgid "Dummy to get i18ndude working"
+msgstr ""
+
+#: ./content/Location.py:158
+msgid "Info"
+msgstr "Informasjon"
+
+#: ./browser/controlpanel.py:51
+msgid "Key"
+msgstr "Nøkkel"
+
+msgid "Map view"
+msgstr ""
+
+#: ./browser/controlpanel.py:145
+msgid "Maps settings"
+msgstr "Maps instillinger "
+
+#. Default: "Specify the default coordinates for new locations."
+#: ./browser/controlpanel.py:86
+msgid "help_default_coordinated"
+msgstr "Spesifiser de initielle koordinatene for nye lokasjoner"
+
+#. Default: "Select the default map type initially used on maps."
+#: ./browser/controlpanel.py:76
+msgid "help_default_map_type"
+msgstr "Velg karttypen som benyttes som utgangspunkt for nye kart"
+
+msgid "help_geolocation"
+msgstr "Du kan søke etter en adresse hvor hver del er skilt med et komma (gate 123, by). Det kan hende du må legge til landsnavnet etter adressen for å få treff. Du kan også oppgi 'lengdegrad, breddegrad' koordinater."
+
+#. Default: "Add Google AJAX Search API keys. You have to use the client side url at which your site is visible. This key is used to search for locations which weren't found with the default geocoding from Google Maps."
+#: ./browser/controlpanel.py:58
+#, fuzzy
+msgid "help_google_ajax_search_api_keys"
+msgstr "Legg til Google AJAX Search API nøkler. Du må benytte klientside url'en hvor nettstedet kan nås. Denne nøkkelen brukes for å søke etter lokasjoner som ikke ble funnet med standard geokoding fra Google Maps."
+
+#. Default: "Add Google Maps API keys. You have to use the client side url at which your site is visible."
+#: ./browser/controlpanel.py:44
+msgid "help_google_maps_api_keys"
+msgstr "Legg til Google Maps API nøkler. Du må benytte klientside url'en hvor nettstedet kan nås."
+
+msgid "help_markericon"
+msgstr "Velg det ikonet som skal brukes som markør på kartet."
+
+#. Default: "Default coordinates"
+#: ./browser/controlpanel.py:84
+msgid "label_default_coordinates"
+msgstr "Initielle koordinater"
+
+#. Default: "Default map type"
+#: ./browser/controlpanel.py:74
+msgid "label_default_map_type"
+msgstr "Initiell karttype"
+
+msgid "label_geolocation"
+msgstr "Lokasjon"
+
+#. Default: "Google AJAX Search API Keys"
+#: ./browser/controlpanel.py:56
+msgid "label_google_ajax_search_api_keys"
+msgstr "Google AJAX Search API Nøkler"
+
+#. Default: "Google Maps API Keys"
+#: ./browser/controlpanel.py:42
+msgid "label_google_maps_api_keys"
+msgstr "Google Maps API Nøkler"
+
+msgid "label_markericon"
+msgstr "Markørikon"
+
+#. Default: "Satellite images"
+#: ./browser/controlpanel.py:32
+msgid "label_satellite_map"
+msgstr "Satellittbilder"
+
+#. Default: "Satellite images with schematic overlay"
+#: ./browser/controlpanel.py:35
+msgid "label_satellite_schematic_map"
+msgstr "Satellittbilder med skjematisk overlagring"
+
+#. Default: "Schematic map"
+#: ./browser/controlpanel.py:29
+msgid "label_schematic_map"
+msgstr "Skjematisk kart"
+
+#. Default: "The location '[LOCATION]' couldn't be found."
+#: ./skins/Maps/maps-config.js.pt:15
+msgid "text_googlemaps_location_not_found"
+msgstr "Fant ikke lokasjonen '[LOCATION]'."
+
3 Products/Maps/permissions.py
@@ -0,0 +1,3 @@
+from Products.CMFCore.permissions import AddPortalContent
+
+ADD_CONTENT_PERMISSION = AddPortalContent
7 Products/Maps/profiles/default/actionicons.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<action-icons>
+ <action-icon category="controlpanel"
+ action_id="Maps"
+ title="Maps settings" priority="0"
+ icon_expr="location_icon.gif" />
+</action-icons>
9 Products/Maps/profiles/default/controlpanel.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<object name="portal_controlpanel" meta_type="Plone Control Panel Tool">
+ <configlet title="Maps" action_id="Maps"
+ appId="Maps" category="Products" condition_expr=""
+ url_expr="string:${portal_url}/@@maps-controlpanel"
+ visible="True">
+ <permission>Manage portal</permission>
+ </configlet>
+</object>
6 Products/Maps/profiles/default/cssregistry.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<object name="portal_css" meta_type="Stylesheets Registry">
+ <stylesheet title="" cacheable="True" compression="safe" cookable="True"
+ enabled="on" expression="" id="maps.css" media="screen" rel="stylesheet"
+ rendering="import"/>
+</object>
6 Products/Maps/profiles/default/factorytool.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<object name="portal_factory" meta_type="Plone Factory Tool">
+ <factorytypes>
+ <type portal_type="GeoLocation" />
+ </factorytypes>
+</object>
9 Products/Maps/profiles/default/jsregistry.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<object name="portal_javascripts" meta_type="JavaScripts Registry">
+ <javascript cacheable="True" compression="full" cookable="True"
+ enabled="True" id="maps-config.js" inline="False"
+ expression="object/@@maps_googlemaps_enabled_view/enabled | nothing" />
+ <javascript cacheable="True" compression="full" cookable="True"
+ enabled="True" id="maps-googlemaps.js" inline="False"
+ expression="object/@@maps_googlemaps_enabled_view/enabled | nothing" />
+</object>
34 Products/Maps/profiles/default/propertiestool.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+<object name="portal_properties" meta_type="Plone Properties Tool">
+ <object name="maps_properties" meta_type="Plone Property Sheet">
+ <property name="title">Maps Properties</property>
+ <property name="map_google_api_keys" type="lines">
+ <element
+ value="http://localhost:8080 | ABQIAAAAaKes6QWqobpCx2AOamo-shTwM0brOpm-All5BF6PoaKBxRWWERSUWbHs4SIAMkeC1KV98E2EdJKuJw"/>
+ <element
+ value="http://testing:8080 | ABQIAAAAaKes6QWqobpCx2AOamo-shS8tbwkwQvVo8y2jCgM8I6Nv1EJJxSpbhzdXfa06Vx2SpX3do9jOWJM6g"/>
+ </property>
+ <property name="google_ajaxsearch_api_keys" type="lines">
+ <element
+ value="http://localhost:8080 | ABQIAAAAMKqifBTazCnHqAnQfZ6DAxTwM0brOpm-All5BF6PoaKBxRWWERTY0DuDpOVZe50LuUPSi4EGcO9Bxg"/>
+ <element
+ value="http://testing:8080 | ABQIAAAAMKqifBTazCnHqAnQfZ6DAxS8tbwkwQvVo8y2jCgM8I6Nv1EJJxQCGO61VsKeAyjbr4Nl6XCQc_gtqQ"/>
+ </property>
+ <property name="map_markers" type="lines">
+ <element
+ value="Name | Icon | iconSize | iconAnchor | infoWindowAnchor | Shadow | shadowSize | infoShadowAnchor"/>
+ <element
+ value="Red Marker | marker-red.png | 20,34 | 9,34 | 9,2 | shadow50.png | 37,34 | 18,25"/>
+ <element
+ value="Green Marker | marker-green.png | 20,34 | 9,34 | 9,2 | shadow50.png | 37,34 | 18,25"/>
+ <element
+ value="Blue Marker | marker-blue.png | 20,34 | 9,34 | 9,2 | shadow50.png | 37,34 | 18,25"/>
+ <element
+ value="Yellow Marker | marker-yellow.png | 20,34 | 9,34 | 9,2 | shadow50.png | 37,34 | 18,25"/>
+ <element
+ value="Magenta Marker | marker-magenta.png | 20,34 | 9,34 | 9,2 | shadow50.png | 37,34 | 18,25"/>
+ </property>
+ <property name="map_default_location" type="string">0.0, 0.0</property>
+ <property name="map_default_maptype" type="string">normal</property>
+ </object>
+</object>
9 Products/Maps/profiles/default/skins.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<object name="portal_skins" meta_type="Plone Skins Tool">
+ <object name="Maps"
+ meta_type="Filesystem Directory View"
+ directory="Maps/skins/Maps"/>
+ <skin-path name="*">
+ <layer name="Maps" insert-after="custom"/>
+ </skin-path>
+</object>
9 Products/Maps/profiles/default/types.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<object name="portal_types" meta_type="Plone Types Tool">
+ <object name="Folder"
+ meta_type="Factory-based Type Information with dynamic views"/>
+ <object name="GeoLocation"
+ meta_type="Factory-based Type Information with dynamic views"/>
+ <object name="Topic"
+ meta_type="Factory-based Type Information with dynamic views"/>
+</object>
8 Products/Maps/profiles/default/types/Folder.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<object name="Folder"
+ meta_type="Factory-based Type Information with dynamic views"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="view_methods" purge="False">
+ <element value="maps_map"/>
+ </property>
+</object>
52 Products/Maps/profiles/default/types/GeoLocation.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0"?>
+<object name="GeoLocation"
+ meta_type="Factory-based Type Information with dynamic views"
+ i18n:domain="plone" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="title">Location</property>
+ <property name="description">Location content type.
+ </property>
+ <property name="content_icon">location_icon.gif</property>
+ <property name="content_meta_type">GeoLocation</property>
+ <property name="product">Maps</property>
+ <property name="factory">addLocation</property>
+ <property name="immediate_view">maps_map</property>
+ <property name="global_allow">True</property>
+ <property name="filter_content_types">False</property>
+ <property name="allowed_content_types"/>
+ <property name="allow_discussion">False</property>
+ <property name="default_view">maps_location</property>
+ <property name="view_methods">
+ <element value="maps_location"/>
+ <element value="maps_map"/>
+ </property>
+ <property name="default_view_fallback">False</property>
+ <alias from="(Default)" to="(dynamic view)"/>
+ <alias from="edit" to="atct_edit"/>
+ <alias from="sharing" to="@@sharing"/>
+ <alias from="view" to="(selected layout)"/>
+ <action title="View" action_id="view" category="object" condition_expr=""
+ url_expr="string:${object_url}" visible="True" i18n:attributes="title">
+ <permission value="View"/>
+ </action>
+ <action title="Edit" action_id="edit" category="object"
+ condition_expr="not:object/@@plone_lock_info/is_locked_for_current_user|python:True"
+ url_expr="string:${object_url}/edit" visible="True" i18n:attributes="title">
+ <permission value="Modify portal content"/>
+ </action>
+ <action title="References" action_id="references" category="object"
+ condition_expr="object/archetype_tool/has_graphviz"
+ url_expr="string:${object_url}/reference_graph" visible="True">
+ <permission value="Modify portal content"/>
+ <permission value="Review portal content"/>
+ </action>
+ <action title="History" action_id="history" category="object"
+ condition_expr="" url_expr="string:${object_url}/atct_history"
+ visible="False" i18n:attributes="title">
+ <permission value="ATContentTypes: View history"/>
+ </action>
+ <action title="External Edit" action_id="external_edit" category="object"
+ condition_expr="object/externalEditorEnabled"
+ url_expr="string:${object_url}/external_edit" visible="False">
+ <permission value="Modify portal content"/>
+ </action>
+</object>
8 Products/Maps/profiles/default/types/Topic.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<object name="Topic"
+ meta_type="Factory-based Type Information with dynamic views"
+ xmlns:i18n="http://xml.zope.org/namespaces/i18n">
+ <property name="view_methods" purge="False">
+ <element value="maps_map"/>
+ </property>
+</object>
BIN Products/Maps/skins/Maps/location_icon.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 Products/Maps/skins/Maps/location_icon.gif.metadata
@@ -0,0 +1,3 @@
+[default]
+title=Location Icon
+cache=HTTPCache
25 Products/Maps/skins/Maps/maps-config.js.pt
@@ -0,0 +1,25 @@
+<tal:block define="_dummy python:request.response.setHeader('content-type','text/javascript;;charset=utf-8')" />
+<metal:block i18n:domain="maps"
+ tal:define="config context/@@maps_configuration">
+
+/*
+ <span tal:omit-tag="" i18n:translate="">Dummy to get i18ndude working</span>
+*/
+
+var mapsConfig = {
+ google: {
+ apikey: '<tal:block tal:replace="config/googlemaps_key" />',
+ ajaxsearchkey: '<tal:block tal:replace="config/googleajaxsearch_key" />',
+ maxinfowidth: 400,
+ locationnotfound: '<tal:block tal:replace="python: here.translate('text_googlemaps_location_not_found', default='The location \'[LOCATION]\' couldn\'t be found.', domain='maps', escape_for_js=True)" />',
+ selectablemaptypes: true,
+ defaultmaptype: '<tal:block tal:replace="config/default_maptype" />',
+
+ maxzoomlevel: 13,
+ initialzoomlevel: 12,
+
+ markericons: <tal:block tal:replace="structure config/marker_icons" />
+ }
+};
+
+</metal:block>
496 Products/Maps/skins/Maps/maps-googlemaps.js
@@ -0,0 +1,496 @@
+
+// start namespace
+var mapsGoogleMaps = function() {
+ // local shadows for improved packing
+
+ var _mapsConfig = mapsConfig;
+ var _mapsConfig_google = _mapsConfig.google;
+ var _cssQuery = cssQuery;
+ var _parseInt = parseInt;
+ var _parseFloat = parseFloat;
+
+ // privates
+
+ var _markericons = null;
+ var _defaultmaptype = null;
+
+ var _localSearch = null;
+ var _LayerControl = null;
+
+ function _LayerControlFactory() {
+ // This is a bit stupid. The Google Maps javascript is loaded later,
+ // so GControl and other things aren't yet available. We put this
+ // into a factory function, so we can call it later.
+ function $LayerControl($$locations, $$layers) {
+ this._locations = $$locations;
+ this._layers = $$layers;
+ };
+ $LayerControl.prototype = new GControl();
+
+ $LayerControl.prototype._addLayerButton = function($$container, $$layer) {
+ var $checkbox = document.createElement("input");
+ var $$locations = this._locations;
+ var layers = this._layers['enabled'];
+ $checkbox.type = "checkbox";
+ $checkbox.defaultChecked = true;
+ $checkbox.onclick = function(e) {
+ layers[$$layer] = $checkbox.checked;
+ for (var i=0; i < $$locations.length; i++) {
+ var $location = $$locations[i];
+ var $marker = $location['marker'];
+ var $visible = false;
+ if (typeof $location['layers'] == 'undefined') {
+ $visible = true;
+ } else {
+ for (var $name in $location['layers']) {
+ if (layers[$name] == true) {
+ $visible = true;
+ break;
+ }
+ }
+ }
+ if ($visible) {
+ $marker.show();
+ } else {
+ $marker.hide();
+ }
+ }
+ };
+
+ var $label = document.createElement("label");
+ $label.style.display = "block";
+ $label.appendChild($checkbox);
+ $label.appendChild(document.createTextNode($$layer));
+ $$container.appendChild($label);
+ };
+
+ $LayerControl.prototype.initialize = function($map) {
+ var $container = document.createElement("div");
+ var $$layers = this._layers['enabled'];
+
+ for (var $name in $$layers) {
+ if ($$layers[$name]) {
+ this._addLayerButton($container, $name);
+ }
+ }
+
+ $container.style.backgroundColor = "white";
+ $container.style.border = "1px solid black";
+ $container.style.padding = "2px";
+ $container.style.fontSize = "90%";
+ $map.getContainer().appendChild($container);
+
+ return $container;
+ };
+
+ $LayerControl.prototype.getDefaultPosition = function() {
+ return new GControlPosition(G_ANCHOR_BOTTOM_RIGHT, new GSize(7, 16));
+ };
+
+ return $LayerControl;
+ };
+
+ function _initDefaults($$defaults) {
+ if (_markericons == null) {
+ _markericons = {};
+ for (var j=0; j < $$defaults.markericons.length; j++) {
+ var $definition = $$defaults.markericons[j];
+ var $icon = new GIcon();
+ $icon.image = $definition['icon'];
+ $icon.iconSize = new GSize(_parseInt($definition['iconSize'][0]), _parseInt($definition['iconSize'][1]));
+ $icon.iconAnchor = new GPoint(_parseInt($definition['iconAnchor'][0]), _parseInt($definition['iconAnchor'][1]));
+ $icon.infoWindowAnchor = new GPoint(_parseInt($definition['infoWindowAnchor'][0]), _parseInt($definition['infoWindowAnchor'][1]));
+ $icon.shadow = $definition['shadow'];
+ $icon.shadowSize = new GSize(_parseInt($definition['shadowSize'][0]), _parseInt($definition['shadowSize'][1]));
+ $icon.infoShadowAnchor = new GPoint(_parseInt($definition['infoShadowAnchor'][0]), _parseInt($definition['infoShadowAnchor'][1]));
+ _markericons[$definition['name']] = $icon;
+ }
+ }
+ if (_defaultmaptype == null) {
+ if ($$defaults.defaultmaptype == 'satellite') {
+ _defaultmaptype = G_SATELLITE_MAP;
+ } else if ($$defaults.defaultmaptype == 'hybrid') {
+ _defaultmaptype = G_HYBRID_MAP;
+ } else {
+ _defaultmaptype = G_NORMAL_MAP;
+ }
+ }
+ };
+
+ function _addInfoWindow($marker, $node) {
+ // this needs to be done in a seperate function to keep the correct
+ // references to node and marker
+ GEvent.addListener($marker, "click", function() {
+ $marker.openInfoWindow($node, {maxWidth: _mapsConfig_google.maxinfowidth});
+ });
+ };
+
+ function _addInfoWindowTabs($marker, $tabs) {
+ // this needs to be done in a seperate function to keep the correct
+ // references to node and marker
+ GEvent.addListener($marker, "click", function() {
+ $marker.openInfoWindowTabs($tabs, {maxWidth: _mapsConfig_google.maxinfowidth});
+ });
+ };
+
+ function _createMarker($data) {
+ $data['marker'] = new GMarker($data['point'], $data['icon']);
+ $data['info_windows'] = [];
+ for (var j=0; j < $data['tabs'].length; j++) {
+ var $tab = $data['tabs'][j];
+ var $info_window = new GInfoWindowTab($tab['title'], $tab['node']);
+ $data['info_windows'].push($info_window);
+ }
+ if ($data['info_windows'].length > 1) {
+ _addInfoWindowTabs($data['marker'], $data['info_windows']);
+ } else {
+ _addInfoWindow($data['marker'], $data['tabs'][0]['node']);
+ }
+ };
+
+ function _parseMarkers($markers, $result) {
+ var $result = [];
+ var $data;
+ var $first_tab = true;
+ for (var j=0; j < $markers.length; j++) {
+ $node = $markers[j];
+ if ($node.nodeType != 1)
+ continue;
+ if (hasClassName($node, 'title')) {
+ $node.parentNode.removeChild($node);
+ if ($data) {
+ _createMarker($data);
+ $result.push($data);
+ }
+ $data = {};
+ $data['tabs'] = [];
+ var $tab = {};
+ $data['tabs'].push($tab);
+ var dl = document.createElement('dl');
+ dl.appendChild($node);
+ addClassName(dl, "mapsMarker");
+ $tab['node'] = dl;