// Differs from superclass version in that it may omit the panel (if no student selected),
  // and will create a READ-ONLY tagging panel to view student's tags.
  protected void addTaggingPanel() {
    if (showXmlContent) {
      WebMarkupContainer tagBox = new WebMarkupContainer("tagBox");
      add(tagBox);
      Boolean toggleState =
          userPreferenceService.getUserPreferenceBoolean(
              ISISession.get().getUserModel(), "tagToggle");
      if (toggleState != null) {
        tagBox.add(new ClassAttributeModifier("open", !toggleState));
      }
      tagBox.setVisible(ISIApplication.get().isTagsOn());

      StateSavingCollapseBoxBehavior behavior =
          new StateSavingCollapseBoxBehavior("tagToggle", getPageName(), "tagToggle");
      tagBox.add(new WebMarkupContainer("tagBoxToggle").add(behavior));

      ContentElement ce = responseService.getOrCreateContentElement(loc).getObject();
      tagBox.add(
          new TagPanel(
              "tagPanel",
              ce,
              ISIApplication.get().getTagLinkBuilder(),
              ISISession.get().getStudentModel().getObject()));
    } else {
      add(
          new WebMarkupContainer("tagBox")
              .add(new WebMarkupContainer("tagBoxToggle"))
              .add(new WebMarkupContainer("tagPanel"))
              .setVisible(false));
    }
  }
 // Differs from superclass version in that it creates a READ-ONLY page notes area with no edit
 // buttons
 // view the student's notes
 protected void addNotesPanel() {
   setPageNotesMetadata();
   mNotesPrompt = responseService.getOrCreatePrompt(PromptType.PAGE_NOTES, loc);
   StateSavingCollapseBoxBorder noteBox =
       new StateSavingCollapseBoxBorder("noteBox", "noteToggle", null, getPageName());
   add(noteBox);
   noteBox.setVisible(showXmlContent);
   ResponseList responseList =
       new ResponseList("responseList", mNotesPrompt, pageNotesMetadata, loc, mTargetUser);
   responseList.setContext("pagenote.teacher");
   responseList.setAllowNotebook(false);
   responseList.setAllowEdit(false);
   responseList.setAllowWhiteboard(ISIApplication.get().isWhiteboardOn());
   noteBox.add(responseList);
   WebMarkupContainer responseButtons = new WebMarkupContainer("responseButtons");
   noteBox.add(responseButtons);
   responseButtons.setVisible(false);
   noteBox.setVisible(ISIApplication.get().isPageNotesOn());
 }
 public static SectionIconFactory getIconFactory(boolean teacher) {
   IModel<User> targetUserModel = ISISession.get().getTargetUserModel();
   if (teacher) {
     String type = ISIApplication.get().getNavbarSectionIconsTeacher();
     if (ICON_TYPE_STATUS.equals(type)) {
       return new TeacherStatusSectionIconFactory(targetUserModel);
     } else if (ICON_TYPE_CLASS.equals(type)) {
       return new ClassSectionIconFactory();
     } else {
       return new NullSectionIconFactory();
     }
   } else {
     String type = ISIApplication.get().getNavbarSectionIconsStudent();
     if (ICON_TYPE_STATUS.equals(type)) {
       return new StudentStatusSectionIconFactory(targetUserModel);
     } else if (ICON_TYPE_CLASS.equals(type)) {
       return new ClassSectionIconFactory();
     } else {
       return new NullSectionIconFactory();
     }
   }
 }
  @SuppressWarnings("static-access")
  @Override
  protected void addQuestionsPanel() {
    StateSavingCollapseBoxBorder questionBox =
        new StateSavingCollapseBoxBorder("questionBox", "questionToggle", null, getPageName());
    add(questionBox);
    questionBox.setVisible(ISIApplication.get().isMyQuestionsOn() && (showXmlContent));
    questionContainer = new WebMarkupContainer("questionContainer");
    questionContainer.setOutputMarkupId(true);
    questionBox.add(questionContainer);
    PopupSettings questionPopupSettings = ISIApplication.get().questionPopupSettings;
    questionList =
        new QuestionListView(
            "question",
            QuestionPopup.class,
            questionPopupSettings,
            null,
            (ISISession.get().getTargetUserModel().getObject().getId()));
    questionContainer.add(questionList);
    questionContainer.add(new WebMarkupContainer("qButtonVisible").setVisible(false));

    // teachers can't add new Qs
    add(new WebMarkupContainer("newQuestion").setVisible(false));
  }
  /**
   * Construct nav bar based on a certain page that is currently being displayed.
   *
   * @param id
   * @param mCurrentPage - model of the XmlSection that is the current page.
   * @param teacher if true, a version of the nav bar appropriate for the teacher is produced.
   */
  public DefaultNavBar(String id, IModel<XmlSection> mCurrentPage, boolean teacher) {
    super(id, mCurrentPage);
    setOutputMarkupId(true);
    iconFactory = SectionIconFactory.getIconFactory(teacher);

    if (mCurrentPage == null) {
      setModel(new XmlSectionModel(ISIApplication.get().getPageNum(1)));
    }

    ISIXmlSection rootSection = ISIXmlSection.getRootSection(getCurrentSection());

    // Current Section's Page Repeater with prev/next
    PageNavPanel pageNavPanelTop = new PageNavPanel("pageNavPanelTop", getModel());
    add(pageNavPanelTop);

    /** ******* Other * ******* */
    // Jump to a certain page
    add(new QuickFlipForm("quickFlipForm", true));

    // Chapter Title (xml level 1)
    add(new Label("title", rootSection.getTitle()));
  }
 @Override
 public Component getIconFor(ISIXmlSection section) {
   SectionStatus stat = sectionService.getSectionStatus(targetUserModel.getObject(), section);
   return ISIApplication.get().teacherStatusIconFor(section, stat);
 }
 @Override
 public Component getIconFor(ISIXmlSection section) {
   return ISIApplication.get().iconFor(section);
 }