Changeset 369
- Timestamp:
- 07/05/06 03:41:54
- Files:
-
- geolocation/trunk/Extensions/Install.py (modified) (2 diffs)
- geolocation/trunk/adapter.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
geolocation/trunk/Extensions/Install.py
r368 r369 3 3 from Products.CMFCore.utils import getToolByName 4 4 5 PORTAL_TYPES = ['Document', 'News Item', 'Event', 'Link', 'Image'] 5 6 7 def installGEOLocationAction(self): 8 """ add geoLocation edit tab for content types """ 9 ptypes = getToolByName(self, 'portal_types') 10 for tname in PORTAL_TYPES: 11 type = ptypes.getTypeInfo(tname) 12 type.addAction('edit_location', 13 name='GEO Location', 14 action='string:edit_location', 15 condition='', 16 permission='Modify portal content', 17 category='object') 18 19 def uninstallGEOLocationAction(self): 20 """ remove geoLocation edit tab for content types """ 21 ptypes = getToolByName(self, 'portal_types') 22 for tname in PORTAL_TYPES: 23 type = ptypes.getTypeInfo(tname) 24 actions = type._cloneActions() 25 actions = [a for a in actions if a.id != 'edit_location'] 26 type._actions = tuple(actions) 6 27 7 28 def install(self): … … 9 30 out = StringIO() 10 31 catalog = getToolByName(self, 'portal_catalog') 11 catalog.addIndex('geoLocation','FieldIndex') 12 catalog.addColumn('geoLocation') 32 if 'geoLocation' not in catalog.indexes: 33 catalog.addIndex('geoLocation','FieldIndex') 34 if 'geoLocation' not in catalog.schema: 35 catalog.addColumn('geoLocation') 13 36 out.write('geoLocation index created') 37 installGEOLocationAction(self) 38 out.write('Added geolocation edit for content types') 14 39 return out.getvalue() 15 40 41 def uninstall(self): 42 out = StringIO() 43 uninstallGEOLocationAction(self) 44 out.write('Removed geolocation edit for content types') geolocation/trunk/adapter.py
r368 r369 32 32 def setLongitude(self, value): 33 33 """ set longtitude """ 34 self.geolocation['longitude'] = value34 self.geolocation['longitude'] = float(value) 35 35 36 36 def setLatitude(self, value): 37 37 """ set latitutde """ 38 self.geolocation['latitude'] = value38 self.geolocation['latitude'] = float(value) 39 39 40 40 def setLocation(self, longitude, latitude): 41 41 """ set location """ 42 self.geolocation['longitude'] = longitude43 self.geolocation['latitude'] = latitude42 self.geolocation['longitude'] = float(longitude) 43 self.geolocation['latitude'] = float(latitude) 44 44 45 45 default = None
