Changeset 2193 in products
- Timestamp:
- Apr 21, 2010 8:02:33 PM (14 years ago)
- Location:
- quintagroup.portlet.map/trunk/quintagroup/portlet/map
- Files:
-
- 1 deleted
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.portlet.map/trunk/quintagroup/portlet/map/configure.zcml
r2188 r2193 2 2 xmlns="http://namespaces.zope.org/zope" 3 3 xmlns:five="http://namespaces.zope.org/five" 4 xmlns:browser="http://namespaces.zope.org/browser" 4 5 xmlns:genericsetup="http://namespaces.zope.org/genericsetup" 5 6 xmlns:plone="http://namespaces.plone.org/plone" … … 34 35 /> 35 36 37 <!-- overrides IMapEnabledView --> 38 <browser:page 39 for="Products.ATContentTypes.interface.IATTopic" 40 name="maps_googlemaps_enabled_view" 41 class=".map_fix.FolderMapView" 42 permission="zope.Public" 43 layer=".interfaces.IQGMapPortletLayer" 44 allowed_interface="Products.Maps.interfaces.map.IMapEnabledView" 45 /> 46 47 <browser:page 48 for="Products.ATContentTypes.interface.IATFolder" 49 name="maps_googlemaps_enabled_view" 50 class=".map_fix.FolderMapView" 51 permission="zope.Public" 52 layer=".interfaces.IQGMapPortletLayer" 53 allowed_interface="Products.Maps.interfaces.map.IMapEnabledView" 54 /> 55 56 36 57 </configure> -
quintagroup.portlet.map/trunk/quintagroup/portlet/map/qgmapportlet.pt
r2188 r2193 1 1 <metal:block use-macro="here/global_defines/macros/defines" /> 2 <tal:portlet 3 define="view context/@@maps_googlemaps_view; 4 enabled context/@@maps_googlemaps_enabled_view/enabled" 5 condition="python:isViewTemplate and enabled and [m for m in view.getMarkers()]" 6 on-error="nothing"> 2 <tal:portlet> 7 3 8 <dl class="portlet portletMapsPortlet"> 4 <dl class="portlet portletMapsPortlet" 5 tal:define="view view/gmapview;"> 9 6 10 7 <dt class="portletHeader"> … … 31 28 <span> 32 29 <a href="#" 33 tal:attributes="href string:${ here/absolute_url}/maps_map"30 tal:attributes="href string:${view/collection/absolute_url}/maps_map" 34 31 i18n:domain="quintagroup.portlet.map" i18n:translate="label_full_map">Full Map</a></span> 35 32 <span class="portletBottomRight"></span> -
quintagroup.portlet.map/trunk/quintagroup/portlet/map/qgmapportlet.py
r2188 r2193 1 1 from zope.interface import implements 2 from zope.component import queryMultiAdapter, getMultiAdapter 2 3 4 from plone.memoize import ram 5 from plone.memoize.instance import memoize 6 from plone.memoize.compress import xhtml_compress 7 8 from plone.app.portlets.portlets import base 9 from plone.app.portlets.cache import render_cachekey 3 10 from plone.portlets.interfaces import IPortletDataProvider 4 from plone.app.portlets.portlets import base5 11 6 12 from zope import schema 7 13 from zope.formlib import form 14 15 from Acquisition import aq_inner 8 16 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile 9 17 10 18 from quintagroup.portlet.map import QGMapPortletMessageFactory as _ 11 19 20 from logging import getLogger 21 logger = getLogger("Plone") 12 22 13 23 class IQGMapPortlet(IPortletDataProvider): … … 24 34 # below. 25 35 26 # some_field = schema.TextLine(title=_(u"Some field"),27 # description=_(u"A field to use"),28 #required=True)36 collection_path = schema.TextLine(title=_(u"Path to collection"), 37 description=_(u"A plone physical path to collection of locations"), 38 required=True) 29 39 30 40 … … 40 50 # TODO: Set default values for the configurable parameters here 41 51 42 # some_field = u"" 43 44 # TODO: Add keyword parameters for configurable parameters here 45 # def __init__(self, some_field=u""): 46 # self.some_field = some_field 47 48 def __init__(self): 49 pass 52 def __init__(self, collection_path=""): 53 self.collection_path = str(collection_path) 50 54 51 55 @property … … 65 69 """ 66 70 67 render = ViewPageTemplateFile('qgmapportlet.pt') 71 _template = ViewPageTemplateFile('qgmapportlet.pt') 72 73 def __init__(self, *args): 74 base.Renderer.__init__(self, *args) 75 context = aq_inner(self.context) 76 portal_state = getMultiAdapter((context, self.request), name=u'plone_portal_state') 77 self.portal = portal_state.portal() 78 self.gmapview = queryMultiAdapter((self.collection, self.request), 79 name='maps_googlemaps_enabled_view') 80 #self._data = self.collection 81 82 #@ram.cache(render_cachekey) 83 def render(self): 84 return xhtml_compress(self._template()) 85 86 @property 87 def available(self): 88 return bool(self.gmapview and \ 89 self.gmapview.enabled and \ 90 self.gmapview.getMarkers()) 91 92 @property 93 def collection(self): 94 try: 95 return self.portal.restrictedTraverse(self.data.collection_path) 96 except: 97 return None 68 98 69 99 70 100 class AddForm(base.AddForm): 71 """Portlet add form.72 73 This is registered in configure.zcml. The form_fields variable tells74 zope.formlib which fields to display. The create() method actually75 constructs the assignment that is being added.76 """77 101 form_fields = form.Fields(IQGMapPortlet) 102 label = _(u"Add Quintagroup Map Portlet") 103 description = _(u"This portlet displays Locations from the collection on the Google Map.") 78 104 79 105 def create(self, data): 80 return Assignment(**data) 81 82 83 # NOTE: If this portlet does not have any configurable parameters, you 84 # can use the next AddForm implementation instead of the previous. 85 86 # class AddForm(base.NullAddForm): 87 # """Portlet add form. 88 # """ 89 # def create(self): 90 # return Assignment() 91 92 93 # NOTE: If this portlet does not have any configurable parameters, you 94 # can remove the EditForm class definition and delete the editview 95 # attribute from the <plone:portlet /> registration in configure.zcml 96 106 portal_state = getMultiAdapter((self.context, self.request), 107 name=u'plone_portal_state') 108 default_path = '/'.join(portal_state.portal().getPhysicalPath()) + '/events' 109 return Assignment(collection_path=data.get('collection_path', default_path)) 97 110 98 111 class EditForm(base.EditForm): 99 """Portlet edit form.100 101 This is registered with configure.zcml. The form_fields variable tells102 zope.formlib which fields to display.103 """104 112 form_fields = form.Fields(IQGMapPortlet) 113 label = _(u"Edit Quintagroup Map Portlet") 114 description = _(u"This portlet displays Locations from the collection on the Google Map.")
Note: See TracChangeset
for help on using the changeset viewer.