Skip to content
Snippets Groups Projects
Commit 63343a1a authored by srosse's avatar srosse
Browse files

OO-512: give a cloned course config the preview environnement

parent a213250d
No related branches found
No related tags found
No related merge requests found
......@@ -48,6 +48,7 @@ import org.olat.course.ICourse;
import org.olat.course.Structure;
import org.olat.course.assessment.AssessmentManager;
import org.olat.course.auditing.UserNodeAuditManager;
import org.olat.course.config.CourseConfig;
import org.olat.course.groupsandrights.CourseGroupManager;
import org.olat.course.properties.CoursePropertyManager;
import org.olat.course.run.environment.CourseEnvironment;
......@@ -180,9 +181,10 @@ public class PreviewConfigController extends MainLayoutBasicController {
final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
final String title = course.getCourseTitle();
final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
simCourseEnv = new PreviewCourseEnvironment(title, runStructure, psf.getDate(), course.getCourseFolderContainer(), course
.getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am);
.getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
simIdentEnv = new IdentityEnvironment();
simIdentEnv.setRoles(new Roles(false, false, false, isGlobalAuthor, isGuestOnly, false, false));
final Identity ident = new PreviewIdentity();
......
......@@ -31,6 +31,7 @@ import org.olat.course.ICourse;
import org.olat.course.Structure;
import org.olat.course.assessment.AssessmentManager;
import org.olat.course.auditing.UserNodeAuditManager;
import org.olat.course.config.CourseConfig;
import org.olat.course.groupsandrights.CourseGroupManager;
import org.olat.course.properties.CoursePropertyManager;
import org.olat.course.run.environment.CourseEnvironment;
......@@ -57,9 +58,10 @@ public class PreviewConfigHelper {
final CoursePropertyManager cpm = new PreviewCoursePropertyManager();
final Structure runStructure = course.getEditorTreeModel().createStructureForPreview();
final String title = course.getCourseTitle();
final CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
CourseEnvironment previewCourseEnvironment = new PreviewCourseEnvironment(title, runStructure, new Date(), course.getCourseFolderContainer(),
course.getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am);
course.getCourseBaseContainer(),course.getResourceableId(), cpm, cgm, auditman, am, courseConfig);
return previewCourseEnvironment;
}
......
......@@ -53,9 +53,11 @@ final class PreviewCourseEnvironment implements CourseEnvironment {
private final AssessmentManager am;
private final long simulatedDateTime;
private Long resourceablId;
private CourseConfig courseConfig;
PreviewCourseEnvironment(String title, Structure runStructure, Date simulatedDateTime, VFSContainer courseFolderContainer, OlatRootFolderImpl courseBaseContainer,
Long courseResourceableID, CoursePropertyManager cpm, CourseGroupManager cgm, UserNodeAuditManager auditman, AssessmentManager am) {
PreviewCourseEnvironment(String title, Structure runStructure, Date simulatedDateTime, VFSContainer courseFolderContainer,
OlatRootFolderImpl courseBaseContainer, Long courseResourceableID, CoursePropertyManager cpm, CourseGroupManager cgm,
UserNodeAuditManager auditman, AssessmentManager am, CourseConfig courseConfig) {
super();
this.title = title;
this.simulatedDateTime = simulatedDateTime.getTime();
......@@ -67,6 +69,7 @@ final class PreviewCourseEnvironment implements CourseEnvironment {
this.auditman = auditman;
this.am = am;
this.resourceablId = courseResourceableID;
this.courseConfig = courseConfig.clone();
}
/**
......@@ -135,14 +138,14 @@ final class PreviewCourseEnvironment implements CourseEnvironment {
}
public CourseConfig getCourseConfig() {
throw new UnsupportedOperationException("never to be called in preview mode");
return courseConfig;
}
/**
* @see org.olat.course.run.environment.CourseEnvironment#setCourseConfig()
*/
public void setCourseConfig(CourseConfig cc) {
throw new UnsupportedOperationException("never to be called in preview mode");
courseConfig = (cc == null ? null : cc.clone());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment