RSS Git Download  Clone
Raw Blame History
    [% META title = 'User » Register New User' -%]
<!-- BEGIN [% template.name %] -->

    [% # PROCESS dumper.tt dump = errs %]
    
    <h2>Registration Details</h2>    
    
    [% IF errs %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
    [% ELSE %]
        <p class="indent">Usage: preview message -> post message.</p>
        <div><strong>Paste Application Details:</strong></div>
    [% END %]
    
    <form method="post" action="[% app_url %]/admin/user/new_user"
        name="new_user" id="new_user" enctype="application/x-www-form-urlencoded"> 
        <div>
          <textarea name="src_data" rows=8
            cols=80>[% c.query.param('src_data') # DO NOT LINE BREAK %]</textarea>      
        </div>
        
        [% IF user_groups AND NOT errs %]
        <p class="bold">User group:
            <select name="group_id" id="user_group">
                <option value="">&nbsp;</option>
                [% FOREACH group IN user_groups %]
                <option value="[% group.id %]" [%
                    'selected' IF group.group_label.match('guest') # default to %]>
                    [% group.group_label %]
                </option>
                [% END %]
             </select>
            <span class="red">&#171; select one</span>
        </p>
        [% END %]
        
        <p class="indent">
            [% IF new_user_create_success %]
                <a href="[% app_url %]/admin/user/new_user">create new user &#187;</a>
            [% ELSE %]
                <input type="submit" name="preview" value="Preview" />
                [% IF user_details AND NOT errs;
                        class = has_role ? 'normal' : 'red' %]
                    <input type="hidden" value="[% user_details.user_location_id %]"
                        name="user_location_id" />
                    <input type="submit" name="post" value="Post" class="[% class %]" />
                [% ELSE %]
                    <input type="submit" value="Post" disabled />
                [% END %]
                <input type="button" value="Clear"
                    onclick="document.new_user.src_data.value = '';" />
                [% IF user_details AND NOT has_role %]
                    <span class="red">check spelling/case of 'position' entry</span>
                [% END %]
            [% END %]
        </p>
    </form>

    [% IF user_details; # PROCESS dumper.tt dump = preview %]
        <h3>Preview:</h3>
        <div style="width: 80%; border: solid thin; padding: 1em;">
            <table class="results">
                <tr>
                    <td class="label">UserID:</td>
                    <td>
                        [% user_details.username | upper %]
                        [% IF user_details.username != user_details.last_name %]
                            <span class="red">
                                &#171; LastName = Username already exists
                                - check user details
                            </span>
                        [% END %]
                    </td>
                </tr>
                <tr>
                    <td class="label">LastName:</td>
                    <td>
                        [% user_details.last_name | ucfirst %]
                        [% IF errs.error_first_name # fname + lname constraint; would update existing entry %]
                        <span class="red">
                            * combination of first &amp; last name already exists
                        </span>
                        [% END %]                        
                        [% IF errs.error_last_name %]
                          <span class="red">[%errs.error_last_name %]</span>
                        [% END %]
                    </td>
                </tr>
                <tr>
                    <td class="label">FirstName:</td>
                    <td>[% user_details.first_name | ucfirst %]</td>
                </tr>
                <tr>
                    <td class="label">Email:</td>
                    <td>
                        [% user_details.email %]
                        [% errs.error_email %]
                    </td>
                </tr>
                <tr>
                    [% class = user_details.user_location_id ? 'normal' : 'red' %]
                    <td class="label">Location:</td>
                    <td class="[% class %]">
                        [% user_details.location %]
                        [% IF errs.error_user_location_id.match('missing') %]
                            &#171; unknown user location
                        [% END %]                        
                    </td>
                </tr>
                <tr>
                    <td class="label">Designation:</td>
                    <td class="[% class %]">
                    [% class = has_role OR new_user_create_success
                            ? 'normal' : 'red' %]
                        [% user_details.designation %]
                        [% UNLESS has_role OR new_user_create_success %]
                            &#171; does not exist
                        [% END %]                        
                    </td>
                </tr>
            </table>
            
            <hr />
            
            <pre>[% INCLUDE admin/user/new_user_msg.tt | html %]</pre>
        </div>    
    [% END %]
<!-- END [% template.name %] -->