[199] | 1 | #-*- mode: python; mode: fold -*- |
---|
[204] | 2 | # $Id: __init__.py 7978 2012-03-26 04:57:14Z henrik $ |
---|
[206] | 3 | from Products.CMFCore.utils import ContentInit, ToolInit |
---|
[19] | 4 | from Products.CMFCore.DirectoryView import registerDirectory |
---|
| 5 | from Products.CMFCore import utils as cmfutils |
---|
[452] | 6 | from Products.CMFCore.permissions import AddPortalContent |
---|
[19] | 7 | |
---|
[199] | 8 | from Products.GenericSetup import profile_registry |
---|
| 9 | from Products.GenericSetup import EXTENSION |
---|
[3682] | 10 | from Products.GenericSetup import BASE |
---|
[19] | 11 | |
---|
[199] | 12 | from Products.CPSCore.interfaces import ICPSSite |
---|
[2094] | 13 | from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry |
---|
[199] | 14 | |
---|
[3673] | 15 | import patches |
---|
| 16 | |
---|
[274] | 17 | import Products.WAeUP_SRP.WAeUPPermissions |
---|
[828] | 18 | import WAeUPTool |
---|
[200] | 19 | |
---|
[59] | 20 | import Widgets |
---|
[828] | 21 | tools = (WAeUPTool.WAeUPTool,) |
---|
[19] | 22 | |
---|
[452] | 23 | waeup_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] | 85 | contentClasses = [] |
---|
| 86 | cc = [] |
---|
[454] | 87 | for 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())) |
---|
| 97 | contentConstructors = tuple(cc) |
---|
[200] | 98 | |
---|
[440] | 99 | fti = [{} for t in range(len(contentConstructors))] |
---|
[200] | 100 | |
---|
[199] | 101 | registerDirectory('skins', globals()) |
---|
[197] | 102 | |
---|
[199] | 103 | def 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', |
---|
[7978] | 126 | 'WAeUP Uniben UG Profile', |
---|
[3705] | 127 | "University of Benin", |
---|
| 128 | 'profiles/uniben', |
---|
| 129 | 'WAeUP_SRP', |
---|
[3708] | 130 | EXTENSION, |
---|
[3705] | 131 | for_=ICPSSite) |
---|
| 132 | profile_registry.registerProfile( |
---|
[7978] | 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( |
---|
[3689] | 141 | 'fceokene', |
---|
[3705] | 142 | 'WAeUP FCE Okene Profile', |
---|
[3689] | 143 | "Federal College of Education", |
---|
| 144 | 'profiles/fceokene', |
---|
| 145 | 'WAeUP_SRP', |
---|
[199] | 146 | EXTENSION, |
---|
[3689] | 147 | for_=ICPSSite) |
---|
| 148 | profile_registry.registerProfile( |
---|
| 149 | 'aaua', |
---|
[3705] | 150 | 'WAeUP AAUA Profile', |
---|
[3689] | 151 | "Adekunle Ajasin University", |
---|
| 152 | 'profiles/aaua', |
---|
| 153 | 'WAeUP_SRP', |
---|
| 154 | EXTENSION, |
---|
| 155 | for_=ICPSSite) |
---|
| 156 | profile_registry.registerProfile( |
---|
| 157 | 'unilorin', |
---|
[3705] | 158 | 'WAeUP Unilorin Profile', |
---|
[3689] | 159 | "University of Ilorin", |
---|
| 160 | 'profiles/unilorin', |
---|
| 161 | 'WAeUP_SRP', |
---|
| 162 | EXTENSION, |
---|
| 163 | for_=ICPSSite) |
---|
| 164 | profile_registry.registerProfile( |
---|
| 165 | 'ois', |
---|
[3705] | 166 | 'WAeUP OIS Profile', |
---|
[3689] | 167 | "Olashore International School", |
---|
| 168 | 'profiles/ois', |
---|
| 169 | 'WAeUP_SRP', |
---|
| 170 | EXTENSION, |
---|
[3714] | 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, |
---|
[3763] | 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, |
---|
[3815] | 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) |
---|
[2094] | 204 | ## DirectoryTypeRegistry.register(WAeUPTables.Applicants) |
---|
[84] | 205 | |
---|
[3672] | 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(): |
---|
[3682] | 213 | addSessionDataContainer( temp, sess_container_name, 9600, 4800, |
---|
[3672] | 214 | lazy=True, title='Faster session data container') |
---|
| 215 | |
---|