Search in sources :

Example 1 with OLATResource

use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.

the class GTAIdentityListCourseNodeController method doDownload.

private void doDownload(UserRequest ureq) {
    AssessmentToolOptions asOptions = getOptions();
    OLATResource courseOres = getCourseRepositoryEntry().getOlatResource();
    ArchiveOptions options = new ArchiveOptions();
    options.setGroup(asOptions.getGroup());
    options.setIdentities(asOptions.getIdentities());
    ArchiveResource resource = new ArchiveResource(courseNode, courseOres, options, getLocale());
    ureq.getDispatchResult().setResultingMediaResource(resource);
}
Also used : AssessmentToolOptions(org.olat.modules.assessment.AssessmentToolOptions) OLATResource(org.olat.resource.OLATResource) ArchiveOptions(org.olat.course.nodes.ArchiveOptions) ArchiveResource(org.olat.course.archiver.ArchiveResource)

Example 2 with OLATResource

use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.

the class QTIHandler method createResource.

protected RepositoryEntry createResource(String type, FileResource ores, Identity initialAuthor, String displayname, String description, Object object, Locale locale) {
    RepositoryService repositoryService = CoreSpringFactory.getImpl(RepositoryService.class);
    OLATResource resource = OLATResourceManager.getInstance().findOrPersistResourceable(ores);
    RepositoryEntry re = repositoryService.create(initialAuthor, null, "", displayname, description, resource, RepositoryEntry.ACC_OWNERS);
    DBFactory.getInstance().commit();
    File fRepositoryQTI = new File(FileResourceManager.getInstance().getFileResourceRoot(re.getOlatResource()), "qti.zip");
    QTIEditorPackageImpl qtiPackage = new QTIEditorPackageImpl(displayname, type, locale);
    if (object instanceof QItemList) {
        QItemList itemToImport = (QItemList) object;
        QTIQPoolServiceProvider provider = (QTIQPoolServiceProvider) CoreSpringFactory.getBean("qtiPoolServiceProvider");
        provider.exportToEditorPackage(qtiPackage, itemToImport.getItems(), true);
    }
    qtiPackage.savePackageTo(fRepositoryQTI);
    return re;
}
Also used : QTIEditorPackageImpl(org.olat.ims.qti.editor.QTIEditorPackageImpl) QTIQPoolServiceProvider(org.olat.ims.qti.qpool.QTIQPoolServiceProvider) OLATResource(org.olat.resource.OLATResource) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) RepositoryService(org.olat.repository.RepositoryService) QItemList(org.olat.modules.qpool.model.QItemList)

Example 3 with OLATResource

use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.

the class QTIHandler method copy.

@Override
public RepositoryEntry copy(Identity author, RepositoryEntry source, RepositoryEntry target) {
    OLATResource sourceResource = source.getOlatResource();
    OLATResource targetResource = target.getOlatResource();
    // getFileResource search the first zip
    File sourceFile = FileResourceManager.getInstance().getFileResource(sourceResource);
    File targetRootDir = FileResourceManager.getInstance().getFileResourceRootImpl(targetResource).getBasefile();
    File targetDir = new File(targetRootDir, FileResourceManager.ZIPDIR);
    FileResource.copyResource(sourceFile, sourceFile.getName(), targetDir, new ChangeLogFilter());
    ZipUtil.zipAll(targetDir, new File(targetRootDir, "qti.zip"));
    return target;
}
Also used : OLATResource(org.olat.resource.OLATResource) File(java.io.File)

Example 4 with OLATResource

use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.

the class QTITestHandler method createEditorController.

@Override
public Controller createEditorController(RepositoryEntry re, UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar) {
    OLATResource res = re.getOlatResource();
    if (OnyxModule.isOnyxTest(res)) {
        return null;
    }
    TestFileResource fr = new TestFileResource();
    fr.overrideResourceableId(res.getResourceableId());
    // check if we can edit in restricted mode -> only typos
    List<Reference> referencees = CoreSpringFactory.getImpl(ReferenceManager.class).getReferencesTo(res);
    QTIEditorMainController editor = new QTIEditorMainController(ureq, wControl, re, referencees, fr);
    if (editor.isLockedSuccessfully()) {
        return editor;
    } else {
        return null;
    }
}
Also used : QTIEditorMainController(org.olat.ims.qti.editor.QTIEditorMainController) Reference(org.olat.resource.references.Reference) OLATResource(org.olat.resource.OLATResource) TestFileResource(org.olat.ims.qti.fileresource.TestFileResource) ReferenceManager(org.olat.resource.references.ReferenceManager)

Example 5 with OLATResource

use of org.olat.resource.OLATResource in project OpenOLAT by OpenOLAT.

the class QTISurveyHandler method createEditorController.

@Override
public Controller createEditorController(RepositoryEntry re, UserRequest ureq, WindowControl wControl, TooledStackedPanel toolbar) {
    OLATResource res = re.getOlatResource();
    if (OnyxModule.isOnyxTest(res)) {
        return null;
    }
    SurveyFileResource fr = new SurveyFileResource();
    fr.overrideResourceableId(res.getResourceableId());
    // check if we can edit in restricted mode -> only typos
    List<Reference> referencees = CoreSpringFactory.getImpl(ReferenceManager.class).getReferencesTo(res);
    QTIEditorMainController editor = new QTIEditorMainController(ureq, wControl, re, referencees, fr);
    if (editor.isLockedSuccessfully()) {
        return editor;
    } else {
        return null;
    }
}
Also used : SurveyFileResource(org.olat.ims.qti.fileresource.SurveyFileResource) QTIEditorMainController(org.olat.ims.qti.editor.QTIEditorMainController) Reference(org.olat.resource.references.Reference) OLATResource(org.olat.resource.OLATResource) ReferenceManager(org.olat.resource.references.ReferenceManager)

Aggregations

OLATResource (org.olat.resource.OLATResource)706 Test (org.junit.Test)304 RepositoryEntry (org.olat.repository.RepositoryEntry)198 Identity (org.olat.core.id.Identity)170 File (java.io.File)80 Date (java.util.Date)72 Feed (org.olat.modules.webFeed.Feed)72 ArrayList (java.util.ArrayList)64 ICourse (org.olat.course.ICourse)64 RepositoryService (org.olat.repository.RepositoryService)62 OLATResourceable (org.olat.core.id.OLATResourceable)60 BusinessGroup (org.olat.group.BusinessGroup)58 Item (org.olat.modules.webFeed.Item)44 AccessMethod (org.olat.resource.accesscontrol.model.AccessMethod)38 OLATResourceManager (org.olat.resource.OLATResourceManager)34 TokenAccessMethod (org.olat.resource.accesscontrol.model.TokenAccessMethod)34 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)30 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)30 FreeAccessMethod (org.olat.resource.accesscontrol.model.FreeAccessMethod)28 Group (org.olat.basesecurity.Group)26