Source

bugs.python.org / html / user.item.html

Diff from to

File html/user.item.html

 <!-- dollarId: user.item,v 1.7 2002/08/16 04:29:04 richard Exp dollar-->
-<tal:block metal:use-macro="templates/page/macros/icing">
+<tal:doc metal:use-macro="templates/page/macros/icing"
+define="edit_ok context/is_edit_ok"
+>
 <title metal:fill-slot="head_title">
-<tal:block condition="context/id" i18n:translate=""
+<tal:if condition="context/id" i18n:translate=""
  >User <span tal:replace="context/id" i18n:name="id"
  />: <span tal:replace="context/username" i18n:name="title"
  /> - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
-/></tal:block>
-<tal:block condition="not:context/id" i18n:translate=""
+/></tal:if>
+<tal:if condition="not:context/id" i18n:translate=""
  >New User - <span tal:replace="config/TRACKER_NAME" i18n:name="tracker"
-/></tal:block>
+/></tal:if>
 </title>
-<tal:block metal:fill-slot="body_title">
- <span tal:condition="python: not (context.id or context.is_edit_ok())"
+<metal:slot fill-slot="more-javascript">
+<script metal:use-macro="templates/page/macros/user_utils"></script>
+<script type="text/javascript" src="@@file/help_controls.js"></script>
+</metal:slot>
+<tal:block metal:fill-slot="body_title"
+  define="edit_ok context/is_edit_ok">
+ <span tal:condition="python: not (context.id or edit_ok)"
   tal:omit-tag="python:1" i18n:translate="">New User</span>
- <span tal:condition="python: not context.id and context.is_edit_ok()"
+ <span tal:condition="python: not context.id and edit_ok"
   tal:omit-tag="python:1" i18n:translate="">New User Editing</span>
- <span tal:condition="python: context.id and not context.is_edit_ok()"
+ <span tal:condition="python: context.id and not edit_ok"
   tal:omit-tag="python:1" i18n:translate="">User<tal:x
   replace="context/id" i18n:name="id" /></span>
- <span tal:condition="python: context.id and context.is_edit_ok()"
+ <span tal:condition="python: context.id and edit_ok"
   tal:omit-tag="python:1" i18n:translate="">User<tal:x
   replace="context/id" i18n:name="id" /> Editing</span>
 </tal:block>
 
 <div tal:condition="context/is_view_ok">
 
-<form method="POST" onSubmit="return submit_once()"
+<form method="POST"
+      tal:define="required python:'username address'.split()"
       enctype="multipart/form-data"
-      tal:attributes="action context/designator">
-
-<table class="form">
- <tr>
-  <th i18n:translate="">Name</th>
-  <td tal:content="structure context/realname/field">realname</td>
+      tal:attributes="action context/designator;
+      onSubmit python:'return checkRequiredFields(\'%s\')'%'\', \''.join(required);
+      ">
+<table class="form" tal:define="
+  th_label templates/page/macros/th_label;
+  src_input templates/page/macros/user_src_input;
+  normal_input templates/page/macros/user_normal_input;
+  pw_input templates/page/macros/user_pw_input;
+  confirm_input templates/page/macros/user_confirm_input;
+  edit_ok context/is_edit_ok;
+  ">
+ <tr tal:define="name string:realname; label string:Name; value context/realname; edit_ok edit_ok">
+  <th metal:use-macro="th_label">Name</th>
+  <td><input name="realname" metal:use-macro="src_input"></td>
  </tr>
- <tr>
-  <th class="required" i18n:translate="">Login Name</th>
-  <td tal:content="structure context/username/field">username</td>
+ <tr tal:define="name string:username; label string:Login Name; value context/username">
+   <th metal:use-macro="th_label">Login Name</th>
+   <td><input metal:use-macro="src_input"></td>
  </tr>
- <tr tal:condition="context/is_edit_ok">
-  <th i18n:translate="">Login Password</th>
-  <td tal:content="structure context/password/field">password</td>
+ <tal:if condition="edit_ok">
+ <tr tal:define="name string:password; label string:Login Password">
+  <th metal:use-macro="th_label">Login Password</th>
+  <td><input metal:use-macro="pw_input" type="password"></td>
  </tr>
- <tr tal:condition="context/is_edit_ok">
-  <th i18n:translate="">Confirm Password</th>
-  <td tal:content="structure context/password/confirm">password</td>
+ <tr tal:define="name string:password; label string:Confirm Password">
+  <th metal:use-macro="th_label">Confirm Password</th>
+  <td><input metal:use-macro="confirm_input" type="password"></td>
  </tr>
- <tr tal:condition="python:request.user.hasPermission('Web Roles')">
-  <th i18n:translate="">Roles</th>
-  <td>
-   <input tal:condition="context/id"
-          tal:replace="structure context/roles/field">
-   <input name="roles" tal:condition="not:context/id"
-          tal:attributes="value db/config/NEW_WEB_USER_ROLES">
+ </tal:if>
+ <tal:if condition="python:request.user.hasPermission('Web Roles')">
+ <tr tal:define="name string:roles; label string:Roles;">
+  <th><label for="roles" i18n:translate="">Roles</label></th>
+  <td tal:define="gips context/id">
+    <tal:subif condition=gips define="value context/roles">
+      <input metal:use-macro="normal_input">
+    </tal:subif>
+    <tal:subif condition="not:gips" define="value db/config/NEW_WEB_USER_ROLES">
+      <input metal:use-macro="normal_input">
+    </tal:subif>
    <tal:block i18n:translate="">(to give the user more than one role,
     enter a comma,separated,list)</tal:block>
   </td>
  </tr>
- <tr>
-  <th i18n:translate="">Phone</th>
-  <td tal:content="structure context/phone/field">phone</td>
+ </tal:if>
+
+ <tr tal:define="name string:phone; label string:Phone; value context/phone">
+  <th metal:use-macro="th_label">Phone</th>
+  <td><input name="phone" metal:use-macro="normal_input"></td>
  </tr>
- <tr>
-  <th i18n:translate="">Organisation</th>
-  <td tal:content="structure context/organisation/field">organisation</td>
+
+ <tr tal:define="name string:organisation; label string:Organisation; value context/organisation">
+  <th metal:use-macro="th_label">Organisation</th>
+  <td><input name="organisation" metal:use-macro="normal_input"></td>
  </tr>
- <tr>
-  <th i18n:translate="">Timezone</th>
-  <td>
-   <input tal:replace="structure context/timezone/field">
-   <tal:block i18n:translate="">(this is a numeric hour offset, the default is
+
+ <tr tal:condition="python:edit_ok or context.timezone"
+     tal:define="name string:timezone; label string:Timezone; value context/timezone">
+  <th metal:use-macro="th_label">Timezone</th>
+  <td><input name="timezone" metal:use-macro="normal_input">
+   <tal:block tal:condition="edit_ok" i18n:translate="">(this is a numeric hour offset, the default is
     <span tal:replace="db/config/DEFAULT_TIMEZONE" i18n:name="zone"
     />)</tal:block>
   </td>
  </tr>
- <tr>
-  <th class="required" i18n:translate="">E-mail address</th>
-  <td tal:define="mailto context/address/field">
-   <a tal:condition="not:context/is_edit_ok"
-    tal:attributes="href string:mailto:${mailto}" tal:content="mailto"
-   /><span tal:condition="context/is_edit_ok" tal:replace="structure mailto" />
+
+ <tr tal:define="name string:address; label string:E-mail address; value context/address">
+  <th metal:use-macro="th_label">E-mail address</th>
+  <td tal:define="mailto python:context.address.field(id='address');
+	  mklink python:mailto and not edit_ok">
+      <a href="mailto:calvin@the-z.org"
+		  tal:attributes="href string:mailto:$value"
+		  tal:content="value"
+          tal:condition="python:mklink">calvin@the-z.org</a>
+      <tal:if condition=edit_ok>
+      <input metal:use-macro="src_input" value="calvin@the-z.org">
+      </tal:if>
+      &nbsp;
   </td>
  </tr>
+
  <tr>
-  <th i18n:translate="">Alternate E-mail addresses<br>One address per line</th>
-  <td tal:content="structure context/alternate_addresses/multiline">alternate_addresses</td>
+  <th><label for="alternate_addresses" i18n:translate="">Alternate E-mail addresses<br>One address per line</label></th>
+  <td>
+    <textarea rows=5 cols=40 tal:replace="structure context/alternate_addresses/multiline">nobody@nowhere.org
+anybody@everywhere.net
+(alternate_addresses)
+    </textarea>
+  </td>
  </tr>
 
- <tr tal:condition="context/is_edit_ok">
+ <tr tal:condition="edit_ok">
   <td>
    &nbsp;
    <input type="hidden" name="@template" value="item">
-   <input type="hidden" name="@required" value="username,address">
+   <input type="hidden" name="@required" value="username,address"
+          tal:attributes="value python:','.join(required)">
   </td>
-  <td tal:content="structure context/submit">submit button here</td>
+  <td><input type="submit" value="save" tal:replace="structure context/submit"><!--submit button here-->
+    <input type=reset>
+  </td>
  </tr>
 </table>
 </form>
 
 </td>
 
-</tal:block>
+</tal:doc>