[68] | 1 | #-*- mode: python; mode: fold -*- |
---|
| 2 | from Globals import InitializeClass |
---|
| 3 | from AccessControl import ClassSecurityInfo |
---|
| 4 | |
---|
| 5 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
| 6 | from Products.CMFCore.permissions import View |
---|
| 7 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
| 8 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
| 9 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
| 10 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
[200] | 11 | #from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
| 12 | #from Products.CPSCore.CPSBase import CPSBaseBTreeDocument as BaseBTreeDocument |
---|
| 13 | #from Products.CMFCore.DirectoryView import registerDirectory |
---|
[68] | 14 | |
---|
[200] | 15 | #registerDirectory('skins', globals()) |
---|
| 16 | #registerDirectory('skins/waeup_default', globals()) |
---|
| 17 | #registerDirectory('skins/waeup_faculty', globals()) |
---|
[68] | 18 | |
---|
| 19 | class Faculty(CPSDocument): ###( |
---|
| 20 | """ |
---|
| 21 | WAeUP Faculty containing Departments |
---|
| 22 | """ |
---|
| 23 | meta_type = 'Faculty' |
---|
| 24 | portal_type = meta_type |
---|
| 25 | security = ClassSecurityInfo() |
---|
| 26 | |
---|
[200] | 27 | def __init__(self, id, **kw): |
---|
| 28 | CPSDocument.__init__(self, id, **kw) |
---|
[173] | 29 | |
---|
[200] | 30 | security.declareProtected(View,"Title") |
---|
| 31 | def Title(self): |
---|
| 32 | """compose title""" |
---|
| 33 | return "Faculty of %s" % (self.title) |
---|
| 34 | |
---|
[68] | 35 | InitializeClass(Faculty) |
---|
| 36 | |
---|
| 37 | def addFaculty(container, id, REQUEST=None, **kw): |
---|
| 38 | """Add a Faculty.""" |
---|
| 39 | ob = Faculty(id, **kw) |
---|
| 40 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 41 | |
---|
| 42 | ###) |
---|
| 43 | |
---|
[200] | 44 | |
---|
[68] | 45 | class Department(CPSDocument): ###( |
---|
| 46 | """ |
---|
| 47 | WAeUP Department containing the courses and students |
---|
| 48 | """ |
---|
| 49 | meta_type = 'Department' |
---|
| 50 | portal_type = meta_type |
---|
| 51 | security = ClassSecurityInfo() |
---|
[173] | 52 | |
---|
[176] | 53 | ## security.declareProtected(View,"Title") |
---|
| 54 | ## def Title(self): |
---|
| 55 | ## """compose title""" |
---|
| 56 | ## reg_nr = self.getId()[1:] |
---|
| 57 | ## return "Department of %s" % (self.title) |
---|
[173] | 58 | |
---|
[68] | 59 | InitializeClass(Department) |
---|
| 60 | |
---|
| 61 | def addDepartment(container, id, REQUEST=None, **kw): |
---|
| 62 | """Add a Department.""" |
---|
| 63 | ob = Department(id, **kw) |
---|
| 64 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 65 | ###) |
---|
| 66 | |
---|
[200] | 67 | ##course_fti = { ###( |
---|
| 68 | ## 'title': 'WAeUP Course', |
---|
| 69 | ## 'description': '', |
---|
| 70 | ## 'content_icon': '', |
---|
| 71 | ## 'content_meta_type': 'Course', |
---|
| 72 | ## 'factory': 'addCourse', |
---|
| 73 | ## 'immediate_view': 'cpsdocument_view', |
---|
| 74 | ## 'global_allow': True, |
---|
| 75 | ## 'filter_content_types': True, |
---|
| 76 | ## 'allowed_content_types': (), |
---|
| 77 | ## 'allow_discussion': False, |
---|
| 78 | ##} |
---|
| 79 | #####) |
---|
[68] | 80 | |
---|
| 81 | class Course(CPSDocument): ###( |
---|
| 82 | """ |
---|
| 83 | WAeUP Course |
---|
| 84 | """ |
---|
| 85 | meta_type = 'Course' |
---|
| 86 | portal_type = meta_type |
---|
| 87 | security = ClassSecurityInfo() |
---|
[152] | 88 | |
---|
| 89 | security.declareProtected(View,"Title") |
---|
| 90 | def Title(self): |
---|
| 91 | """compose title""" |
---|
| 92 | content = self.getContent() |
---|
| 93 | heading = getattr(content,'heading',None) |
---|
| 94 | if heading is None: |
---|
| 95 | return self.title |
---|
| 96 | return heading |
---|
[68] | 97 | |
---|
| 98 | InitializeClass(Course) |
---|
| 99 | |
---|
| 100 | def addCourse(container, id, REQUEST=None, **kw): |
---|
| 101 | """Add a Course.""" |
---|
| 102 | ob = Course(id, **kw) |
---|
| 103 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 104 | ###) |
---|
[139] | 105 | |
---|
| 106 | class CourseTicket(CPSDocument): ###( |
---|
| 107 | """ |
---|
| 108 | WAeUP CourseTicket |
---|
| 109 | """ |
---|
| 110 | meta_type = 'CourseTicket' |
---|
| 111 | portal_type = meta_type |
---|
| 112 | security = ClassSecurityInfo() |
---|
| 113 | |
---|
| 114 | InitializeClass(CourseTicket) |
---|
| 115 | |
---|
| 116 | def addCourseTicket(container, id, REQUEST=None, **kw): |
---|
| 117 | """Add a CourseTicket.""" |
---|
| 118 | ob = CourseTicket(id, **kw) |
---|
| 119 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 120 | ###) |
---|