source: WAeUP_SRP/trunk/__init__.py @ 5214

Last change on this file since 5214 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
Line 
1#-*- mode: python; mode: fold -*-
2# $Id: __init__.py 3824 2008-12-19 15:44:45Z henrik $
3from Products.CMFCore.utils import ContentInit, ToolInit
4from Products.CMFCore.DirectoryView import registerDirectory
5from Products.CMFCore import utils as cmfutils
6from Products.CMFCore.permissions import AddPortalContent
7
8from Products.GenericSetup import profile_registry
9from Products.GenericSetup import EXTENSION
10from Products.GenericSetup import BASE
11
12from Products.CPSCore.interfaces import ICPSSite
13from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry
14
15import patches
16
17import Products.WAeUP_SRP.WAeUPPermissions
18import WAeUPTool
19
20import Widgets
21tools = (WAeUPTool.WAeUPTool,)
22
23waeup_types = (
24    ("University",
25       ('University',
26        'WAeUPConfiguration',
27        )
28    ),
29    ("Academics",
30       ("AcademicsFolder",
31        "Certificate",
32        "CertificateCourse",
33        "Faculty",
34        "Department",
35        "Course",
36        "CertificateCourse",
37        "StudyLevel",
38        )
39     ),
40     ("Accommodation",
41        ("AccoFolder",
42         "AccoHall",
43         )
44     ),
45     ("Payment",
46        ("PaymentsFolder",
47         "Payment",
48         )
49     ),
50     ("Students",
51        ("StudentsFolder",
52         "Student",
53         "StudentAccommodation",
54         "StudentStudyCourse",
55         "StudentCourseResult",
56         "StudentApplication",
57         "StudentPume",
58         "StudentClearance",
59         "StudentPersonal",
60         "StudentStudyLevel",
61         #"Semester",
62         "StudentCourseResult",
63         "StudentPastoralReport",
64         # move to Academics later
65         #"Semester",
66         )
67      ),
68     ("ScratchCards",
69         ("ScratchCardBatch",
70          "ScratchCardBatchesFolder",
71         )
72     ),
73     ("Documents",
74        ("DocumentsFolder",
75         "WAeUPDocument",
76        )
77     ),
78     ("Upload",
79        ("UploadsFolder",
80         "Upload",
81         )
82     ),
83    )
84
85contentClasses = []
86cc = []
87for modu,names in waeup_types:
88    mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(),
89                globals(),
90                locals(),
91                ['*',]
92                )
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)
98
99fti = [{} for t in range(len(contentConstructors))]
100
101registerDirectory('skins', globals())
102
103def initialize(registrar):
104    ToolInit('WAeUP Tool',
105              tools=tools,
106              icon='tool.gif',
107              ).initialize(registrar)
108    ContentInit('WAeUP Types',
109                content_types = contentClasses,
110                permission = AddPortalContent,
111                extra_constructors = contentConstructors,
112                fti = fti,
113                ).initialize(registrar)
114
115    # profile registration
116    profile_registry.registerProfile(
117        'default',
118        'WAeUP_SRP',
119        "WAeUP Default Profile",
120        'profiles/default',
121        'WAeUP_SRP',
122        BASE,
123        for_=ICPSSite)
124    profile_registry.registerProfile(
125        'uniben',
126        'WAeUP Uniben Profile',
127        "University of Benin",
128        'profiles/uniben',
129        'WAeUP_SRP',
130        EXTENSION,
131        for_=ICPSSite)       
132    profile_registry.registerProfile(
133        'fceokene',
134        'WAeUP FCE Okene Profile',
135        "Federal College of Education",
136        'profiles/fceokene',
137        'WAeUP_SRP',
138        EXTENSION,
139        for_=ICPSSite)       
140    profile_registry.registerProfile(
141        'aaua',
142        'WAeUP AAUA Profile',
143        "Adekunle Ajasin University",
144        'profiles/aaua',
145        'WAeUP_SRP',
146        EXTENSION,
147        for_=ICPSSite)   
148    profile_registry.registerProfile(
149        'unilorin',
150        'WAeUP Unilorin Profile',
151        "University of Ilorin",
152        'profiles/unilorin',
153        'WAeUP_SRP',
154        EXTENSION,
155        for_=ICPSSite)   
156    profile_registry.registerProfile(
157        'ois',
158        'WAeUP OIS Profile',
159        "Olashore International School",
160        'profiles/ois',
161        'WAeUP_SRP',
162        EXTENSION,
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,
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,
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)                                               
196##    DirectoryTypeRegistry.register(WAeUPTables.Applicants)
197
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():
205        addSessionDataContainer( temp, sess_container_name, 9600, 4800,
206                  lazy=True, title='Faster session data container')
207
Note: See TracBrowser for help on using the repository browser.