Search in sources :

Example 51 with VelocityContainer

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;
}
Also used : PositionComparator(org.olat.modules.edubase.model.PositionComparator) BookSection(org.olat.modules.edubase.BookSection) Link(org.olat.core.gui.components.link.Link) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 52 with VelocityContainer

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);
}
Also used : Mapper(org.olat.core.dispatcher.mapper.Mapper) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) JSAndCSSComponent(org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent) LTIContext(org.olat.ims.lti.LTIContext) PostDataMapper(org.olat.ims.lti.ui.PostDataMapper) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 53 with VelocityContainer

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);
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 54 with VelocityContainer

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"));
}
Also used : FormEvent(org.olat.core.gui.components.form.flexible.impl.FormEvent) Event(org.olat.core.gui.control.Event) RetrieveAssessmentTestSessionEvent(org.olat.ims.qti21.ui.event.RetrieveAssessmentTestSessionEvent) CandidateEvent(org.olat.ims.qti21.model.audit.CandidateEvent) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 55 with VelocityContainer

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 "";
    }
}
Also used : Renderer(org.olat.core.gui.render.Renderer) RenderResult(org.olat.core.gui.render.RenderResult) StringOutput(org.olat.core.gui.render.StringOutput) IOException(java.io.IOException) URLBuilder(org.olat.core.gui.render.URLBuilder) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) VelocityRenderDecorator(org.olat.core.gui.render.velocity.VelocityRenderDecorator)

Aggregations

VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)162 Component (org.olat.core.gui.components.Component)22 ArrayList (java.util.ArrayList)16 DefaultFlexiColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.DefaultFlexiColumnModel)14 FlexiTableColumnModel (org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableColumnModel)14 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)14 Link (org.olat.core.gui.components.link.Link)12 Panel (org.olat.core.gui.components.panel.Panel)12 UserRequest (org.olat.core.gui.UserRequest)10 JSAndCSSComponent (org.olat.core.gui.components.htmlheader.jscss.JSAndCSSComponent)10 List (java.util.List)8 LayoutMain3ColsController (org.olat.core.commons.fullWebApp.LayoutMain3ColsController)8 WindowControl (org.olat.core.gui.control.WindowControl)8 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 Translator (org.olat.core.gui.translator.Translator)8 OLATResourceable (org.olat.core.id.OLATResourceable)8 HashMap (java.util.HashMap)6 Collectors (java.util.stream.Collectors)6 Mapper (org.olat.core.dispatcher.mapper.Mapper)6 BarSeries (org.olat.core.gui.components.chart.BarSeries)6