source: WAeUP_SRP/trunk/__init__.py @ 4010

Last change on this file since 4010 was 3824, checked in by Henrik Bettermann, 16 years ago

implement configuration object (step 1)

Configuration file must be created with create_configuration_file.py

  • Property svn:keywords set to Id
File size: 5.5 KB
RevLine 
[199]1#-*- mode: python; mode: fold -*-
[204]2# $Id: __init__.py 3824 2008-12-19 15:44:45Z henrik $
[206]3from Products.CMFCore.utils import ContentInit, ToolInit
[19]4from Products.CMFCore.DirectoryView import registerDirectory
5from Products.CMFCore import utils as cmfutils
[452]6from Products.CMFCore.permissions import AddPortalContent
[19]7
[199]8from Products.GenericSetup import profile_registry
9from Products.GenericSetup import EXTENSION
[3682]10from Products.GenericSetup import BASE
[19]11
[199]12from Products.CPSCore.interfaces import ICPSSite
[2094]13from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry
[199]14
[3673]15import patches
16
[274]17import Products.WAeUP_SRP.WAeUPPermissions
[828]18import WAeUPTool
[200]19
[59]20import Widgets
[828]21tools = (WAeUPTool.WAeUPTool,)
[19]22
[452]23waeup_types = (
[3824]24    ("University",
25       ('University',
26        'WAeUPConfiguration',
27        )
28    ),
[454]29    ("Academics",
30       ("AcademicsFolder",
31        "Certificate",
32        "CertificateCourse",
33        "Faculty",
34        "Department",
35        "Course",
36        "CertificateCourse",
[565]37        "StudyLevel",
[454]38        )
39     ),
40     ("Accommodation",
41        ("AccoFolder",
[622]42         "AccoHall",
[454]43         )
44     ),
[1226]45     ("Payment",
46        ("PaymentsFolder",
47         "Payment",
48         )
49     ),
[454]50     ("Students",
51        ("StudentsFolder",
52         "Student",
[639]53         "StudentAccommodation",
[454]54         "StudentStudyCourse",
[464]55         "StudentCourseResult",
[472]56         "StudentApplication",
[758]57         "StudentPume",
[454]58         "StudentClearance",
59         "StudentPersonal",
[464]60         "StudentStudyLevel",
[760]61         #"Semester",
[467]62         "StudentCourseResult",
[3682]63         "StudentPastoralReport",
[464]64         # move to Academics later
[565]65         #"Semester",
[454]66         )
67      ),
[488]68     ("ScratchCards",
69         ("ScratchCardBatch",
[2013]70          "ScratchCardBatchesFolder",
71         )
72     ),
73     ("Documents",
74        ("DocumentsFolder",
75         "WAeUPDocument",
76        )
[2914]77     ),
[3277]78     ("Upload",
79        ("UploadsFolder",
80         "Upload",
81         )
82     ),
[200]83    )
84
[452]85contentClasses = []
86cc = []
[454]87for modu,names in waeup_types:
88    mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(),
[452]89                globals(),
90                locals(),
[454]91                ['*',]
[452]92                )
[454]93    for name in names:
94        #print name
95        contentClasses.append(getattr(mod,name))
96        cc.append(getattr(mod,"add%(name)s" % vars()))
97contentConstructors = tuple(cc)
[200]98
[440]99fti = [{} for t in range(len(contentConstructors))]
[200]100
[199]101registerDirectory('skins', globals())
[197]102
[199]103def initialize(registrar):
[828]104    ToolInit('WAeUP Tool',
105              tools=tools,
106              icon='tool.gif',
107              ).initialize(registrar)
[200]108    ContentInit('WAeUP Types',
109                content_types = contentClasses,
110                permission = AddPortalContent,
111                extra_constructors = contentConstructors,
112                fti = fti,
113                ).initialize(registrar)
114
[3689]115    # profile registration
[199]116    profile_registry.registerProfile(
117        'default',
[274]118        'WAeUP_SRP',
[3705]119        "WAeUP Default Profile",
[199]120        'profiles/default',
[274]121        'WAeUP_SRP',
[3689]122        BASE,
123        for_=ICPSSite)
124    profile_registry.registerProfile(
[3705]125        'uniben',
126        'WAeUP Uniben Profile',
127        "University of Benin",
128        'profiles/uniben',
129        'WAeUP_SRP',
[3708]130        EXTENSION,
[3705]131        for_=ICPSSite)       
132    profile_registry.registerProfile(
[3689]133        'fceokene',
[3705]134        'WAeUP FCE Okene Profile',
[3689]135        "Federal College of Education",
136        'profiles/fceokene',
137        'WAeUP_SRP',
[199]138        EXTENSION,
[3689]139        for_=ICPSSite)       
140    profile_registry.registerProfile(
141        'aaua',
[3705]142        'WAeUP AAUA Profile',
[3689]143        "Adekunle Ajasin University",
144        'profiles/aaua',
145        'WAeUP_SRP',
146        EXTENSION,
147        for_=ICPSSite)   
148    profile_registry.registerProfile(
149        'unilorin',
[3705]150        'WAeUP Unilorin Profile',
[3689]151        "University of Ilorin",
152        'profiles/unilorin',
153        'WAeUP_SRP',
154        EXTENSION,
155        for_=ICPSSite)   
156    profile_registry.registerProfile(
157        'ois',
[3705]158        'WAeUP OIS Profile',
[3689]159        "Olashore International School",
160        'profiles/ois',
161        'WAeUP_SRP',
162        EXTENSION,
[3714]163        for_=ICPSSite)       
164    profile_registry.registerProfile(
165        'fceoyo',
166        'WAeUP FCE Oyo Profile',
167        "Federal College of Education",
168        'profiles/fceoyo',
169        'WAeUP_SRP',
170        EXTENSION,
[3763]171        for_=ICPSSite)       
172    profile_registry.registerProfile(
173        'aaue',
174        'WAeUP AAUE Profile',
175        "Ambrose Alli University",
176        'profiles/aaue',
177        'WAeUP_SRP',
178        EXTENSION,
179        for_=ICPSSite) 
180    profile_registry.registerProfile(
181        'futminna',
182        'WAeUP FUT Minna Profile',
183        "Federal University of Technology",
184        'profiles/futminna',
185        'WAeUP_SRP',
186        EXTENSION,
[3815]187        for_=ICPSSite)       
188    profile_registry.registerProfile(
189        'nau',
190        'WAeUP NAU Awka Profile',
191        "Nnamdi Azikiwe University",
192        'profiles/nau',
193        'WAeUP_SRP',
194        EXTENSION,
195        for_=ICPSSite)                                               
[2094]196##    DirectoryTypeRegistry.register(WAeUPTables.Applicants)
[84]197
[3672]198    # Create a faster session container in temp_folder...
199    import Zope
200    from Products.faster.sessiondata import addSessionDataContainer
201    sess_container_name = "faster_session"
202    root = Zope.app()
203    temp = root.unrestrictedTraverse( "/temp_folder", None )
204    if temp is not None and not sess_container_name in temp.objectIds():
[3682]205        addSessionDataContainer( temp, sess_container_name, 9600, 4800,
[3672]206                  lazy=True, title='Faster session data container')
207
Note: See TracBrowser for help on using the repository browser.