source: waeup_product/trunk/Academics.py @ 238

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

=import csv

  • Property svn:keywords set to Id
File size: 4.0 KB
RevLine 
[68]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
[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
[238]19class 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
35InitializeClass(SCFolder)
36
37def 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 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
60InitializeClass(StudyCourse)
61
62def 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
[68]69class Faculty(CPSDocument): ###(
70    """
71    WAeUP Faculty containing Departments
72    """
73    meta_type = 'Faculty'
74    portal_type = meta_type
75    security = ClassSecurityInfo()
76   
[238]77##    def __init__(self, id, **kw):
78##        CPSDocument.__init__(self, id, **kw)
[173]79
[200]80    security.declareProtected(View,"Title")
81    def Title(self):
82        """compose title"""
[238]83        return "%s" % (self.title)
[200]84
[68]85InitializeClass(Faculty)
86
87def 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
94class Department(CPSDocument): ###(
95    """
96    WAeUP Department containing the courses and students
97    """
98    meta_type = 'Department'
99    portal_type = meta_type
100    security = ClassSecurityInfo()
[173]101
[176]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)
[173]107
[68]108InitializeClass(Department)
109
110def 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
116class Course(CPSDocument): ###(
117    """
118    WAeUP Course 
119    """
120    meta_type = 'Course'
121    portal_type = meta_type
122    security = ClassSecurityInfo()
[152]123
124    security.declareProtected(View,"Title")
125    def Title(self):
126        """compose title"""
[238]127        return self.title
[68]128   
129InitializeClass(Course)
130
131def addCourse(container, id, REQUEST=None, **kw):
132    """Add a Course."""
133    ob = Course(id, **kw)
134    return CPSBase_adder(container, ob, REQUEST=REQUEST)
135###)
[139]136
137class CourseTicket(CPSDocument): ###(
138    """
139    WAeUP CourseTicket 
140    """
141    meta_type = 'CourseTicket'
142    portal_type = meta_type
143    security = ClassSecurityInfo()
144   
145InitializeClass(CourseTicket)
146
147def addCourseTicket(container, id, REQUEST=None, **kw):
148    """Add a CourseTicket."""
149    ob = CourseTicket(id, **kw)
150    return CPSBase_adder(container, ob, REQUEST=REQUEST)
151###)
Note: See TracBrowser for help on using the repository browser.