source: WAeUP_SRP/branches/joachim-azax-branch/skins/waeup_directory/getMembersDirectoryActions.py @ 9785

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

id in edit button after save

  • Property svn:keywords set to Id
File size: 2.2 KB
Line 
1##parameters=mode
2#$Id: getMembersDirectoryActions.py 1906 2007-06-16 13:22:51Z joachim $
3"""
4Get the actions to provide on members directory view
5
6Return the updated actions
7"""
8try:
9    from Products.zdb import set_trace
10except:
11    def set_trace():
12        pass
13
14from Products.CMFCore.utils import getToolByName
15request = context.REQUEST
16qstring = request.get('QUERY_STRING','')
17if qstring:
18    id = ''
19    for par in qstring.split('&'):
20        if par.startswith('id='):
21            id = par[3:]
22else:
23    id = request.form.get('id','')
24utool = getToolByName(context, 'portal_url')
25dtool = getToolByName(context, 'portal_directories')
26base_url = utool.getBaseUrl()
27renderActionIcon = context.portal_cpsportlets.renderActionIcon
28dirname  = 'members'
29dir = getattr(dtool,'members')
30actions_list = (('create_action',
31                 'new_entry',
32                 'Create New Member',
33                 base_url+'member_create_form?dirname=members',   
34                ),
35                ('search_action',
36                'search_entry',
37                'Search Member',
38                 base_url+'search_members_form?dirname=members',
39                ),
40                ('view_action',
41                'view_entry',
42                'View',
43                base_url+'member_view?dirname=members'+'&id='+id,
44                ),
45                ('edit_action',
46                'edit_entry',
47                'Edit',
48                base_url+'member_edit_form?dirname=members'+'&id='+id,
49                ),
50                )
51ad = {}
52for action_id,name,desc,url in actions_list:
53    ad[action_id] = {
54                     'id': name,
55                     'title': desc,
56                     'icon_tag': renderActionIcon(action_id= name,
57                                                  category='object',
58                                                  base_url=base_url,
59                                                  alt= name),
60                     'url': url,
61                     'name': desc,
62                     'category': 'object',
63                    }
64if mode in ['view', 'edit']:
65    return [ad['view_action'],
66            ad['edit_action'],
67            ad['create_action'],
68            ad['search_action']
69           ]
70elif mode in ['create']:
71    return [ad['search_action'],]
72return [ad['create_action'],]
Note: See TracBrowser for help on using the repository browser.