Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Changelog
2.0 (2016-10-06)
----------------

- Allow geolocation field to be addable in Dexterity Type Editor
[davilima6]

- Make geolocation formwidget work with ``pat-leaflet``.
[thet]

Expand Down
22 changes: 18 additions & 4 deletions plone/formwidget/geolocation/configure.zcml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<configure
xmlns="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
xmlns:monkey="http://namespaces.plone.org/monkey"
xmlns:i18n="http://namespaces.zope.org/i18n"
xmlns:plone="http://namespaces.plone.org/plone"
xmlns:z3c="http://namespaces.zope.org/z3c"
Expand Down Expand Up @@ -29,12 +29,26 @@
template="geolocation_input.pt"
/>

<utility
<utility
zcml:condition="installed plone.supermodel"
component=".supermodel.GeolocationHandler"
name="plone.formwidget.geolocation.GeolocationField"
name="plone.formwidget.geolocation.GeolocationHandler"
/>

<configure zcml:condition="installed plone.schemaeditor">
<utility
component=".schemaeditor.GeolocationFactory"
name="plone.formwidget.geolocation.GeolocationFactory"
/>
<include package="collective.monkeypatcher" />
<monkey:patch
description="Allow geolocation field to be addable in Dexterity Type Editor"
class="plone.app.dexterity.browser.types.TypeSchemaContext"
original="allowedFields"
replacement=".schemaeditor.allowedFields"
/>
</configure>

<utility
component=".vocabularies.MapLayers"
name="plone.formwidget.geolocation.vocabularies.map_layers"
Expand All @@ -46,7 +60,7 @@
class=".controlpanel.GeolocationControlPanel"
permission="plone.app.controlpanel.Site"
/>

<genericsetup:registerProfile
name="default"
title="plone.formwidget.geolocation map install"
Expand Down
2 changes: 1 addition & 1 deletion plone/formwidget/geolocation/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from zope.interface import Interface
from zope.schema.interfaces import IObject

_ = MessageFactory('plone.formwidget.geolocation')
_ = GeolocationMessageFactory = MessageFactory('plone.formwidget.geolocation')


class IGeolocation(Interface):
Expand Down
11 changes: 11 additions & 0 deletions plone/formwidget/geolocation/schemaeditor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# -*- coding: utf-8 -*-
from plone.app.dexterity.browser.types import ALLOWED_FIELDS
from plone.formwidget.geolocation import GeolocationField
from plone.formwidget.geolocation.interfaces import GeolocationMessageFactory as _
try:
from plone.schemaeditor.fields import FieldFactory
GeolocationFactory = FieldFactory(GeolocationField, _(u'label_map_field', default=u'Map'))
except ImportError:
pass

allowedFields = ALLOWED_FIELDS + [u'plone.formwidget.geolocation.GeolocationFactory']
2 changes: 1 addition & 1 deletion plone/formwidget/geolocation/supermodel.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from plone.formwidget.geolocation.field import GeolocationField
try:
from plone.formwidget.geolocation.field import GeolocationField
from plone.supermodel.exportimport import BaseHandler
GeolocationHandler = BaseHandler(GeolocationField)
except ImportError:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def read(*rnames):
zip_safe=False,
install_requires=[
'plone.patternslib',
'collective.monkeypatcher',
'setuptools',
'z3c.form',
],
Expand Down