public ContributionCommentSuccessPage(PageParameters parameters) {
    super(parameters);

    contributionId = parameters.getInt("contribution");

    boolean success =
        HibernateUtils.wrapTransaction(
            getHibernateSession(),
            new HibernateTask() {
              public boolean run(Session session) {
                contribution =
                    (Contribution)
                        session
                            .createQuery("select c from Contribution as c where c.id = :id")
                            .setInteger("id", contributionId)
                            .uniqueResult();
                return true;
              }
            });

    if (!success) {
      logger.info("unknown contribution of id " + contributionId);
      throw new RestartResponseAtInterceptPageException(NotFoundPage.class);
    }

    initializeLocation(getNavMenu().getLocationByKey("teacherIdeas"));

    add(
        new LocalizedText(
            "comment-header",
            "contribution.comment.success",
            new Object[] {HtmlUtils.encode(contribution.getTitle())}));

    add(
        new LocalizedText(
            "comment-success",
            "contribution.comment.successRedirection",
            new Object[] {
              ContributionPage.getLinker(contributionId).getHref(getPageContext(), getPhetCycle()),
              REDIRECTION_DELAY_SECONDS
            }));

    Label redirector = new Label("redirector", "");
    redirector.add(
        new AttributeModifier(
            "content",
            true,
            new Model<String>(
                REDIRECTION_DELAY_SECONDS
                    + ";url="
                    + ContributionPage.getLinker(contributionId)
                        .getRawUrl(getPageContext(), getPhetCycle()))));
    add(redirector);

    setTitle(
        StringUtils.messageFormat(
            PhetLocalizer.get().getString("contribution.comment.success", this),
            new Object[] {HtmlUtils.encode(contribution.getTitle())}));
  }
  public ConfirmEmailSentPanel(String id, PageContext context, PhetUser user) {
    super(id, context);

    // if the user is changing their email
    if (user.getNewEmail() != null) {
      add(
          new LocalizedText(
              "toFinish",
              "newsletter.toFinishChangingEmail",
              new Object[] {HtmlUtils.encode(user.getNewEmail())}));
      add(new LocalizedText("pleaseCheck", "newsletter.pleaseCheckChangingEmail"));
    }

    // show them the "newsletter" option if they are newsletter-only, OR if they are already
    // registered and confirmed.
    else if (user.isNewsletterOnlyAccount() || user.isConfirmed()) {
      add(
          new LocalizedText(
              "toFinish",
              "newsletter.toFinishSubscribing",
              new Object[] {HtmlUtils.encode(user.getEmail())}));
      add(new LocalizedText("pleaseCheck", "newsletter.pleaseCheckSubscribing"));
    } else {
      add(
          new LocalizedText(
              "toFinish",
              "newsletter.toFinishRegistering",
              new Object[] {HtmlUtils.encode(user.getEmail())}));
      add(new LocalizedText("pleaseCheck", "newsletter.pleaseCheckRegistering"));
    }

    add(
        new LocalizedText(
            "trouble",
            "newsletter.troubleshooting",
            new Object[] {
              "<a href=\"mailto:"
                  + WebsiteConstants.HELP_EMAIL
                  + "\">"
                  + WebsiteConstants.HELP_EMAIL
                  + "</a>" // TODO: factor out somewhere
            }));
  }