diff --git a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/STCourseNode.java b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/STCourseNode.java index 3b1dcc1900919cf917a3171323aec8ffbd179f86..bbf8121bdf760fd9965f780e25b4175b6314a76d 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/STCourseNode.java +++ b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/STCourseNode.java @@ -56,6 +56,7 @@ import org.olat.course.editor.NodeEditController; import org.olat.course.editor.StatusDescription; import org.olat.course.groupsandrights.CourseGroupManager; import org.olat.course.groupsandrights.CourseRights; +import org.olat.course.nodes.sp.SPEditController; import org.olat.course.nodes.sp.SPPeekviewController; import org.olat.course.nodes.st.STCourseNodeEditController; import org.olat.course.nodes.st.STCourseNodeRunController; @@ -263,7 +264,22 @@ public class STCourseNode extends AbstractAccessableCourseNode implements Assess */ if (oneClickStatusCache != null) { return oneClickStatusCache[0]; } - return StatusDescription.NOERROR; + ModuleConfiguration config = getModuleConfiguration(); + StatusDescription sd = StatusDescription.NOERROR; + if (STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE.equals(config.getStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE))){ + String fileName = (String) config.get(STCourseNodeEditController.CONFIG_KEY_FILE); + if (fileName == null || !StringHelper.containsNonWhitespace(fileName)){ + String shortKey = "error.missingfile.short"; + String longKey = "error.missingfile.long"; + String[] params = new String[] { this.getShortTitle() }; + String translPackage = Util.getPackageName(SPEditController.class); + sd = new StatusDescription(StatusDescription.ERROR, shortKey, longKey, params, translPackage); + sd.setDescriptionForUnit(getIdent()); + // set which pane is affected by error + sd.setActivateableViewIdentifier(STCourseNodeEditController.PANE_TAB_ST_CONFIG); + } + } + return sd; } /** diff --git a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/sp/SPPeekviewController.java b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/sp/SPPeekviewController.java index 62a09670a0da25ef024f19790fdd7d7e1bca0400..a1104eed69fa73b7435d4e442964fc398bcdf067 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/sp/SPPeekviewController.java +++ b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/sp/SPPeekviewController.java @@ -61,31 +61,32 @@ public class SPPeekviewController extends BasicController { super(ureq, wControl); // just display the page String file = config.getStringValue(SPEditController.CONFIG_KEY_FILE); - String fileLC = file.toLowerCase(); - if (fileLC.endsWith(".html") || fileLC.endsWith(".htm") || fileLC.endsWith(".xhtml")) { - // Render normal view but scaled down to 75% - SinglePageController spController = new SinglePageController(ureq, wControl, - userCourseEnv.getCourseEnvironment().getCourseFolderContainer(), - file, null, - config.getBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS), ores); - // but add scaling to fit preview into minimized space - spController.setScaleFactorAndHeight(0.75f, 400, true); - listenTo(spController); - putInitialPanel(spController.getInitialComponent()); - } else { - // Render a download link for file - VFSContainer courseFolder = userCourseEnv.getCourseEnvironment().getCourseFolderContainer(); - VFSItem downloadItem = courseFolder.resolve(file); - if (file != null && downloadItem instanceof VFSLeaf) { - DownloadComponent downloadComp = new DownloadComponent("downloadComp", (VFSLeaf) downloadItem); - VelocityContainer peekviewVC = createVelocityContainer("peekview"); - peekviewVC.put("downloadComp", downloadComp); - putInitialPanel(peekviewVC); + Component resPanel = new Panel("empty"); // empty panel to use if no file could be found + if (file != null) { + String fileLC = file.toLowerCase(); + if (fileLC.endsWith(".html") || fileLC.endsWith(".htm") || fileLC.endsWith(".xhtml")) { + // Render normal view but scaled down to 75% + SinglePageController spController = new SinglePageController(ureq, wControl, + userCourseEnv.getCourseEnvironment().getCourseFolderContainer(), + file, null, + config.getBooleanEntry(SPEditController.CONFIG_KEY_ALLOW_RELATIVE_LINKS), ores); + // but add scaling to fit preview into minimized space + spController.setScaleFactorAndHeight(0.75f, 400, true); + listenTo(spController); + resPanel = spController.getInitialComponent(); } else { - // boy, can't find file, use an empty panel - putInitialPanel(new Panel("empty")); + // Render a download link for file + VFSContainer courseFolder = userCourseEnv.getCourseEnvironment().getCourseFolderContainer(); + VFSItem downloadItem = courseFolder.resolve(file); + if (file != null && downloadItem instanceof VFSLeaf) { + DownloadComponent downloadComp = new DownloadComponent("downloadComp", (VFSLeaf) downloadItem); + VelocityContainer peekviewVC = createVelocityContainer("peekview"); + peekviewVC.put("downloadComp", downloadComp); + resPanel = peekviewVC; + } } } + putInitialPanel(resPanel); } /** diff --git a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/st/STCourseNodeEditController.java b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/st/STCourseNodeEditController.java index 460fef3a5a039e25a26cd995fc2e673be0ebdee2..ee34512efa944a4e4744a8bf79f0140e75395dc9 100644 --- a/olat3/webapp/WEB-INF/src/org/olat/course/nodes/st/STCourseNodeEditController.java +++ b/olat3/webapp/WEB-INF/src/org/olat/course/nodes/st/STCourseNodeEditController.java @@ -64,7 +64,7 @@ import org.olat.modules.ModuleConfiguration; public class STCourseNodeEditController extends ActivateableTabbableDefaultController implements ControllerEventListener { private static final String PANE_TAB_ST_SCORECALCULATION = "pane.tab.st_scorecalculation"; - private static final String PANE_TAB_ST_CONFIG = "pane.tab.st_config"; + public static final String PANE_TAB_ST_CONFIG = "pane.tab.st_config"; private static final String PANE_TAB_ACCESSIBILITY = "pane.tab.accessibility"; /** configuration key for the filename */ @@ -294,6 +294,7 @@ public class STCourseNodeEditController extends ActivateableTabbableDefaultContr // Let other config values from old config setup remain in config, // maybe used when user switches back to other config (OLAT-5610) } + fireEvent(ureq, NodeEditController.NODECONFIG_CHANGED_EVENT); } } else if (source == scoreEasyForm) {