Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ public HashMap<String, Object> getInfo() {
infoMap.put("How did you hear about us", this.getHowDidYouHearAboutUs());
infoMap.put("Email", this.getEmailAddress());
infoMap.put("Language", this.getLanguage());
infoMap.put("Account Enabled", this.isEnabled());
return infoMap;
}

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3196,6 +3196,8 @@ teacher.teacherinfo.numberOfLogins=Number of logins
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=Last Login
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=Account Enabled
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=Close this window
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link

Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_ar.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3426,6 +3426,8 @@ teacher.teacherinfo.numberOfLogins=عدد مرات تسجيل الدخول:
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=آخر تسجيل دخول
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=الحساب مفعل
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=إغلاق هذه النافذة
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=شروط الاستخدام
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_el.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2710,6 +2710,8 @@ teacher.teacherinfo.numberOfLogins=Αριθμός συνδέσεων
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=Τελευταία σύνδεση
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=Ενεργοποιημένος λογαριασμός
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=Κλείσιμο αυτού του παραθύρου
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=Όροι Χρήσης
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2400,6 +2400,8 @@ teacher.teacherinfo.numberOfLogins=Cantidad de veces logueado
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=Última visita
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=Cuenta habilitada
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=Cerrar esta ventana
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=Términos de uso
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_iw.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2804,6 +2804,8 @@ teacher.teacherinfo.numberOfLogins=מספר כניסות
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=כניסה אחרונה
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=חשבון מופעל
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=סגירת החלון
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=תנאי שימוש
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_ja.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1076,6 +1076,8 @@ teacher.teacherinfo.schoolName=学校名
teacher.teacherinfo.schoolName.description=The label for the School Name field
teacher.teacherinfo.schoolLevel=学校レベル
teacher.teacherinfo.schoolLevel.description=The label for the School Level field
teacher.teacherinfo.accountEnabled=アカウント有効
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.management.updatemyaccountinfo.title=アカウント情報
teacher.management.updatemyaccountinfo.title.description=Title for the teacher account information page
teacher.management.updatemyaccountinfo.displayName=表示名:
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_nl.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2735,6 +2735,8 @@ teacher.teacherinfo.numberOfLogins=Aantal logins
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=Laatste login
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=Account ingeschakeld
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=Sluit dit venster
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=Gebruikersvoorwaarden
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_tr.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,8 @@ teacher.teacherinfo.numberOfLogins=Giriş Sayısı
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=Son Giriş
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=Hesap Etkin
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=Bu pencereyi kapat
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=Kullanım Koşulları
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_zh_CN.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,8 @@ teacher.teacherinfo.numberOfLogins=登录次数
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=上次登录
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=账号已启用
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=关闭该窗口
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=使用条款
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/i18n/i18n_zh_TW.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4695,6 +4695,8 @@ teacher.teacherinfo.numberOfLogins=登入次數
teacher.teacherinfo.numberOfLogins.description=The label for the Number of logins field
teacher.teacherinfo.lastLogin=最後一次登入
teacher.teacherinfo.lastLogin.description=The label for the Last Login field
teacher.teacherinfo.accountEnabled=帳號已啟用
teacher.teacherinfo.accountEnabled.description=The label for the Account Enabled field
teacher.teacherinfo.closeThisWindow=關閉視窗
teacher.teacherinfo.closeThisWindow.description=The text for the Close this window link
teacher.termsofuse.termsOfUse=使用條款
Expand Down
45 changes: 45 additions & 0 deletions src/main/webapp/portal/teacher/account/info.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,39 @@
<link href="${contextPath}/<spring:theme code="rtlstylesheet"/>" rel="stylesheet" type="text/css" >
</c:if>

<script type="text/javascript" src="${contextPath}/<spring:theme code="jquerysource"/>"></script>
<script src="${contextPath}/<spring:theme code="generalsource" />" type="text/javascript"></script>

<sec:authorize access="hasRole('ROLE_ADMINISTRATOR')">
<script type="text/javascript">
function toggleUserAccountStatus(username, isCurrentlyEnabled) {
var action = isCurrentlyEnabled ? "disable" : "enable";
var doEnable = !isCurrentlyEnabled;
if (confirm("Are you sure you want to " + action + " user '" + username + "'?")) {
$.ajax({
url: "${contextPath}/admin/account/enabledisableuser",
type: "POST",
data: {
"doEnable": doEnable,
"username": username
},
success: function(data, textStatus, jqXHR) {
if (jqXHR.responseText === "success" || data === "success") {
alert("User '" + username + "' was successfully " + (doEnable ? "enabled" : "disabled") + ".");
location.reload();
} else {
alert(jqXHR.responseText || data);
}
},
error: function(jqXHR, textStatus, errorThrown) {
alert("An error occurred: " + (jqXHR.responseText || errorThrown));
}
});
}
}
</script>
</sec:authorize>

</head>
<body style="background: #FFFFFF;">
<div class="dialogContent">
Expand Down Expand Up @@ -96,6 +127,20 @@
<td><fmt:formatDate value="${userInfoMap['Last Login']}"
type="both" dateStyle="short" timeStyle="short" /></td>
</tr>
<sec:authorize access="hasRole('ROLE_ADMINISTRATOR')">
<tr>
<th><spring:message code="teacher.teacherinfo.accountEnabled" /></th>
<td>
<c:out value="${userInfoMap['Account Enabled']}" />
<button type="button" style="margin-left: 8px;" onclick="toggleUserAccountStatus('${userInfoMap['Username']}', ${userInfoMap['Account Enabled']})">
<c:choose>
<c:when test="${userInfoMap['Account Enabled']}">disable user</c:when>
<c:otherwise>enable user</c:otherwise>
</c:choose>
</button>
</td>
</tr>
</sec:authorize>
</table>
<br>
<table style="margin: 0 auto;">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@
*/
package org.wise.portal.domain.authentication.impl;

import static org.junit.jupiter.api.Assertions.assertEquals;

import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;

import org.junit.jupiter.api.Test;
import org.wise.portal.domain.authentication.Schoollevel;
import org.wise.portal.domain.authentication.impl.TeacherUserDetails;

import junit.framework.TestCase;

/**
* @author Sally Ahn
* @version $Id$
*/
public class TeacherUserDetailsTest extends TestCase {
public class TeacherUserDetailsTest {

private TeacherUserDetails teacherUserDetails = new TeacherUserDetails();

Expand Down Expand Up @@ -63,6 +63,7 @@ public class TeacherUserDetailsTest extends TestCase {

private static final String DISPLAYNAME ="Mr. Right";

@Test
public void testGetInfo() {
teacherUserDetails.setCity(CITY);
teacherUserDetails.setCountry(COUNTRY);
Expand Down Expand Up @@ -91,6 +92,7 @@ public void testGetInfo() {
assertEquals(infoMap.get("Last Login"), LASTLOGIN);
assertEquals(infoMap.get("Number of Logins"), Integer.toString(NUMBEROFLOGINS));
assertEquals(infoMap.get("Display Name"), DISPLAYNAME);
assertEquals(infoMap.get("Account Enabled"), true);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import static org.junit.Assert.assertEquals;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import org.easymock.EasyMockExtension;
Expand Down Expand Up @@ -91,6 +92,8 @@ public void getUserAccountInfo_AdminLooksUpTeacher_ReturnTeacherAccountInfoPage(
String view = controller.getUserAccountInfo(adminAuth, TEACHER_USERNAME, modelMap);
assertEquals("teacher/account/info", view);
assertEquals(false, modelMap.get("isStudent"));
HashMap<String, Object> resultUserInfoMap = (HashMap<String, Object>) modelMap.get("userInfoMap");
assertEquals(true, resultUserInfoMap.get("Account Enabled"));
List<Run> resultRunList = (List<Run>) modelMap.get("runList");
assertEquals(1, resultRunList.size());
verify(userService);
Expand Down
Loading