Search in sources :

Example 6 with CustomCSS

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

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)

Example 7 with CustomCSS

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

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 8 with CustomCSS

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

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)

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