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);
}
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;
}
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;
}
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;
}
}
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;
}
}
Aggregations