from Products.Archetypes.public import listTypes from Products.Archetypes.Extensions.utils import installTypes, install_subskin from Products.CMFCore.utils import getToolByName from StringIO import StringIO from Products.CMFCore.CMFCorePermissions import setDefaultRoles from Products.CMFCurriculum.config import * def install(self): out = StringIO() installTypes(self, out, listTypes(PROJECTNAME), PROJECTNAME) install_subskin(self, out, GLOBALS) portal = getToolByName(self,'portal_url').getPortalObject() #register the folderish items in portal_properties/site_properties for folder-contents views etc site_props = getToolByName(self, 'portal_properties').site_properties use_folder_tabs = site_props.getProperty('use_folder_tabs') if not 'Curriculum' in use_folder_tabs: site_props._updateProperty('use_folder_tabs', tuple(use_folder_tabs) + ('Curriculum',)) # check for property use_folder_contents. This property seems not to be always there: if not site_props.hasProperty('use_folder_contents'): site_props.manage_addProperty('use_folder_contents', '', 'lines') use_folder_contents = site_props.getProperty('use_folder_contents') if not 'Curriculum' in use_folder_contents: site_props._updateProperty('use_folder_contents', tuple(use_folder_contents) + ('Curriculum',)) print >> out, "Successfully installed %s." % PROJECTNAME return out.getvalue() def uninstall(self): # remove the references in each folder to our portlet: # this gotta be effective some time # someone's gotta test if this works like it should # commented out for the time being: #portal = getToolByName(self,'portal_url').getPortalObject() #processPortletOld(portal) #processPortletNew(portal) #removeReferences(portal) #remove configlet pass