use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class RepositoryEntryImageMapper method handle.
@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
if (rootContainer == null) {
rootContainer = new LocalFolderImpl(new File(FolderConfig.getCanonicalRepositoryHome()));
}
if (relPath.startsWith("/")) {
relPath = relPath.substring(1, relPath.length());
}
MediaResource resource = null;
VFSItem image = rootContainer.resolve(relPath);
if (image instanceof VFSLeaf) {
if (image instanceof MetaTagged) {
MetaInfo info = ((MetaTagged) image).getMetaInfo();
if (info != null) {
// 121 is needed to fill the div
VFSLeaf thumbnail = info.getThumbnail(180, 120, true);
if (thumbnail != null) {
resource = new VFSMediaResource(thumbnail);
}
}
}
if (resource == null) {
resource = new VFSMediaResource((VFSLeaf) image);
}
}
return resource;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class QTIEditorPackageImpl method removeMediaFiles.
/**
* Remove the media files specified in the input set (removable contains filenames)
* @param removable
*/
public void removeMediaFiles(Set<String> removable) {
LocalFolderImpl mediaFolder = new LocalFolderImpl(new File(packageDir, "media"));
List<VFSItem> allMedia = mediaFolder.getItems();
QTIEditHelper.removeUnusedMedia(removable, allMedia);
}
use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class QTIEditorPackageImpl method getBaseDir.
@Override
public VFSContainer getBaseDir() {
VFSContainer localDir = new LocalFolderImpl(packageDir);
if (secCallback != null) {
localDir.setLocalSecurityCallback(secCallback);
}
String dirName = translator.translate("qti.basedir.displayname");
NamedContainerImpl namedBaseDir = new NamedContainerImpl(dirName, localDir);
return namedBaseDir;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class IQManager method getIdentitiesWithQtiSerEntry.
/**
* Get identities with exists qti.ser file.
* @param resourceableId
* @param ident
* @return
*/
public List<Identity> getIdentitiesWithQtiSerEntry(Long resourceableId, String ident) {
List<Identity> identities = new ArrayList<Identity>();
LocalFolderImpl item = new LocalFolderImpl(new File(FilePersister.getFullPathToCourseNodeDirectory(Long.toString(resourceableId), ident)));
if (VFSManager.exists(item)) {
for (VFSItem identityFolder : item.getItems()) {
Identity identity = BaseSecurityManager.getInstance().findIdentityByName(identityFolder.getName());
if (identity != null)
identities.add(identity);
}
}
return identities;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class CompMenuForm method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest,
* org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
public void event(UserRequest ureq, Component source, Event event) {
if (source == chooseCPButton || source == changeCPButton) {
removeAsListenerAndDispose(searchController);
searchController = new ReferencableEntriesSearchController(getWindowControl(), ureq, ImsCPFileResource.TYPE_NAME, translate(NLS_COMMAND_CHOOSECP));
listenTo(searchController);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), searchController.getInitialComponent(), true, translate(NLS_COMMAND_CREATECP));
listenTo(cmc);
cmc.activate();
} else if (source == previewLink) {
// Preview as modal dialogue only if the config is valid
RepositoryEntry re = getCPReference(config, false);
if (re == null) {
// we cannot preview it, because the repository entry
// had been deleted between the time when it was chosen here, and now
showError(NLS_ERROR_CPREPOENTRYMISSING);
} else {
File cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
Boolean showMenuB = config.getBooleanEntry(NodeEditController.CONFIG_COMPONENT_MENU);
// pre: showMenuB != null
removeAsListenerAndDispose(previewCtr);
DeliveryOptions previewOptions = deliveryOptionsCtrl.getOptionsForPreview();
previewCtr = CPUIFactory.getInstance().createMainLayoutPreviewController_v2(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), showMenuB.booleanValue(), previewOptions);
stackPanel.pushController(translate("preview.cp"), previewCtr);
}
} else if (source == editLink) {
CourseNodeFactory.getInstance().launchReferencedRepoEntryEditor(ureq, getWindowControl(), cpNode);
}
}
Aggregations