1513e251ec201a8de50dac13abb6fb483f05ec49
1 ##parameters=b_start=0, member_id='', given_name='', name='', member_email='', password='', confirm='', send_password='', add='', cancel='', ajax=''
3 from Products
.CMFCore
.utils
import getToolByName
4 from Products
.CMFDefault
.permissions
import ManageUsers
5 from Products
.Plinn
.RegistrationTool
import MODE_ANONYMOUS
, MODE_REVIEWED
7 mtool
= getToolByName(script
, 'portal_membership')
8 ptool
= getToolByName(script
, 'portal_properties')
9 rtool
= getToolByName(script
, 'portal_registration')
10 atool
= getToolByName(script
, 'portal_actions')
11 utool
= getToolByName(script
, 'portal_url')
13 validate_email
= ptool
.getProperty('validate_email')
14 is_anon
= mtool
.isAnonymousUser()
16 is_usermanager
= mtool
.checkPermission(ManageUsers
, mtool
)
19 form
= context
.REQUEST
.form
21 context
.validatePassword(**form
) and \
22 context
.members_add_control(**form
) and \
23 context
.setRedirect(atool
, 'user/join', b_start
=b_start
, ajax
=ajax
):
26 context
.setRedirect(mtool
, 'global/manage_members', b_start
=b_start
, ajax
=ajax
):
32 if context
.REQUEST
.get('portal_status_message', '') == 'Success!':
36 options
['title'] = is_usermanager
and 'Register Member' or 'Become a Member'
37 options
['member_id'] = member_id
38 options
['given_name'] = given_name
39 options
['name'] = name
40 options
['member_email'] = member_email
41 options
['password'] = is_newmember
and context
.REQUEST
.get('password', '') or ''
42 options
['send_password'] = send_password
43 options
['portal_url'] = portal_url
44 options
['isAnon'] = is_anon
45 options
['isAnonOrUserManager'] = is_anon
or is_usermanager
46 options
['isNewMember'] = is_newmember
47 options
['isOrdinaryMember'] = not (is_anon
or is_newmember
or is_usermanager
)
48 options
['validate_email'] = validate_email
49 options
['isAnonRegistration'] = rtool
.getMode() == MODE_ANONYMOUS
50 options
['isReviewedRegistration'] = rtool
.getMode() == MODE_REVIEWED
54 target
= atool
.getActionInfo('user/logged_in')['url']
55 buttons
.append( {'name': 'login', 'value': 'Log in'} )
57 target
= atool
.getActionInfo('user/join')['url']
58 buttons
.append( {'name': 'add', 'value': 'Register'} )
59 buttons
.append( {'name': 'cancel', 'value': 'Cancel'} )
60 options
['form'] = { 'action': target
,
61 'listButtonInfos': tuple(buttons
) }
63 return context
.join_template(**options
)