[CMF-checkins] CVS: CMF/CMFDefault/skins/zpt_generic -
form_widgets.pt:1.1 members_manage_control.py:1.1
members_manage_form.pt:1.1 join_control.py:1.2
join_form.pt:1.8 zpt_stylesheet.css:1.9
Yvo Schubbe
cvs-admin at zope.org
Mon Nov 3 05:23:26 EST 2003
Update of /cvs-repository/CMF/CMFDefault/skins/zpt_generic
In directory cvs.zope.org:/tmp/cvs-serv31275/CMFDefault/skins/zpt_generic
Modified Files:
join_control.py join_form.pt zpt_stylesheet.css
Added Files:
form_widgets.pt members_manage_control.py
members_manage_form.pt
Log Message:
membership management ui (final part):
- added members_manage_form.pt including controller script and buttons widget
- adjusted join_form.pt, join_control.py and zpt_stylesheet.css
- added 'Manage members' Action to MembershipTool.py
=== Added File CMF/CMFDefault/skins/zpt_generic/form_widgets.pt ===
<html>
<body>
<tal:test tal:define="buttons python: ( {'name': 'delete_items',
'value': 'Delete'}, );
global form python: {'listButtonInfos': buttons}" />
<metal:block metal:define-macro="buttons"
><div class="FormButtons">
<tal:loop tal:repeat="button form/listButtonInfos"
><input type="submit" name="ButtonName" value="ButtonValue"
tal:attributes="name button/name; value button/value"
i18n:attributes="value" /></tal:loop></div
></metal:block>
</body>
</html>
=== Added File CMF/CMFDefault/skins/zpt_generic/members_manage_control.py ===
## Script (Python) "members_manage_control"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=ids=(), b_start=0, members_new='', members_delete=''
##title=
##
from ZTUtils import Batch
from Products.CMFCore.utils import getToolByName
mtool = getToolByName(script, 'portal_membership')
utool = getToolByName(script, 'portal_url')
portal_url = utool()
message = ''
if members_delete:
if ids:
mtool.deleteMembers(ids)
message = 'Selected member%s deleted.' % (len(ids)!=1 and 's' or '',)
else:
message = 'Please select one or more members to delete first.'
elif members_new:
target = '%s/join_form' % portal_url
context.REQUEST.RESPONSE.redirect(target)
if message:
context.REQUEST.set('portal_status_message', message)
control = {}
target = '%s/members_manage_form' % portal_url
members = mtool.listMembers()
batch_obj = Batch(members, 25, b_start, orphan=0)
items = []
addButtons = 0
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')
control['batch'] = { 'listItemInfos': tuple(items),
'navigation': navigation }
buttons = []
buttons.append( {'name': 'members_new', 'value': 'New...'} )
if items:
buttons.append( {'name': 'members_delete', 'value': 'Delete'} )
control['form'] = { 'action': target,
'listButtonInfos': tuple(buttons) }
return control
=== Added File CMF/CMFDefault/skins/zpt_generic/members_manage_form.pt ===
<tal:page
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
tal:define="control python: here.members_manage_control(**request.form)"
><html metal:use-macro="here/main_template/macros/master">
<body>
<metal:block metal:fill-slot="header" i18n:domain="cmf_default">
<h1 i18n:translate="">Manage Members</h1>
</metal:block>
<metal:block metal:fill-slot="main" i18n:domain="cmf_default"
tal:define="batch control/batch;
form control/form">
<div class="Desktop">
<form action="members_manage" method="post"
tal:attributes="action form/action">
<table class="BatchTable"
tal:condition="batch/listItemInfos">
<thead>
<tr class="list-header">
<td width="20"> </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:block metal:use-macro="here/batch_widgets/macros/navigation" />
<metal:block metal:use-macro="here/form_widgets/macros/buttons" />
</form>
</div>
</metal:block>
</body>
</html></tal:page>
=== CMF/CMFDefault/skins/zpt_generic/join_control.py 1.1 => 1.2 ===
--- CMF/CMFDefault/skins/zpt_generic/join_control.py:1.1 Thu Oct 30 14:23:37 2003
+++ CMF/CMFDefault/skins/zpt_generic/join_control.py Mon Nov 3 05:23:25 2003
@@ -49,7 +49,10 @@
is_anon = 0
elif cancel:
- target = portal_url
+ if is_usermanager:
+ target = '%s/members_manage_form' % portal_url
+ else:
+ target = portal_url
context.REQUEST.RESPONSE.redirect(target)
if message:
@@ -69,5 +72,16 @@
control['isNewMember'] = is_newmember
control['isOrdinaryMember'] = not (is_anon or is_newmember or is_usermanager)
control['validate_email'] = validate_email
+
+buttons = []
+if is_newmember:
+ target = '%s/logged_in' % portal_url
+ buttons.append( {'name': 'login', 'value': 'Log in'} )
+else:
+ target = '%s/join_form' % portal_url
+ buttons.append( {'name': 'add', 'value': 'Register'} )
+ buttons.append( {'name': 'cancel', 'value': 'Cancel'} )
+control['form'] = { 'action': target,
+ 'listButtonInfos': tuple(buttons) }
return control
=== CMF/CMFDefault/skins/zpt_generic/join_form.pt 1.7 => 1.8 ===
--- CMF/CMFDefault/skins/zpt_generic/join_form.pt:1.7 Thu Oct 30 14:23:37 2003
+++ CMF/CMFDefault/skins/zpt_generic/join_form.pt Mon Nov 3 05:23:25 2003
@@ -10,7 +10,8 @@
<h1 tal:content="control/title" i18n:translate="">Become a member</h1>
</metal:block>
-<metal:block metal:fill-slot="main" i18n:domain="cmf_default">
+<metal:block metal:fill-slot="main" i18n:domain="cmf_default"
+ tal:define="form control/form">
<div class="Desktop">
<tal:case tal:condition="control/isOrdinaryMember">
@@ -29,17 +30,16 @@
<tal:case tal:condition="not: control/validate_email">
<p>Click the button to log in immediately.</p>
<form action="logged_in" method="post"
- tal:attributes="action string:${control/portal_url}/logged_in">
+ tal:attributes="action form/action">
<input type="hidden" name="__ac_name" value=""
tal:attributes="value control/member_id" />
<input type="hidden" name="__ac_password" value=""
tal:attributes="value control/password" />
-<input type="submit" name="login" value="Log in"
- i18n:attributes="value" />
+<metal:block metal:use-macro="here/form_widgets/macros/buttons" />
</form>
</tal:case>
-<p><a href="" tal:attributes="href string:${control/portal_url}"
+<p><a href="" tal:attributes="href control/portal_url"
i18n:translate="">Return to homepage</a></p>
</tal:case>
@@ -58,7 +58,7 @@
<tal:case tal:condition="control/isAnonOrUserManager">
<form action="join_form" method="post"
- tal:attributes="action string:${control/portal_url}/join_form">
+ tal:attributes="action form/action">
<table class="FormLayout">
<tr>
<th i18n:translate="">Member ID</th>
@@ -98,10 +98,7 @@
<tr>
<td> </td>
<td>
- <input type="submit" name="add" value="Register"
- i18n:attributes="value" />
- <input type="submit" name="cancel" value="Cancel"
- i18n:attributes="value" />
+ <metal:block metal:use-macro="here/form_widgets/macros/buttons" />
</td>
</tr>
</table>
=== CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css 1.8 => 1.9 ===
--- CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css:1.8 Sun Jun 8 15:47:52 2003
+++ CMF/CMFDefault/skins/zpt_generic/zpt_stylesheet.css Mon Nov 3 05:23:25 2003
@@ -360,3 +360,26 @@
p.NewsHeadline {
background-color: #336699;
}
+
+.BatchTable {
+ border-spacing: 0;
+ border-collapse: collapse;
+}
+
+.BatchTable tr.list-header {
+ background-color: #c0c0c0;
+ text-align: left;
+ font: 90%/120% sans-serif;
+}
+
+.BatchTable tr.row-normal {
+ background-color: #ffffff;
+}
+
+.BatchTable tr.row-hilite {
+ background-color: #efefef;
+}
+
+.FormButtons {
+ margin-top: 8pt;
+}
More information about the CMF-checkins
mailing list