| 1 | #-*- mode: python; mode: fold -*- |
|---|
| 2 | # $Id: __init__.py 1226 2007-01-07 16:48:21Z joachim $ |
|---|
| 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 | |
|---|
| 13 | import PatchCPSWorkflowWorkflowDefinition |
|---|
| 14 | import PatchCatalogToolXMLAdapter |
|---|
| 15 | import PatchCPSSchemasAttributeStorageAdapter |
|---|
| 16 | import PatchCPSSchemasDataModel |
|---|
| 17 | import PatchCPSMembershipTool |
|---|
| 18 | import PatchCPSUserFolderUserFolder |
|---|
| 19 | import PatchCPSStackingDirectoryStorageAdapter |
|---|
| 20 | import PatchBasicWidgetsCPSStringWidget |
|---|
| 21 | import PatchBasicWidgetsUnprepare |
|---|
| 22 | # Only for CPS 3.4.1. In 3.4.2 and later this should be fixed. |
|---|
| 23 | import PatchCPSDefaultImportExport |
|---|
| 24 | import Products.WAeUP_SRP.WAeUPPermissions |
|---|
| 25 | import WAeUPTool |
|---|
| 26 | |
|---|
| 27 | import Widgets |
|---|
| 28 | tools = (WAeUPTool.WAeUPTool,) |
|---|
| 29 | |
|---|
| 30 | waeup_types = ( |
|---|
| 31 | ("University",('University',)), |
|---|
| 32 | ("Academics", |
|---|
| 33 | ("AcademicsFolder", |
|---|
| 34 | "Certificate", |
|---|
| 35 | "CertificateCourse", |
|---|
| 36 | "Faculty", |
|---|
| 37 | "Department", |
|---|
| 38 | "Course", |
|---|
| 39 | "CertificateCourse", |
|---|
| 40 | "StudyLevel", |
|---|
| 41 | ) |
|---|
| 42 | ), |
|---|
| 43 | ("Accommodation", |
|---|
| 44 | ("AccoFolder", |
|---|
| 45 | "AccoHall", |
|---|
| 46 | ) |
|---|
| 47 | ), |
|---|
| 48 | ("Payment", |
|---|
| 49 | ("PaymentsFolder", |
|---|
| 50 | "Payment", |
|---|
| 51 | ) |
|---|
| 52 | ), |
|---|
| 53 | ("Students", |
|---|
| 54 | ("StudentsFolder", |
|---|
| 55 | "Student", |
|---|
| 56 | "StudentAccommodation", |
|---|
| 57 | "StudentStudyCourse", |
|---|
| 58 | "StudentCourseResult", |
|---|
| 59 | "StudentApplication", |
|---|
| 60 | "StudentPume", |
|---|
| 61 | "StudentClearance", |
|---|
| 62 | "StudentPersonal", |
|---|
| 63 | "StudentStudyLevel", |
|---|
| 64 | #"Semester", |
|---|
| 65 | "StudentCourseResult", |
|---|
| 66 | # move to Academics later |
|---|
| 67 | #"Semester", |
|---|
| 68 | ) |
|---|
| 69 | ), |
|---|
| 70 | ("ScratchCards", |
|---|
| 71 | ("ScratchCardBatch", |
|---|
| 72 | "ScratchCardBatchesFolder", |
|---|
| 73 | ), |
|---|
| 74 | ) |
|---|
| 75 | ) |
|---|
| 76 | |
|---|
| 77 | contentClasses = [] |
|---|
| 78 | cc = [] |
|---|
| 79 | for modu,names in waeup_types: |
|---|
| 80 | mod = __import__('Products.WAeUP_SRP.%(modu)s' % vars(), |
|---|
| 81 | globals(), |
|---|
| 82 | locals(), |
|---|
| 83 | ['*',] |
|---|
| 84 | ) |
|---|
| 85 | for name in names: |
|---|
| 86 | #print name |
|---|
| 87 | contentClasses.append(getattr(mod,name)) |
|---|
| 88 | cc.append(getattr(mod,"add%(name)s" % vars())) |
|---|
| 89 | contentConstructors = tuple(cc) |
|---|
| 90 | |
|---|
| 91 | fti = [{} for t in range(len(contentConstructors))] |
|---|
| 92 | |
|---|
| 93 | registerDirectory('skins', globals()) |
|---|
| 94 | |
|---|
| 95 | def initialize(registrar): |
|---|
| 96 | ToolInit('WAeUP Tool', |
|---|
| 97 | tools=tools, |
|---|
| 98 | icon='tool.gif', |
|---|
| 99 | ).initialize(registrar) |
|---|
| 100 | ContentInit('WAeUP Types', |
|---|
| 101 | content_types = contentClasses, |
|---|
| 102 | permission = AddPortalContent, |
|---|
| 103 | extra_constructors = contentConstructors, |
|---|
| 104 | fti = fti, |
|---|
| 105 | ).initialize(registrar) |
|---|
| 106 | |
|---|
| 107 | # Extension profile registration |
|---|
| 108 | profile_registry.registerProfile( |
|---|
| 109 | 'default', |
|---|
| 110 | 'WAeUP_SRP', |
|---|
| 111 | "The WestAfrican e-University Project", |
|---|
| 112 | 'profiles/default', |
|---|
| 113 | 'WAeUP_SRP', |
|---|
| 114 | EXTENSION, |
|---|
| 115 | for_=ICPSSite) |
|---|
| 116 | |
|---|