# -*- coding: utf-8 # Copyright 2006-2007 by Meelis Mets __doc__ = """ Psyhvel """ __version__ = "0.1" from config import * import config # CMF imports from Products.CMFCore import utils from Products.CMFCore.DirectoryView import registerDirectory, registerFileExtension from Products.CMFPlone import MigrationTool from Products.CMFCore.FSFile import FSFile # BEGIN: PLONE 2.1 portion from Products.CMFPlone.Portal import addPolicy from Products.CMFPlone.interfaces.CustomizationPolicy import ICustomizationPolicy from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy # END: PLONE 2.1 portion if PLONE25: from Products.CMFPlone.interfaces import IPloneSiteRoot from Products.GenericSetup import profile_registry, BASE, EXTENSION # Archetypes imports from Products.Archetypes.public import process_types, listTypes # Our own workflow import PsyhvelWorkflow # Our own content types # Basic modules import Psyhvel import BaseFunctions import Collection import UserFolder import AnswerFolder # Game modules import BaseGame import GameIntroduction import RoboLaser, RoboRun import BearBasket, BearComboling # Test modules import BaseTest import FlowerTask, HedgehogTask, DragTask, TMTTask, ChoiceTask, SoundTask import PictureStimulus, MultiPictureStimulus, TextStimulus, WordStimulus, SoundStimulus import SoundTesting, DragTesting import ChoiceObject import ElementObject # Our own portal tools # no own tools avaivable # Our own configuration stuff from ConfigurationMethods import PsyhvelSetup # HOOK: Anything executed here will be executed any time the product is refreshed # or Zope is restarted. # Add the skins folder to the registry of viewable folders registerDirectory(SKINS_DIR,GLOBALS) registerFileExtension('class', FSFile) registerFileExtension ('wav', FSFile) def initialize(context): """This method is called when this product is initialized upon Zope startup.""" # Add our setup widgets into MigrationTool MigrationTool.registerSetupWidget(PsyhvelSetup) # making config accessible from python scripts. from AccessControl import allow_module, ModuleSecurityInfo #ModuleSecurityInfo('config').declarePublic() allow_module('Products.Psyhvel.Validators') # Register our extension profile / customization policy if PLONE25: try: profile_registry.registerProfile(name='Psyhvel', title='Psyhvel Legacy Site', description="Psyhvel is a heavily customized Plone for special use, and can't be converted to a normal Plone very easily.", path='profiles/legacy', product='Psyhvel', profile_type=EXTENSION, for_=IPloneSiteRoot) except KeyError: # Already done - ignore pass addPolicy('Psyhvel Site',PsyhvelCustomizationPolicy()) # Register our set of portal tools #utils.ToolInit(PROJECT_NAME + ' Tools', tools=tools, # icon='skins/eportfolio/tool.gif',).initialize(context) # Process all imported content types into nice lists content_types, constructors, ftis = process_types( listTypes(PROJECT_NAME), PROJECT_NAME) # Register our set of content types utils.ContentInit( PROJECT_NAME + ' Content', content_types = content_types, permission = 'Add portal content', extra_constructors = constructors, fti = ftis, ).initialize(context) class PsyhvelCustomizationPolicy(DefaultCustomizationPolicy): """Customization policy for the Psyhvel site.""" __implements__ = ICustomizationPolicy # Yes, this can be used when creating a new Plone instance availableAtConstruction=True def customize(self,portal): """This method is called when a Plone portal is created with this customization policy.""" # Call super class, just in case they do something intelligent DefaultCustomizationPolicy.customize(self,portal) # Locate our migration widget widget = portal.portal_migration._getWidget('Psyhvel Setup') # Add and execute all configuration methods that it lists as being available widget.addItems(widget.available())