boolean teacher = mUser.getObject().getRole().equals(Role.TEACHER);
ISIXmlSection currentPage = (ISIXmlSection) mSection.getObject(); // FIXME: XmlSectionModel should be genericized to fix this and similar hacks
ISIXmlSection currentSection = currentPage.getSectionAncestor(); // May be itself
add(new PageLinkPanel("pageLinkPanel", new XmlSectionModel(currentSection), mSection));
// Previous & Next Links
int currentPageNum = ISIApplication.get().getStudentContent().getLabelIndex(ISIXmlSection.SectionType.PAGE, currentPage);
add(new PageNumberLink("previousPage", currentPageNum-1));
add(new PageNumberLink("nextPage", currentPageNum+1));
add(new Label("sectionTitle", currentSection.getTitle()));
// If this is a student then add the checkbox for a student. If this is a teacher then add the checkbox for the teacher
if (!teacher) {
// Section Complete Toggle Icon
SectionCompleteToggleLink toggle = new StudentSectionCompleteToggleImageLink("sectionCompleteToggle", new XmlSectionModel(currentSection)) {
private static final long serialVersionUID = 1L;
};
add(toggle);
} else {
// teacher is finished reviewing this section
TeacherSectionCompleteToggleImageLink toggle = new TeacherSectionCompleteToggleImageLink("sectionCompleteToggle", new XmlSectionModel(currentSection)) {
private static final long serialVersionUID = 1L;
};
// Teacher can only mark as reviewed if the student has marked this as completed
// and there are no outstanding messages from the student.
toggle.setEnabled(sectionService.sectionReviewable(mTargetUser.getObject(), currentSection));