[199] | 1 | #-*- mode: python; mode: fold -*- |
---|
[204] | 2 | # $Id: __init__.py 3673 2008-09-16 14:59:16Z jens $ |
---|
[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 |
---|
[19] | 10 | |
---|
[199] | 11 | from Products.CPSCore.interfaces import ICPSSite |
---|
[2094] | 12 | from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry |
---|
[199] | 13 | |
---|
[3673] | 14 | import patches |
---|
| 15 | |
---|
[274] | 16 | import Products.WAeUP_SRP.WAeUPPermissions |
---|
[828] | 17 | import WAeUPTool |
---|
[200] | 18 | |
---|
[59] | 19 | import Widgets |
---|
[828] | 20 | tools = (WAeUPTool.WAeUPTool,) |
---|
[19] | 21 | |
---|
[452] | 22 | waeup_types = ( |
---|
[454] | 23 | ("University",('University',)), |
---|
| 24 | ("Academics", |
---|
| 25 | ("AcademicsFolder", |
---|
| 26 | "Certificate", |
---|
| 27 | "CertificateCourse", |
---|
| 28 | "Faculty", |
---|
| 29 | "Department", |
---|
| 30 | "Course", |
---|
| 31 | "CertificateCourse", |
---|
[565] | 32 | "StudyLevel", |
---|
[454] | 33 | ) |
---|
| 34 | ), |
---|
| 35 | ("Accommodation", |
---|
| 36 | ("AccoFolder", |
---|
[622] | 37 | "AccoHall", |
---|
[454] | 38 | ) |
---|
| 39 | ), |
---|
[1226] | 40 | ("Payment", |
---|
| 41 | ("PaymentsFolder", |
---|
| 42 | "Payment", |
---|
| 43 | ) |
---|
| 44 | ), |
---|
[454] | 45 | ("Students", |
---|
| 46 | ("StudentsFolder", |
---|
| 47 | "Student", |
---|
[639] | 48 | "StudentAccommodation", |
---|
[454] | 49 | "StudentStudyCourse", |
---|
[464] | 50 | "StudentCourseResult", |
---|
[472] | 51 | "StudentApplication", |
---|
[758] | 52 | "StudentPume", |
---|
[454] | 53 | "StudentClearance", |
---|
| 54 | "StudentPersonal", |
---|
[464] | 55 | "StudentStudyLevel", |
---|
[760] | 56 | #"Semester", |
---|
[467] | 57 | "StudentCourseResult", |
---|
[464] | 58 | # move to Academics later |
---|
[565] | 59 | #"Semester", |
---|
[454] | 60 | ) |
---|
| 61 | ), |
---|
[488] | 62 | ("ScratchCards", |
---|
| 63 | ("ScratchCardBatch", |
---|
[2013] | 64 | "ScratchCardBatchesFolder", |
---|
| 65 | ) |
---|
| 66 | ), |
---|
| 67 | ("Documents", |
---|
| 68 | ("DocumentsFolder", |
---|
| 69 | "WAeUPDocument", |
---|
| 70 | ) |
---|
[2914] | 71 | ), |
---|
[3277] | 72 | ("Upload", |
---|
| 73 | ("UploadsFolder", |
---|
| 74 | "Upload", |
---|
| 75 | ) |
---|
| 76 | ), |
---|
[200] | 77 | ) |
---|
| 78 | |
---|
[452] | 79 | contentClasses = [] |
---|
| 80 | cc = [] |
---|
[454] | 81 | for modu,names in waeup_types: |
---|
| 82 | mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(), |
---|
[452] | 83 | globals(), |
---|
| 84 | locals(), |
---|
[454] | 85 | ['*',] |
---|
[452] | 86 | ) |
---|
[454] | 87 | for name in names: |
---|
| 88 | #print name |
---|
| 89 | contentClasses.append(getattr(mod,name)) |
---|
| 90 | cc.append(getattr(mod,"add%(name)s" % vars())) |
---|
| 91 | contentConstructors = tuple(cc) |
---|
[200] | 92 | |
---|
[440] | 93 | fti = [{} for t in range(len(contentConstructors))] |
---|
[200] | 94 | |
---|
[199] | 95 | registerDirectory('skins', globals()) |
---|
[197] | 96 | |
---|
[199] | 97 | def initialize(registrar): |
---|
[828] | 98 | ToolInit('WAeUP Tool', |
---|
| 99 | tools=tools, |
---|
| 100 | icon='tool.gif', |
---|
| 101 | ).initialize(registrar) |
---|
[200] | 102 | ContentInit('WAeUP Types', |
---|
| 103 | content_types = contentClasses, |
---|
| 104 | permission = AddPortalContent, |
---|
| 105 | extra_constructors = contentConstructors, |
---|
| 106 | fti = fti, |
---|
| 107 | ).initialize(registrar) |
---|
| 108 | |
---|
[199] | 109 | # Extension profile registration |
---|
| 110 | profile_registry.registerProfile( |
---|
| 111 | 'default', |
---|
[274] | 112 | 'WAeUP_SRP', |
---|
[199] | 113 | "The WestAfrican e-University Project", |
---|
| 114 | 'profiles/default', |
---|
[274] | 115 | 'WAeUP_SRP', |
---|
[199] | 116 | EXTENSION, |
---|
| 117 | for_=ICPSSite) |
---|
[2094] | 118 | ## DirectoryTypeRegistry.register(WAeUPTables.Applicants) |
---|
[84] | 119 | |
---|
[3672] | 120 | # Create a faster session container in temp_folder... |
---|
| 121 | import Zope |
---|
| 122 | from Products.faster.sessiondata import addSessionDataContainer |
---|
| 123 | sess_container_name = "faster_session" |
---|
| 124 | root = Zope.app() |
---|
| 125 | temp = root.unrestrictedTraverse( "/temp_folder", None ) |
---|
| 126 | if temp is not None and not sess_container_name in temp.objectIds(): |
---|
| 127 | addSessionDataContainer( temp, sess_container_name, 9600, 4800, |
---|
| 128 | lazy=True, title='Faster session data container') |
---|
| 129 | |
---|