Search in sources :

Example 11 with CourseConfig

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;
    }
}
Also used : CertificatesOptionsController(org.olat.course.certificate.ui.CertificatesOptionsController) ICourse(org.olat.course.ICourse) WindowControl(org.olat.core.gui.control.WindowControl) CourseConfig(org.olat.course.config.CourseConfig)

Example 12 with CourseConfig

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);
    }
}
Also used : LinkPopupSettings(org.olat.core.gui.components.link.LinkPopupSettings) Dropdown(org.olat.core.gui.components.dropdown.Dropdown) CourseConfig(org.olat.course.config.CourseConfig)

Example 13 with CourseConfig

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);
}
Also used : SharedFolderFileResource(org.olat.fileresource.types.SharedFolderFileResource) RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) VFSContainer(org.olat.core.util.vfs.VFSContainer) LocalFileImpl(org.olat.core.util.vfs.LocalFileImpl) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) SharedFolderManager(org.olat.modules.sharedfolder.SharedFolderManager) RepositoryService(org.olat.repository.RepositoryService) CourseConfig(org.olat.course.config.CourseConfig) ReferenceManager(org.olat.resource.references.ReferenceManager)

Example 14 with 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);
}
Also used : CourseEditorTreeNode(org.olat.course.tree.CourseEditorTreeNode) ICourse(org.olat.course.ICourse) CourseNode(org.olat.course.nodes.CourseNode) CourseConfig(org.olat.course.config.CourseConfig)

Example 15 with CourseConfig

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;
}
Also used : CourseConfigVO(org.olat.restapi.support.vo.CourseConfigVO) CourseConfig(org.olat.course.config.CourseConfig)

Aggregations

CourseConfig (org.olat.course.config.CourseConfig)60 ICourse (org.olat.course.ICourse)28 RepositoryEntry (org.olat.repository.RepositoryEntry)24 OLATResource (org.olat.resource.OLATResource)12 File (java.io.File)10 Identity (org.olat.core.id.Identity)10 Date (java.util.Date)8 RepositoryService (org.olat.repository.RepositoryService)8 BusinessGroup (org.olat.group.BusinessGroup)7 Roles (org.olat.core.id.Roles)6 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 RepositoryEntryImportExport (org.olat.repository.RepositoryEntryImportExport)6 CourseConfigVO (org.olat.restapi.support.vo.CourseConfigVO)6 Calendar (java.util.Calendar)4 Before (org.junit.Before)4 Dropdown (org.olat.core.gui.components.dropdown.Dropdown)4 LinkPopupSettings (org.olat.core.gui.components.link.LinkPopupSettings)4 IdentityEnvironment (org.olat.core.id.IdentityEnvironment)4 ReadOnlyCallback (org.olat.core.util.vfs.callbacks.ReadOnlyCallback)4 Structure (org.olat.course.Structure)4