source: waeup_product/trunk/Academics.py @ 259

Last change on this file since 259 was 256, checked in by joachim, 18 years ago

=import from csv

  • Property svn:keywords set to Id
File size: 4.8 KB
Line 
1#-*- mode: python; mode: fold -*-
2from Globals import InitializeClass
3from AccessControl import ClassSecurityInfo
4
5from Products.CMFCore.utils import UniqueObject, getToolByName
6from Products.CMFCore.permissions import View
7from Products.CMFCore.permissions import ModifyPortalContent
8from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder
9#from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument
10from 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
44class 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
60InitializeClass(Certificate)
61
62def 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
69class 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
88InitializeClass(CertificateCourse)
89
90def 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
96class 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
112InitializeClass(Faculty)
113
114def 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
121class 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
135InitializeClass(Department)
136
137def 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
143class 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   
156InitializeClass(Course)
157
158def 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
164class CourseTicket(CPSDocument): ###(
165    """
166    WAeUP CourseTicket 
167    """
168    meta_type = 'CourseTicket'
169    portal_type = meta_type
170    security = ClassSecurityInfo()
171   
172InitializeClass(CourseTicket)
173
174def 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
Note: See TracBrowser for help on using the repository browser.