use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method doCertificatesOptions.
private void doCertificatesOptions(UserRequest ureq) {
if (delayedClose == Delayed.certificates || requestForClose(ureq)) {
if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) {
removeCustomCSS();
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone();
WindowControl bwControl = getSubWindowControl("CertificationSettings");
CertificatesOptionsController ctrl = new CertificatesOptionsController(ureq, addToHistory(ureq, bwControl), getRepositoryEntry(), courseConfig, true);
certificatesOptionsCtrl = pushController(ureq, translate("command.options"), ctrl);
setActiveTool(certificatesOptionsLink);
currentToolCtr = certificatesOptionsCtrl;
}
} else {
delayedClose = Delayed.certificates;
}
}
use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class CourseRuntimeController method initGeneralTools.
private void initGeneralTools(ICourse course) {
boolean assessmentLock = isAssessmentLock();
CourseConfig cc = course.getCourseConfig();
if (!assessmentLock && showInfos) {
detailsLink = LinkFactory.createToolLink("courseconfig", translate("command.courseconfig"), this, "o_icon_details");
toolbarPanel.addTool(detailsLink);
}
boolean calendarIsEnabled = !assessmentLock && !isGuestOnly && calendarModule.isEnabled() && calendarModule.isEnableCourseToolCalendar() && reSecurity.canLaunch();
if (calendarIsEnabled && getUserCourseEnvironment() != null) {
calendarLink = LinkFactory.createToolLink("calendar", translate("command.calendar"), this, "o_icon_calendar");
calendarLink.setPopup(new LinkPopupSettings(950, 750, "cal"));
calendarLink.setVisible(cc.isCalendarEnabled());
toolbarPanel.addTool(calendarLink);
}
if (!assessmentLock) {
glossary = new Dropdown("glossary", "command.glossary", false, getTranslator());
glossary.setIconCSS("o_icon o_FileResource-GLOSSARY_icon");
glossary.setVisible(cc.hasGlossary());
openGlossaryLink = LinkFactory.createToolLink("command.glossary.open", translate("command.glossary.open"), this);
openGlossaryLink.setPopup(new LinkPopupSettings(950, 750, "gloss"));
glossary.addComponent(openGlossaryLink);
enableGlossaryLink = LinkFactory.createToolLink("command.glossary.on.off", translate("command.glossary.on.alt"), this);
glossary.addComponent(enableGlossaryLink);
toolbarPanel.addTool(glossary);
}
if (!assessmentLock && isLecturesLinkEnabled()) {
lecturesLink = LinkFactory.createToolLink("command.lectures", translate("command.lectures"), this, "o_icon_lecture");
toolbarPanel.addTool(lecturesLink);
}
// add group chat to toolbox
boolean chatIsEnabled = !assessmentLock && !isGuestOnly && imModule.isEnabled() && imModule.isCourseEnabled() && reSecurity.canLaunch();
if (chatIsEnabled && getUserCourseEnvironment() != null && !getUserCourseEnvironment().isCourseReadOnly()) {
chatLink = LinkFactory.createToolLink("chat", translate("command.coursechat"), this, "o_icon_chat");
chatLink.setVisible(imModule.isCourseEnabled() && cc.isChatEnabled());
toolbarPanel.addTool(chatLink);
}
// add course search to toolbox
boolean isSearchEnabled = !assessmentLock && searchModule.isSearchAllowed(roles);
if (isSearchEnabled) {
searchLink = LinkFactory.createToolLink("coursesearch", translate("command.coursesearch"), this, "o_icon_search");
searchLink.setVisible(cc.isCourseSearchEnabled());
toolbarPanel.addTool(searchLink);
}
}
use of org.olat.course.config.CourseConfig in project openolat by klemens.
the class CourseHandler method importSharedFolder.
private void importSharedFolder(ICourse course, Identity owner) {
SharedFolderManager sfm = SharedFolderManager.getInstance();
RepositoryEntryImportExport importExport = sfm.getRepositoryImportExport(course.getCourseExportDataDir().getBasefile());
SharedFolderFileResource resource = sfm.createSharedFolder();
if (resource == null) {
log.error("Error adding file resource during repository reference import: " + importExport.getDisplayName());
}
// unzip contents
VFSContainer sfContainer = sfm.getSharedFolder(resource);
File fExportedFile = importExport.importGetExportedFile();
if (fExportedFile.exists()) {
ZipUtil.unzip(new LocalFileImpl(fExportedFile), sfContainer);
} else {
log.warn("The actual contents of the shared folder were not found in the export.");
}
// create repository entry
RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
OLATResource ores = OLATResourceManager.getInstance().findOrPersistResourceable(resource);
RepositoryEntry importedRepositoryEntry = repositoryService.create(owner, null, importExport.getResourceName(), importExport.getDisplayName(), importExport.getDescription(), ores, 0);
// set the new shared folder reference
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setSharedFolderSoftkey(importedRepositoryEntry.getSoftkey());
CoreSpringFactory.getImpl(ReferenceManager.class).addReference(importedRepositoryEntry.getOlatResource(), course, SharedFolderManager.SHAREDFOLDERREF);
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
}
use of org.olat.course.config.CourseConfig in project openolat by klemens.
the class CoursesWebService method prepareCourse.
private static ICourse prepareCourse(RepositoryEntry addedEntry, String shortTitle, String longTitle, CourseConfigVO courseConfigVO) {
// set root node title
String courseShortTitle = addedEntry.getDisplayname();
if (StringHelper.containsNonWhitespace(shortTitle)) {
courseShortTitle = shortTitle;
}
String courseLongTitle = addedEntry.getDisplayname();
if (StringHelper.containsNonWhitespace(longTitle)) {
courseLongTitle = longTitle;
}
ICourse course = CourseFactory.openCourseEditSession(addedEntry.getOlatResource().getResourceableId());
course.getRunStructure().getRootNode().setShortTitle(Formatter.truncate(courseShortTitle, 25));
course.getRunStructure().getRootNode().setLongTitle(courseLongTitle);
CourseNode rootNode = ((CourseEditorTreeNode) course.getEditorTreeModel().getRootNode()).getCourseNode();
rootNode.setShortTitle(Formatter.truncate(courseShortTitle, 25));
rootNode.setLongTitle(courseLongTitle);
if (courseConfigVO != null) {
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
if (StringHelper.containsNonWhitespace(courseConfigVO.getSharedFolderSoftKey())) {
courseConfig.setSharedFolderSoftkey(courseConfigVO.getSharedFolderSoftKey());
}
if (courseConfigVO.getCalendar() != null) {
courseConfig.setCalendarEnabled(courseConfigVO.getCalendar().booleanValue());
}
if (courseConfigVO.getChat() != null) {
courseConfig.setChatIsEnabled(courseConfigVO.getChat().booleanValue());
}
if (courseConfigVO.getEfficencyStatement() != null) {
courseConfig.setEfficencyStatementIsEnabled(courseConfigVO.getEfficencyStatement().booleanValue());
}
if (StringHelper.containsNonWhitespace(courseConfigVO.getCssLayoutRef())) {
courseConfig.setCssLayoutRef(courseConfigVO.getCssLayoutRef());
}
if (StringHelper.containsNonWhitespace(courseConfigVO.getGlossarySoftkey())) {
courseConfig.setGlossarySoftKey(courseConfigVO.getGlossarySoftkey());
}
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
}
CourseFactory.saveCourse(course.getResourceableId());
CourseFactory.closeCourseEditSession(course.getResourceableId(), true);
return CourseFactory.loadCourse(addedEntry);
}
use of org.olat.course.config.CourseConfig in project openolat by klemens.
the class ObjectFactory method getConfig.
public static CourseConfigVO getConfig(ICourse course) {
CourseConfigVO vo = new CourseConfigVO();
CourseConfig config = course.getCourseEnvironment().getCourseConfig();
vo.setCalendar(new Boolean(config.isCalendarEnabled()));
vo.setChat(new Boolean(config.isChatEnabled()));
vo.setCssLayoutRef(config.getCssLayoutRef());
vo.setEfficencyStatement(new Boolean(config.isEfficencyStatementEnabled()));
vo.setGlossarySoftkey(config.getGlossarySoftKey());
vo.setSharedFolderSoftKey(config.getSharedFolderSoftkey());
return vo;
}
Aggregations