diff --git a/src/main/java/org/olat/modules/lecture/ui/TeacherLecturesTableController.java b/src/main/java/org/olat/modules/lecture/ui/TeacherLecturesTableController.java index 99aee667ce6285abc7f47f5704a4ad5a700da48c..3ee5fd46f08829bff919c9fb1e619fcd5146713c 100644 --- a/src/main/java/org/olat/modules/lecture/ui/TeacherLecturesTableController.java +++ b/src/main/java/org/olat/modules/lecture/ui/TeacherLecturesTableController.java @@ -69,6 +69,7 @@ import org.olat.modules.lecture.model.LectureBlockRow; import org.olat.modules.lecture.model.RollCallSecurityCallbackImpl; import org.olat.modules.lecture.ui.TeacherOverviewDataModel.TeachCols; import org.olat.modules.lecture.ui.component.LectureBlockStatusCellRenderer; +import org.olat.modules.lecture.ui.event.ReopenLectureBlockEvent; import org.olat.modules.lecture.ui.export.LectureBlockExport; import org.olat.modules.lecture.ui.export.LecturesBlockPDFExport; import org.olat.modules.lecture.ui.export.LecturesBlockSignaturePDFExport; @@ -216,7 +217,11 @@ public class TeacherLecturesTableController extends FormBasicController implemen @Override protected void event(UserRequest ureq, Controller source, Event event) { if(source == rollCallCtrl) { - if(event == Event.DONE_EVENT || event == Event.CANCELLED_EVENT || event == Event.CHANGED_EVENT) { + if(event instanceof ReopenLectureBlockEvent) { + LectureBlock lectureBlock = rollCallCtrl.getLectureBlock(); + toolbarPanel.popController(rollCallCtrl); + doSelectLectureBlock(ureq, lectureBlock); + } else if(event == Event.DONE_EVENT || event == Event.CANCELLED_EVENT || event == Event.CHANGED_EVENT) { fireEvent(ureq, event); } } else if(toolsCalloutCtrl == source) { diff --git a/src/main/java/org/olat/modules/lecture/ui/TeacherRollCallController.java b/src/main/java/org/olat/modules/lecture/ui/TeacherRollCallController.java index 96dfc803b267d52bca20285bbc5d49e62ff9cdcd..1d2543f165bbec08debd507c3c82c0266fa7fc11 100644 --- a/src/main/java/org/olat/modules/lecture/ui/TeacherRollCallController.java +++ b/src/main/java/org/olat/modules/lecture/ui/TeacherRollCallController.java @@ -68,6 +68,7 @@ import org.olat.modules.lecture.LectureService; import org.olat.modules.lecture.RollCallSecurityCallback; import org.olat.modules.lecture.ui.TeacherRollCallDataModel.RollCols; import org.olat.modules.lecture.ui.component.LectureBlockRollCallStatusItem; +import org.olat.modules.lecture.ui.event.ReopenLectureBlockEvent; import org.olat.user.UserManager; import org.olat.user.propertyhandlers.UserPropertyHandler; import org.springframework.beans.factory.annotation.Autowired; @@ -143,6 +144,10 @@ public class TeacherRollCallController extends FormBasicController { initForm(ureq); loadModel(); } + + public LectureBlock getLectureBlock() { + return lectureBlock; + } @Override protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) { @@ -654,10 +659,14 @@ public class TeacherRollCallController extends FormBasicController { private void doReopen(UserRequest ureq) { String before = lectureService.toAuditXml(lectureBlock); lectureBlock.setRollCallStatus(LectureRollCallStatus.reopen); + if(lectureBlock.getStatus() == LectureBlockStatus.cancelled) { + lectureBlock.setStatus(LectureBlockStatus.active); + } + lectureBlock = lectureService.save(lectureBlock, null); secCallback.updateLectureBlock(lectureBlock); updateUI(); - fireEvent(ureq, Event.CHANGED_EVENT); + fireEvent(ureq, new ReopenLectureBlockEvent()); String after = lectureService.toAuditXml(lectureBlock); lectureService.auditLog(LectureBlockAuditLog.Action.reopenLectureBlock, before, after, null, lectureBlock, null, lectureBlock.getEntry(), null, getIdentity()); diff --git a/src/main/java/org/olat/modules/lecture/ui/event/ReopenLectureBlockEvent.java b/src/main/java/org/olat/modules/lecture/ui/event/ReopenLectureBlockEvent.java new file mode 100644 index 0000000000000000000000000000000000000000..0857e4ab28b5d8a3e3bd668cd506d8b57bdce870 --- /dev/null +++ b/src/main/java/org/olat/modules/lecture/ui/event/ReopenLectureBlockEvent.java @@ -0,0 +1,39 @@ +/** + * <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.modules.lecture.ui.event; + +import org.olat.core.gui.control.Event; + +/** + * + * Initial date: 30 oct. 2017<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class ReopenLectureBlockEvent extends Event { + + private static final long serialVersionUID = -3616421988319250757L; + public static final String REOPEN_EVENT = "reopen-lecture-block-event"; + + public ReopenLectureBlockEvent() { + super(REOPEN_EVENT); + } + +}