Search in sources :

Example 96 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class DefaultController method dispatchEvent.

/**
 * @see org.olat.core.gui.control.ControllerEventListener#dispatchEvent(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
public void dispatchEvent(final UserRequest ureq, final Controller source, final Event event) {
    if (!disposed) {
        getUserActivityLogger().frameworkSetBusinessPathFromWindowControl(getWindowControl());
        ThreadLocalUserActivityLoggerInstaller.runWithUserActivityLogger(new Runnable() {

            public void run() {
                event(ureq, source, event);
            }
        }, getUserActivityLogger());
    } else {
        // show message
        if (disposedMessageController != null && wrapperPanel != null) {
            wrapperPanel.setContent(disposedMessageController.getInitialComponent());
        } else if (wrapperPanel != null) {
            if (locale == null) {
                locale = ureq.getLocale();
            }
            // place disposed message
            Translator pT = Util.createPackageTranslator(DefaultController.class, locale);
            Component dispMsgVC = new VelocityContainer(DEFAULTDISPOSED_PAGE, DefaultController.class, DEFAULTDISPOSED_PAGE, pT, null);
            wrapperPanel.pushContent(dispMsgVC);
        }
    }
}
Also used : Translator(org.olat.core.gui.translator.Translator) Component(org.olat.core.gui.components.Component) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 97 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

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 98 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class EdubasePeekViewController method createPeekviewComponent.

private Component createPeekviewComponent(ModuleConfiguration modulConfiguration) {
    VelocityContainer container = createVelocityContainer(PEEKVIEW_CONTAINER);
    ;
    // BookSections
    List<BookSection> bookSections = modulConfiguration.getList(EdubaseCourseNode.CONFIG_BOOK_SECTIONS, BookSection.class).stream().sorted(new PositionComparator()).limit(NUMBER_BOOK_SECTION_DESC_DISABLED).collect(Collectors.toList());
    container.contextPut("bookSections", bookSections);
    // Add a link to show all BookSections (go to node)
    Link allItemsLink = LinkFactory.createLink("peekview.allItemsLink", container, this);
    allItemsLink.setIconRightCSS("o_icon o_icon_start");
    allItemsLink.setCustomEnabledLinkCSS("pull-right");
    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 99 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class PortfolioCourseNodeRunController method initForm.

@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
    infosContainer = FormLayoutContainer.createDefaultFormLayout("infos", getTranslator());
    formLayout.add(infosContainer);
    String assessmentPage = velocity_root + "/assessment_infos.html";
    assessmentInfosContainer = FormLayoutContainer.createCustomFormLayout("assessmentInfos", getTranslator(), assessmentPage);
    assessmentInfosContainer.setVisible(false);
    formLayout.add(assessmentInfosContainer);
    VelocityContainer mainVC = ((FormLayoutContainer) formLayout).getFormItemComponent();
    if (courseNode.getModuleConfiguration().getBooleanSafe(MSCourseNode.CONFIG_KEY_HAS_SCORE_FIELD, false)) {
        HighScoreRunController highScoreCtr = new HighScoreRunController(ureq, getWindowControl(), userCourseEnv, courseNode, this.mainForm);
        if (highScoreCtr.isViewHighscore()) {
            Component highScoreComponent = highScoreCtr.getInitialComponent();
            mainVC.put("highScore", highScoreComponent);
        }
    }
    Object text = config.get(PortfolioCourseNodeConfiguration.NODE_TEXT);
    String explanation = (text instanceof String) ? (String) text : "";
    if (StringHelper.containsNonWhitespace(explanation)) {
        uifactory.addStaticTextElement("explanation.text", explanation, infosContainer);
    }
    String deadlineconfig = (String) config.get(PortfolioCourseNodeConfiguration.DEADLINE_TYPE);
    if (!DeadlineType.none.name().equals(deadlineconfig) && deadlineconfig != null) {
        // show deadline-config
        String deadLineLabel = "map.deadline." + deadlineconfig + ".label";
        String deadLineInfo = "";
        if (deadlineconfig.equals(DeadlineType.absolut.name())) {
            Formatter f = Formatter.getInstance(getLocale());
            deadLineInfo = f.formatDate((Date) config.get(PortfolioCourseNodeConfiguration.DEADLINE_DATE));
        } else {
            deadLineInfo = getDeadlineRelativeInfo();
        }
        deadlineDateText = uifactory.addStaticTextElement("deadline", deadLineLabel, deadLineInfo, infosContainer);
    }
    if (templateMap != null || templateBinder != null) {
        updateUI(ureq);
    }
}
Also used : Formatter(org.olat.core.util.Formatter) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer) HighScoreRunController(org.olat.course.highscore.ui.HighScoreRunController) Component(org.olat.core.gui.components.Component) Date(java.util.Date) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 100 with VelocityContainer

use of org.olat.core.gui.components.velocity.VelocityContainer in project OpenOLAT by OpenOLAT.

the class BusinessGroupMainRunController method getOnWaitingListMessage.

private Component getOnWaitingListMessage(UserRequest ureq, BusinessGroup group) {
    VelocityContainer vc = createVelocityContainer("waiting");
    vc.contextPut("name", group.getName());
    columnLayoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, vc, "grouprun");
    // cleanup on dispose
    listenTo(columnLayoutCtr);
    return columnLayoutCtr.getInitialComponent();
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

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