[% 
    title = users.data.realname _ ' (Edit Profile)' ;

    crumb2_name = 'Profile' ;
    crumb2_href = '/cgi-bin/pages.cgi?act=user-list' ;
    crumb1_name = 'Edit' ;
%]

[% INCLUDE "public/tinymce.html" %]


[% IF users.data %]
[% IF thanks %]<p>[% thanks %]</p>[% END %]
<p>Fields marked * are mandatory fields and must be completed.</p>
<p><strong>Please take the time to enter your details, as it helps others to identify you when you make any
changes to the pages on the site. Note that only the details shown in the preview at the bottom of
the page, will be visible on the wiki.</strong></p>

<form method="post" action="[% cgipath %]/pages.cgi">
<input type="hidden" name="act" value="user-pass" />
<input type="hidden" name="userid" value="[% users.data.userid %]" />
<p><input type="submit" name="submit" value="CHANGE PASSWORD" /></p>
</form>

[% IF errmess %]
<p class="alert">There are invalid or missing fields, as noted by the &empty; symbol.</p>
[% END %]

<form method="post" action="[% cgipath %]/pages.cgi" enctype="multipart/form-data">
<input type="hidden" name="act" value="user-amend" />
<input type="hidden" name="userid" value="[% users.data.userid %]" />
<input type="hidden" name="imageid" value="[% users.data.imageid %]" />

<table width="100%" summary="User Edit Form">
<tr><th width="150">Email *</th>
    <th width="10" class="alert">[% users.data.email_err %]</th>
    <td><input type="text" name="email" value="[% users.data.email %]" size="40" />
        <br />Your email address will NOT be publically visible or be passed to any third party.
        It is required, as this will be your login and will be used to send you a site password.</td>
</tr>
<tr><th>Display Name *</th>
    <th class="alert">[% users.data.realname_err %]</th>
    <td><input type="text" name="realname" value="[% users.data.realname %]" size="40" /></td>
</tr>
<tr><th>About Me</th>
    <th class="alert">[% users.data.aboutme_err %]</th>
    <td><textarea name="aboutme" rows="10" cols="50">[% users.data.aboutme %]</textarea></td>
</tr>
<tr><th>Web Page</th>
    <th class="alert">[% users.data.url_err %]</th>
    <td><input type="text" name="url" value="[% users.data.url %]" size="50" /></td>
</tr>
<tr><th>Avatar</th>
    <th class="alert">[% users.data.image_err %]</th>
    <td><input type="file" name="image" /><br/>
        <img src="[% webpath %]/[% users.data.link %]" alt="[% users.data.name %]"/></td>
</tr>
</table>

<p><input type="submit" name="submit" value="UPDATE" /></p>
</form>

<h2>Preview</h2>

<div class="users">
  <div class="userbits">
    <div class="username">[% users.preview.realname %]</div>
  </div>
  <div class="userinfo">
    [% IF users.preview.link %]<img src="[% webpath %]/[% users.preview.link %]" alt="[% users.preview.tag %]" align="right" />[% END %]
    [% IF users.preview.aboutme ; users.preview.aboutme ; END %]
    [% IF users.preview.url %]<p><strong>My Web Page:</strong> <a href="[% preview.url %]">[% users.preview.url %]</a></p>[% END %]
    [% IF ! users.preview.aboutme AND ! users.preview.url %]<p>... to be completed.</p>[% END %]
  </div>
</div>

[% ELSE %]

<div class="box"><p>User not found.</p></div>

[% END %]
