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 Certificate(CPSDocument): ###( |
---|
45 | """ |
---|
46 | WAeUP Certificate |
---|
47 | """ |
---|
48 | meta_type = 'Certificate' |
---|
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 "Certificate of %s" % (self.title) |
---|
59 | |
---|
60 | InitializeClass(Certificate) |
---|
61 | |
---|
62 | def addCertificate(container, id, REQUEST=None, **kw): |
---|
63 | """Add a Certificate.""" |
---|
64 | ob = Certificate(id, **kw) |
---|
65 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
66 | |
---|
67 | ###) |
---|
68 | |
---|
69 | class CertificateCourse(CPSDocument): ###( |
---|
70 | """ |
---|
71 | WAeUP CertificateCourse |
---|
72 | """ |
---|
73 | meta_type = 'CertificateCourse' |
---|
74 | portal_type = meta_type |
---|
75 | security = ClassSecurityInfo() |
---|
76 | |
---|
77 | security.declareProtected(View,"Title") |
---|
78 | def Title(self): |
---|
79 | """compose title""" |
---|
80 | res = self.portal_catalog({'meta_type': "Course", |
---|
81 | 'id': self.id}) |
---|
82 | if res: |
---|
83 | course = res[-1].getObject() |
---|
84 | else: |
---|
85 | return "No course for %s" % self.id |
---|
86 | return "%s" % (course.title) |
---|
87 | |
---|
88 | InitializeClass(CertificateCourse) |
---|
89 | |
---|
90 | def addCertificateCourse(container, id, REQUEST=None, **kw): |
---|
91 | """Add a CertificateCourse.""" |
---|
92 | ob = CertificateCourse(id, **kw) |
---|
93 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
94 | ###) |
---|
95 | |
---|
96 | class Faculty(CPSDocument): ###( |
---|
97 | """ |
---|
98 | WAeUP Faculty containing Departments |
---|
99 | """ |
---|
100 | meta_type = 'Faculty' |
---|
101 | portal_type = meta_type |
---|
102 | security = ClassSecurityInfo() |
---|
103 | |
---|
104 | ## def __init__(self, id, **kw): |
---|
105 | ## CPSDocument.__init__(self, id, **kw) |
---|
106 | |
---|
107 | security.declareProtected(View,"Title") |
---|
108 | def Title(self): |
---|
109 | """compose title""" |
---|
110 | return "%s" % (self.title) |
---|
111 | |
---|
112 | InitializeClass(Faculty) |
---|
113 | |
---|
114 | def addFaculty(container, id, REQUEST=None, **kw): |
---|
115 | """Add a Faculty.""" |
---|
116 | ob = Faculty(id, **kw) |
---|
117 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
118 | |
---|
119 | ###) |
---|
120 | |
---|
121 | class Department(CPSDocument): ###( |
---|
122 | """ |
---|
123 | WAeUP Department containing the courses and students |
---|
124 | """ |
---|
125 | meta_type = 'Department' |
---|
126 | portal_type = meta_type |
---|
127 | security = ClassSecurityInfo() |
---|
128 | |
---|
129 | ## security.declareProtected(View,"Title") |
---|
130 | ## def Title(self): |
---|
131 | ## """compose title""" |
---|
132 | ## reg_nr = self.getId()[1:] |
---|
133 | ## return "Department of %s" % (self.title) |
---|
134 | |
---|
135 | InitializeClass(Department) |
---|
136 | |
---|
137 | def addDepartment(container, id, REQUEST=None, **kw): |
---|
138 | """Add a Department.""" |
---|
139 | ob = Department(id, **kw) |
---|
140 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
141 | ###) |
---|
142 | |
---|
143 | class Course(CPSDocument): ###( |
---|
144 | """ |
---|
145 | WAeUP Course |
---|
146 | """ |
---|
147 | meta_type = 'Course' |
---|
148 | portal_type = meta_type |
---|
149 | security = ClassSecurityInfo() |
---|
150 | |
---|
151 | security.declareProtected(View,"Title") |
---|
152 | def Title(self): |
---|
153 | """compose title""" |
---|
154 | return self.title |
---|
155 | |
---|
156 | InitializeClass(Course) |
---|
157 | |
---|
158 | def addCourse(container, id, REQUEST=None, **kw): |
---|
159 | """Add a Course.""" |
---|
160 | ob = Course(id, **kw) |
---|
161 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
162 | ###) |
---|
163 | |
---|
164 | class CourseTicket(CPSDocument): ###( |
---|
165 | """ |
---|
166 | WAeUP CourseTicket |
---|
167 | """ |
---|
168 | meta_type = 'CourseTicket' |
---|
169 | portal_type = meta_type |
---|
170 | security = ClassSecurityInfo() |
---|
171 | |
---|
172 | InitializeClass(CourseTicket) |
---|
173 | |
---|
174 | def addCourseTicket(container, id, REQUEST=None, **kw): |
---|
175 | """Add a CourseTicket.""" |
---|
176 | ob = CourseTicket(id, **kw) |
---|
177 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
178 | ###) |
---|
179 | |
---|