File:  [Repository] / MPIWGWeb / Attic / MPIWGFolder.py
Revision 1.1.2.1: download - view: text, annotated - select for diffs - revision graph
Thu Apr 16 15:55:19 2009 UTC (15 years, 2 months ago) by casties
Branches: r2
refactored MPIWGFeature and -Folder to have their own files
getFeatures takes number of features to return

    1: from Products.PageTemplates.PageTemplateFile import PageTemplateFile
    2: import logging
    3: from OFS.Folder import Folder
    4: from AccessControl import ClassSecurityInfo
    5: from MPIWGHelper import *
    6: 
    7: 
    8: class MPIWGFolder(Folder):
    9:     """special Folder object for MPIWG website """
   10: 
   11:     meta_type="MPIWGFolder"
   12: 
   13:     manage_options=Folder.manage_options+(
   14:         {'label':'Change Weight','action':'changeWeightForm'},
   15:         {'label':'Main Config','action':'changeForm'},
   16:         )
   17: 
   18:     changeWeightForm = PageTemplateFile('zpt/MPIWGFolderChangeWeight', globals())
   19:     changeForm = PageTemplateFile('zpt/MPIWGFolderConfig', globals())
   20: 
   21:     def __init__(self, id, title=None, weight=0, canonicalName=None):
   22:         self.id = str(id)
   23:         self.weight = weight
   24:         if title is None:
   25:             self.title = id
   26:         else:
   27:             self.title = title
   28:             
   29:         if canonicalName is None:
   30:             self.canonicalName = self.id
   31:         else:
   32:             self.canonicalName = canonicalName
   33: 
   34:     def changeWeight(self,weight,RESPONSE=None):
   35:         """change weight"""
   36:         self.weight=weight
   37:         if RESPONSE is not None:
   38:             RESPONSE.redirect('manage_main')
   39: 
   40:     def changeMPIWGFolder(self, title=None, weight=None, canonicalName=None, RESPONSE=None):
   41:         """change everything"""
   42:         if title is not None:
   43:             self.title = title
   44:         if weight is not None:
   45:             self.weight = weight
   46:         if canonicalName is not None:
   47:             self.canonicalName = canonicalName
   48:         if RESPONSE is not None:
   49:             RESPONSE.redirect('manage_main')
   50:        
   51:     getBreadcrumbs = getBreadcrumbs
   52:     
   53:     getSection = getSection
   54: 
   55:     getSubSection = getSubSection
   56:     
   57: 
   58: def manage_addMPIWGFolderForm(self):
   59:     """Form for adding"""
   60:     pt=PageTemplateFile('zpt/AddMPIWGFolder', globals()).__of__(self)
   61:     return pt()
   62: 
   63: def manage_addMPIWGFolder(self, id, title=None,weight=0,RESPONSE=None):
   64:     "Add a MPIWG Folder."
   65:     newObj=MPIWGFolder(id,title,weight)
   66:     self.Destination()._setObject(id,newObj)
   67:     if RESPONSE is not None:
   68:         RESPONSE.redirect('manage_main')
   69: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>