private void exposeUserTestDataToVC(UserRequest ureq) { // config : show score info Object enableScoreInfoObject = modConfig.get(IQEditController.CONFIG_KEY_ENABLESCOREINFO); if (enableScoreInfoObject != null) { myContent.contextPut("enableScoreInfo", enableScoreInfoObject); } else { myContent.contextPut("enableScoreInfo", Boolean.TRUE); } // configuration data myContent.contextPut("attemptsConfig", modConfig.get(IQEditController.CONFIG_KEY_ATTEMPTS)); // user data Identity identity = userCourseEnv.getIdentityEnvironment().getIdentity(); if (courseNode instanceof PersistentAssessableCourseNode) { PersistentAssessableCourseNode acn = (PersistentAssessableCourseNode) courseNode; AssessmentEntry assessmentEntry = acn.getUserAssessmentEntry(userCourseEnv); if (assessmentEntry == null) { myContent.contextPut("blockAfterSuccess", Boolean.FALSE); myContent.contextPut("score", null); myContent.contextPut("hasPassedValue", Boolean.FALSE); myContent.contextPut("passed", Boolean.FALSE); myContent.contextPut("comment", null); myContent.contextPut("attempts", 0); } else { // block if test passed (and config set to check it) Boolean blockAfterSuccess = modConfig.getBooleanEntry(IQEditController.CONFIG_KEY_BLOCK_AFTER_SUCCESS); Boolean blocked = Boolean.FALSE; if (blockAfterSuccess != null && blockAfterSuccess.booleanValue()) { Boolean passed = assessmentEntry.getPassed(); if (passed != null && passed.booleanValue()) { blocked = Boolean.TRUE; } } myContent.contextPut("blockAfterSuccess", blocked); myContent.contextPut("score", AssessmentHelper.getRoundedScore(assessmentEntry.getScore())); myContent.contextPut( "hasPassedValue", (assessmentEntry.getPassed() == null ? Boolean.FALSE : Boolean.TRUE)); myContent.contextPut("passed", assessmentEntry.getPassed()); StringBuilder comment = Formatter.stripTabsAndReturns(assessmentEntry.getComment()); myContent.contextPut("comment", StringHelper.xssScan(comment)); myContent.contextPut("attempts", assessmentEntry.getAttempts()); } } UserNodeAuditManager am = userCourseEnv.getCourseEnvironment().getAuditManager(); myContent.contextPut("log", am.getUserNodeLog(courseNode, identity)); exposeResults(ureq); }
private void init(UserRequest ureq) { String artFulltextContent = ePFMgr.getArtefactFullTextContent(artefact); if (!readOnlyMode) { // prepare an edit link String fulltext = FilterFactory.getHtmlTagAndDescapingFilter().filter(artFulltextContent); fulltext = StringHelper.xssScan(fulltext); fulltext = Formatter.truncate(fulltext, 50); editBtn = LinkFactory.createCustomLink( "text.edit.link", "edit", fulltext, Link.NONTRANSLATED, vC, this); editBtn.setIconRightCSS("o_icon o_icon_inline_editable"); } else { // register a mapper to deliver uploaded media files final VFSContainer artefactFolder = ePFMgr.getArtefactContainer(artefact); String mapperBase = registerMapper(ureq, new VFSContainerMapper(artefactFolder)); Filter urlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBase); String wrappedText = urlFilter.filter(artFulltextContent); vC.contextPut("text", wrappedText); } }