use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class EdubaseRunController method createOverviewComponent.
private Component createOverviewComponent(ModuleConfiguration modulConfiguration) {
VelocityContainer container;
if (modulConfiguration.getBooleanSafe(EdubaseCourseNode.CONFIG_DESCRIPTION_ENABLED)) {
container = createVelocityContainer(OVERVIEW_DESCRIPTION_ENABLED);
} else {
container = createVelocityContainer(OVERVIEW_DESCRIPTION_DISABLED);
}
bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).collect(Collectors.toList());
container.contextPut("bookSections", bookSections);
for (BookSection bookSection : bookSections) {
Link nodeLink = LinkFactory.createLink("startReader_" + bookSection.getPosition(), container, this);
nodeLink.setCustomDisplayText(getTranslator().translate("open.document"));
nodeLink.setIconRightCSS("o_icon o_icon_start");
nodeLink.setUserObject(bookSection);
}
EdubaseViewHelper edubaseViewHelper = new EdubaseViewHelper(getTranslator());
container.contextPut("helper", edubaseViewHelper);
container.contextPut("run", EVENT_RUN);
return container;
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class Card2BrainRunController method runCard2Brain.
private void runCard2Brain(UserRequest ureq) {
VelocityContainer container = createVelocityContainer("run");
String url = String.format(card2BrainModule.getBaseUrl(), config.getStringValue(Card2BrainCourseNode.CONFIG_FLASHCARD_ALIAS));
String oauth_consumer_key;
String oauth_secret;
if (config.getBooleanSafe(Card2BrainCourseNode.CONFIG_ENABLE_PRIVATE_LOGIN)) {
oauth_consumer_key = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_KEY);
oauth_secret = (String) config.get(Card2BrainCourseNode.CONFIG_PRIVATE_SECRET);
} else {
oauth_consumer_key = card2BrainModule.getEnterpriseKey();
oauth_secret = card2BrainModule.getEnterpriseSecret();
}
LTIContext context = new Card2BrainContext();
Map<String, String> unsignedProps = ltiManager.forgeLTIProperties(getIdentity(), getLocale(), context, true, true, false);
Mapper contentMapper = new PostDataMapper(unsignedProps, url, oauth_consumer_key, oauth_secret, false);
String mapperUri = registerMapper(ureq, contentMapper);
container.contextPut("mapperUri", mapperUri + "/");
JSAndCSSComponent js = new JSAndCSSComponent("js", new String[] { "js/iframeResizer/iframeResizer.min.js" }, null);
container.put("js", js);
main.setContent(container);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class CPContentController method displayNotFoundPage.
/**
* displays a info page in the "content-area" of the cpEditor
*
* see: ../_content/infoPage.html
*/
protected void displayNotFoundPage() {
currentPage.setFile(null);
VelocityContainer nfVC = createVelocityContainer("notFoundPage");
// Don't display the file name. It's too much information.
nfVC.contextPut("not_found_message", translate("contentcontroller.page.not.found"));
mainPanel.setContent(nfVC);
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class AssessmentTestDisplayController method doSuspend.
private void doSuspend(UserRequest ureq) {
VelocityContainer suspendedVC = createVelocityContainer("suspended");
mainPanel.setContent(suspendedVC);
suspendAssessmentTest(ureq.getRequestTimestamp());
fireEvent(ureq, new Event("suspend"));
}
use of org.olat.core.gui.components.velocity.VelocityContainer in project openolat by klemens.
the class QTI21ResultsExportMediaResource method createResultHTML.
private String createResultHTML(Component results) {
String pagePath = Util.getPackageVelocityRoot(this.getClass()) + "/qti21results.html";
URLBuilder ubu = new URLBuilder("auth", "1", "0");
// generate VelocityContainer and put Component
VelocityContainer mainVC = new VelocityContainer("html", pagePath, translator, null);
mainVC.contextPut("rootTitle", translator.translate("table.grading"));
mainVC.put("results", results);
// render VelocityContainer to StringOutPut
Renderer renderer = Renderer.getInstance(mainVC, translator, ubu, new RenderResult(), new EmptyGlobalSettings());
try (StringOutput sb = new StringOutput(32000);
VelocityRenderDecorator vrdec = new VelocityRenderDecorator(renderer, mainVC, sb)) {
mainVC.contextPut("r", vrdec);
renderer.render(sb, mainVC, null);
vrdec.close();
return sb.toString();
} catch (Exception e) {
log.error("", e);
return "";
}
}
Aggregations