1 | #-*- mode: python; mode: fold -*- |
---|
2 | # $Id: __init__.py 7978 2012-03-26 04:57:14Z 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", |
---|
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 | |
---|
85 | contentClasses = [] |
---|
86 | cc = [] |
---|
87 | for 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())) |
---|
97 | contentConstructors = tuple(cc) |
---|
98 | |
---|
99 | fti = [{} for t in range(len(contentConstructors))] |
---|
100 | |
---|
101 | registerDirectory('skins', globals()) |
---|
102 | |
---|
103 | def 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 UG Profile', |
---|
127 | "University of Benin", |
---|
128 | 'profiles/uniben', |
---|
129 | 'WAeUP_SRP', |
---|
130 | EXTENSION, |
---|
131 | for_=ICPSSite) |
---|
132 | profile_registry.registerProfile( |
---|
133 | 'unibenpg', |
---|
134 | 'WAeUP Uniben PG Profile', |
---|
135 | "University of Benin", |
---|
136 | 'profiles/unibenpg', |
---|
137 | 'WAeUP_SRP', |
---|
138 | EXTENSION, |
---|
139 | for_=ICPSSite) |
---|
140 | profile_registry.registerProfile( |
---|
141 | 'fceokene', |
---|
142 | 'WAeUP FCE Okene Profile', |
---|
143 | "Federal College of Education", |
---|
144 | 'profiles/fceokene', |
---|
145 | 'WAeUP_SRP', |
---|
146 | EXTENSION, |
---|
147 | for_=ICPSSite) |
---|
148 | profile_registry.registerProfile( |
---|
149 | 'aaua', |
---|
150 | 'WAeUP AAUA Profile', |
---|
151 | "Adekunle Ajasin University", |
---|
152 | 'profiles/aaua', |
---|
153 | 'WAeUP_SRP', |
---|
154 | EXTENSION, |
---|
155 | for_=ICPSSite) |
---|
156 | profile_registry.registerProfile( |
---|
157 | 'unilorin', |
---|
158 | 'WAeUP Unilorin Profile', |
---|
159 | "University of Ilorin", |
---|
160 | 'profiles/unilorin', |
---|
161 | 'WAeUP_SRP', |
---|
162 | EXTENSION, |
---|
163 | for_=ICPSSite) |
---|
164 | profile_registry.registerProfile( |
---|
165 | 'ois', |
---|
166 | 'WAeUP OIS Profile', |
---|
167 | "Olashore International School", |
---|
168 | 'profiles/ois', |
---|
169 | 'WAeUP_SRP', |
---|
170 | EXTENSION, |
---|
171 | for_=ICPSSite) |
---|
172 | profile_registry.registerProfile( |
---|
173 | 'fceoyo', |
---|
174 | 'WAeUP FCE Oyo Profile', |
---|
175 | "Federal College of Education", |
---|
176 | 'profiles/fceoyo', |
---|
177 | 'WAeUP_SRP', |
---|
178 | EXTENSION, |
---|
179 | for_=ICPSSite) |
---|
180 | profile_registry.registerProfile( |
---|
181 | 'aaue', |
---|
182 | 'WAeUP AAUE Profile', |
---|
183 | "Ambrose Alli University", |
---|
184 | 'profiles/aaue', |
---|
185 | 'WAeUP_SRP', |
---|
186 | EXTENSION, |
---|
187 | for_=ICPSSite) |
---|
188 | profile_registry.registerProfile( |
---|
189 | 'futminna', |
---|
190 | 'WAeUP FUT Minna Profile', |
---|
191 | "Federal University of Technology", |
---|
192 | 'profiles/futminna', |
---|
193 | 'WAeUP_SRP', |
---|
194 | EXTENSION, |
---|
195 | for_=ICPSSite) |
---|
196 | profile_registry.registerProfile( |
---|
197 | 'nau', |
---|
198 | 'WAeUP NAU Awka Profile', |
---|
199 | "Nnamdi Azikiwe University", |
---|
200 | 'profiles/nau', |
---|
201 | 'WAeUP_SRP', |
---|
202 | EXTENSION, |
---|
203 | for_=ICPSSite) |
---|
204 | ## DirectoryTypeRegistry.register(WAeUPTables.Applicants) |
---|
205 | |
---|
206 | # Create a faster session container in temp_folder... |
---|
207 | import Zope |
---|
208 | from Products.faster.sessiondata import addSessionDataContainer |
---|
209 | sess_container_name = "faster_session" |
---|
210 | root = Zope.app() |
---|
211 | temp = root.unrestrictedTraverse( "/temp_folder", None ) |
---|
212 | if temp is not None and not sess_container_name in temp.objectIds(): |
---|
213 | addSessionDataContainer( temp, sess_container_name, 9600, 4800, |
---|
214 | lazy=True, title='Faster session data container') |
---|
215 | |
---|