source: WAeUP_SRP/branches/joachim-event-branch/skins/waeup_directory/getWAeUPDirectoryActions.py @ 9819

Last change on this file since 9819 was 953, checked in by Henrik Bettermann, 18 years ago

member directory acl permission, schema and layouts changed
not yet optimized

File size: 2.0 KB
Line 
1##parameters=actions, dirname, dir, mode, id=''
2#$Id: getDirectoryActions.py 25260 2005-07-26 00:41:23Z atchertchian $
3"""
4Get the actions to provide on a directory view
5
6Parameters are:
7- the current actions
8- the directory id
9- the directory itself
10- the mode (create, edit, view or search)
11- the entry id (eventually)
12
13Return the updated actions
14"""
15
16from Products.CMFCore.utils import getToolByName
17
18utool = getToolByName(context, 'portal_url')
19base_url = utool.getBaseUrl()
20
21create_action = {
22    'id': 'new_entry',
23    'url': base_url+'member_create_form?dirname='+dirname,
24    'name': 'cpsdir_label_create_entry',
25    'category': 'object',
26    }
27
28search_action = {
29    'id': 'search_entry',
30    'url': base_url+'search_members_form?dirname='+dirname,
31    'name': 'cpsdir_label_search_entry',
32    'category': 'object'
33    }
34
35view_action = {
36    'id': 'view_entry',
37    'url': base_url+'member_view?dirname='+dirname+'&id='+id,
38    'name': 'cpsdir_label_view_entry',
39    'category': 'object',
40    }
41
42edit_action = {
43    'id': 'edit_entry',
44    'url': base_url+'member_edit_form?dirname='+dirname+'&id='+id,
45    'name': 'cpsdir_label_edit_entry',
46    'category': 'object',
47    }
48
49confirm_text = context.translation_service('description_confirm_delete')
50confirm_text.encode('ISO-8859-15', 'ignore')
51delete_action = {
52    'id': 'delete_entry',
53    'url': base_url+'member_delete?dirname='+dirname+'&id='+id,
54    'onclick': 'return window.confirm(\''+ confirm_text +'\')' ,
55    'name': 'cpsdir_label_delete_entry',
56    'category': 'object',
57    }
58
59
60# only actions with category 'object' have to be changed
61
62if dir.isSearchEntriesAllowed():
63    actions.update({'object': [search_action]})
64
65if dir.isCreateEntryAllowed():
66    actions['object'].append(create_action)
67
68if mode in ['view', 'edit']:
69    if dir.isViewEntryAllowed(id):
70        actions['object'].append(view_action)
71    if dir.isEditEntryAllowed(id):
72        actions['object'].append(edit_action)
73    if dir.isDeleteEntryAllowed(id):
74        actions['object'].append(delete_action)
75
76return actions
Note: See TracBrowser for help on using the repository browser.