From bb75a02656013556be9a9cdc19bd719921a136ca Mon Sep 17 00:00:00 2001
From: uhensler <urs.hensler@frentix.com>
Date: Fri, 31 Aug 2018 15:09:26 +0200
Subject: [PATCH] OO-3304: Hide all OpenOLAT layout elements when executing
 quality survey

---
 .../quality/ui/ExecutionController.java       | 10 +++++-
 .../ExecutorParticipationsListController.java | 35 +++++++++----------
 .../quality/ui/QualityHomeController.java     |  2 +-
 .../quality/ui/_content/execution.html        |  9 +++++
 4 files changed, 35 insertions(+), 21 deletions(-)

diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
index c86a9580a82..776489d7dad 100644
--- a/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
+++ b/src/main/java/org/olat/modules/quality/ui/ExecutionController.java
@@ -27,6 +27,8 @@ import java.util.List;
 
 import org.olat.core.gui.UserRequest;
 import org.olat.core.gui.components.Component;
+import org.olat.core.gui.components.link.Link;
+import org.olat.core.gui.components.link.LinkFactory;
 import org.olat.core.gui.components.velocity.VelocityContainer;
 import org.olat.core.gui.control.Controller;
 import org.olat.core.gui.control.Event;
@@ -58,6 +60,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 public class ExecutionController extends BasicController {
 
 	private VelocityContainer mainVC;
+	private Link back;
 	private Controller executionCtrl;
 	
 	private final QualityExecutorParticipation qualityParticipation;
@@ -77,6 +80,9 @@ public class ExecutionController extends BasicController {
 	}
 
 	protected void initVelocityContainer(UserRequest ureq) {
+		back = LinkFactory.createLinkBack(mainVC, this);
+		mainVC.put("back", back);
+		
 		mainVC.contextPut("title", qualityParticipation.getTitle());
 		mainVC.contextPut("contexts", createContextWrappers());
 		
@@ -235,7 +241,9 @@ public class ExecutionController extends BasicController {
 
 	@Override
 	protected void event(UserRequest ureq, Component source, Event event) {
-		//
+		if (source == back) {
+			fireEvent(ureq, Event.CLOSE_EVENT);
+		}
 	}
 
 	@Override
diff --git a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
index 9f829191912..1aae51bad80 100644
--- a/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
+++ b/src/main/java/org/olat/modules/quality/ui/ExecutorParticipationsListController.java
@@ -27,7 +27,6 @@ import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 
-import org.olat.core.commons.fullWebApp.LayoutMain3ColsBackController;
 import org.olat.core.gui.UserRequest;
 import org.olat.core.gui.components.form.flexible.FormItem;
 import org.olat.core.gui.components.form.flexible.FormItemContainer;
@@ -40,9 +39,10 @@ import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTable
 import org.olat.core.gui.components.form.flexible.impl.elements.table.FlexiTableDataModelFactory;
 import org.olat.core.gui.components.form.flexible.impl.elements.table.SelectionEvent;
 import org.olat.core.gui.components.form.flexible.impl.elements.table.StaticFlexiCellRenderer;
-import org.olat.core.gui.components.stack.TooledStackedPanel;
+import org.olat.core.gui.control.ChiefController;
 import org.olat.core.gui.control.Controller;
 import org.olat.core.gui.control.Event;
+import org.olat.core.gui.control.ScreenMode.Mode;
 import org.olat.core.gui.control.WindowControl;
 import org.olat.core.gui.control.generic.dtabs.Activateable2;
 import org.olat.core.id.OLATResourceable;
@@ -74,15 +74,12 @@ public class ExecutorParticipationsListController extends FormBasicController im
 	private FlexiTableElement tableEl;
 
 	private ExecutionController executionCtrl;
-	private LayoutMain3ColsBackController fullLayoutCtrl;
 	
-	private final TooledStackedPanel stackPanel;
 	private final QualitySecurityCallback secCallback;
 
 	public ExecutorParticipationsListController(UserRequest ureq, WindowControl wControl,
-			TooledStackedPanel stackPanel, QualitySecurityCallback secCallback) {
+			QualitySecurityCallback secCallback) {
 		super(ureq, wControl, LAYOUT_BAREBONE);
-		this.stackPanel = stackPanel;
 		this.secCallback = secCallback;
 		initForm(ureq);
 	}
@@ -161,29 +158,31 @@ public class ExecutorParticipationsListController extends FormBasicController im
 	
 	@Override
 	protected void event(UserRequest ureq, Controller source, Event event) {
-		if (source == executionCtrl && event == Event.DONE_EVENT) {
-			showInfo("executor.participation.future.done.message");
-			doDeactivateExecution(ureq);
-		} else if (source == fullLayoutCtrl) {
-			doDeactivateExecution(ureq);
+		if (source == executionCtrl) {
+			if (event == Event.DONE_EVENT) {
+				showInfo("executor.participation.future.done.message");
+				doDeactivateExecution(ureq);
+			} else if (event == Event.CLOSE_EVENT) {
+				doDeactivateExecution(ureq);
+			}
 		}
 		super.event(ureq, source, event);
 	}
 
 	private void doDeactivateExecution(UserRequest ureq) {
 		addToHistory(ureq, this);
-		fullLayoutCtrl.deactivate();
+		getWindowControl().pop();
+		getWindowControl().getWindowBackOffice().getChiefController().getScreenMode().setMode(Mode.standard);
 		cleanUp();
 		tableEl.reloadData();
 	}
 
 	private void cleanUp() {
-		removeAsListenerAndDispose(fullLayoutCtrl);
 		removeAsListenerAndDispose(executionCtrl);
-		fullLayoutCtrl = null;
 		executionCtrl = null;
 	}
 
+	@SuppressWarnings("deprecation")
 	private void doExecute(UserRequest ureq, QualityExecutorParticipation participation) {
 		if (FUTURE.equals(participation.getExecutionStatus())) {
 			showInfo("executor.participation.future", participation.getTitle());
@@ -205,11 +204,9 @@ public class ExecutorParticipationsListController extends FormBasicController im
 		executionCtrl = new ExecutionController(ureq, bwControl, participation);
 		listenTo(executionCtrl);
 		
-		fullLayoutCtrl = new LayoutMain3ColsBackController(ureq, getWindowControl(), null,
-				executionCtrl.getInitialComponent(), null);
-		fullLayoutCtrl.addDisposableChildController(executionCtrl);
-		fullLayoutCtrl.activate();
-		listenTo(fullLayoutCtrl);
+		ChiefController cc = getWindowControl().getWindowBackOffice().getChiefController();
+		cc.getScreenMode().setMode(Mode.full);
+		getWindowControl().pushToMainArea(executionCtrl.getInitialComponent());
 	}
 
 	@Override
diff --git a/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java b/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java
index 3d7e00945c8..0b301e7393a 100644
--- a/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java
+++ b/src/main/java/org/olat/modules/quality/ui/QualityHomeController.java
@@ -144,7 +144,7 @@ public class QualityHomeController extends BasicController implements Activateab
 		stackPanel.popUpToRootController(ureq);
 		OLATResourceable ores = OresHelper.createOLATResourceableInstance(ORES_MY_TYPE, 0l);
 		WindowControl bwControl = addToHistory(ureq, ores, null);
-		executorParticipationListCtrl = new ExecutorParticipationsListController(ureq, bwControl, stackPanel, secCallback);
+		executorParticipationListCtrl = new ExecutorParticipationsListController(ureq, bwControl, secCallback);
 		listenTo(executorParticipationListCtrl);
 		stackPanel.pushController(translate("breadcrumb.executor.participations"), executorParticipationListCtrl);
 	}
diff --git a/src/main/java/org/olat/modules/quality/ui/_content/execution.html b/src/main/java/org/olat/modules/quality/ui/_content/execution.html
index be65335da6e..34aa693574c 100644
--- a/src/main/java/org/olat/modules/quality/ui/_content/execution.html
+++ b/src/main/java/org/olat/modules/quality/ui/_content/execution.html
@@ -1,3 +1,12 @@
+#if($r.available("back"))
+	<div id="o_back_wrapper" class="o_toolbar clearfix">
+		<div class="o_breadcrumb">
+			<ol class="breadcrumb">
+				<li>$r.render("back")</li>
+			</ol>
+		</div>
+	</div>
+#end
 <div class="o_qual_execute">
 	#if( $r.isNotNull($title) )
 		<h2>$r.escapeHtml($title)</h2>
-- 
GitLab