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