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