NIHVIVO-2279 Add more functions to the UserAccount controller.

This commit is contained in:
j2blake 2011-05-18 21:47:44 +00:00
parent 9b41389bd7
commit 74a34e8a31
17 changed files with 728 additions and 216 deletions

View file

@ -0,0 +1,70 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for adding a user account -->
<h1>Add new account</h1>
<#if errorEmailIsEmpty??>
<#assign errorMessage = "You must supply an email address." />
</#if>
<#if errorEmailInUse??>
<#assign errorMessage = "An account with that email address already exists." />
</#if>
<#if errorFirstNameIsEmpty??>
<#assign errorMessage = "You must supply a first name." />
</#if>
<#if errorLastNameIsEmpty??>
<#assign errorMessage = "You must supply a last name." />
</#if>
<#if errorNoRoleSelected??>
<#assign errorMessage = "You must select a role." />
</#if>
<#if errorMessage?has_content>
<section id="error-alert" role="alert">
<img src="${urls.images}/iconAlert.png" width="24" height="24" alert="Error alert icon"/>
<p>${errorMessage}</p>
</section>
</#if>
<form method="POST" action="${formUrls.add}">
Email address *
<br/>
<input type="text" name="emailAddress" value="${emailAddress}" />
<br/>
First name *
<br/>
<input type="text" name="firstName" value="${firstName}" />
<br/>
Last name *
<br/>
<input type="text" name="lastName" value="${lastName}" />
<br/>
<br/>
Roles *
<br/>
<#list roles as role>
<input type="radio" name="role" value="${role.uri}" <#if selectedRole = role.uri>selected</#if> />${role.label}
<br>
</#list>
<br/>
Associate a profile with this account
<br/>
<input type="radio" name="associate" value="yes" <#if associate??>checked</#if> />Yes
<br/>
<input type="radio" name="associate" value="no" <#if !associate??>checked</#if> />No
<br/>
<p>
Note: An email will be sent to the address entered above
notifying that an account has been created.
It will include instructions for activating the account and creating a password.
</p>
<input type="submit" name="submitAdd" value="Add new account" />
or <a href="${formUrls.list}">Cancel</a>
</form>

View file

@ -0,0 +1,6 @@
<#-- $This file is distributed under the terms of the license in /doc/license.txt$ -->
<#-- Template for editing a user account -->
<h1>Edit user account</h1>

View file

@ -2,7 +2,7 @@
<#-- Template for displaying list of user accounts -->
<form method="POST" action="${formUrl}">
<form method="POST" action="${formUrls.list}">
<#--current page: <input type="text" name="pageIndex" value="${page.current}" />
<br />-->
@ -38,12 +38,28 @@
<input type="submit" name="list" value="Refresh page" />-->
</form>
<h3>Account | <input type="submit" name="add" class="submit" value="Add new account" /></h3>
<!-- When this is clicked, all other fields are ignored. -->
<form method="POST" action="${formUrls.add}">
<h3>Account | <input type="submit" class="submit" value="Add new account" /></h3>
</form>
<section class="account-feedback">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <a hrf="#">Maecenas dui erat</a>, dapibus non vehicula at, tristique eu sem. Suspendisse ligula felis, mollis vitae elementum eget, semper a nisl.</p>
</section>
<#if newUserAccount?? >
<section class="account-feedback">
<p>
A new account for
<a href="${newUserAccount.editUrl}">${newUserAccount.firstName} ${newUserAccount.lastName}</a>
was successfully created. A notification email has been sent to ${newUserAccount.emailAddress}
with instructions for activating the account and creating a password.
</p>
</section>
</#if>
<#if deletedAccountCount?? >
<section class="account-feedback">
<p>
Deleted ${deletedAccountCount} accounts.
</p>
</section>
</#if>
<section id="filter-roles">
<select name="roleFilterUri" id="">
@ -59,98 +75,105 @@
</select>
</section>
<section id="search-accounts">
<input type="text" name="" />
<input class="submit" type="submit" value="Search accounts"/>
<!--
When searchTerm changes,
set pageIndex to 1
set orderDirection to "ASC"
set orderField to "email"
submit the form (submit action is "list")
-->
</section>
<form method="POST" action="${formUrls.list}">
<section id="search-accounts">
<input type="text" name="" />
<input class="submit" type="submit" value="Search accounts"/>
<!--
When searchTerm changes,
set pageIndex to 1
set orderDirection to "ASC"
set orderField to "email"
submit the form (submit action is "list")
-->
</section>
</form>
<section class="accounts">
<input type="submit" name="delete" class="submit delete-account" value="Delete" />
<!-- When this is clicked, the checkboxes are noticed and all other fields are ignored. -->
<SCRIPT TYPE="text/javascript">
function changeAction(form, url) {
form.action = url;
return true;
}
</SCRIPT>
<nav class="display-tools">
<span>| <a href="#">n</a> accounts | </span>
<form method="get" class="accounts-per-page-form" name="list" action="${formUrl}">
<form method="POST" action="${formUrls.list}">
<section class="accounts">
<input type="submit" class="submit delete-account" value="Delete" onClick="changeAction(this.form, '${formUrls.delete}')" />
<!--
When this is clicked, the checkboxes are noticed and all other fields are ignored.
submit the form (submit action is formUrls.delete)
-->
<nav class="display-tools">
<span>| <a href="#">n</a> accounts | </span>
<#assign counts = [25, 50, 100]>
<select name="accountsPerPage" class="accounts-per-page">
<#list counts as count>
<option value="${count}" <#if accountsPerPage= count>selected</#if> >${count}</option>
</#list>
<!--
<!--
When accountsPerPage changes,
set pageIndex to 1
submit the form (submit action is "list")
submit the form (submit action is formUrls.list)
-->
</select>
<input class="hide" type="submit" value="Update" />
</form>
accounts per page |
<#if page.previous?has_content>
<a href="${formUrls.list}?accountsPerPage=${accountsPerPage}&pageIndex=${page.previous}">Previous</a> <!-- only present if current page is not 1.-->
</#if>
${page.current} of ${page.last}
<#if page.next?has_content>
<a href="${formUrls.list}?accountsPerPage=${accountsPerPage}&pageIndex=${page.next}">Next</a><!-- only present if current page is not last page.-->
</#if>
</nav>
</section>
accounts per page |
<table id="account">
<caption>Account Management</caption>
<#if page.previous?has_content>
<a href="${formUrl}?accountsPerPage=${accountsPerPage}&pageIndex=${page.previous}">Previous</a> <!-- only present if current page is not 1.-->
</#if>
${page.current} of ${page.last}
<#if page.next?has_content>
<a href="${formUrl}?accountsPerPage=${accountsPerPage}&pageIndex=${page.next}">Next</a><!-- only present if current page is not last page.-->
</#if>
</nav>
</section>
<table id="account">
<caption>Account Management</caption>
<thead>
<tr>
<th scope="col">
<div>
<form method="get" class="delete-all-accounts" name="list" action="${formUrl}">
<input class="hide" type="checkbox" name="delete-all" id="">Email Address<span></span>
</form>
</div>
</th>
<th scope="col"><div>First name <a href="?accountsPerPage=${accountsPerPage}&orderField=firstName&orderDirection=ASC"><img class="middle" src="${urls.themeImages}/sort-asc.gif" /></a> <a href="?accountsPerPage=${accountsPerPage}&orderField=firstNameorderDirection=DEC"><img src="${urls.themeImages}/sort-desc.gif" /></a></div></th>
<th scope="col"><div>Last Name<span></span></div></th>
<th scope="col"><div>Status<span></span></div></th>
<th scope="col"><div>Roles</div></th>
<th scope="col"><div>Login Count<span></span></div></th>
</tr>
</thead>
<tbody>
<#list accounts as account>
<thead>
<tr>
<td>
<input type="checkbox" name="deleteAccount" value="${account.uri}" />
<!-- ignored unless submit action is "delete" -->
<a href="${formUrl}?edit&editAccount=${account.uri}" >${account.emailAddress}</a>
<!-- if submit action is "edit", editAccount is noticed and all other fields are ignored. -->
</td>
<td>${account.firstName}</td>
<td>${account.lastName}</td>
<td>${account.status}</td>
<td>
<#list account.permissionSets as permissionSet>
<div>${permissionSet}</div>
</#list>
</td>
<td>${account.loginCount}</td>
<th scope="col">
<div>
<input class="hide" type="checkbox" name="delete-all" id="">Email Address<span></span>
</div>
</th>
<th scope="col"><div>First name <a href="?accountsPerPage=${accountsPerPage}&orderField=firstName&orderDirection=ASC"><img class="middle" src="${urls.themeImages}/sort-asc.gif" /></a> <a href="?accountsPerPage=${accountsPerPage}&orderField=firstNameorderDirection=DEC"><img src="${urls.themeImages}/sort-desc.gif" /></a></div></th>
<th scope="col"><div>Last Name<span></span></div></th>
<th scope="col"><div>Status<span></span></div></th>
<th scope="col"><div>Roles</div></th>
<th scope="col"><div>Login Count<span></span></div></th>
</tr>
</#list>
</tbody>
</table>
<#--link on user's email address currently does nothing-->
</thead>
<tbody>
<#list accounts as account>
<tr>
<td>
<input type="checkbox" name="deleteAccount" value="${account.uri}" />
<!-- ignored unless submit action is formUrls.delete -->
<a href="${account.editUrl}" >${account.emailAddress}</a>
<!-- when this link is clicked, editAccount is noticed and all other fields are ignored. -->
</td>
<td>${account.firstName}</td>
<td>${account.lastName}</td>
<td>${account.status}</td>
<td>
<#list account.permissionSets as permissionSet>
<div>${permissionSet}</div>
</#list>
</td>
<td>${account.loginCount}</td>
</tr>
</#list>
</tbody>
</table>
</form>
${scripts.add('<script type="text/javascript" src="${urls.base}/js/account/accountUtils.js"></script>')}