Search in sources :

Example 76 with VelocityContainer

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

the class PrintUserTool method getMenuComponent.

@Override
public Component getMenuComponent(UserRequest ureq, VelocityContainer container) {
    String componentName = "print-" + CodeHelper.getRAMUniqueID();
    String velocity_root = Util.getPackageVelocityRoot(PrintUserTool.class);
    String pagePath = velocity_root + "/print.html";
    VelocityContainer print = new VelocityContainer(componentName, pagePath, container.getTranslator(), this);
    print.setDomReplacementWrapperRequired(false);
    container.put(componentName, print);
    return print;
}
Also used : VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 77 with VelocityContainer

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

the class GuiDemoPushPopController method event.

public void event(UserRequest ureq, Component source, Event event) {
    if (source == pushButton) {
        VelocityContainer container = this.createVelocityContainer("guidemo-pushpop");
        LayoutMain3ColsController layoutCtr = new LayoutMain3ColsController(ureq, getWindowControl(), null, container, null);
        listenTo(layoutCtr);
        windowStack.push(layoutCtr.getInitialComponent());
        container.put("guidemo.window.control.push", pushButton);
        container.put("guidemo.window.control.pop", popButton);
        container.contextPut("stack", getStackHTMLRepresentation());
        getWindowControl().pushToMainArea(container);
    } else if (source == popButton) {
        if (windowStack.isEmpty()) {
            fireEvent(ureq, Event.DONE_EVENT);
        } else {
            getWindowControl().pop();
            windowStack.pop();
        }
    }
}
Also used : LayoutMain3ColsController(org.olat.core.commons.fullWebApp.LayoutMain3ColsController) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 78 with VelocityContainer

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

the class LoginAuthprovidersController method initLoginContent.

private VelocityContainer initLoginContent(UserRequest ureq, String provider) {
    // in every case we build the container for pages to fill the panel
    VelocityContainer contentBorn = createVelocityContainer("main_loging", "login");
    // browser not supported messages
    // true if browserwarning should be showed
    boolean bwo = Settings.isBrowserAjaxBlacklisted(ureq);
    contentBorn.contextPut("browserWarningOn", bwo ? Boolean.TRUE : Boolean.FALSE);
    // prepare login
    if (provider == null) {
        provider = loginModule.getDefaultProviderName();
    }
    AuthenticationProvider authProvider = loginModule.getAuthenticationProvider(provider);
    if (authProvider == null) {
        authProvider = loginModule.getAuthenticationProviderHeuristic(provider);
    }
    // clean-up controllers
    if (authController != null) {
        removeAsListenerAndDispose(authController);
    }
    for (Controller controller : authControllers) {
        removeAsListenerAndDispose(controller);
    }
    authControllers.clear();
    // recreate controllers
    authController = authProvider.createController(ureq, getWindowControl());
    listenTo(authController);
    contentBorn.put("loginComp", authController.getInitialComponent());
    contentBorn.contextPut("currentProvider", authProvider.getName());
    Collection<AuthenticationProvider> providers = loginModule.getAuthenticationProviders();
    List<AuthenticationProvider> providerSet = new ArrayList<>(providers.size());
    int count = 0;
    for (AuthenticationProvider prov : providers) {
        if (prov.isEnabled()) {
            providerSet.add(prov);
            if (!prov.getName().equals(authProvider.getName())) {
                // hang these components to the component tree, for state-less behavior
                Controller controller = prov.createController(ureq, getWindowControl());
                authControllers.add(controller);
                Component cmp = controller.getInitialComponent();
                contentBorn.put("dormant_" + count++, cmp);
                listenTo(controller);
            }
        }
    }
    contentBorn.contextPut("providerSet", providerSet);
    contentBorn.contextPut("locale", ureq.getLocale());
    // prepare info message
    InfoMessageManager mrg = CoreSpringFactory.getImpl(InfoMessageManager.class);
    String infomsg = mrg.getInfoMessage();
    if (infomsg != null && infomsg.length() > 0) {
        contentBorn.contextPut("infomsg", infomsg);
    }
    String infomsgNode = mrg.getInfoMessageNodeOnly();
    if (infomsgNode != null && infomsgNode.length() > 0) {
        contentBorn.contextPut("infomsgNode", infomsgNode);
    }
    // add additional login intro message for custom content
    String customMsg = translate("login.custommsg");
    if (!StringUtils.isBlank(customMsg)) {
        contentBorn.contextPut("logincustommsg", customMsg);
    }
    // add additional login footer message for custom content
    String footerMsg = translate("login.customfootermsg");
    if (!StringUtils.isBlank(footerMsg)) {
        contentBorn.contextPut("loginfootermsg", footerMsg);
    }
    // login is blocked?
    if (AuthHelper.isLoginBlocked()) {
        contentBorn.contextPut("loginBlocked", Boolean.TRUE);
    }
    // guest link
    if (loginModule.isGuestLoginEnabled()) {
        anoLink = LinkFactory.createButton("menu.guest", contentBorn, this);
        anoLink.setIconLeftCSS("o_icon o_icon-2x o_icon_provider_guest");
        anoLink.setTitle("menu.guest.alt");
        anoLink.setEnabled(!AuthHelper.isLoginBlocked());
    }
    return contentBorn;
}
Also used : AuthenticationProvider(org.olat.login.auth.AuthenticationProvider) ArrayList(java.util.ArrayList) InfoMessageManager(org.olat.admin.sysinfo.InfoMessageManager) BaseFullWebappController(org.olat.core.commons.fullWebApp.BaseFullWebappController) Controller(org.olat.core.gui.control.Controller) MainLayoutBasicController(org.olat.core.gui.control.controller.MainLayoutBasicController) Component(org.olat.core.gui.components.Component) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer)

Example 79 with VelocityContainer

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

the class LoginAuthprovidersController method showAboutPage.

protected void showAboutPage() {
    VelocityContainer aboutVC = createVelocityContainer("about");
    // Add version info and licenses
    aboutVC.contextPut("version", Settings.getFullVersionInfo());
    // Add translator and languages info
    I18nManager i18nMgr = I18nManager.getInstance();
    Collection<String> enabledKeysSet = i18nModule.getEnabledLanguageKeys();
    Map<String, String> langNames = new HashMap<String, String>();
    Map<String, String> langTranslators = new HashMap<String, String>();
    String[] enabledKeys = ArrayHelper.toArray(enabledKeysSet);
    String[] names = new String[enabledKeys.length];
    for (int i = 0; i < enabledKeys.length; i++) {
        String key = enabledKeys[i];
        String langName = i18nMgr.getLanguageInEnglish(key, i18nModule.isOverlayEnabled());
        langNames.put(key, langName);
        names[i] = langName;
        String author = i18nMgr.getLanguageAuthor(key);
        langTranslators.put(key, author);
    }
    ArrayHelper.sort(enabledKeys, names, true, true, true);
    aboutVC.contextPut("enabledKeys", enabledKeys);
    aboutVC.contextPut("langNames", langNames);
    aboutVC.contextPut("langTranslators", langTranslators);
    dmzPanel.pushContent(aboutVC);
}
Also used : HashMap(java.util.HashMap) VelocityContainer(org.olat.core.gui.components.velocity.VelocityContainer) I18nManager(org.olat.core.util.i18n.I18nManager)

Example 80 with VelocityContainer

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

the class LoginAuthprovidersController method showAccessibilityPage.

protected void showAccessibilityPage() {
    VelocityContainer accessibilityVC = createVelocityContainer("accessibility");
    dmzPanel.pushContent(accessibilityVC);
}
Also used : 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