use of org.olat.course.config.CourseConfig in project openolat by klemens.
the class CourseRuntimeController method doLayout.
private void doLayout(UserRequest ureq) {
if (delayedClose == Delayed.layout || requestForClose(ureq)) {
if (reSecurity.isEntryAdmin() || hasCourseRight(CourseRights.RIGHT_COURSEEDITOR)) {
removeCustomCSS();
ICourse course = CourseFactory.loadCourse(getRepositoryEntry());
boolean managedLayout = RepositoryEntryManagedFlag.isManaged(getRepositoryEntry(), RepositoryEntryManagedFlag.layout);
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig().clone();
CourseLayoutGeneratorController ctrl = new CourseLayoutGeneratorController(ureq, getWindowControl(), getRepositoryEntry(), courseConfig, course.getCourseEnvironment(), !managedLayout);
listenTo(ctrl);
courseLayoutCtrl = pushController(ureq, translate("command.layout"), ctrl);
setActiveTool(layoutLink);
currentToolCtr = courseLayoutCtrl;
}
} else {
delayedClose = Delayed.layout;
}
}
use of org.olat.course.config.CourseConfig in project openolat by klemens.
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 klemens.
the class CourseRuntimeController method initToolsMyCourse.
private void initToolsMyCourse(ICourse course, UserCourseEnvironmentImpl uce) {
boolean assessmentLock = isAssessmentLock();
myCourse = new Dropdown("myCourse", "header.tools.mycourse", false, getTranslator());
myCourse.setElementCssClass("dropdown-menu-right");
myCourse.setIconCSS("o_icon o_icon_user");
// Personal tools on right side
CourseConfig cc = course.getCourseConfig();
if ((course.hasAssessableNodes() || cc.isCertificateEnabled()) && !isGuestOnly && !assessmentLock && uce != null) {
// link to efficiency statements should
// - not appear when not configured in course configuration
// - not appear when configured in course configuration but no assessable
// node exist
// - appear but dimmed when configured, assessable node exist but no
// assessment data exists for user
// - appear as link when configured, assessable node exist and assessment
// data exists for user
efficiencyStatementsLink = LinkFactory.createToolLink("efficiencystatement", translate("command.efficiencystatement"), this, "o_icon_certificate");
efficiencyStatementsLink.setVisible(cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled());
myCourse.addComponent(efficiencyStatementsLink);
if (cc.isEfficencyStatementEnabled() || cc.isCertificateEnabled()) {
boolean certification = uce.hasEfficiencyStatementOrCertificate(false);
efficiencyStatementsLink.setVisible(certification);
}
}
if (!isGuestOnly && !assessmentLock) {
noteLink = LinkFactory.createToolLink("personalnote", translate("command.personalnote"), this, "o_icon_notes");
noteLink.setPopup(new LinkPopupSettings(750, 550, "notes"));
myCourse.addComponent(noteLink);
}
if (allowBookmark && !isGuestOnly) {
boolean marked = markManager.isMarked(getRepositoryEntry(), getIdentity(), null);
String css = marked ? Mark.MARK_CSS_ICON : Mark.MARK_ADD_CSS_ICON;
bookmarkLink = LinkFactory.createToolLink("bookmark", translate("command.bookmark"), this, css);
bookmarkLink.setTitle(translate(marked ? "details.bookmark.remove" : "details.bookmark"));
myCourse.addComponent(bookmarkLink);
}
if (uce != null) {
if (myCourse.size() > 0 && (uce.getCoachedGroups().size() > 0 || uce.getParticipatingGroups().size() > 0 || uce.getWaitingLists().size() > 0)) {
myCourse.addComponent(new Spacer(""));
}
// 2) add coached groups
if (uce.getCoachedGroups().size() > 0) {
for (BusinessGroup group : uce.getCoachedGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 3) add participating groups
if (uce.getParticipatingGroups().size() > 0) {
for (BusinessGroup group : uce.getParticipatingGroups()) {
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", StringHelper.escapeHtml(group.getName()), this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(!assessmentLock);
myCourse.addComponent(link);
}
}
// 5) add waiting-list groups
if (uce.getWaitingLists().size() > 0) {
for (BusinessGroup group : uce.getWaitingLists()) {
int pos = businessGroupService.getPositionInWaitingListFor(getIdentity(), group);
String name = StringHelper.escapeHtml(group.getName()) + " (" + pos + ")";
Link link = LinkFactory.createToolLink(CMD_START_GROUP_PREFIX + group.getKey(), "group", name, this);
link.setIconLeftCSS("o_icon o_icon-fw o_icon_group");
link.setUserObject(group);
link.setEnabled(false);
myCourse.addComponent(link);
}
}
if (repositoryService.isParticipantAllowedToLeave(getRepositoryEntry()) && !assessmentLock && !roles.isGuestOnly() && !uce.isCourseReadOnly() && isAllowedToLeave(uce)) {
leaveLink = LinkFactory.createToolLink("sign.out", "leave", translate("sign.out"), this);
leaveLink.setIconLeftCSS("o_icon o_icon-fw o_icon_sign_out");
myCourse.addComponent(new Spacer("leaving-space"));
myCourse.addComponent(leaveLink);
}
}
if (myCourse.size() > 0) {
toolbarPanel.addTool(myCourse, Align.right);
}
}
use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
the class CourseHandler method importGlossary.
private void importGlossary(ICourse course, Identity owner) {
GlossaryManager gm = GlossaryManager.getInstance();
RepositoryEntryImportExport importExport = gm.getRepositoryImportExport(course.getCourseExportDataDir().getBasefile());
GlossaryResource resource = gm.createGlossary();
if (resource == null) {
log.error("Error adding glossary directry during repository reference import: " + importExport.getDisplayName());
return;
}
// unzip contents
VFSContainer glossaryContainer = gm.getGlossaryRootFolder(resource);
File fExportedFile = importExport.importGetExportedFile();
if (fExportedFile.exists()) {
ZipUtil.unzip(new LocalFileImpl(fExportedFile), glossaryContainer);
} else {
log.warn("The actual contents of the glossary 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 glossary reference
CourseConfig courseConfig = course.getCourseEnvironment().getCourseConfig();
courseConfig.setGlossarySoftKey(importedRepositoryEntry.getSoftkey());
CoreSpringFactory.getImpl(ReferenceManager.class).addReference(course, importedRepositoryEntry.getOlatResource(), GlossaryManager.GLOSSARY_REPO_REF_IDENTIFYER);
CourseFactory.setCourseConfig(course.getResourceableId(), courseConfig);
}
use of org.olat.course.config.CourseConfig in project OpenOLAT by OpenOLAT.
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);
}
Aggregations