|
|
||||||||||||||||||
|
|
||||||||||||||||||
![]() |
![]() |
Issue 1 - Revision 5 / June 14, 2002
|
|||
|
Customized User Folders Part I Write your own product that suits you best. - - - - - - - - - - - - By Kristoph Kirchner | May 22, 2002 As mentioned before, you also need to change the standard forms for adding and editing a user. You can use the standard user folder forms and simply add a text row with an email textfield: Listing 3: Additional Code for addUser.dtml
<tr>
<td align="left" valign="top">
<div class="form-optional">
E-Mail
</div>
</td>
<td align="left" valign="top">
<input type="text" name="email" size="30" value="" />
</td>
</tr>
Listing 4: Additional Code for editUser.dtml
<TR>
<TD VALIGN="TOP">
<div class="form-optional">
E-Mail
</div>
</TD>
<TD VALIGN="TOP">
<INPUT TYPE="TEXT" NAME="email" SIZE="30"
VALUE="<dtml-if expr="user.email">
<dtml-var expr="user.email"></dtml-if>" />
</TD>
</TR>
If you want to, you can also add a method that checks whether a valid email address was entered (Listing 5). Listing 5: checkEmail() Method of the ExtendedUserFolder class
def checkEmail(self, email):
isEmail = 0
if string.find(email, '@') <> -1:
isEmail = 1
return isEmail
Then you can use this method and refuse adding or changing a user if the email address does not appear to be a valid one. Listing 6 shows the additional lines that have to go into the _addUser() and the _changeUser() methods. Listing 6: Additional Code for the _addUser() and the _changeUser() Methods
if self.checkEmail(REQUEST['email']) != 1:
return MessageDialog(
title ='Illegal value',
message='Not a valid email address',
action ='manage_main')
Summary
This article has given you an easy introduction on how to create your own user folder. The next part in this series will show you how to store user information in a relational database and how to retrieve it from there.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| ZopeMag is committed to bringing you the best in Zope Documentation. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
Reproduction of material from any of ZopeMag's pages without prior written permission is strictly prohibited. Copyright 2003 - 2005 ZopeMag |
|