repositoryEntryChanged = false;
}
}
if(courseConfigChanged && !initialCourseConfig.equals(changedCourseConfig) && DialogBoxUIFactory.isYesEvent(event)) {
//ICourse course = CourseFactory.loadCourse(repositoryEntry.getOlatResource());
ICourse course = CourseFactory.openCourseEditSession(repositoryEntry.getOlatResource().getResourceableId());
//change course config
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setCalendarEnabled(changedCourseConfig.isCalendarEnabled());
courseConfig.setChatIsEnabled(changedCourseConfig.isChatEnabled());
courseConfig.setCssLayoutRef(changedCourseConfig.getCssLayoutRef());
courseConfig.setEfficencyStatementIsEnabled(changedCourseConfig.isEfficencyStatementEnabled());
courseConfig.setGlossarySoftKey(changedCourseConfig.getGlossarySoftKey());
courseConfig.setSharedFolderSoftkey(changedCourseConfig.getSharedFolderSoftkey());
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
CourseFactory.closeCourseEditSession(course.getResourceableId(),true);
//CourseChatSettingController
if(ccc!=null) {
if(changedCourseConfig.isChatEnabled() != initialCourseConfig.isChatEnabled()) {
//log instant messaging enabled disabled settings
if (changedCourseConfig.isChatEnabled()) {
ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.REPOSITORY_ENTRY_PROPERTIES_IM_ENABLED, getClass());
} else {
ThreadLocalUserActivityLogger.log(LearningResourceLoggingAction.REPOSITORY_ENTRY_PROPERTIES_IM_DISABLED, getClass());
}
}
}
// CourseLayoutController
if(!changedCourseConfig.getCssLayoutRef().equals(initialCourseConfig.getCssLayoutRef()) && clayoutC.getLoggingAction()!=null) {
// log removing custom course layout
ThreadLocalUserActivityLogger.log(clayoutC.getLoggingAction(), getClass());
}
// CourseSharedFolderController
if(!changedCourseConfig.getSharedFolderSoftkey().equals(initialCourseConfig.getSharedFolderSoftkey()) && csfC.getLoggingAction()!=null) {
String logDetail = csfC.getSharedFolderRepositoryEntry()!=null ? csfC.getSharedFolderRepositoryEntry().getDisplayname() : null;
ThreadLocalUserActivityLogger.log(csfC.getLoggingAction(), getClass(), LoggingResourceable.wrapBCFile(logDetail));
if(!changedCourseConfig.getSharedFolderSoftkey().equals(CourseConfig.VALUE_EMPTY_SHAREDFOLDER_SOFTKEY)) {
CourseSharedFolderController.updateRefTo(csfC.getSharedFolderRepositoryEntry(), course);
} else {
CourseSharedFolderController.deleteRefTo(course);
}
}
// CourseEfficencyStatementController
if((changedCourseConfig.isEfficencyStatementEnabled() != initialCourseConfig.isEfficencyStatementEnabled() && ceffC.getLoggingAction()!=null)) {
if(changedCourseConfig.isEfficencyStatementEnabled()) {
// first create the efficiencies, send event to agency (all courses add link)
List identitiesWithData = course.getCourseEnvironment().getCoursePropertyManager().getAllIdentitiesWithCourseAssessmentData();
EfficiencyStatementManager.getInstance().updateEfficiencyStatements(course, identitiesWithData, false);
} else {
// delete really the efficiencies of the users.
RepositoryEntry courseRepoEntry = RepositoryManager.getInstance().lookupRepositoryEntry(course, true);
EfficiencyStatementManager.getInstance().deleteEfficiencyStatementsFromCourse(courseRepoEntry.getKey());
}
//inform everybody else
EventBus eventBus = CoordinatorManager.getCoordinator().getEventBus();
CourseConfigEvent courseConfigEvent = new CourseConfigEvent(CourseConfigEvent.EFFICIENCY_STATEMENT_TYPE, course.getResourceableId());
eventBus.fireEventToListenersOf(courseConfigEvent, course);
ThreadLocalUserActivityLogger.log(ceffC.getLoggingAction(), getClass());
}
// CourseCalendarConfigController
if(changedCourseConfig.isCalendarEnabled()!= initialCourseConfig.isCalendarEnabled() && calCfgCtr.getLoggingAction()!=null) {
ThreadLocalUserActivityLogger.log(calCfgCtr.getLoggingAction(), getClass());
// notify calendar components to refresh their calendars
CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new KalendarModifiedEvent(), OresHelper.lookupType(CalendarManager.class));
}
// CourseConfigGlossaryController
if((changedCourseConfig.getGlossarySoftKey()==null && initialCourseConfig.getGlossarySoftKey()!=null)
|| (changedCourseConfig.getGlossarySoftKey()!=null && initialCourseConfig.getGlossarySoftKey()==null)
&& cglosCtr.getLoggingAction()!=null) {
final String glossarySoftKey = changedCourseConfig.getGlossarySoftKey();
LoggingResourceable lri = null;
if (glossarySoftKey!=null) {
lri = LoggingResourceable.wrapNonOlatResource(StringResourceableType.glossarySoftKey, glossarySoftKey, glossarySoftKey);
}
ThreadLocalUserActivityLogger.log(cglosCtr.getLoggingAction(), getClass(), lri);
if(changedCourseConfig.getGlossarySoftKey()==null) {
// update references
ReferenceManager refM = ReferenceManager.getInstance();
List repoRefs = refM.getReferences(course);
for (Iterator iter = repoRefs.iterator(); iter.hasNext();) {
ReferenceImpl ref = (ReferenceImpl) iter.next();
if (ref.getUserdata().equals(GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER)) {
refM.delete(ref);
continue;
}
}
} else if(changedCourseConfig.getGlossarySoftKey()!=null) {
// update references
RepositoryManager rm = RepositoryManager.getInstance();
RepositoryEntry repoEntry = rm.lookupRepositoryEntryBySoftkey(changedCourseConfig.getGlossarySoftKey(), false);
ReferenceManager.getInstance().addReference(course, repoEntry.getOlatResource(), GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER);
}
}
//course config transaction fihished
initialCourseConfig = course.getCourseEnvironment().getCourseConfig().clone();
//fire CourseConfigEvent for this course channel
EventBus eventBus = CoordinatorManager.getCoordinator().getEventBus();
CourseConfigEvent courseConfigEvent = new CourseConfigEvent(CourseConfigEvent.CALENDAR_TYPE, course.getResourceableId());
eventBus.fireEventToListenersOf(courseConfigEvent, course);
this.fireEvent(ureq, Event.DONE_EVENT);
} else if(!DialogBoxUIFactory.isYesEvent(event) || DialogBoxUIFactory.isYesEvent(event)) {
this.fireEvent(ureq, Event.DONE_EVENT);