| 1 | #-*- mode: python; mode: fold -*- |
|---|
| 2 | # $Id: __init__.py 3673 2008-09-16 14:59:16Z jens $ |
|---|
| 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 | |
|---|
| 11 | from Products.CPSCore.interfaces import ICPSSite |
|---|
| 12 | from Products.CPSDirectory.DirectoryTool import DirectoryTypeRegistry |
|---|
| 13 | |
|---|
| 14 | import patches |
|---|
| 15 | |
|---|
| 16 | import Products.WAeUP_SRP.WAeUPPermissions |
|---|
| 17 | import WAeUPTool |
|---|
| 18 | |
|---|
| 19 | import Widgets |
|---|
| 20 | tools = (WAeUPTool.WAeUPTool,) |
|---|
| 21 | |
|---|
| 22 | waeup_types = ( |
|---|
| 23 | ("University",('University',)), |
|---|
| 24 | ("Academics", |
|---|
| 25 | ("AcademicsFolder", |
|---|
| 26 | "Certificate", |
|---|
| 27 | "CertificateCourse", |
|---|
| 28 | "Faculty", |
|---|
| 29 | "Department", |
|---|
| 30 | "Course", |
|---|
| 31 | "CertificateCourse", |
|---|
| 32 | "StudyLevel", |
|---|
| 33 | ) |
|---|
| 34 | ), |
|---|
| 35 | ("Accommodation", |
|---|
| 36 | ("AccoFolder", |
|---|
| 37 | "AccoHall", |
|---|
| 38 | ) |
|---|
| 39 | ), |
|---|
| 40 | ("Payment", |
|---|
| 41 | ("PaymentsFolder", |
|---|
| 42 | "Payment", |
|---|
| 43 | ) |
|---|
| 44 | ), |
|---|
| 45 | ("Students", |
|---|
| 46 | ("StudentsFolder", |
|---|
| 47 | "Student", |
|---|
| 48 | "StudentAccommodation", |
|---|
| 49 | "StudentStudyCourse", |
|---|
| 50 | "StudentCourseResult", |
|---|
| 51 | "StudentApplication", |
|---|
| 52 | "StudentPume", |
|---|
| 53 | "StudentClearance", |
|---|
| 54 | "StudentPersonal", |
|---|
| 55 | "StudentStudyLevel", |
|---|
| 56 | #"Semester", |
|---|
| 57 | "StudentCourseResult", |
|---|
| 58 | # move to Academics later |
|---|
| 59 | #"Semester", |
|---|
| 60 | ) |
|---|
| 61 | ), |
|---|
| 62 | ("ScratchCards", |
|---|
| 63 | ("ScratchCardBatch", |
|---|
| 64 | "ScratchCardBatchesFolder", |
|---|
| 65 | ) |
|---|
| 66 | ), |
|---|
| 67 | ("Documents", |
|---|
| 68 | ("DocumentsFolder", |
|---|
| 69 | "WAeUPDocument", |
|---|
| 70 | ) |
|---|
| 71 | ), |
|---|
| 72 | ("Upload", |
|---|
| 73 | ("UploadsFolder", |
|---|
| 74 | "Upload", |
|---|
| 75 | ) |
|---|
| 76 | ), |
|---|
| 77 | ) |
|---|
| 78 | |
|---|
| 79 | contentClasses = [] |
|---|
| 80 | cc = [] |
|---|
| 81 | for modu,names in waeup_types: |
|---|
| 82 | mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(), |
|---|
| 83 | globals(), |
|---|
| 84 | locals(), |
|---|
| 85 | ['*',] |
|---|
| 86 | ) |
|---|
| 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) |
|---|
| 92 | |
|---|
| 93 | fti = [{} for t in range(len(contentConstructors))] |
|---|
| 94 | |
|---|
| 95 | registerDirectory('skins', globals()) |
|---|
| 96 | |
|---|
| 97 | def initialize(registrar): |
|---|
| 98 | ToolInit('WAeUP Tool', |
|---|
| 99 | tools=tools, |
|---|
| 100 | icon='tool.gif', |
|---|
| 101 | ).initialize(registrar) |
|---|
| 102 | ContentInit('WAeUP Types', |
|---|
| 103 | content_types = contentClasses, |
|---|
| 104 | permission = AddPortalContent, |
|---|
| 105 | extra_constructors = contentConstructors, |
|---|
| 106 | fti = fti, |
|---|
| 107 | ).initialize(registrar) |
|---|
| 108 | |
|---|
| 109 | # Extension profile registration |
|---|
| 110 | profile_registry.registerProfile( |
|---|
| 111 | 'default', |
|---|
| 112 | 'WAeUP_SRP', |
|---|
| 113 | "The WestAfrican e-University Project", |
|---|
| 114 | 'profiles/default', |
|---|
| 115 | 'WAeUP_SRP', |
|---|
| 116 | EXTENSION, |
|---|
| 117 | for_=ICPSSite) |
|---|
| 118 | ## DirectoryTypeRegistry.register(WAeUPTables.Applicants) |
|---|
| 119 | |
|---|
| 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 | |
|---|