[57] | 1 | #-*- mode: python; mode: fold -*- |
---|
[45] | 2 | from Globals import InitializeClass |
---|
| 3 | from AccessControl import ClassSecurityInfo |
---|
| 4 | |
---|
[47] | 5 | from Products.CMFCore.utils import UniqueObject, getToolByName |
---|
[45] | 6 | from Products.CMFCore.permissions import View |
---|
| 7 | from Products.CMFCore.permissions import ModifyPortalContent |
---|
| 8 | from Products.CPSCore.CPSBase import CPSBase_adder, CPSBaseFolder |
---|
[47] | 9 | #from Products.CPSCore.CPSBase import CPSBaseDocument as BaseDocument |
---|
| 10 | from Products.CPSDocument.CPSDocument import CPSDocument |
---|
[45] | 11 | from Products.CPSCore.CPSBase import CPSBaseBTreeFolder as BaseBTreeFolder |
---|
| 12 | |
---|
[57] | 13 | class StudentsFolder(BaseBTreeFolder): ###( |
---|
[45] | 14 | """ |
---|
| 15 | WAeUP container for the various WAeUP containers data |
---|
| 16 | """ |
---|
| 17 | meta_type = 'Students Folder' |
---|
| 18 | portal_type = meta_type |
---|
| 19 | security = ClassSecurityInfo() |
---|
| 20 | |
---|
[47] | 21 | |
---|
[45] | 22 | InitializeClass(StudentsFolder) |
---|
| 23 | |
---|
| 24 | def addStudentsFolder(container, id, REQUEST=None, **kw): |
---|
| 25 | """Add a Student.""" |
---|
| 26 | ob = StudentsFolder(id, **kw) |
---|
| 27 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 28 | ### |
---|
[57] | 29 | ###) |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | student_fti = { ###( |
---|
| 33 | 'title': 'WAeUP Student', |
---|
| 34 | 'description': '', |
---|
| 35 | 'content_icon': 'student.gif', |
---|
| 36 | 'content_meta_type': 'Student', |
---|
| 37 | 'factory': 'addStudent', |
---|
| 38 | 'immediate_view': 'cpsdocument_view', |
---|
| 39 | 'global_allow': True, |
---|
| 40 | 'filter_content_types': True, |
---|
| 41 | 'allowed_content_types': ('Jamb','StudentPersonal'), |
---|
| 42 | 'allow_discussion': False, |
---|
| 43 | 'actions': ( |
---|
| 44 | {'id': 'view', |
---|
| 45 | 'name': 'action_view', |
---|
| 46 | 'action': 'string:${object_url}/student_index_html', |
---|
| 47 | #'action': 'string:${object_url}/cpsdocument_view', |
---|
| 48 | 'condition': '', |
---|
| 49 | 'permission': ('View',), |
---|
| 50 | 'category': 'object', |
---|
| 51 | 'visible': True,}, |
---|
| 52 | {'id': 'new_content', |
---|
| 53 | 'name': 'Add Data', |
---|
| 54 | 'action': 'string:${object_url}/folder_factories', |
---|
| 55 | 'condition': "python:1 or len(object.contentItems()) == 0 ", |
---|
| 56 | 'permission': ('Modify portal content',), |
---|
| 57 | 'category': 'object', |
---|
| 58 | 'visible': True,}, |
---|
| 59 | {'id': 'contents', |
---|
| 60 | 'name': 'action_folder_contents', |
---|
| 61 | 'action': 'string:${object_url}/folder_contents', |
---|
| 62 | 'condition': "python:1 or object.getTypeInfo().cps_proxy_type != 'document'", |
---|
| 63 | 'permission': ('Modify portal content',), |
---|
| 64 | 'category': 'object', |
---|
| 65 | 'visible': True,}, |
---|
| 66 | {'id': 'edit', |
---|
| 67 | 'name': 'action_edit', |
---|
| 68 | 'action': 'string:${object_url}/cpsdocument_edit_form', |
---|
| 69 | 'condition': '', |
---|
| 70 | 'permission': ('Modify portal content',), |
---|
| 71 | 'category': 'object', |
---|
| 72 | 'visible': True,}, |
---|
| 73 | ) |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | ###) |
---|
| 77 | |
---|
| 78 | class Student(CPSDocument): ###( |
---|
| 79 | """ |
---|
| 80 | WAeUP Student container for the various student data |
---|
| 81 | """ |
---|
| 82 | meta_type = 'Student' |
---|
| 83 | portal_type = meta_type |
---|
| 84 | security = ClassSecurityInfo() |
---|
| 85 | |
---|
| 86 | security.declarePublic("test") |
---|
| 87 | def test(self): |
---|
| 88 | """test""" |
---|
| 89 | return self.REQUEST |
---|
| 90 | |
---|
| 91 | InitializeClass(Student) |
---|
| 92 | |
---|
| 93 | def addStudent(container, id, REQUEST=None, **kw): |
---|
| 94 | """Add a Student.""" |
---|
| 95 | ob = Student(id, **kw) |
---|
| 96 | return CPSBase_adder(container, ob, REQUEST=REQUEST) |
---|
| 97 | |
---|
| 98 | ###) |
---|