diff --git a/src/main/java/org/olat/course/run/CourseRuntimeController.java b/src/main/java/org/olat/course/run/CourseRuntimeController.java index 706f13ee0fba603b1e22e73202dd03cb9306bb34..98ede250d1ab14adc8f02404836fa38e819bc373 100644 --- a/src/main/java/org/olat/course/run/CourseRuntimeController.java +++ b/src/main/java/org/olat/course/run/CourseRuntimeController.java @@ -196,23 +196,25 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im boolean offerBookmark, boolean showCourseConfigLink) { super(ureq, wControl, re, reSecurity, runtimeControllerCreator, offerBookmark, showCourseConfigLink); - ICourse course = CourseFactory.loadCourse(getOlatResourceable()); - addLoggingResourceable(LoggingResourceable.wrap(course)); + if(!corrupted) { + ICourse course = CourseFactory.loadCourse(getOlatResourceable()); + addLoggingResourceable(LoggingResourceable.wrap(course)); - coordinatorManager.getCoordinator().getEventBus().registerFor(this, getIdentity(), getOlatResourceable()); - // - group modification events - coordinatorManager.getCoordinator().getEventBus().registerFor(this, getIdentity(), getRepositoryEntry()); - - if (CourseModule.displayParticipantsCount()) { - coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new MultiUserEvent(JOINED), getOlatResourceable()); - updateCurrentUserCount(); - } - - if(enableGlossaryLink != null) { - Preferences prefs = ureq.getUserSession().getGuiPreferences(); - String guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(course); - Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey); - setGlossaryLinkTitle(ureq, state); + coordinatorManager.getCoordinator().getEventBus().registerFor(this, getIdentity(), getOlatResourceable()); + // - group modification events + coordinatorManager.getCoordinator().getEventBus().registerFor(this, getIdentity(), getRepositoryEntry()); + + if (CourseModule.displayParticipantsCount()) { + coordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new MultiUserEvent(JOINED), getOlatResourceable()); + updateCurrentUserCount(); + } + + if(enableGlossaryLink != null) { + Preferences prefs = ureq.getUserSession().getGuiPreferences(); + String guiPrefsKey = CourseGlossaryFactory.createGuiPrefsKey(course); + Boolean state = (Boolean) prefs.get(CourseGlossaryToolLinkController.class, guiPrefsKey); + setGlossaryLinkTitle(ureq, state); + } } } @@ -229,6 +231,7 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im @Override protected void loadRights(RepositoryEntrySecurity security) { super.loadRights(security); + if(corrupted) return; ICourse course = CourseFactory.loadCourse(getOlatResourceable()); CourseGroupManager cgm = course.getCourseEnvironment().getCourseGroupManager(); @@ -334,10 +337,11 @@ public class CourseRuntimeController extends RepositoryEntryRuntimeController im @Override protected void initToolbar(Dropdown toolsDropdown, Dropdown settingsDropdown) { + toolbarPanel.removeAllTools(); + if(corrupted) return; + ICourse course = CourseFactory.loadCourse(getRepositoryEntry().getOlatResource()); UserCourseEnvironmentImpl uce = getUserCourseEnvironment(); - - toolbarPanel.removeAllTools(); if(!isAssessmentLock()) { initTools(toolsDropdown, course, uce); initSettingsTools(settingsDropdown); diff --git a/src/main/java/org/olat/repository/ui/CorruptedCourseController.java b/src/main/java/org/olat/repository/ui/CorruptedCourseController.java new file mode 100644 index 0000000000000000000000000000000000000000..20e9dc62bf36bb28253be0c3bec1f53a1deef98c --- /dev/null +++ b/src/main/java/org/olat/repository/ui/CorruptedCourseController.java @@ -0,0 +1,56 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.repository.ui; + +import org.olat.core.gui.UserRequest; +import org.olat.core.gui.components.Component; +import org.olat.core.gui.components.velocity.VelocityContainer; +import org.olat.core.gui.control.Event; +import org.olat.core.gui.control.WindowControl; +import org.olat.core.gui.control.controller.BasicController; +import org.olat.core.util.Util; +import org.olat.repository.RepositoryService; + +/** + * + * Initial date: 20.04.2015<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class CorruptedCourseController extends BasicController { + + public CorruptedCourseController(UserRequest ureq, WindowControl wControl) { + super(ureq, wControl); + setTranslator(Util.createPackageTranslator(RepositoryService.class, getLocale(), getTranslator())); + + VelocityContainer mainVC = createVelocityContainer("corrupted_course"); + putInitialPanel(mainVC); + } + + @Override + protected void event(UserRequest ureq, Component source, Event event) { + // + } + + @Override + protected void doDispose() { + // + } +} \ No newline at end of file diff --git a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java index 54daf8b8343a88bbcd1a0fa8b0fd5f87b8242395..1ea2a850189879ac5e7f366ad4c3897b487520ef 100644 --- a/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java +++ b/src/main/java/org/olat/repository/ui/RepositoryEntryRuntimeController.java @@ -864,7 +864,11 @@ public class RepositoryEntryRuntimeController extends MainLayoutBasicController } protected void launchContent(UserRequest ureq, RepositoryEntrySecurity security) { - if(security.canLaunch()) { + if(corrupted) { + runtimeController = new CorruptedCourseController(ureq, this.getWindowControl()); + listenTo(runtimeController); + toolbarPanel.rootController(re.getDisplayname(), runtimeController); + } else if(security.canLaunch()) { runtimeController = runtimeControllerCreator.create(ureq, getWindowControl(), toolbarPanel, re, reSecurity, assessmentMode); listenTo(runtimeController); toolbarPanel.rootController(re.getDisplayname(), runtimeController); diff --git a/src/main/java/org/olat/repository/ui/_content/corrupted_course.html b/src/main/java/org/olat/repository/ui/_content/corrupted_course.html new file mode 100644 index 0000000000000000000000000000000000000000..6069b3ff0554782da44007cc5dad1d56ba9d5962 --- /dev/null +++ b/src/main/java/org/olat/repository/ui/_content/corrupted_course.html @@ -0,0 +1 @@ +<div class="o_error">$r.translate("cif.error.corrupted")</div> \ No newline at end of file