Search in sources :

Example 6 with CourseConfigEvent

use of org.olat.course.config.CourseConfigEvent in project openolat by klemens.

the class CourseLayoutGeneratorController method formOK.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#formOK(org.olat.core.gui.UserRequest)
 */
@Override
protected void formOK(UserRequest ureq) {
    OLATResource courseRes = courseEntry.getOlatResource();
    if (CourseFactory.isCourseEditSessionOpen(courseRes.getResourceableId())) {
        showWarning("error.editoralreadylocked", new String[] { "???" });
        return;
    }
    String selection = styleSel.getSelectedKey();
    ICourse course = CourseFactory.openCourseEditSession(courseRes.getResourceableId());
    courseEnvironment = course.getCourseEnvironment();
    courseConfig = courseEnvironment.getCourseConfig();
    courseConfig.setCssLayoutRef(selection);
    if (CourseLayoutHelper.CONFIG_KEY_CUSTOM.equals(selection)) {
        Map<String, Map<String, Object>> customConfig = compileCustomConfigFromGuiWrapper();
        customCMgr.saveCustomConfigAndCompileCSS(customConfig, courseEnvironment);
        persistedCustomConfig = customConfig;
        if (!elWithErrorExists)
            prepareStyleEditor(customConfig);
    }
    CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
    CourseFactory.closeCourseEditSession(course.getResourceableId(), true);
    CoordinatorManager.getInstance().getCoordinator().getEventBus().fireEventToListenersOf(new CourseConfigEvent(CourseConfigType.layout, course.getResourceableId()), course);
    // inform course-settings-dialog about changes:
    fireEvent(ureq, Event.CHANGED_EVENT);
}
Also used : CourseConfigEvent(org.olat.course.config.CourseConfigEvent) OLATResource(org.olat.resource.OLATResource) ICourse(org.olat.course.ICourse) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

ICourse (org.olat.course.ICourse)6 CourseConfigEvent (org.olat.course.config.CourseConfigEvent)6 OLATResourceable (org.olat.core.id.OLATResourceable)4 ILoggingAction (org.olat.core.logging.activity.ILoggingAction)4 RepositoryEntry (org.olat.repository.RepositoryEntry)4 HashMap (java.util.HashMap)2 LinkedHashMap (java.util.LinkedHashMap)2 Map (java.util.Map)2 CalendarManager (org.olat.commons.calendar.CalendarManager)2 CalendarGUIModifiedEvent (org.olat.commons.calendar.ui.events.CalendarGUIModifiedEvent)2 Identity (org.olat.core.id.Identity)2 EventBus (org.olat.core.util.event.EventBus)2 RecertificationTimeUnit (org.olat.course.certificate.RecertificationTimeUnit)2 OLATResource (org.olat.resource.OLATResource)2 Reference (org.olat.resource.references.Reference)2 LoggingResourceable (org.olat.util.logging.activity.LoggingResourceable)2