${h.form(url('my_account'), method='post')}
    <div class="form">

         <div class="field">
           <div class="gravatar_box">
               <div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/></div>
                <p>
                %if c.visual.use_gravatar:
                <strong>${_('Change your avatar at')} <a href="http://gravatar.com">gravatar.com</a></strong>
                <br/>${_('Using')} ${c.user.email}
                %else:
                <strong>${_('Avatars are disabled')}</strong>
                <br/>${c.user.email or _('Missing email, please update your user email address.')}
                    [${_('current IP')}: ${c.perm_user.ip_addr or "?"}]
                %endif
               </p>
           </div>
         </div>

        <% readonly = None %>
        <% disabled = "" %>
        <div class="fields">
           %if c.extern_type != c.EXTERN_TYPE_INTERNAL:
                <% readonly = "readonly" %>
                <% disabled = " disabled" %>
                <strong>${_('Your user is in an external Source of Record; some details cannot be managed here')}.</strong>
           %endif
             <div class="field">
                <div class="label">
                    <label for="username">${_('Username')}:</label>
                </div>
                <div class="input">
                  ${h.text('username',class_='medium%s' % disabled, readonly=readonly)}
                  ${h.hidden('extern_name', c.extern_name)}
                  ${h.hidden('extern_type', c.extern_type)}
                </div>
             </div>

             <div class="field">
                <div class="label">
                    <label for="name">${_('First Name')}:</label>
                </div>
                <div class="input">
                    ${h.text('firstname',class_="medium")}
                </div>
             </div>

             <div class="field">
                <div class="label">
                    <label for="lastname">${_('Last Name')}:</label>
                </div>
                <div class="input">
                    ${h.text('lastname',class_="medium")}
                </div>
             </div>

             <div class="field">
                <div class="label">
                    <label for="email">${_('Email')}:</label>
                </div>
                <div class="input">
                    ## we should be able to edit email !
                    ${h.text('email',class_="medium")}
                </div>
             </div>

            <div class="buttons">
              ${h.submit('save',_('Save'),class_="btn")}
              ${h.reset('reset',_('Reset'),class_="btn")}
            </div>
        </div>
    </div>
${h.end_form()}
