# Copyright 2006 by Meelis Mets from OFS.SimpleItem import SimpleItem from OFS.SimpleItem import Item from OFS.PropertyManager import PropertyManager from Products.CMFCore.utils import UniqueObject from Globals import InitializeClass from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName from ZODB.PersistentMapping import PersistentMapping import xmlrpclib from Acquisition import aq_base class UpdateTool(PropertyManager, SimpleItem, UniqueObject): """ update """ id = 'update_tool' meta_type = 'UpdateTool' security = ClassSecurityInfo() plone_tool = 1 toolicon = 'skins/eportfolio/update.gif' __allow_access_to_unprotected_subobjects__ = 1 def checkObjects(self, item, container): for eport in self.Members.objectValues("Eportfolio"): if not hasattr(eport, 'profile'): #profile for user from Profile import Profile profile = Profile('profile') self._setObject(profile.id, profile) ob=getattr(self,profile.id) ob.setTitle('Profile') ob.reindexObject() if not hasattr(eport, 'forms'): #forms folder from Forms import Forms forms = Forms('forms') self._setObject(forms.id, forms) ob=getattr(self,forms.id) ob.setTitle('Forms') ob.reindexObject() if not hasattr(eport, 'drawer'): #folder for forms #self.invokeFactory('Folder', id='forms', title='Forms') #drawer folder from Drawer import Drawer drawer = Drawer('drawer') self._setObject(drawer.id, drawer) ob=getattr(self,drawer.id) ob.setTitle('Drawer') ob.reindexObject() if not hasattr(eport, 'presentations'): #presentation folder from Presentations import Presentations presentations = Presentations('presentations') self._setObject(presentations.id, presentations) ob=getattr(self,presentations.id) ob.setTitle('Presentations') ob.reindexObject() if not hasattr(eport, 'blog'): #blog for user typestool = getToolByName(self, 'portal_types') puf_type = getattr(typestool, 'COREBlog2', None) eportfolio = getattr(typestool, 'Eportfolio', None) if not puf_type: return 0 if not eportfolio: return 0 puf_type.global_allow = 1 eportfolio.allowed_content_types = ('COREBlog2') new_id = self.invokeFactory('COREBlog2', id='blog', title='Blog') puf_type.global_allow = 0 eportfolio.allowed_content_types = () InitializeClass(UpdateTool)