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 static RawLinkable getLinker(Contribution contribution) { return getLinker(contribution.getId()); }