Changeset 382

Show
Ignore:
Timestamp:
07/07/06 09:40:16
Author:
piv
Message:

added skins

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • geolocation/trunk/Extensions/Install.py

    r381 r382  
    22from cStringIO import StringIO 
    33from Products.CMFCore.utils import getToolByName 
     4from Products.CMFCore.DirectoryView import addDirectoryViews 
     5 
     6from Products.geolocation.config import * 
    47 
    58PORTAL_TYPES = ['Document', 'News Item', 'Event', 'Link', 'Image'] 
     9 
     10def setupSkin(self, out, skinFolder): 
     11    """ Setup product skin layer """ 
     12    skinstool=getToolByName(self, 'portal_skins') 
     13    addDirectoryViews(skinstool, SKINS_DIR, GLOBALS) 
     14    for skin in skinstool.getSkinSelections(): 
     15        path = skinstool.getSkinPath(skin) 
     16        path = map(string.strip, string.split(path,',')) 
     17        if not skinFolder in path: 
     18            try: 
     19                path.insert( path.index('custom')+1, skinFolder) 
     20            except ValueError: 
     21                path.append(skinFolder) 
     22            path = string.join(path, ', ') 
     23            skinstool.addSkinSelection(skin, path) 
     24            out.write('  %s layer sucessfully installed into skin %s.\n' % (skinFolder, skin)) 
     25        else: 
     26            out.write('  %s layer was already installed into skin %s.\n' % (skinFolder, skin)) 
     27 
     28def removeSkin(self, skins=[]): 
     29    """ Setup product skin layer """ 
     30    if skins: 
     31        skinstool = getToolByName(self, 'portal_skins') 
     32        for skinName in skinstool.getSkinSelections(): 
     33            path = skinstool.getSkinPath(skinName) 
     34            path = [i.strip() for i in  path.split(',')] 
     35            for s in skins: 
     36                if s in path: 
     37                    path.remove(s) 
     38                s += '/' 
     39                for layer in path: 
     40                    if layer.startswith(s): 
     41                        path.remove(layer) 
     42            path = ','.join(path) 
     43            skinstool.addSkinSelection(skinName, path) 
    644 
    745def installGEOLocationAction(self): 
     
    2967    """ Product installation """ 
    3068    out = StringIO() 
     69    out.write('setupSkin... \n') 
     70    setupSkin(self, out, PROJECTNAME)     
    3171    catalog = getToolByName(self, 'portal_catalog') 
    3272    if 'geoLocation' not in catalog.indexes(): 
     
    4181def uninstall(self): 
    4282    out = StringIO() 
     83    removeSkin(self, [PROJECTNAME,]) 
    4384    uninstallGEOLocationAction(self) 
    4485    out.write('Removed geolocation edit for content types') 
  • geolocation/trunk/__init__.py

    r381 r382  
    1 
     1from Products.CMFCore.DirectoryView import registerDirectory 
     2 
     3from Products.geolocation.config import * 
     4 
     5registerDirectory(SKINS_DIR, GLOBALS) 
  • geolocation/trunk/browser/location.py

    r381 r382  
    1717        self.request = request 
    1818        self.location = IGEOLocated(self.context, None) 
    19         self.latitude = self.location and self.location.getLatitude() or 0 
    20         self.longitude = self.location and self.location.getLongitude() or 0 
     19        self.latitude = self.location and self.location.getLatitude() or None 
     20        self.longitude = self.location and self.location.getLongitude() or None 
    2121  
    2222    def editLocation(self, latitude=None, longitude=None): 
     
    2525        self.context.reindexObject() 
    2626         
     27    def getLatitude(self): 
     28       """ return location latitude """ 
     29       return self.latitude 
     30        
     31    def getLongitude(self): 
     32       """ return location longitude """ 
     33       return self.longitude 
  • geolocation/trunk/configure.zcml

    r381 r382  
    5151      permission="zope2.View" 
    5252      allowed_interface=".interface.IGEOLocatedView" 
     53      allowed_attributes="getLatitude getLongitude" 
    5354      />   
    5455 
    55   <browser:page 
     56<!--  <browser:page 
    5657      for="*" 
    5758      name="edit_location" 
    58       template="browser/edit_location.pt" 
     59      template="browser/edit_location.cpt" 
    5960      permission="zope2.View" 
    60       />   
     61      />  --> 
    6162     
    6263  <browser:page