Search in sources :

Example 1 with CustomCSS

use of org.olat.core.gui.components.htmlheader.jscss.CustomCSS in project OpenOLAT by OpenOLAT.

the class BaseFullWebappController method removeCurrentCustomCSSFromView.

/**
 * Remove the current custom css from the view
 */
@Override
public void removeCurrentCustomCSSFromView() {
    Window myWindow = getWindowControl().getWindowBackOffice().getWindow();
    CustomCSS currentCustomCSS = myWindow.getCustomCSS();
    if (currentCustomCSS != null) {
        // remove css and js from view
        cssHolder.setContent(null);
        myWindow.setCustomCSS(null);
    }
}
Also used : Window(org.olat.core.gui.components.Window) CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS)

Example 2 with CustomCSS

use of org.olat.core.gui.components.htmlheader.jscss.CustomCSS in project openolat by klemens.

the class CourseLayoutHelper method getCustomCSS.

/**
 * get CustomCSS preconfigured according to choosen course theme
 * @param usess
 * @param courseEnvironment
 * @return
 */
public static CustomCSS getCustomCSS(UserSession usess, CourseEnvironment courseEnvironment) {
    VFSContainer courseContainer = getCSSBaseFolder(courseEnvironment);
    CustomCSS customCSS = null;
    // check for existing main.css and iframe.css
    if (isCourseThemeFolderValid(courseContainer)) {
        customCSS = new CustomCSS(courseContainer, MAIN_CSS, IFRAME_CSS, usess);
    } else if (courseContainer != null && courseContainer.resolve(courseEnvironment.getCourseConfig().getCssLayoutRef()) != null) {
        // legacy fallback
        customCSS = new CustomCSS(courseContainer, courseEnvironment.getCourseConfig().getCssLayoutRef(), usess);
    }
    return customCSS;
}
Also used : CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Example 3 with CustomCSS

use of org.olat.core.gui.components.htmlheader.jscss.CustomCSS in project openolat by klemens.

the class BaseFullWebappController method removeCurrentCustomCSSFromView.

/**
 * Remove the current custom css from the view
 */
@Override
public void removeCurrentCustomCSSFromView() {
    Window myWindow = getWindowControl().getWindowBackOffice().getWindow();
    CustomCSS currentCustomCSS = myWindow.getCustomCSS();
    if (currentCustomCSS != null) {
        // remove css and js from view
        cssHolder.setContent(null);
        myWindow.setCustomCSS(null);
    }
}
Also used : Window(org.olat.core.gui.components.Window) CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS)

Example 4 with CustomCSS

use of org.olat.core.gui.components.htmlheader.jscss.CustomCSS in project openolat by klemens.

the class ModifyCourseEvent method getCustomCourseCss.

/**
 * Create a custom css object for the course layout. This can then be set on a
 * MainLayoutController to activate the course layout
 *
 * @param usess The user session
 * @param courseEnvironment the course environment
 * @return The custom course css or NULL if no course css is available
 */
public static CustomCSS getCustomCourseCss(UserSession usess, CourseEnvironment courseEnvironment) {
    CustomCSS customCSS = null;
    CourseConfig courseConfig = courseEnvironment.getCourseConfig();
    if (courseConfig.hasCustomCourseCSS()) {
        // Notify the current tab that it should load a custom CSS
        return CourseLayoutHelper.getCustomCSS(usess, courseEnvironment);
    }
    return customCSS;
}
Also used : CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS) CourseConfig(org.olat.course.config.CourseConfig)

Example 5 with CustomCSS

use of org.olat.core.gui.components.htmlheader.jscss.CustomCSS in project openolat by klemens.

the class CourseRuntimeController method addCustomCSS.

private void addCustomCSS(UserRequest ureq) {
    ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
    CustomCSS customCSS = CourseFactory.getCustomCourseCss(ureq.getUserSession(), course.getCourseEnvironment());
    ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
    if (cc != null) {
        if (customCSS == null) {
            cc.removeCurrentCustomCSSFromView();
        } else {
            cc.addCurrentCustomCSSToView(customCSS);
        }
    }
    setCustomCSS(customCSS);
}
Also used : CustomCSS(org.olat.core.gui.components.htmlheader.jscss.CustomCSS) ICourse(org.olat.course.ICourse) ChiefController(org.olat.core.gui.control.ChiefController)

Aggregations

CustomCSS (org.olat.core.gui.components.htmlheader.jscss.CustomCSS)8 Window (org.olat.core.gui.components.Window)2 ChiefController (org.olat.core.gui.control.ChiefController)2 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 ICourse (org.olat.course.ICourse)2 CourseConfig (org.olat.course.config.CourseConfig)2