use of teammates.ui.pagedata.StudentCourseJoinConfirmationPageData in project teammates by TEAMMATES.
the class StudentCourseJoinAction method execute.
@Override
public ActionResult execute() {
Assumption.assertPostParamNotNull(Const.ParamsNames.REGKEY, regkey);
statusToAdmin = "Action Student Clicked Join Link" + (account.googleId == null ? "<br>Email: " + account.email : "<br>Google ID: " + account.googleId + "<br>Key: " + regkey);
if (student == null) {
statusToAdmin += "<br>Student course join failed as student does not exist.";
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
isError = true;
statusToUser.add(new StatusMessage(String.format(Const.StatusMessages.NON_EXISTENT_STUDENT_ATTEMPTING_TO_JOIN_COURSE, courseId), StatusMessageColor.WARNING));
return createRedirectResult(Const.ActionURIs.STUDENT_HOME_PAGE);
}
String nextUrl = getNextUrl();
if (gateKeeper.getCurrentUser() == null) {
return createRedirectToAuthenticatedJoinPage(nextUrl);
}
String confirmUrl = Const.ActionURIs.STUDENT_COURSE_JOIN_AUTHENTICATED + "?" + Const.ParamsNames.REGKEY + "=" + regkey + "&" + Const.ParamsNames.NEXT_URL + "=" + SanitizationHelper.sanitizeForNextUrl(nextUrl);
String nextUrlType = getPageTypeOfUrl(nextUrl);
// the student is redirected to join page because he/she is not registered in the course
boolean isRedirectResult = !Const.SystemParams.PAGES_ACCESSIBLE_WITHOUT_REGISTRATION.contains(nextUrlType);
boolean isNextUrlAccessibleWithoutLogin = Const.SystemParams.PAGES_ACCESSIBLE_WITHOUT_GOOGLE_LOGIN.contains(nextUrlType);
String courseId = student.course;
StudentCourseJoinConfirmationPageData data = new StudentCourseJoinConfirmationPageData(account, student, sessionToken, confirmUrl, gateKeeper.getLogoutUrl(SanitizationHelper.sanitizeForNextUrl(confirmUrl)), isRedirectResult, courseId, isNextUrlAccessibleWithoutLogin);
excludeStudentDetailsFromResponseParams();
return createShowPageResult(Const.ViewURIs.STUDENT_COURSE_JOIN_CONFIRMATION, data);
}
Aggregations