Exemplo n.º 1
0
 def enable(self):
     """Enable the map"""
     if not self.canEnable():
         raise Unauthorized("You can't enable the map for this content")
     context = self.context
     interface.directlyProvides(context, IMonetMapsEnabledContent)
     context.reindexObject(idxs=['object_provides',])
     putils = getToolByName(context, 'plone_utils')
     putils.addPortalMessage(_(u"Map enabled"))
     if not context.getLocation() and (context.getField('geolocation') and context.getField('geolocation').get(context)==(0, 0)):
         putils.addPortalMessage(_(u"The current content has no Location nor Geolocation infos; maps will not be show",),
                                 type='warning')
     self.request.response.redirect(context.absolute_url())
Exemplo n.º 2
0
 def disable(self):
     """Disable the map"""
     if not self.canDisable():
         raise Unauthorized("You can't enable the map for this content")
     context = self.context
     interface.noLongerProvides(self.context, IMonetMapsEnabledContent)
     context.reindexObject(idxs=['object_provides',])
     putils = getToolByName(context, 'plone_utils')
     putils.addPortalMessage(_(u"Map disabled"))
     self.request.response.redirect(context.absolute_url())
Exemplo n.º 3
0
 def title(self):
     return _(u"KML map controls")
Exemplo n.º 4
0
 def __call__(self, context):
     return SimpleVocabulary([SimpleTerm('location',_(u'Location')),
                              SimpleTerm('text',_(u'Custom text (see below)'))])