Search in sources :

Example 1 with InfoMessageManager

use of org.olat.admin.sysinfo.InfoMessageManager in project OpenOLAT by OpenOLAT.

the class AdminModuleDispatcher method handleSetMaintenanceOrInfoMessage.

/**
 * Handle setMaintenanceMessage command, extract parameter msg form request and call method on AdminModule.
 * @param request
 * @param response
 */
private void handleSetMaintenanceOrInfoMessage(HttpServletRequest request, HttpServletResponse response, String cmd) {
    AdminModule adminModule = CoreSpringFactory.getImpl(AdminModule.class);
    if (adminModule.checkMaintenanceMessageToken(request)) {
        String message = request.getParameter(PARAMETER_MSG);
        if (cmd.equalsIgnoreCase(CMD_SET_INFO_MESSAGE)) {
            InfoMessageManager mrg = (InfoMessageManager) CoreSpringFactory.getBean(InfoMessageManager.class);
            mrg.setInfoMessage(message);
            ServletUtil.serveStringResource(request, response, "Ok, new infoMessage is::" + message);
        } else if (cmd.equalsIgnoreCase(CMD_SET_MAINTENANCE_MESSAGE)) {
            adminModule.setMaintenanceMessage(message);
            ServletUtil.serveStringResource(request, response, "Ok, new maintenanceMessage is::" + message);
        }
    } else {
        DispatcherModule.sendForbidden(request.getPathInfo(), response);
    }
}
Also used : InfoMessageManager(org.olat.admin.sysinfo.InfoMessageManager)

Example 2 with InfoMessageManager

use of org.olat.admin.sysinfo.InfoMessageManager 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 3 with InfoMessageManager

use of org.olat.admin.sysinfo.InfoMessageManager in project OpenOLAT by OpenOLAT.

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 4 with InfoMessageManager

use of org.olat.admin.sysinfo.InfoMessageManager in project openolat by klemens.

the class AdminModuleDispatcher method handleSetMaintenanceOrInfoMessage.

/**
 * Handle setMaintenanceMessage command, extract parameter msg form request and call method on AdminModule.
 * @param request
 * @param response
 */
private void handleSetMaintenanceOrInfoMessage(HttpServletRequest request, HttpServletResponse response, String cmd) {
    AdminModule adminModule = CoreSpringFactory.getImpl(AdminModule.class);
    if (adminModule.checkMaintenanceMessageToken(request)) {
        String message = request.getParameter(PARAMETER_MSG);
        if (cmd.equalsIgnoreCase(CMD_SET_INFO_MESSAGE)) {
            InfoMessageManager mrg = (InfoMessageManager) CoreSpringFactory.getBean(InfoMessageManager.class);
            mrg.setInfoMessage(message);
            ServletUtil.serveStringResource(request, response, "Ok, new infoMessage is::" + message);
        } else if (cmd.equalsIgnoreCase(CMD_SET_MAINTENANCE_MESSAGE)) {
            adminModule.setMaintenanceMessage(message);
            ServletUtil.serveStringResource(request, response, "Ok, new maintenanceMessage is::" + message);
        }
    } else {
        DispatcherModule.sendForbidden(request.getPathInfo(), response);
    }
}
Also used : InfoMessageManager(org.olat.admin.sysinfo.InfoMessageManager)

Aggregations

InfoMessageManager (org.olat.admin.sysinfo.InfoMessageManager)4 ArrayList (java.util.ArrayList)2 BaseFullWebappController (org.olat.core.commons.fullWebApp.BaseFullWebappController)2 Component (org.olat.core.gui.components.Component)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 Controller (org.olat.core.gui.control.Controller)2 MainLayoutBasicController (org.olat.core.gui.control.controller.MainLayoutBasicController)2 AuthenticationProvider (org.olat.login.auth.AuthenticationProvider)2