use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class InstructorCourseStudentDetailsEditSaveAction method redirectWithError.
private RedirectResult redirectWithError(String errorToUser, String errorToAdmin, String courseId) {
statusToUser.add(new StatusMessage(errorToUser, StatusMessageColor.DANGER));
statusToAdmin = errorToAdmin;
isError = true;
RedirectResult result = createRedirectResult(Const.ActionURIs.INSTRUCTOR_COURSE_DETAILS_PAGE);
result.addResponseParam(Const.ParamsNames.COURSE_ID, courseId);
return result;
}
use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class InstructorCourseStudentDetailsPageAction method loadStudentProfile.
private StudentProfileAttributes loadStudentProfile(StudentAttributes student, InstructorAttributes currentInstructor) {
StudentProfileAttributes studentProfile = null;
boolean isInstructorAllowedToViewStudent = currentInstructor.isAllowedForPrivilege(student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS);
boolean isStudentWithProfile = !student.googleId.isEmpty();
if (isInstructorAllowedToViewStudent && isStudentWithProfile) {
studentProfile = logic.getStudentProfile(student.googleId);
Assumption.assertNotNull(studentProfile);
return studentProfile;
}
// this means that the user is returning to the page and is not the first time
boolean hasExistingStatus = !statusToUser.isEmpty() || session.getAttribute(Const.ParamsNames.STATUS_MESSAGES_LIST) != null;
if (!isStudentWithProfile && !hasExistingStatus) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_JOINED_YET_FOR_RECORDS, StatusMessageColor.WARNING));
}
if (!isInstructorAllowedToViewStudent && !hasExistingStatus) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_PROFILE_UNACCESSIBLE_TO_INSTRUCTOR, StatusMessageColor.WARNING));
}
return null;
}
use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class InstructorCourseStudentDetailsPageAction method execute.
@Override
public ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
String studentEmail = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
Assumption.assertPostParamNotNull(Const.ParamsNames.STUDENT_EMAIL, studentEmail);
StudentAttributes student = logic.getStudentForEmail(courseId, studentEmail);
if (student == null) {
statusToUser.add(new StatusMessage(Const.StatusMessages.STUDENT_NOT_FOUND_FOR_COURSE_DETAILS, StatusMessageColor.DANGER));
isError = true;
return createRedirectResult(Const.ActionURIs.INSTRUCTOR_HOME_PAGE);
}
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
gateKeeper.verifyAccessible(instructor, logic.getCourse(courseId), student.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS);
boolean hasSection = logic.hasIndicatedSections(courseId);
StudentProfileAttributes studentProfile = loadStudentProfile(student, instructor);
InstructorCourseStudentDetailsPageData data = new InstructorCourseStudentDetailsPageData(account, sessionToken, student, studentProfile, hasSection);
statusToAdmin = "instructorCourseStudentDetails Page Load<br>" + "Viewing details for Student <span class=\"bold\">" + studentEmail + "</span> in Course <span class=\"bold\">[" + courseId + "]</span>";
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_COURSE_STUDENT_DETAILS, data);
}
use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class InstructorFeedbackUnpublishAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String nextUrl = getRequestParamValue(Const.ParamsNames.NEXT_URL);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
FeedbackSessionAttributes session = logic.getFeedbackSession(feedbackSessionName, courseId);
boolean isCreatorOnly = false;
gateKeeper.verifyAccessible(instructor, session, isCreatorOnly, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
try {
logic.unpublishFeedbackSession(session);
if (session.isPublishedEmailEnabled()) {
taskQueuer.scheduleFeedbackSessionUnpublishedEmail(session.getCourseId(), session.getFeedbackSessionName());
}
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_UNPUBLISHED, StatusMessageColor.SUCCESS));
statusToAdmin = "Feedback Session <span class=\"bold\">(" + feedbackSessionName + ")</span> " + "for Course <span class=\"bold\">[" + courseId + "]</span> unpublished.";
} catch (InvalidParametersException e) {
setStatusForException(e);
}
if (nextUrl == null) {
nextUrl = Const.ActionURIs.INSTRUCTOR_FEEDBACK_SESSIONS_PAGE;
}
return createRedirectResult(nextUrl);
}
use of teammates.common.util.StatusMessage in project teammates by TEAMMATES.
the class InstructorHomePageAction method execute.
@Override
public ActionResult execute() throws EntityDoesNotExistException {
if (!account.isInstructor && isPersistenceIssue()) {
statusToUser.add(new StatusMessage(Const.StatusMessages.INSTRUCTOR_PERSISTENCE_ISSUE, StatusMessageColor.WARNING));
statusToAdmin = "instructorHome " + Const.StatusMessages.INSTRUCTOR_PERSISTENCE_ISSUE;
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_HOME, new InstructorHomePageData(account, sessionToken));
}
gateKeeper.verifyInstructorPrivileges(account);
String courseToLoad = getRequestParamValue(Const.ParamsNames.COURSE_TO_LOAD);
return courseToLoad == null ? loadPage() : loadCourse(courseToLoad);
}
Aggregations