source: trunk/__init__.py @ 53

Revision 53, 2.6 KB checked in by meelis, 14 years ago (diff)

renaming activities to stories

  • Property svn:eol-style set to LF
Line 
1# license ....
2
3# CMF imports
4from Products.CMFCore import utils
5from Products.CMFCore.DirectoryView import registerDirectory
6from Products.CMFPlone import MigrationTool
7from Products.CMFPlone.Portal import addPolicy, PloneGenerator
8from Products.CMFPlone.interfaces.CustomizationPolicy import ICustomizationPolicy
9from Products.CMFPlone.CustomizationPolicy import DefaultCustomizationPolicy
10
11# Archetypes imports
12from Products.Archetypes.public import process_types, listTypes
13
14# Our own content types
15import BaseAsset, HTMLTextAsset, ImageAsset, AudioAsset
16import Module
17import SyndicatedFolder
18import Story
19
20# Our own portal tools
21import ToolboxSearchTool
22# Make is list of portal tools
23tools = (ToolboxSearchTool.ToolboxSearchTool,)
24
25# Our own configuration stuff
26from config import *
27from ConfigurationMethods import ToolboxSetup
28
29# Add the skins folder to the registry of viewable folders
30registerDirectory(SKINS_DIR,GLOBALS)
31
32def initialize(context):
33    """This method is called when this product is initialized upon Zope startup."""
34
35    # Add our setup widgets into MigrationTool
36    MigrationTool.registerSetupWidget(ToolboxSetup)
37
38    # Register our customization policy
39    addPolicy('Toolbox Site',ToolboxCustomizationPolicy())
40
41    # Register our set of portal tools
42    utils.ToolInit(PROJECTNAME + ' Tools', tools=tools,
43        icon='',).initialize(context)
44
45    # Process all imported content types into nice lists
46    content_types, constructors, ftis = process_types(
47        listTypes(PROJECTNAME),
48        PROJECTNAME)
49
50    # Register our set of content types
51    utils.ContentInit(
52        PROJECTNAME + ' Content',
53        content_types      = content_types,
54        permission         = ADD_CONTENT_PERMISSION,
55        extra_constructors = constructors,
56        fti                = ftis,
57        ).initialize(context)
58
59
60class ToolboxCustomizationPolicy(DefaultCustomizationPolicy):
61    """Customization policy for the Toolbox site."""
62    __implements__ = ICustomizationPolicy
63
64    # Yes, this can be used when creating a new Plone instance
65    availableAtConstruction=True
66
67    def customize(self,portal):
68        """This method is called when a Plone portal is created with this
69        customization policy."""
70       
71        # Call super class, just in case they do something intelligent
72        DefaultCustomizationPolicy.customize(self,portal)
73       
74        # Locate our migration widget
75        widget = portal.portal_migration._getWidget('Toolbox Setup')
76       
77        # Add and execute all configuration methods that it lists as being available
78        widget.addItems(widget.available())
Note: See TracBrowser for help on using the repository browser.