[% META title="User Manager" -%]
<!-- BEGIN [% template.name %] -->

<script type="text/javascript">
  user_return = function(){
   document.getElementById('user_fname').value    = arguments[0];
   document.getElementById('user_pwd').value      = arguments[1];
   document.getElementById('user_role').value     = arguments[2];
   document.getElementById('user_email').value    = arguments[3];
   document.getElementById('user_active').value   = arguments[4];
   document.getElementById('user_location').value = arguments[5];
  }
</script>

	[% # PROCESS dumper.tt dump = user_permissions %]
	[% # PROCESS dumper.tt dump = c.stash.errs %]

    [% PROCESS admin/user_nav.tt page = 'user_list' %]

    [% user_details_dfv_js %]

	<h2>Select a registered user or create new user:</h2>

    [% IF dfv_errors %]
        <p class="error">[% c.cfg('msg').dfv_errors %]</p>
        [% IF error_first_name.match('already exists') %]
        <p class="warning">* combination of first &amp; last names already used</p>
        [% END %]
    [% END %]

    [% IF selected_user %]
    <p class="title">Current user permissions:
        [% class = permissions_type.match('custom') ? 'highlight' : 'maroon' %]
		<span class="[% class %]">[% permissions_type | upper %]</span> settings
        [ <a href="[% app_url %]/admin/user/edit_permissions/[% selected_user.id %]">
            change user permissions
            </a> ]
        [ <a href="[% app_url %]/admin/user/delete_user/[% selected_user.id %]">delete user</a> ]
        [ <a href="[% app_url %]/admin/user">reset/new user</a> ]
    </p>
    [% END %]

    <table>
        <tr>
            <td class="admin-user">
                [% PROCESS admin/user/list.tt %]
            </td>
            <th valign="top">OR</th>
            <td class="admin-user">
                [% PROCESS admin/user/details.tt %]
            </td>
            <td class="admin-user">
                [% PROCESS admin/user/functions.tt IF user_permissions %]
            </td>
        </tr>
    </table>
<!-- END [% template.name %] -->




