from Products.PageTemplates.PageTemplateFile import PageTemplateFile import logging from OFS.Folder import Folder from AccessControl import ClassSecurityInfo from MPIWGHelper import * class MPIWGFolder(Folder): """special Folder object for MPIWG website """ meta_type="MPIWGFolder" manage_options=Folder.manage_options+( {'label':'Change Weight','action':'changeWeightForm'}, {'label':'Main Config','action':'changeForm'}, ) changeWeightForm = PageTemplateFile('zpt/MPIWGFolderChangeWeight', globals()) changeForm = PageTemplateFile('zpt/MPIWGFolderConfig', globals()) def __init__(self, id, title=None, weight=0, canonicalName=None): self.id = str(id) self.weight = weight if title is None: self.title = id else: self.title = title if canonicalName is None: self.canonicalName = self.id else: self.canonicalName = canonicalName def changeWeight(self,weight,RESPONSE=None): """change weight""" self.weight=weight if RESPONSE is not None: RESPONSE.redirect('manage_main') def changeMPIWGFolder(self, title=None, weight=None, canonicalName=None, RESPONSE=None): """change everything""" if title is not None: self.title = title if weight is not None: self.weight = weight if canonicalName is not None: self.canonicalName = canonicalName if RESPONSE is not None: RESPONSE.redirect('manage_main') getBreadcrumbs = getBreadcrumbs getSection = getSection getSubSection = getSubSection def manage_addMPIWGFolderForm(self): """Form for adding""" pt=PageTemplateFile('zpt/AddMPIWGFolder', globals()).__of__(self) return pt() def manage_addMPIWGFolder(self, id, title=None,weight=0,RESPONSE=None): "Add a MPIWG Folder." newObj=MPIWGFolder(id,title,weight) self.Destination()._setObject(id,newObj) if RESPONSE is not None: RESPONSE.redirect('manage_main')