#-*- mode: python; mode: fold -*- from Globals import InitializeClass from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import UniqueObject, getToolByName from Products.CMFCore.permissions import View from Products.CMFCore.permissions import ModifyPortalContent from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument from Products.CPSDocument.CPSDocument import CPSDocument from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder ##class FacultyFolder(BaseBTreeFolder): ###( ## """ ## WAeUP container for the various WAeUP containers data ## """ ## meta_type = 'Faculty Folder' ## portal_type = meta_type ## security = ClassSecurityInfo() ## ## ##InitializeClass(FacultyFolder) ## ##def addFacultyFolder(container, id, REQUEST=None, **kw): ## """Add a Student.""" ## ob = StudentsFolder(id, **kw) ## return CPSBase_adder(container, ob, REQUEST=REQUEST) ##### #####) faculty_fti = { ###( 'title': 'WAeUP Faculty', 'description': '', 'content_icon': '', 'content_meta_type': 'Faculty', 'factory': 'addFaculty', 'immediate_view': 'cpsdocument_view', 'global_allow': True, 'filter_content_types': True, 'allowed_content_types': ('Department',), 'allow_discussion': False, ## 'actions': ( ## {'id': 'view', ## 'name': 'action_view', ## 'action': 'string:${object_url}/faculty_index_html', ## #'action': 'string:${object_url}/cpsdocument_view', ## 'condition': '', ## 'permission': ('View',), ## 'category': 'object', ## 'visible': True,}, ## {'id': 'new_content', ## 'name': 'Add Data', ## 'action': 'string:${object_url}/folder_factories', ## 'condition': "python:1 or len(object.contentItems()) == 0 ", ## 'permission': ('Modify portal content',), ## 'category': 'object', ## 'visible': True,}, ## {'id': 'contents', ## 'name': 'action_folder_contents', ## 'action': 'string:${object_url}/folder_contents', ## 'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'", ## 'permission': ('Modify portal content',), ## 'category': 'object', ## 'visible': True,}, ## {'id': 'edit', ## 'name': 'action_edit', ## 'action': 'string:${object_url}/cpsdocument_edit_form', ## 'condition': '', ## 'permission': ('Modify portal content',), ## 'category': 'object', ## 'visible': True,}, ## ) } ###) class Faculty(CPSDocument): ###( """ WAeUP Faculty containing Departments """ meta_type = 'Faculty' portal_type = meta_type security = ClassSecurityInfo() InitializeClass(Faculty) def addFaculty(container, id, REQUEST=None, **kw): """Add a Faculty.""" ob = Faculty(id, **kw) return CPSBase_adder(container, ob, REQUEST=REQUEST) ###) department_fti = { ###( 'title': 'WAeUP Department', 'description': '', 'content_icon': '', 'content_meta_type': 'Department', 'factory': 'addDepartment', 'immediate_view': 'cpsdocument_view', 'global_allow': True, 'filter_content_types': True, 'allowed_content_types': ('Course',), 'allow_discussion': False, } ###) class Department(CPSDocument): ###( """ WAeUP Department containing the courses and students """ meta_type = 'Department' portal_type = meta_type security = ClassSecurityInfo() InitializeClass(Department) def addDepartment(container, id, REQUEST=None, **kw): """Add a Department.""" ob = Department(id, **kw) return CPSBase_adder(container, ob, REQUEST=REQUEST) ###) course_fti = { ###( 'title': 'WAeUP Course', 'description': '', 'content_icon': '', 'content_meta_type': 'Course', 'factory': 'addCourse', 'immediate_view': 'cpsdocument_view', 'global_allow': True, 'filter_content_types': True, 'allowed_content_types': (), 'allow_discussion': False, } ###) class Course(CPSDocument): ###( """ WAeUP Course """ meta_type = 'Course' portal_type = meta_type security = ClassSecurityInfo() security.declareProtected(View,"Title") def Title(self): """compose title""" content = self.getContent() heading = getattr(content,'heading',None) if heading is None: return self.title return heading InitializeClass(Course) def addCourse(container, id, REQUEST=None, **kw): """Add a Course.""" ob = Course(id, **kw) return CPSBase_adder(container, ob, REQUEST=REQUEST) ###) course_ticket_fti = { ###( 'title': 'WAeUP CourseTicket', 'description': '', 'content_icon': '', 'content_meta_type': 'CourseTicket', 'factory': 'addCourseTicket', 'immediate_view': 'cpsdocument_view', 'global_allow': True, 'filter_content_types': True, 'allowed_content_types': (), 'allow_discussion': False, } ###) class CourseTicket(CPSDocument): ###( """ WAeUP CourseTicket """ meta_type = 'CourseTicket' portal_type = meta_type security = ClassSecurityInfo() InitializeClass(CourseTicket) def addCourseTicket(container, id, REQUEST=None, **kw): """Add a CourseTicket.""" ob = CourseTicket(id, **kw) return CPSBase_adder(container, ob, REQUEST=REQUEST) ###)