##parameters=mode #$Id: getMembersDirectoryActions.py 2348 2007-10-11 10:28:55Z henrik $ """ Get the actions to provide on members directory view Return the updated actions """ try: from Products.zdb import set_trace except: def set_trace(): pass from Products.CMFCore.utils import getToolByName request = context.REQUEST qstring = request.get('QUERY_STRING','') if qstring: id = '' for par in qstring.split('&'): if par.startswith('id='): id = par[3:] else: id = request.form.get('id','') utool = getToolByName(context, 'portal_url') dtool = getToolByName(context, 'portal_directories') base_url = utool.getBaseUrl() renderActionIcon = context.portal_cpsportlets.renderActionIcon dirname = 'members' dir = getattr(dtool,'members') actions_list = (('create_action', 'new_entry', 'Create New Member', base_url+'member_create_form?dirname=members', ), ('search_action', 'search_entry', 'Search Member', base_url+'search_members_form?dirname=members', ), ('view_action', 'view_entry', 'View', base_url+'member_view?dirname=members'+'&id='+id, ), ('edit_action', 'edit_entry', 'Edit', base_url+'member_edit_form?dirname=members'+'&id='+id, ), ) ad = {} for action_id,name,desc,url in actions_list: ad[action_id] = { 'id': name, 'title': desc, 'icon_tag': renderActionIcon(action_id= name, category='object', base_url=base_url, alt= name), 'url': url, 'name': desc, 'category': 'object', } if not dtool.members.isSectionOfficer(): return [ad['view_action'], ad['edit_action'] ] if mode in ['view', 'edit']: return [ad['view_action'], ad['edit_action'], ad['create_action'], ad['search_action'] ] elif mode in ['create']: return [ad['search_action'],] return [ad['create_action'],]