[199] | 1 | #-*- mode: python; mode: fold -*- |
---|
[204] | 2 | # $Id: __init__.py 3714 2008-10-08 18:29:55Z 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 = ( |
---|
[454] | 24 | ("University",('University',)), |
---|
| 25 | ("Academics", |
---|
| 26 | ("AcademicsFolder", |
---|
| 27 | "Certificate", |
---|
| 28 | "CertificateCourse", |
---|
| 29 | "Faculty", |
---|
| 30 | "Department", |
---|
| 31 | "Course", |
---|
| 32 | "CertificateCourse", |
---|
[565] | 33 | "StudyLevel", |
---|
[454] | 34 | ) |
---|
| 35 | ), |
---|
| 36 | ("Accommodation", |
---|
| 37 | ("AccoFolder", |
---|
[622] | 38 | "AccoHall", |
---|
[454] | 39 | ) |
---|
| 40 | ), |
---|
[1226] | 41 | ("Payment", |
---|
| 42 | ("PaymentsFolder", |
---|
| 43 | "Payment", |
---|
| 44 | ) |
---|
| 45 | ), |
---|
[454] | 46 | ("Students", |
---|
| 47 | ("StudentsFolder", |
---|
| 48 | "Student", |
---|
[639] | 49 | "StudentAccommodation", |
---|
[454] | 50 | "StudentStudyCourse", |
---|
[464] | 51 | "StudentCourseResult", |
---|
[472] | 52 | "StudentApplication", |
---|
[758] | 53 | "StudentPume", |
---|
[454] | 54 | "StudentClearance", |
---|
| 55 | "StudentPersonal", |
---|
[464] | 56 | "StudentStudyLevel", |
---|
[760] | 57 | #"Semester", |
---|
[467] | 58 | "StudentCourseResult", |
---|
[3682] | 59 | "StudentPastoralReport", |
---|
[464] | 60 | # move to Academics later |
---|
[565] | 61 | #"Semester", |
---|
[454] | 62 | ) |
---|
| 63 | ), |
---|
[488] | 64 | ("ScratchCards", |
---|
| 65 | ("ScratchCardBatch", |
---|
[2013] | 66 | "ScratchCardBatchesFolder", |
---|
| 67 | ) |
---|
| 68 | ), |
---|
| 69 | ("Documents", |
---|
| 70 | ("DocumentsFolder", |
---|
| 71 | "WAeUPDocument", |
---|
| 72 | ) |
---|
[2914] | 73 | ), |
---|
[3277] | 74 | ("Upload", |
---|
| 75 | ("UploadsFolder", |
---|
| 76 | "Upload", |
---|
| 77 | ) |
---|
| 78 | ), |
---|
[200] | 79 | ) |
---|
| 80 | |
---|
[452] | 81 | contentClasses = [] |
---|
| 82 | cc = [] |
---|
[454] | 83 | for modu,names in waeup_types: |
---|
| 84 | mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(), |
---|
[452] | 85 | globals(), |
---|
| 86 | locals(), |
---|
[454] | 87 | ['*',] |
---|
[452] | 88 | ) |
---|
[454] | 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) |
---|
[200] | 94 | |
---|
[440] | 95 | fti = [{} for t in range(len(contentConstructors))] |
---|
[200] | 96 | |
---|
[199] | 97 | registerDirectory('skins', globals()) |
---|
[197] | 98 | |
---|
[199] | 99 | def initialize(registrar): |
---|
[828] | 100 | ToolInit('WAeUP Tool', |
---|
| 101 | tools=tools, |
---|
| 102 | icon='tool.gif', |
---|
| 103 | ).initialize(registrar) |
---|
[200] | 104 | ContentInit('WAeUP Types', |
---|
| 105 | content_types = contentClasses, |
---|
| 106 | permission = AddPortalContent, |
---|
| 107 | extra_constructors = contentConstructors, |
---|
| 108 | fti = fti, |
---|
| 109 | ).initialize(registrar) |
---|
| 110 | |
---|
[3689] | 111 | # profile registration |
---|
[199] | 112 | profile_registry.registerProfile( |
---|
| 113 | 'default', |
---|
[274] | 114 | 'WAeUP_SRP', |
---|
[3705] | 115 | "WAeUP Default Profile", |
---|
[199] | 116 | 'profiles/default', |
---|
[274] | 117 | 'WAeUP_SRP', |
---|
[3689] | 118 | BASE, |
---|
| 119 | for_=ICPSSite) |
---|
| 120 | profile_registry.registerProfile( |
---|
[3705] | 121 | 'uniben', |
---|
| 122 | 'WAeUP Uniben Profile', |
---|
| 123 | "University of Benin", |
---|
| 124 | 'profiles/uniben', |
---|
| 125 | 'WAeUP_SRP', |
---|
[3708] | 126 | EXTENSION, |
---|
[3705] | 127 | for_=ICPSSite) |
---|
| 128 | profile_registry.registerProfile( |
---|
[3689] | 129 | 'fceokene', |
---|
[3705] | 130 | 'WAeUP FCE Okene Profile', |
---|
[3689] | 131 | "Federal College of Education", |
---|
| 132 | 'profiles/fceokene', |
---|
| 133 | 'WAeUP_SRP', |
---|
[199] | 134 | EXTENSION, |
---|
[3689] | 135 | for_=ICPSSite) |
---|
| 136 | profile_registry.registerProfile( |
---|
| 137 | 'aaua', |
---|
[3705] | 138 | 'WAeUP AAUA Profile', |
---|
[3689] | 139 | "Adekunle Ajasin University", |
---|
| 140 | 'profiles/aaua', |
---|
| 141 | 'WAeUP_SRP', |
---|
| 142 | EXTENSION, |
---|
| 143 | for_=ICPSSite) |
---|
| 144 | profile_registry.registerProfile( |
---|
| 145 | 'unilorin', |
---|
[3705] | 146 | 'WAeUP Unilorin Profile', |
---|
[3689] | 147 | "University of Ilorin", |
---|
| 148 | 'profiles/unilorin', |
---|
| 149 | 'WAeUP_SRP', |
---|
| 150 | EXTENSION, |
---|
| 151 | for_=ICPSSite) |
---|
| 152 | profile_registry.registerProfile( |
---|
| 153 | 'ois', |
---|
[3705] | 154 | 'WAeUP OIS Profile', |
---|
[3689] | 155 | "Olashore International School", |
---|
| 156 | 'profiles/ois', |
---|
| 157 | 'WAeUP_SRP', |
---|
| 158 | EXTENSION, |
---|
[3714] | 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) |
---|
[2094] | 168 | ## DirectoryTypeRegistry.register(WAeUPTables.Applicants) |
---|
[84] | 169 | |
---|
[3672] | 170 | # Create a faster session container in temp_folder... |
---|
| 171 | import Zope |
---|
| 172 | from Products.faster.sessiondata import addSessionDataContainer |
---|
| 173 | sess_container_name = "faster_session" |
---|
| 174 | root = Zope.app() |
---|
| 175 | temp = root.unrestrictedTraverse( "/temp_folder", None ) |
---|
| 176 | if temp is not None and not sess_container_name in temp.objectIds(): |
---|
[3682] | 177 | addSessionDataContainer( temp, sess_container_name, 9600, 4800, |
---|
[3672] | 178 | lazy=True, title='Faster session data container') |
---|
| 179 | |
---|