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

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

<script type="text/javascript" src="[% webpath %]/js/tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
    mode : "textareas",
    theme : "advanced",
    plugins : "preview,searchreplace",
    theme_advanced_buttons1 : "bold,italic,underline,strikethrough,sub,sup,formatselect,hr,|,justifyleft,justifycenter,justifyright,justifyfull",
    theme_advanced_buttons2 : "bullist,numlist,|,link,unlink,anchor,|,undo,redo,search,replace,|,cleanup,help,preview",
    theme_advanced_buttons3 : "",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_path_location : "bottom",
    extended_valid_elements : "hr[class|width|size|noshade]",
    force_br_newlines : true,
    force_p_newlines : false,
    convert_urls : false
});
</script>



[% IF users.data %]
<div class="box">
[% 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></div>

<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" />
</form>

[% IF errmess %]
<div class="box">
<p class="alert">There are invalid or missing fields, as noted by the &empty; symbol.</p>
</div>
[% 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 %]" />

<div class="box">
    <table width="100%">
    <tr><td width="150">Email *</td>
        <td width="10" class="alert">[% users.data.email_err %]</td>
        <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><td>Display Name *</td>
        <td class="alert">[% users.data.realname_err %]</td>
        <td><input type="text" name="realname" value="[% users.data.realname %]" size="40" /></td>
    </tr>
    <tr><td>About Me</td>
        <td class="alert">[% users.data.aboutme_err %]</td>
        <td><textarea name="aboutme" rows="10" cols="50">[% users.data.aboutme %]</textarea></td>
    </tr>
    <tr><td>Web Page</td>
        <td class="alert">[% users.data.url_err %]</td>
        <td><input type="text" name="url" value="[% users.data.url %]" size="50" /></td>
    </tr>
<!--
    <tr><td>Avatar</td>
        <td class="alert">[% users.data.image_err %]</td>
        <td><input type="file" name="image" /><br/>
            <img src="[% webpath %]/[% users.data.link %]" alt="[% users.data.name %]"/></td>
    </tr>
-->
    </table>
</div>

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

<h2>Preview</h2>

<div class="users">
  <div class="userpic">
    [% IF users.preview.gravatar %]
      <img src="[% users.preview.gravatar %]" alt="[% users.preview.realname %]" width="80" height="80" />
    [% END %]

    <!--
    [% IF users.preview.link %]
      <img src="[% webpath %]/[% users.preview.link %]" alt="[% users.preview.tag %]" align="right"
      [% IF users.preview.width  %]width="[% users.preview.width %]"[% END %]
      [% IF users.preview.height %]height="[% users.preview.height %]"[% END %]
      />
    [% END %]
    -->
  </div>

  <div class="userbits">
    [% IF user.access == 5 %]
    <div class="username"><a href="[% cgipath %]/pages.cgi?act=user-adminedit&amp;userid=[% users.preview.userid %]">[% users.preview.realname %]</a></div>
    [% ELSE %]
    <div class="username">[% users.preview.realname %]</div>
    [% END %]
  </div>
  <div class="userinfo">
    [% IF users.preview.aboutme ; users.preview.aboutme ; END %]
    [% IF users.preview.url %]<p><strong>My Web Page:</strong> <a href="[% users.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 %]
