use of teammates.ui.pagedata.FeedbackSubmissionEditPageData in project teammates by TEAMMATES.
the class FeedbackSubmissionEditPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
if (!isSpecificUserJoinedCourse()) {
return createPleaseJoinCourseResponse(courseId);
}
FeedbackSessionAttributes feedbackSession = logic.getFeedbackSession(feedbackSessionName, courseId);
if (feedbackSession == null) {
statusToUser.add(new StatusMessage(Const.StatusMessages.FEEDBACK_SESSION_DELETED_NO_ACCESS, StatusMessageColor.WARNING));
return createSpecificRedirectResult();
}
verifyAccessibleForSpecificUser(feedbackSession);
String regKey = getRequestParamValue(Const.ParamsNames.REGKEY);
String email = getRequestParamValue(Const.ParamsNames.STUDENT_EMAIL);
String userEmailForCourse = getUserEmailForCourse();
data = new FeedbackSubmissionEditPageData(account, student, sessionToken);
data.bundle = getDataBundle(userEmailForCourse);
data.setSessionOpenForSubmission(isSessionOpenForSpecificUser(data.bundle.feedbackSession));
data.init(regKey, email, courseId);
setStatusToAdmin();
// TODO: implement this in another way so there is no dependence on status messages from another page
addFeedbackSubmissionStatusMessageIfNotRedirected();
return createSpecificShowPageResult();
}
use of teammates.ui.pagedata.FeedbackSubmissionEditPageData in project teammates by TEAMMATES.
the class InstructorEditInstructorFeedbackPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String instructorUnderModerationEmail = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON);
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
InstructorAttributes instructorUnderModeration = logic.getInstructorForEmail(courseId, instructorUnderModerationEmail);
// If the instructor doesn't exist
if (instructorUnderModeration == null) {
throw new EntityDoesNotExistException("Instructor Email " + instructorUnderModerationEmail + " does not exist in " + courseId + ".");
}
String moderatedQuestionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_QUESTION_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, instructorUnderModerationEmail);
FeedbackSubmissionEditPageData data = new FeedbackSubmissionEditPageData(account, student, sessionToken);
data.bundle = logic.getFeedbackSessionQuestionsBundleForInstructor(feedbackSessionName, courseId, instructorUnderModeration.email);
Assumption.assertNotNull(data.bundle);
data.setSessionOpenForSubmission(true);
data.setModeration(true);
data.setHeaderHidden(true);
data.setPreviewInstructor(instructorUnderModeration);
data.setSubmitAction(Const.ActionURIs.INSTRUCTOR_EDIT_INSTRUCTOR_FEEDBACK_SAVE);
if (moderatedQuestionId != null) {
data.setModeratedQuestionId(moderatedQuestionId);
}
statusToAdmin = "Moderating feedback session for instructor (" + instructorUnderModeration.email + ")<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId;
data.bundle.hideUnmoderatableQuestions();
data.init(courseId);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, data);
}
use of teammates.ui.pagedata.FeedbackSubmissionEditPageData in project teammates by TEAMMATES.
the class InstructorFeedbackPreviewAsInstructorAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
String previewInstructorEmail = getRequestParamValue(Const.ParamsNames.PREVIEWAS);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
Assumption.assertPostParamNotNull(Const.ParamsNames.PREVIEWAS, previewInstructorEmail);
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION);
InstructorAttributes previewInstructor = logic.getInstructorForEmail(courseId, previewInstructorEmail);
if (previewInstructor == null) {
throw new EntityDoesNotExistException("Instructor Email " + previewInstructorEmail + " does not exist in " + courseId + ".");
}
FeedbackSubmissionEditPageData data = new FeedbackSubmissionEditPageData(account, student, sessionToken);
data.bundle = logic.getFeedbackSessionQuestionsBundleForInstructor(feedbackSessionName, courseId, previewInstructor.email);
data.setSessionOpenForSubmission(true);
data.setPreview(true);
data.setHeaderHidden(true);
data.setPreviewInstructor(previewInstructor);
data.setSubmitAction(Const.ActionURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT_SAVE);
data.bundle.resetAllResponses();
statusToAdmin = "Preview feedback session as instructor (" + previewInstructor.email + ")<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId;
data.init("", "", courseId);
return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_SUBMISSION_EDIT, data);
}
use of teammates.ui.pagedata.FeedbackSubmissionEditPageData in project teammates by TEAMMATES.
the class FeedbackSubmissionEditPageDataTest method testAll.
@Test
public void testAll() {
______TS("test typical case");
AccountAttributes studentAccount = dataBundle.accounts.get("student1InCourse1");
StudentAttributes student = dataBundle.students.get("student1InCourse1");
pageData = new FeedbackSubmissionEditPageData(studentAccount, student, dummySessionToken);
createData(student);
pageData.init(student.key, student.email, student.course);
assertEquals("You are submitting feedback as <span class='text-danger text-bold text-large'>" + "student1 In Course1</td></div>'\"</span>. " + "You may submit feedback for sessions that are currently open " + "and view results without logging in. " + "To access other features you need <a href='/page/studentCourseJoinAuthentication?" + "studentemail=student1InCourse1%40gmail.tmt&courseid=idOfTypicalCourse1' class='link'>" + "to login using a Google account</a> (recommended).", pageData.getRegisterMessage());
assertNull(pageData.getSubmitAction());
assertFalse(pageData.isModeration());
assertFalse(pageData.isSessionOpenForSubmission());
assertFalse(pageData.isSubmittable());
testQuestionAttributes();
______TS("student in unregistered course");
student = dataBundle.students.get("student1InUnregisteredCourse");
pageData = new FeedbackSubmissionEditPageData(studentAccount, student, dummySessionToken);
createData(student);
pageData.init(student.key, student.email, student.course);
assertEquals("You are submitting feedback as <span class='text-danger text-bold text-large'>student1 " + "In unregisteredCourse</span>. You may submit feedback for sessions that are currently open " + "and view results without logging in. " + "To access other features you need <a href='/page/studentCourseJoinAuthentication?" + "key=regKeyForStuNotYetJoinCourse&studentemail=student1InUnregisteredCourse%40gmail.tmt&" + "courseid=idOfUnregisteredCourse' class='link'>to login using a Google account</a> " + "(recommended).", pageData.getRegisterMessage());
assertNull(pageData.getSubmitAction());
assertFalse(pageData.isModeration());
assertFalse(pageData.isSessionOpenForSubmission());
assertFalse(pageData.isSubmittable());
testQuestionAttributes();
______TS("student in archived course");
student = dataBundle.students.get("student1InArchivedCourse");
pageData = new FeedbackSubmissionEditPageData(studentAccount, student, dummySessionToken);
createData(student);
pageData.init(student.key, student.email, student.course);
assertEquals("You are submitting feedback as <span class='text-danger text-bold text-large'>student1 In Course1" + "</span>. You may submit feedback for sessions that are currently open " + "and view results without logging in. To access other features " + "you need <a href='/page/studentCourseJoinAuthentication?studentemail=student1InArchivedCourse%40" + "gmail.tmt&courseid=idOfArchivedCourse' class='link'>to login using a Google account</a> " + "(recommended).", pageData.getRegisterMessage());
assertNull(pageData.getSubmitAction());
assertFalse(pageData.isModeration());
assertFalse(pageData.isSessionOpenForSubmission());
assertFalse(pageData.isSubmittable());
testQuestionAttributes();
______TS("student submission open");
student = dataBundle.students.get("student1InCourse1");
pageData = new FeedbackSubmissionEditPageData(studentAccount, student, dummySessionToken);
createData(student);
pageData.setSessionOpenForSubmission(true);
pageData.init(student.key, student.email, student.course);
assertEquals("You are submitting feedback as <span class='text-danger text-bold text-large'>" + "student1 In Course1</td></div>'\"</span>. " + "You may submit feedback for sessions that are currently open " + "and view results without logging in. " + "To access other features you need <a href='/page/studentCourseJoinAuthentication?" + "studentemail=student1InCourse1%40gmail.tmt&courseid=idOfTypicalCourse1' class='link'>" + "to login using a Google account</a> (recommended).", pageData.getRegisterMessage());
assertNull(pageData.getSubmitAction());
assertFalse(pageData.isModeration());
assertTrue(pageData.isSessionOpenForSubmission());
assertTrue(pageData.isSubmittable());
______TS("instructor moderating a response - closed for submission");
AccountAttributes instructorAccount = dataBundle.accounts.get("instructor1OfCourse1");
InstructorAttributes instructor = dataBundle.instructors.get("instructor1OfCourse1");
student = dataBundle.students.get("student1InCourse1");
pageData = new FeedbackSubmissionEditPageData(instructorAccount, student, dummySessionToken);
createData(student);
pageData.setModeration(true);
pageData.init("", student.email, student.course);
assertNull(pageData.getSubmitAction());
assertTrue(pageData.isModeration());
assertFalse(pageData.isSessionOpenForSubmission());
assertTrue(pageData.isSubmittable());
testQuestionAttributes();
______TS("instructor moderating a response - open for submission");
student = dataBundle.students.get("student1InCourse1");
pageData = new FeedbackSubmissionEditPageData(instructorAccount, student, dummySessionToken);
createData(student);
pageData.setModeration(true);
pageData.setSessionOpenForSubmission(true);
pageData.init("", student.email, student.course);
assertNull(pageData.getSubmitAction());
assertTrue(pageData.isModeration());
assertTrue(pageData.isSessionOpenForSubmission());
assertTrue(pageData.isSubmittable());
testQuestionAttributes();
______TS("instructor previewing a response");
pageData = new FeedbackSubmissionEditPageData(instructorAccount, student, dummySessionToken);
createData(student);
pageData.setPreview(true);
pageData.setPreviewInstructor(instructor);
pageData.init("", student.email, student.course);
assertNull(pageData.getSubmitAction());
assertFalse(pageData.isModeration());
assertFalse(pageData.isSessionOpenForSubmission());
assertFalse(pageData.isSubmittable());
testQuestionAttributes();
}
use of teammates.ui.pagedata.FeedbackSubmissionEditPageData in project teammates by TEAMMATES.
the class InstructorEditStudentFeedbackPageAction method execute.
@Override
protected ActionResult execute() throws EntityDoesNotExistException {
String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
String moderatedEntityIdentifier = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON);
StudentAttributes studentUnderModeration = logic.getStudentForEmail(courseId, moderatedEntityIdentifier);
if (studentUnderModeration == null) {
List<TeamDetailsBundle> teams = logic.getTeamsForCourse(courseId);
boolean isTeam = false;
for (TeamDetailsBundle team : teams) {
if (team.name.equals(moderatedEntityIdentifier)) {
isTeam = true;
studentUnderModeration = team.students.get(0);
break;
}
}
if (!isTeam) {
throw new EntityDoesNotExistException("An entity with the identifier " + moderatedEntityIdentifier + " does not exist in " + courseId + ".");
}
}
String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
gateKeeper.verifyAccessible(logic.getInstructorForGoogleId(courseId, account.googleId), logic.getFeedbackSession(feedbackSessionName, courseId), false, studentUnderModeration.section, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_SESSION_COMMENT_IN_SECTIONS);
String moderatedQuestionId = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_QUESTION_ID);
Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_MODERATED_PERSON, moderatedEntityIdentifier);
FeedbackSubmissionEditPageData data = new FeedbackSubmissionEditPageData(account, student, sessionToken);
data.bundle = logic.getFeedbackSessionQuestionsBundleForStudent(feedbackSessionName, courseId, studentUnderModeration.email);
Assumption.assertNotNull(data.bundle);
data.setSessionOpenForSubmission(true);
data.setModeration(true);
data.setHeaderHidden(true);
data.setStudentToViewPageAs(studentUnderModeration);
data.setSubmitAction(Const.ActionURIs.INSTRUCTOR_EDIT_STUDENT_FEEDBACK_SAVE);
if (moderatedQuestionId != null) {
data.setModeratedQuestionId(moderatedQuestionId);
}
statusToAdmin = "Moderating feedback session for student (" + studentUnderModeration.email + ")<br>" + "Session Name: " + feedbackSessionName + "<br>" + "Course ID: " + courseId;
data.bundle.hideUnmoderatableQuestions();
data.init(courseId);
return createShowPageResult(Const.ViewURIs.STUDENT_FEEDBACK_SUBMISSION_EDIT, data);
}
Aggregations