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())
 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())
Example #3
0
 def title(self):
     return _(u"KML map controls")
 def __call__(self, context):
     return SimpleVocabulary([SimpleTerm('location',_(u'Location')),
                              SimpleTerm('text',_(u'Custom text (see below)'))])