[CMF-checkins] CVS: Products/CMFDefault/skins/zpt_generic - join_form.py:1.1 join_template.pt:1.1 members_manage_form.py:1.1 members_manage_template.pt:1.1 join_control.py:NONE join_form.pt:NONE members_manage_control.py:NONE members_manage_form.pt:NONE

Yvo Schubbe y.2004_ at wcm-solutions.de
Tue Jul 6 17:41:22 EDT 2004


Update of /cvs-repository/Products/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv10040/CMFDefault/skins/zpt_generic

Added Files:
	join_form.py join_template.pt members_manage_form.py 
	members_manage_template.pt 
Removed Files:
	join_control.py join_form.pt members_manage_control.py 
	members_manage_form.pt 
Log Message:
- renamed members_manage_form.pt and join_form.pt to *_template.pt
- renamed *_control.py to members_manage_form.py and join_form.py: these scripts are now called directly
- renamed members controllers to members_*_control.py
- modified kw handling a bit to work with the new calling order


=== Added File Products/CMFDefault/skins/zpt_generic/join_form.py ===
##parameters=b_start=0, member_id='', member_email='', password='', confirm='', send_password='', add='', cancel=''
##
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.permissions import ManageUsers

mtool = getToolByName(script, 'portal_membership')
ptool = getToolByName(script, 'portal_properties')
rtool = getToolByName(script, 'portal_registration')
utool = getToolByName(script, 'portal_url')
portal_url = utool()
validate_email = ptool.getProperty('validate_email')
is_anon = mtool.isAnonymousUser()
is_newmember = False
is_usermanager = mtool.checkPermission(ManageUsers, mtool)


form = context.REQUEST.form
if add and \
        context.validatePassword(**form) and \
        context.members_add_control(**form) and \
        context.setRedirect(rtool, 'user/join', b_start=b_start):
    return
elif cancel and \
        context.setRedirect(mtool, 'global/manage_members', b_start=b_start):
    return


options = {}

if context.REQUEST.get('portal_status_message', '') == 'Success!':
    is_anon = False
    is_newmember = True

options['title'] = is_usermanager and 'Register Member' or 'Become a Member'
options['member_id'] = member_id
options['member_email'] = member_email
options['password'] = is_newmember and context.REQUEST.get('password', '') or ''
options['send_password'] = send_password
options['portal_url'] = portal_url
options['isAnon'] = is_anon
options['isAnonOrUserManager'] = is_anon or is_usermanager
options['isNewMember'] = is_newmember
options['isOrdinaryMember'] = not (is_anon or is_newmember or is_usermanager)
options['validate_email'] = validate_email

buttons = []
if is_newmember:
    target = mtool.getActionInfo('user/logged_in')['url']
    buttons.append( {'name': 'login', 'value': 'Log in'} )
else:
    target = rtool.getActionInfo('user/join')['url']
    buttons.append( {'name': 'add', 'value': 'Register'} )
    buttons.append( {'name': 'cancel', 'value': 'Cancel'} )
options['form'] = { 'action': target,
                    'listButtonInfos': tuple(buttons) }

return context.join_template(**options)


=== Added File Products/CMFDefault/skins/zpt_generic/join_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>

<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 tal:content="options/title" i18n:translate="">Become a member</h1>
</metal:slot>

<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
   tal:define="form options/form">
<div class="Desktop">

<tal:case tal:condition="options/isOrdinaryMember">
  <p i18n:translate=""> You are already a member. You may use the
      <a href="personalize_form">personalization form</a>
       to change your membership information. </p>
</tal:case>

<tal:case tal:condition="options/isNewMember">
<p i18n:translate="">You have been registered as a member.</p>

<p tal:condition="options/validate_email" i18n:translate="">You will receive
  an email shortly containing your password and instructions on how to
  activate your membership.</p>

<tal:case tal:condition="not: options/validate_email">
<p>Click the button to log in immediately.</p>
<form action="logged_in" method="post"
      tal:attributes="action form/action">
<input type="hidden" name="__ac_name"  value=""
       tal:attributes="value options/member_id" />
<input type="hidden" name="__ac_password" value=""
       tal:attributes="value options/password" />
<metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</form>
</tal:case>

<p><a href="" tal:attributes="href options/portal_url"
      i18n:translate="">Return to homepage</a></p>
</tal:case>

<tal:case tal:condition="options/isAnon">
  <p i18n:translate="">Becoming a member gives you the ability to personalize
    the site and participate in the community.</p>

  <p i18n:translate="">It does not cost any money to become a member and your
    email and other personal information will remain private.</p>

  <p tal:condition="options/validate_email" i18n:translate="">
      You must submit a valid email address. This address will be used
      to send you a randomly-generated password.  Once you have logged
      in with this password, you may change it to anything you like.</p>
</tal:case>

<tal:case tal:condition="options/isAnonOrUserManager">
  <form action="join_form" method="post"
        tal:attributes="action form/action">
   <table class="FormLayout">
    <tr>
     <th i18n:translate="">Member ID</th>
     <td>
      <input type="text" name="member_id" size="30" value=""
             tal:attributes="value options/member_id" />
     </td>
    </tr>
    <tr>
     <th i18n:translate="">Email Address</th>
     <td>
      <input type="text" name="member_email" size="30" value=""
             tal:attributes="value options/member_email" />
     </td>
    </tr><tal:case tal:condition="not: options/validate_email">
    <tr>
     <th i18n:translate="">Password</th>
     <td>
      <input type="password" name="password" size="30" />
     </td>
    </tr>
    <tr>
     <th i18n:translate="">Password (confirm)</th>
     <td>
      <input type="password" name="confirm" size="30" />
     </td>
    </tr>
    <tr>
     <th i18n:translate="">Mail Password?</th>
     <td>
      <input type="checkbox" name="send_password" id="cb_send_password"
             tal:attributes="checked options/send_password" />
      <em><label for="cb_send_password" i18n:translate="">Check this box to
        have the password mailed.</label></em>
     </td>
    </tr></tal:case>
    <tr>
     <td>&nbsp;</td>
     <td>
      <metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
     </td>
    </tr>
   </table>
  </form>
</tal:case>

</div>
</metal:slot>

</body>
</html>


=== Added File Products/CMFDefault/skins/zpt_generic/members_manage_form.py ===
##parameters=b_start=0, ids=(), members_new='', members_delete=''
##
from ZTUtils import Batch
from Products.CMFCore.utils import getToolByName
from Products.CMFDefault.utils import html_marshal

mtool = getToolByName(script, 'portal_membership')
rtool = getToolByName(script, 'portal_registration')


form = context.REQUEST.form
if members_delete and \
        context.validateMemberIds(**form) and \
        context.members_delete_control(**form) and \
        context.setRedirect(mtool, 'global/manage_members', b_start=b_start):
    return
elif members_new and \
        context.setRedirect(rtool, 'user/join', b_start=b_start):
    return


options = {}

target = mtool.getActionInfo('global/manage_members')['url']

members = mtool.listMembers()
batch_obj = Batch(members, 25, b_start, orphan=0)
items = []
for member in batch_obj:
    member_id = member.getId()
    login_time = member.getProperty('login_time')
    member_login = login_time == '2000/01/01' and '---' or login_time.Date()
    member_home = mtool.getHomeUrl(member_id, verifyPermission=0)
    items.append( {'checkbox': 'cb_%s' % member_id,
                   'email': member.getProperty('email'),
                   'login': member_login,
                   'id': member_id,
                   'home': member_home } )
navigation = context.getBatchNavigation(batch_obj, target,
                                        'member', 'members')
options['batch'] = { 'listItemInfos': tuple(items),
                     'navigation': navigation }

hidden_vars = []
for name, value in html_marshal(b_start=b_start):
    hidden_vars.append( {'name': name, 'value': value} )
buttons = []
buttons.append( {'name': 'members_new', 'value': 'New...'} )
if items:
    buttons.append( {'name': 'members_delete', 'value': 'Delete'} )
options['form'] = { 'action': target,
                    'listHiddenVarInfos': tuple(hidden_vars),
                    'listButtonInfos': tuple(buttons) }

return context.members_manage_template(**options)


=== Added File Products/CMFDefault/skins/zpt_generic/members_manage_template.pt ===
<html metal:use-macro="context/main_template/macros/master">
<body>

<metal:slot metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Manage Members</h1>
</metal:slot>

<metal:slot metal:fill-slot="main" i18n:domain="cmf_default"
   tal:define="batch options/batch;
               form options/form">
<div class="Desktop">
<form action="members_manage" method="post"
   tal:attributes="action form/action"
><metal:macro metal:use-macro="context/form_widgets/macros/hidden_vars" />
 <table class="BatchTable"
    tal:condition="batch/listItemInfos">
  <thead>
   <tr class="list-header">
    <td width="20">&nbsp;</td>
    <th width="120" i18n:translate="">Member</th>
    <th width="260" i18n:translate="">Email Address</th>
    <th width="80" i18n:translate="">Last Login</th>
   </tr>
  </thead>
  <tbody tal:repeat="member batch/listItemInfos">
   <tr class="" tal:define="even repeat/member/even;"
      tal:attributes="class python: (even and 'row-hilite') or 'row-normal'">
    <td
    ><input type="checkbox" name="ids:list" value="" id=""
        tal:attributes="value member/id; id member/checkbox"
        tal:condition="member/checkbox" /></td>
    <td
    ><a href="" tal:attributes="href member/home"
        tal:omit-tag="not:member/home"
        tal:content="member/id">ID</a></td>
    <td
    ><a href="" tal:attributes="href string:mailto:${member/email}"
        tal:omit-tag="not:member/email"
        tal:content="member/email">user at example.org</a></td>
    <td tal:content="member/login"
    >2003/03/03</td>
   </tr>
  </tbody>
 </table>
 <p tal:condition="not: batch/listItemInfos" i18n:translate="">Currently there
  are no members registered.</p>
 <metal:macro metal:use-macro="context/batch_widgets/macros/navigation" />
 <metal:macro metal:use-macro="context/form_widgets/macros/buttons" />
</form>
</div>
</metal:slot>

</body>
</html>

=== Removed File Products/CMFDefault/skins/zpt_generic/join_control.py ===

=== Removed File Products/CMFDefault/skins/zpt_generic/join_form.pt ===

=== Removed File Products/CMFDefault/skins/zpt_generic/members_manage_control.py ===

=== Removed File Products/CMFDefault/skins/zpt_generic/members_manage_form.pt ===



More information about the CMF-checkins mailing list