[%
    admin_header = 1;
    title = c.pref('name');
    selected = 'user';
    WRAPPER page/wrapper.tt;
%]

<div id="content">
    <h1>[% c.loc('Users') %]</h1>
    <table>
    <thead>
        <tr>
            <th>[% c.loc('Active') %]</th>
            <th>[% c.loc('login') %]</th>
            <th>[% c.loc('roles') %]</th>
            <th>[% loc('name') %]</th>
            <th>[% loc('email') %]</th>
        </tr>
    </thead>
    <tbody>
[% WHILE (user=users.next) %]
        <tr>
            [% activeurl= c.uri_for('/.admin/update_user',  user.id , 'active') %]
            [% active=(user.active==1) ? loc('yes') : loc('no') %]
            <td><a class="activelink" href="[% activeurl %]">[% active %]</a></td>
            <td><a href="[% c.uri_for(user.link) %].profile">[% user.login %]</a></td>
            <td>[% FOR role=user.roles %] [% role.name %] [% END %]</td>
            <td>[% user.name %]</td>
            <td>
                [% IF user.email %]
                    <a href="mailto:[%user.email%]">[%user.email%]</a>
                [% ELSE %]
                    [% loc("no email address") %]
                [% END %]
            </td>
        </tr>
[% END %]
    </table>

    <p>
[% IF pager.previous_page %]
        <a href="[% c.uri_for('/.admin/user', {page => pager.previous_page}) %]">[% loc('Previous') %]</a>
[% END %]

[% IF pager.previous_page AND pager.next_page %]
|
[% END %]

[% IF pager.next_page %]
        <a href="[% c.uri_for('/.admin/user', {page => pager.next_page}) %]">[% loc('Next') %]</a>
[% END %]
    </p>

    <a href="[% c.uri_for('/.register') %]">[% loc('Add user') %]</a>
</div>
[% END # WRAPPER %]
