Search in sources :

Example 16 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class BinderRuntimeController method initRuntimeTools.

@Override
protected void initRuntimeTools(Dropdown toolsDropdown) {
    if (reSecurity.isEntryAdmin()) {
        membersLink = LinkFactory.createToolLink("members", translate("details.members"), this, "o_sel_repo_members");
        membersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_membersmanagement");
        toolsDropdown.addComponent(membersLink);
    }
    if (reSecurity.isEntryAdmin() || reSecurity.isCourseCoach() || reSecurity.isGroupCoach()) {
        assessmentLink = LinkFactory.createToolLink("assessment", translate("command.openassessment"), this, "o_icon_assessment_tool");
        assessmentLink.setElementCssClass("o_sel_course_assessment_tool");
        toolsDropdown.addComponent(assessmentLink);
    }
    if (reSecurity.isEntryAdmin()) {
        RepositoryEntry re = getRepositoryEntry();
        ordersLink = LinkFactory.createToolLink("bookings", translate("details.orders"), this, "o_sel_repo_booking");
        ordersLink.setIconLeftCSS("o_icon o_icon-fw o_icon_booking");
        boolean booking = acService.isResourceAccessControled(re.getOlatResource(), null);
        ordersLink.setEnabled(booking);
        toolsDropdown.addComponent(ordersLink);
    }
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 17 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class CourseTemplateSearchController method loadCourseModel.

private void loadCourseModel(CourseNode courseNode, UserCourseEnvironment uce, List<CourseTemplateRow> rows, Set<CurrentBinder> currentSet) {
    if (courseNode instanceof PortfolioCourseNode) {
        PortfolioCourseNode pNode = (PortfolioCourseNode) courseNode;
        NodeEvaluation ne = pNode.eval(uce.getConditionInterpreter(), new TreeEvaluation(), new VisibleTreeFilter());
        if (NavigationHandler.mayAccessWholeTreeUp(ne)) {
            RepositoryEntry refEntry = pNode.getReferencedRepositoryEntry();
            if ("BinderTemplate".equals(refEntry.getOlatResource().getResourceableTypeName())) {
                RepositoryEntry courseEntry = uce.getCourseEnvironment().getCourseGroupManager().getCourseEntry();
                CurrentBinder binderKey = new CurrentBinder(courseEntry.getKey(), pNode.getIdent());
                if (!currentSet.contains(binderKey)) {
                    rows.add(new CourseTemplateRow(courseEntry, pNode, refEntry));
                }
            }
        }
    }
    for (int i = courseNode.getChildCount(); i-- > 0; ) {
        loadCourseModel((CourseNode) courseNode.getChildAt(i), uce, rows, currentSet);
    }
}
Also used : CourseTemplateRow(org.olat.modules.portfolio.ui.model.CourseTemplateRow) PortfolioCourseNode(org.olat.course.nodes.PortfolioCourseNode) VisibleTreeFilter(org.olat.course.run.userview.VisibleTreeFilter) TreeEvaluation(org.olat.course.run.userview.TreeEvaluation) RepositoryEntry(org.olat.repository.RepositoryEntry) NodeEvaluation(org.olat.course.run.userview.NodeEvaluation)

Example 18 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class BinderDAO method syncAssignment.

private AssignmentImpl syncAssignment(Assignment refAssignment, AssignmentImpl currentAssignment) {
    if (StringHelper.isSame(currentAssignment.getTitle(), refAssignment.getTitle()) && StringHelper.isSame(currentAssignment.getSummary(), refAssignment.getSummary()) && StringHelper.isSame(currentAssignment.getContent(), refAssignment.getContent()) && StringHelper.isSame(currentAssignment.getStorage(), refAssignment.getStorage()) && StringHelper.isSame(currentAssignment.getType(), refAssignment.getAssignmentType().name()) && StringHelper.isSame(currentAssignment.isOnlyAutoEvaluation(), refAssignment.isOnlyAutoEvaluation()) && StringHelper.isSame(currentAssignment.isReviewerSeeAutoEvaluation(), refAssignment.isReviewerSeeAutoEvaluation()) && StringHelper.isSame(currentAssignment.isAnonymousExternalEvaluation(), refAssignment.isAnonymousExternalEvaluation()) && StringHelper.isSame(currentAssignment.getFormEntry(), refAssignment.getFormEntry())) {
        return currentAssignment;
    }
    currentAssignment.setTitle(refAssignment.getTitle());
    currentAssignment.setSummary(refAssignment.getSummary());
    currentAssignment.setContent(refAssignment.getContent());
    currentAssignment.setStorage(refAssignment.getStorage());
    currentAssignment.setType(refAssignment.getAssignmentType().name());
    currentAssignment.setOnlyAutoEvaluation(refAssignment.isOnlyAutoEvaluation());
    currentAssignment.setReviewerSeeAutoEvaluation(refAssignment.isReviewerSeeAutoEvaluation());
    currentAssignment.setAnonymousExternalEvaluation(refAssignment.isAnonymousExternalEvaluation());
    RepositoryEntry formEntry = refAssignment.getFormEntry();
    if (formEntry != null) {
        RepositoryEntry refFormEntry = dbInstance.getCurrentEntityManager().getReference(RepositoryEntry.class, formEntry.getKey());
        currentAssignment.setFormEntry(refFormEntry);
    }
    return dbInstance.getCurrentEntityManager().merge(currentAssignment);
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry)

Example 19 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class BinderTemplateHandler method importResource.

@Override
public RepositoryEntry importResource(Identity initialAuthor, String initialAuthorAlt, String displayname, String description, boolean withReferences, Locale locale, File file, String filename) {
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    PortfolioService portfolioService = CoreSpringFactory.getImpl(PortfolioService.class);
    try {
        // create resource
        OLATResource resource = portfolioService.createBinderTemplateResource();
        OlatRootFolderImpl fResourceRootContainer = FileResourceManager.getInstance().getFileResourceRootImpl(resource);
        File fResourceFileroot = fResourceRootContainer.getBasefile();
        File zipRoot = new File(fResourceFileroot, FileResourceManager.ZIPDIR);
        FileResource.copyResource(file, filename, zipRoot);
        // create repository entry
        RepositoryEntry re = repositoryService.create(initialAuthor, initialAuthorAlt, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
        // import binder
        File binderFile = new File(zipRoot, BinderTemplateResource.BINDER_XML);
        Binder transientBinder = BinderXStream.fromPath(binderFile.toPath());
        File posterImage = null;
        if (StringHelper.containsNonWhitespace(transientBinder.getImagePath())) {
            posterImage = new File(zipRoot, transientBinder.getImagePath());
        }
        portfolioService.importBinder(transientBinder, re, posterImage);
        RepositoryEntryImportExport rei = new RepositoryEntryImportExport(re, zipRoot);
        if (rei.anyExportedPropertiesAvailable()) {
            re = rei.importContent(re, fResourceRootContainer.createChildContainer("media"));
        }
        // delete the imported files
        FileUtils.deleteDirsAndFiles(zipRoot, true, true);
        return re;
    } catch (IOException e) {
        log.error("", e);
        return null;
    }
}
Also used : Binder(org.olat.modules.portfolio.Binder) OlatRootFolderImpl(org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl) PortfolioService(org.olat.modules.portfolio.PortfolioService) RepositoryEntryImportExport(org.olat.repository.RepositoryEntryImportExport) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) IOException(java.io.IOException) File(java.io.File) RepositoryService(org.olat.repository.RepositoryService)

Example 20 with RepositoryEntry

use of org.olat.repository.RepositoryEntry in project OpenOLAT by OpenOLAT.

the class SearchUserToolExtension method createUserTool.

@Override
public UserTool createUserTool(UserRequest ureq, WindowControl wControl, Locale locale) {
    boolean canSearch = isEnabled();
    if (canSearch && isSearchOnlyHasInternalSiteMember()) {
        String softKey = getInternalSiteSoftKey();
        RepositoryEntry repoEntry = RepositoryManager.getInstance().lookupRepositoryEntryBySoftkey(softKey, false);
        if (repoEntry != null) {
            RepositoryService contextManager = CoreSpringFactory.getImpl(RepositoryService.class);
            canSearch = contextManager.isMember(ureq.getUserSession().getIdentity(), repoEntry);
        }
    }
    return canSearch ? new SearchUserTool(wControl) : null;
}
Also used : RepositoryEntry(org.olat.repository.RepositoryEntry) RepositoryService(org.olat.repository.RepositoryService)

Aggregations

RepositoryEntry (org.olat.repository.RepositoryEntry)2108 Test (org.junit.Test)922 Identity (org.olat.core.id.Identity)888 BusinessGroup (org.olat.group.BusinessGroup)344 ArrayList (java.util.ArrayList)258 File (java.io.File)246 ICourse (org.olat.course.ICourse)246 Date (java.util.Date)234 OLATResource (org.olat.resource.OLATResource)200 URI (java.net.URI)176 HttpResponse (org.apache.http.HttpResponse)172 OLATResourceable (org.olat.core.id.OLATResourceable)132 RepositoryManager (org.olat.repository.RepositoryManager)122 Roles (org.olat.core.id.Roles)104 RepositoryService (org.olat.repository.RepositoryService)104 LectureBlock (org.olat.modules.lecture.LectureBlock)94 Path (javax.ws.rs.Path)90 URL (java.net.URL)84 VFSContainer (org.olat.core.util.vfs.VFSContainer)76 WindowControl (org.olat.core.gui.control.WindowControl)74