diff --git a/src/main/java/org/olat/course/MergedCourseContainer.java b/src/main/java/org/olat/course/MergedCourseContainer.java index 5f58db6d535b1531b683ac04deabd34c19308267..6178f9e0a9027886ae7d0edf2dd0e1bb7553d22b 100644 --- a/src/main/java/org/olat/course/MergedCourseContainer.java +++ b/src/main/java/org/olat/course/MergedCourseContainer.java @@ -360,7 +360,7 @@ public class MergedCourseContainer extends MergeSource { } else { VFSContainer courseBase = course.getCourseBaseContainer(); rootFolder = (VFSContainer) courseBase.resolve("/coursefolder" + subpath); - if(rootFolder.getLocalSecurityCallback() != null) { + if(rootFolder != null && rootFolder.getLocalSecurityCallback() != null) { SubscriptionContext subContext = CourseModule.createSubscriptionContext(course.getCourseEnvironment(), bcNode); rootFolder.setLocalSecurityCallback(new OverrideSubscriptionSecurityCallback(rootFolder.getLocalSecurityCallback(), subContext)); } diff --git a/src/main/java/org/olat/course/nodes/bc/BCCourseNodeEditForm.java b/src/main/java/org/olat/course/nodes/bc/BCCourseNodeEditForm.java index 56131f0c3238effb2704819cbe11def1317fae0d..222987871e9224d243165281fd80e70078eb0db8 100644 --- a/src/main/java/org/olat/course/nodes/bc/BCCourseNodeEditForm.java +++ b/src/main/java/org/olat/course/nodes/bc/BCCourseNodeEditForm.java @@ -66,6 +66,7 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control private FormLink createFolder; private BCCourseNodeEditCreateFolderForm createFolderForm; private FormItem sharedFolderWarning, sharedFolderInfo; + private FormItem linkedFolderWarning; private BCCourseNodeEditChooseFolderForm chooseForm; public BCCourseNodeEditForm(UserRequest ureq, WindowControl wControl, BCCourseNode bcNode, ICourse course) { @@ -89,12 +90,16 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control sharedFolderWarning = uifactory.createSimpleErrorText("warning", translate("warning.no.sharedfolder")); formLayout.add(sharedFolderWarning); + linkedFolderWarning = uifactory.createSimpleErrorText("warning2", translate("warning.no.linkedfolder")); + formLayout.add(linkedFolderWarning); + boolean isAuto = node.getModuleConfiguration().getBooleanSafe(BCCourseNodeEditController.CONFIG_AUTO_FOLDER); if(isAuto){ folderTargetChoose.select("autoPath", true); subPath.setVisible(false); sharedFolderWarning.setVisible(false); + linkedFolderWarning.setVisible(false); }else{ folderTargetChoose.select("pathChoose", false); String subpath = node.getModuleConfiguration().getStringValue(BCCourseNodeEditController.CONFIG_SUBPATH); @@ -110,6 +115,12 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control sharedFolderWarning.setVisible(false); } + if(isLinkedFolderNotPresent()){ + linkedFolderWarning.setVisible(true); + }else{ + linkedFolderWarning.setVisible(false); + } + } if(node.isSharedFolder()) { @@ -137,6 +148,7 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) { if(folderTargetChoose.isSelected(0)){ sharedFolderWarning.setVisible(false); + linkedFolderWarning.setVisible(false); }else{ if(isSharedfolderNotPresent()){ sharedFolderWarning.setVisible(true); @@ -148,6 +160,11 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control }else{ sharedFolderInfo.setVisible(false); } + if(isLinkedFolderNotPresent()){ + linkedFolderWarning.setVisible(true); + }else{ + linkedFolderWarning.setVisible(false); + } } if(source == folderTargetChoose){ subPath.setVisible(folderTargetChoose.isSelected(1)); @@ -276,4 +293,10 @@ public class BCCourseNodeEditForm extends FormBasicController implements Control return false; } + private boolean isLinkedFolderNotPresent(){ + VFSContainer courseBase = course.getCourseBaseContainer(); + String subpath = node.getModuleConfiguration().getStringValue(BCCourseNodeEditController.CONFIG_SUBPATH); + VFSContainer rootFolder = (VFSContainer) courseBase.resolve("/coursefolder" + subpath); + return rootFolder == null; + } } diff --git a/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_de.properties index 3f5aefadcb18127696fcb769bf145f9f0d6ec4ad..7b2362f51edff8a4cfa7eddba72a9787df16219b 100644 --- a/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_de.properties +++ b/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_de.properties @@ -31,4 +31,5 @@ createPath=Zu erstellender Pfad createButton=Ordner erstellen warning.no.sharedfolder=Der konfigurierte Ressourcenordner ist nicht mehr verf\u00FCgbar info.sharedfolder=F\u00fcr den Ressourcenordner erhalten Kursmitglieder im Kurs nur Leserechte. +warning.no.linkedfolder=Der angegebene Ordner existiert nicht im Ablageordner. chooseFolder=Ordner w\u00E4hlen diff --git a/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_en.properties index a4886002c166afd052754649c88422e2a0e5b685..343b3f73c3cf8a659fcb2b79ae7eaed04107b02f 100644 --- a/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_en.properties +++ b/src/main/java/org/olat/course/nodes/bc/_i18n/LocalStrings_en.properties @@ -30,4 +30,5 @@ subPathLab.dummy=There is no folder configured yet subPathLab.label=File path title_bc=Folder warn.folderdelete=Warning\: all the files of the folder will be deleted. +warning.no.linkedfolder=The configured folder is not available in the course storage folder. warning.no.sharedfolder=The configured resourcefolder is not available anymore\!