use of org.olat.core.util.vfs.LocalFolderImpl in project OpenOLAT by OpenOLAT.
the class VideoModule method getTranscodingBaseContainer.
/**
* The base container where the transcoded videos are stored. This config can only be set in
* olat.localproperties, see "video.transcoding.dir"
* @return
*/
public VFSContainer getTranscodingBaseContainer() {
if (transcodingDir != null) {
File base = new File(transcodingDir);
if (base.exists() || base.mkdirs()) {
return new LocalFolderImpl(base);
}
}
if (transcodingEnabled) {
log.error("Error, no valid transcoding dir. Disabling transcoding. video.transcoding.dir=" + transcodingDir);
// only disable variable, don't store it in persisted properties
transcodingEnabled = false;
}
return null;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.
the class CourseLayoutHelper method getOLATThemeCourseLayoutFolder.
/**
* returns the Folder with the additional courselayouts from the current
* OLAT-Theme this is e.g. : /static/themes/frentix/courselayouts/<br />
* If no courselayouts exist in the current OLAT-Theme, null is returned!
*
* @return the courselayouts-folder or null
*/
public static VFSContainer getOLATThemeCourseLayoutFolder() {
VFSContainer courseLayoutFolder = null;
File themeDir = null;
// first attempt is to use custom theme path
if (Settings.getGuiCustomThemePath() != null) {
themeDir = new File(Settings.getGuiCustomThemePath(), CoreSpringFactory.getImpl(GUISettings.class).getGuiThemeIdentifyer());
if (themeDir.exists() && themeDir.isDirectory()) {
VFSContainer themeContainer = new LocalFolderImpl(themeDir);
courseLayoutFolder = (VFSContainer) themeContainer.resolve("/courselayouts");
}
}
// fallback is to use the standards themes directory in the web app
if (themeDir == null || !themeDir.exists() || !themeDir.isDirectory()) {
File themesDir = new File(WebappHelper.getContextRealPath("/static/themes/"));
themeDir = new File(themesDir, CoreSpringFactory.getImpl(GUISettings.class).getGuiThemeIdentifyer());
}
// resolve now
if (themeDir != null && themeDir.exists() && themeDir.isDirectory()) {
VFSContainer themeContainer = new LocalFolderImpl(themeDir);
courseLayoutFolder = (VFSContainer) themeContainer.resolve("/courselayouts");
}
return courseLayoutFolder;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.
the class CourseLayoutHelper method getCourseThemeTemplates.
/**
* get a list of system wide course theme templates
* they need to be in webapp/static/coursethemes/XY
* @return
*/
public static List<VFSItem> getCourseThemeTemplates() {
List<VFSItem> courseThemes = new ArrayList<VFSItem>();
// 1. add the system-defaults
String staticAbsPath = WebappHelper.getContextRealPath("/static");
File themesFile = new File(staticAbsPath);
VFSContainer cThemeCont = new LocalFolderImpl(themesFile);
cThemeCont = (VFSContainer) cThemeCont.resolve("/coursethemes");
if (cThemeCont != null) {
courseThemes = cThemeCont.getItems(themeNamesFilter);
}
// 2. now add the additional Templates from the current Theme
VFSContainer addThCont = CourseLayoutHelper.getOLATThemeCourseLayoutFolder();
if (addThCont != null) {
List<VFSItem> additionalThemes = addThCont.getItems(themeNamesFilter);
courseThemes.addAll(additionalThemes);
}
return courseThemes;
}
use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.
the class DialogCourseNodeRunController method doUploadFile.
private void doUploadFile(UserRequest ureq) {
removeAsListenerAndDispose(fileUplCtr);
VFSContainer tmpContainer = new LocalFolderImpl(new File(WebappHelper.getTmpDir(), "poster_" + UUID.randomUUID()));
fileUplCtr = new FileUploadController(getWindowControl(), tmpContainer, ureq, FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false, false, false, false, true, false);
listenTo(fileUplCtr);
cmc = new CloseableModalController(getWindowControl(), "close", fileUplCtr.getInitialComponent(), true, translate("dialog.upload.file"));
listenTo(cmc);
cmc.activate();
}
use of org.olat.core.util.vfs.LocalFolderImpl in project openolat by klemens.
the class CPRunController method doLaunch.
private void doLaunch(UserRequest ureq) {
DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(CPEditController.CONFIG_DELIVERYOPTIONS);
if (cpRoot == null) {
// it is the first time we start the contentpackaging from this instance
// of this controller.
// need to be strict when launching -> "true"
RepositoryEntry re = CPEditController.getCPReference(config, false);
if (re == null) {
showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
return;
}
cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
// nodes reference them
if (cpRoot == null) {
showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
return;
}
if (deliveryOptions != null && deliveryOptions.getInherit() != null && deliveryOptions.getInherit().booleanValue()) {
CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource());
if (packageConfig != null && packageConfig.getDeliveryOptions() != null) {
deliveryOptions = packageConfig.getDeliveryOptions();
}
}
}
// else cpRoot is already set (save some db access if the user opens /
// closes / reopens the cp from the same CPRuncontroller instance)
boolean activateFirstPage = true;
if ((nodecmd != null) && !nodecmd.equals("")) {
activateFirstPage = false;
}
boolean showNavigation = !config.getBooleanSafe(NodeEditController.CONFIG_COMPONENT_MENU);
cpDispC = CPUIFactory.getInstance().createContentOnlyCPDisplayController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), activateFirstPage, showNavigation, deliveryOptions, nodecmd, courseResource, cpNode.getIdent(), preview);
cpDispC.setContentEncoding(deliveryOptions.getContentEncoding());
cpDispC.setJSEncoding(deliveryOptions.getJavascriptEncoding());
cpDispC.addControllerListener(this);
main.setContent(cpDispC.getInitialComponent());
if (isExternalMenuConfigured()) {
treeModel = cpDispC.getTreeModel();
treeNodeClickListener = this;
if (activateFirstPage) {
selNodeId = cpDispC.getInitialSelectedNodeId();
} else {
String uri = nodecmd;
if (uri.startsWith("/")) {
uri = uri.substring(1, uri.length());
}
selNodeId = cpDispC.getNodeByUri(uri);
}
}
}
Aggregations