hydra: added some user admin

This commit is contained in:
Rob Vermaas
2010-12-03 09:40:25 +00:00
parent 6d6f43fa0c
commit cd7742f610
7 changed files with 268 additions and 1 deletions

View File

@ -0,0 +1,23 @@
[% WRAPPER layout.tt title="Change password" %]
[% PROCESS common.tt %]
<form action="[% c.uri_for('/change-password/submit') %]" method="post">
<h2>Change password</h2>
<table class="layoutTable">
<tr>
<th>Enter password:</th>
<td><input type="password" class="string" id="password" name="password" /></td>
</tr>
<tr>
<th>Enter password again:</th>
<td><input type="password" class="string" id="password_check" name="password_check" /></td>
</tr>
</table>
<p><button type="submit"><img src="/static/images/success.gif" />Change</button></p>
</form>
[% END %]

View File

@ -82,6 +82,9 @@
[% INCLUDE makeLink
uri = c.uri_for(c.controller('Admin').action_for('managenews'))
title = "News" %]
[% INCLUDE makeLink
uri = c.uri_for(c.controller('Admin').action_for('users'))
title = "Users" %]
[% END %]
[% END %]

70
src/root/user.tt Normal file
View File

@ -0,0 +1,70 @@
[% WRAPPER layout.tt title=(create ? "New user" : "Editing user '$user.username'") %]
[% PROCESS common.tt %]
[% BLOCK roleoption %]
<option value="[% role %]"
[% checked = false %]
[% FOREACH r IN user.userroles %]
[% checked = r.role == role %]
[% BREAK IF checked %]
[% END %]
[% IF checked %]
SELECTED
[% END %]
>[% role %]</option>
[% END %]
<form action="[% IF create %][% c.uri_for('/admin/create-user/submit') %][% ELSE %][% c.uri_for('/admin/user' user.username 'submit') %][% END %]" method="post">
<h2>User[% IF ! create %] '[% user.username %]'[% END %]</h2>
<table class="layoutTable">
[% IF create %]
<tr>
<th>Username:</th>
<td>[% INCLUDE maybeEditString param="username" value=user.username %]</td>
</tr>
[% END %]
<tr>
<th>Full name:</th>
<td>[% INCLUDE maybeEditString param="fullname" value=user.fullname %]</td>
</tr>
<tr>
<th>Email:</th>
<td>[% INCLUDE maybeEditString param="emailaddress" value=user.emailaddress %]</td>
</tr>
<tr>
<th>Evaluation error notifications:</th>
<td>
[% INCLUDE renderSelection param="emailonerror" curValue=user.emailonerror options={"1" = "Yes", "0" = "No"} %]
</td>
</tr>
<tr>
<th>Roles:</th>
<td>
<select multiple name="roles" style="width: 27em;">
[% INCLUDE roleoption role="admin" %]
[% INCLUDE roleoption role="create-project" %]
</select>
</td>
</tr>
</table>
<p><button type="submit"><img src="/static/images/success.gif" />[%IF create %]Create[% ELSE %]Apply changes[% END %]</button></p>
</form>
[% IF !create %]
<form action="[% c.uri_for('/admin/user' user.hostname 'delete') %]" method="post">
<p><button id="delete-user" type="submit"><img src="/static/images/failure.gif" />Remove this user</button></p>
</form>
<script type="text/javascript">
$("#delete-user").click(function() {
return confirm("Are you sure you want to delete this user?");
});
</script>
[% END %]
[% END %]

34
src/root/users.tt Normal file
View File

@ -0,0 +1,34 @@
[% WRAPPER layout.tt title="Users" %]
[% PROCESS common.tt %]
<h1>Users</h1>
<table>
<thead>
<tr>
<th>Username</th>
<th>Name</th>
<th>Email</th>
<th>Roles</th>
<th>Eval. notifications</th>
<th>Options</th>
</tr>
</thead>
<tbody>
[% FOREACH u IN users %]
<tr>
<td>[% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('user_edit'), [u.username]) content = u.username %]</td>
<td>[% u.fullname %]</td>
<td>[% u.emailaddress %]</td>
<td>[% FOREACH r IN u.userroles %]<i>[% r.role %]</i> [% END %]</td>
<td>[% IF u.emailonerror %]Yes[% ELSE %]No[% END %]</td>
<td>[ [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('reset_password'), [u.username]) content = "Reset password" confirmmsg = "Are you sure you want to reset the password for this user?" %] ]</td>
</tr>
[% END %]
</tbody>
</table>
<p>[ <a href="[% c.uri_for(c.controller('Admin').action_for('create_user')) %]">Add a new user</a> ]</p>
[% END %]