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 |
---|
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 |
---|
14 | |
---|
15 | #registerDirectory('skins', globals()) |
---|
16 | #registerDirectory('skins/waeup_default', globals()) |
---|
17 | #registerDirectory('skins/waeup_faculty', globals()) |
---|
18 | |
---|
19 | class SCFolder(CPSDocument): ###( |
---|
20 | """ |
---|
21 | WAeUP StudyCourseFolder containing StudyCourses |
---|
22 | """ |
---|
23 | meta_type = 'SCFolder' |
---|
24 | portal_type = meta_type |
---|
25 | security = ClassSecurityInfo() |
---|
26 | |
---|
27 | def __init__(self, id, **kw): |
---|
28 | CPSDocument.__init__(self, id, **kw) |
---|
29 | |
---|
30 | security.declareProtected(View,"Title") |
---|
31 | def Title(self): |
---|
32 | """compose title""" |
---|
33 | return "SCFolder of %s" % (self.title) |
---|
34 | |
---|
35 | InitializeClass(SCFolder) |
---|
36 | |
---|
37 | def addSCFolder(container, id, REQUEST=None, **kw): |
---|
38 | """Add a SCFolder.""" |
---|
39 | ob = SCFolder(id, **kw) |
---|
40 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
41 | |
---|
42 | ###) |
---|
43 | |
---|
44 | class StudyCourse(CPSDocument): ###( |
---|
45 | """ |
---|
46 | WAeUP StudyCourse |
---|
47 | """ |
---|
48 | meta_type = 'StudyCourse' |
---|
49 | portal_type = meta_type |
---|
50 | security = ClassSecurityInfo() |
---|
51 | |
---|
52 | def __init__(self, id, **kw): |
---|
53 | CPSDocument.__init__(self, id, **kw) |
---|
54 | |
---|
55 | ## security.declareProtected(View,"Title") |
---|
56 | ## def Title(self): |
---|
57 | ## """compose title""" |
---|
58 | ## return "StudyCourse of %s" % (self.title) |
---|
59 | |
---|
60 | InitializeClass(StudyCourse) |
---|
61 | |
---|
62 | def addStudyCourse(container, id, REQUEST=None, **kw): |
---|
63 | """Add a StudyCourse.""" |
---|
64 | ob = StudyCourse(id, **kw) |
---|
65 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
66 | |
---|
67 | ###) |
---|
68 | |
---|
69 | class Faculty(CPSDocument): ###( |
---|
70 | """ |
---|
71 | WAeUP Faculty containing Departments |
---|
72 | """ |
---|
73 | meta_type = 'Faculty' |
---|
74 | portal_type = meta_type |
---|
75 | security = ClassSecurityInfo() |
---|
76 | |
---|
77 | ## def __init__(self, id, **kw): |
---|
78 | ## CPSDocument.__init__(self, id, **kw) |
---|
79 | |
---|
80 | security.declareProtected(View,"Title") |
---|
81 | def Title(self): |
---|
82 | """compose title""" |
---|
83 | return "%s" % (self.title) |
---|
84 | |
---|
85 | InitializeClass(Faculty) |
---|
86 | |
---|
87 | def addFaculty(container, id, REQUEST=None, **kw): |
---|
88 | """Add a Faculty.""" |
---|
89 | ob = Faculty(id, **kw) |
---|
90 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
91 | |
---|
92 | ###) |
---|
93 | |
---|
94 | class Department(CPSDocument): ###( |
---|
95 | """ |
---|
96 | WAeUP Department containing the courses and students |
---|
97 | """ |
---|
98 | meta_type = 'Department' |
---|
99 | portal_type = meta_type |
---|
100 | security = ClassSecurityInfo() |
---|
101 | |
---|
102 | ## security.declareProtected(View,"Title") |
---|
103 | ## def Title(self): |
---|
104 | ## """compose title""" |
---|
105 | ## reg_nr = self.getId()[1:] |
---|
106 | ## return "Department of %s" % (self.title) |
---|
107 | |
---|
108 | InitializeClass(Department) |
---|
109 | |
---|
110 | def addDepartment(container, id, REQUEST=None, **kw): |
---|
111 | """Add a Department.""" |
---|
112 | ob = Department(id, **kw) |
---|
113 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
114 | ###) |
---|
115 | |
---|
116 | class Course(CPSDocument): ###( |
---|
117 | """ |
---|
118 | WAeUP Course |
---|
119 | """ |
---|
120 | meta_type = 'Course' |
---|
121 | portal_type = meta_type |
---|
122 | security = ClassSecurityInfo() |
---|
123 | |
---|
124 | security.declareProtected(View,"Title") |
---|
125 | def Title(self): |
---|
126 | """compose title""" |
---|
127 | return self.title |
---|
128 | |
---|
129 | InitializeClass(Course) |
---|
130 | |
---|
131 | def addCourse(container, id, REQUEST=None, **kw): |
---|
132 | """Add a Course.""" |
---|
133 | ob = Course(id, **kw) |
---|
134 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
135 | ###) |
---|
136 | |
---|
137 | class CourseTicket(CPSDocument): ###( |
---|
138 | """ |
---|
139 | WAeUP CourseTicket |
---|
140 | """ |
---|
141 | meta_type = 'CourseTicket' |
---|
142 | portal_type = meta_type |
---|
143 | security = ClassSecurityInfo() |
---|
144 | |
---|
145 | InitializeClass(CourseTicket) |
---|
146 | |
---|
147 | def addCourseTicket(container, id, REQUEST=None, **kw): |
---|
148 | """Add a CourseTicket.""" |
---|
149 | ob = CourseTicket(id, **kw) |
---|
150 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
151 | ###) |
---|