1 ## Script (Python) "member_registration_modify"
2 ##parameters=members=[], register=None, reject=None, ajax=''
3 ##title=Modify the status of a content object
5 from Products
.CMFCore
.utils
import getToolByName
6 from ZTUtils
import make_query
as mq
10 utool
= getToolByName(context
, 'portal_url')
11 portal
= utool
.getPortalObject()
12 mtool
= getToolByName(portal
, 'portal_membership')
18 members
= [ mtool
.getMemberById(entry
['id']) for entry
in members
if entry
.has_key('checked') ]
19 workflow_action
= 'register'
20 nbMembers
= len(members
)
22 message
= 'Please select at least one member.'
24 message
= 'Member registered.'
26 message
= 'Members registered.'
29 # handle form from reject_member_form
30 members
= [ mtool
.getMemberById(entry
['id']) for entry
in members
if entry
.has_key('checked') ]
31 workflow_action
= 'reject'
33 wfkw
['subject'] = form
.get('subject', '')
34 wfkw
['body'] = form
.get('body', '')
35 message
= 'Registration rejected.'
39 if m
.has_key('reject') :
40 resp
.redirect('%s/reject_member_form?%s' % ( portal
.absolute_url(),
41 mq(id=m
['id'], ajax
=ajax
) ))
43 raise ValueError, 'No action selected.'
45 wtool
= getToolByName(portal
, 'portal_workflow')
48 wtool
.doActionFor(m
, workflow_action
, wf_id
= 'member_workflow', **wfkw
)
53 query
= mq(portal_status_message
=message
, ajax
='1', syncFragments
=['rightCell'] )
55 query
= mq(portal_status_message
=message
)
56 redirect_url
= portal
.absolute_url() + '/pending_members?'+ query
58 resp
.redirect( redirect_url
)