From b08cb6fe7b0d306490007f306933be56200a798c Mon Sep 17 00:00:00 2001
From: srosse <stephane.rosse@frentix.com>
Date: Wed, 25 Mar 2020 18:48:28 +0100
Subject: [PATCH] OO-4584: add an secret option about breaout rooms in BBB

---
 .../bigbluebutton/BigBlueButtonMeetingTemplate.java  |  4 ++++
 .../manager/BigBlueButtonManagerImpl.java            |  2 ++
 .../model/BigBlueButtonMeetingTemplateImpl.java      | 12 ++++++++++++
 .../ui/EditBigBlueButtonTemplateController.java      |  7 +++++++
 .../ui/_i18n/LocalStrings_de.properties              |  1 +
 .../ui/_i18n/LocalStrings_en.properties              |  1 +
 .../database/mysql/alter_14_2_x_to_14_2_5.sql        |  1 +
 src/main/resources/database/mysql/setupDatabase.sql  |  1 +
 .../database/oracle/alter_14_2_x_to_14_2_5.sql       |  1 +
 src/main/resources/database/oracle/setupDatabase.sql |  1 +
 .../database/postgresql/alter_14_2_x_to_14_2_5.sql   |  1 +
 .../resources/database/postgresql/setupDatabase.sql  |  1 +
 12 files changed, 33 insertions(+)

diff --git a/src/main/java/org/olat/modules/bigbluebutton/BigBlueButtonMeetingTemplate.java b/src/main/java/org/olat/modules/bigbluebutton/BigBlueButtonMeetingTemplate.java
index 3d963472499..73a211b60d9 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/BigBlueButtonMeetingTemplate.java
+++ b/src/main/java/org/olat/modules/bigbluebutton/BigBlueButtonMeetingTemplate.java
@@ -72,6 +72,10 @@ public interface BigBlueButtonMeetingTemplate extends ModifiedInfo, CreateInfo {
 
 	public void setRecord(Boolean record);
 	
+	public Boolean getBreakoutRoomsEnabled();
+
+	public void setBreakoutRoomsEnabled(Boolean breakoutRoomsEnabled);
+	
 	public Boolean getMuteOnStart();
 
 	public void setMuteOnStart(Boolean muteOnStart);
diff --git a/src/main/java/org/olat/modules/bigbluebutton/manager/BigBlueButtonManagerImpl.java b/src/main/java/org/olat/modules/bigbluebutton/manager/BigBlueButtonManagerImpl.java
index 5e21ba35451..92b1cf674c3 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/manager/BigBlueButtonManagerImpl.java
+++ b/src/main/java/org/olat/modules/bigbluebutton/manager/BigBlueButtonManagerImpl.java
@@ -398,6 +398,8 @@ public class BigBlueButtonManagerImpl implements BigBlueButtonManager, Initializ
 			uriBuilder
 				.optionalParameter("maxParticipants", template.getMaxParticipants().intValue() + 1)
 				.optionalParameter("record", template.getRecord())
+				.optionalParameter("breakoutRoomsEnabled", template.getBreakoutRoomsEnabled())
+				
 				// video options
 				.optionalParameter("muteOnStart", template.getMuteOnStart())
 				.optionalParameter("autoStartRecording", template.getAutoStartRecording())
diff --git a/src/main/java/org/olat/modules/bigbluebutton/model/BigBlueButtonMeetingTemplateImpl.java b/src/main/java/org/olat/modules/bigbluebutton/model/BigBlueButtonMeetingTemplateImpl.java
index 14e9816315e..21c865415bb 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/model/BigBlueButtonMeetingTemplateImpl.java
+++ b/src/main/java/org/olat/modules/bigbluebutton/model/BigBlueButtonMeetingTemplateImpl.java
@@ -85,6 +85,8 @@ public class BigBlueButtonMeetingTemplateImpl implements Persistable, BigBlueBut
 	
 	@Column(name="b_record", nullable=true, insertable=true, updatable=true)
 	private Boolean record;
+	@Column(name="b_breakout", nullable=true, insertable=true, updatable=true)
+	private Boolean breakoutRoomsEnabled;
 	@Column(name="b_auto_start_recording", nullable=true, insertable=true, updatable=true)
 	private Boolean autoStartRecording;
 	@Column(name="b_allow_start_stop_recording", nullable=true, insertable=true, updatable=true)
@@ -237,6 +239,16 @@ public class BigBlueButtonMeetingTemplateImpl implements Persistable, BigBlueBut
 		this.record = record;
 	}
 
+	@Override
+	public Boolean getBreakoutRoomsEnabled() {
+		return breakoutRoomsEnabled;
+	}
+
+	@Override
+	public void setBreakoutRoomsEnabled(Boolean breakoutRoomsEnabled) {
+		this.breakoutRoomsEnabled = breakoutRoomsEnabled;
+	}
+
 	@Override
 	public Boolean getMuteOnStart() {
 		return muteOnStart;
diff --git a/src/main/java/org/olat/modules/bigbluebutton/ui/EditBigBlueButtonTemplateController.java b/src/main/java/org/olat/modules/bigbluebutton/ui/EditBigBlueButtonTemplateController.java
index 802ffbf2a3b..793555ab024 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/ui/EditBigBlueButtonTemplateController.java
+++ b/src/main/java/org/olat/modules/bigbluebutton/ui/EditBigBlueButtonTemplateController.java
@@ -64,6 +64,7 @@ public class EditBigBlueButtonTemplateController extends FormBasicController {
 	private TextElement maxDurationEl;
 	
 	private SingleSelection recordEl;
+	private SingleSelection breakoutEl;
 	private SingleSelection muteOnStartEl;
 	private SingleSelection autoStartRecordingEl;
 	private SingleSelection allowStartStopRecordingEl;
@@ -159,6 +160,11 @@ public class EditBigBlueButtonTemplateController extends FormBasicController {
 		recordEl.addActionListener(FormEvent.ONCHANGE);
 		select(record, recordEl, false);
 		
+		Boolean breakout = template == null ? null : template.getBreakoutRoomsEnabled();
+		breakoutEl = uifactory.addRadiosHorizontal("template.breakout", formLayout, yesNoKeys, onValues);
+		breakoutEl.addActionListener(FormEvent.ONCHANGE);
+		select(breakout, breakoutEl, true);
+		
 		Boolean autoStartRecording = template == null ? null : template.getAutoStartRecording();
 		autoStartRecordingEl = uifactory.addRadiosHorizontal("template.autoStartRecording", formLayout, yesNoKeys, onValues);
 		select(autoStartRecording, autoStartRecordingEl, false);
@@ -364,6 +370,7 @@ public class EditBigBlueButtonTemplateController extends FormBasicController {
 
 		boolean record = getSelected(recordEl);
 		template.setRecord(record);
+		template.setBreakoutRoomsEnabled(getSelected(breakoutEl));
 		template.setMuteOnStart(getSelected(muteOnStartEl));
 		template.setAutoStartRecording(record && getSelected(autoStartRecordingEl));
 		template.setAllowStartStopRecording(record && getSelected(allowStartStopRecordingEl));
diff --git a/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_de.properties b/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_de.properties
index 18778d87e1a..a7f7aa3ff1c 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_de.properties
+++ b/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_de.properties
@@ -86,6 +86,7 @@ table.header.webcams.only.moderator=Webcams Moderatoren
 template.allowModsToUnmuteUsers=Allow moderators to unmute users
 template.allowStartStopRecording=Allow to start / stop recording
 template.autoStartRecording=Auto start recording
+template.breakout=Breakout Meetings erlauben
 template.description=Beschreibung
 template.enabled=Vorlage einschalten
 template.explain.max.participants=Max. Anzahl von Teilnehmer: {0}
diff --git a/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_en.properties b/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_en.properties
index 23beb3a2625..e6e99d7b471 100644
--- a/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_en.properties
+++ b/src/main/java/org/olat/modules/bigbluebutton/ui/_i18n/LocalStrings_en.properties
@@ -86,6 +86,7 @@ table.header.webcams.only.moderator=Webcams moderators
 template.allowModsToUnmuteUsers=Allow moderators to unmute users
 template.allowStartStopRecording=Allow to start / stop recording
 template.autoStartRecording=Auto start recording
+template.breakout=Allow breakout meetings
 template.description=Description
 template.enabled=Enable template
 template.explain.max.participants=Max. number of participants: {0}
diff --git a/src/main/resources/database/mysql/alter_14_2_x_to_14_2_5.sql b/src/main/resources/database/mysql/alter_14_2_x_to_14_2_5.sql
index 1f8f18bef29..1acfaeb2723 100644
--- a/src/main/resources/database/mysql/alter_14_2_x_to_14_2_5.sql
+++ b/src/main/resources/database/mysql/alter_14_2_x_to_14_2_5.sql
@@ -11,6 +11,7 @@ create table o_bbb_template (
    b_max_participants int default null,
    b_max_duration bigint default null,
    b_record bool default null,
+   b_breakout bool default null,
    b_mute_on_start bool default null,
    b_auto_start_recording bool default null,
    b_allow_start_stop_recording bool default null,
diff --git a/src/main/resources/database/mysql/setupDatabase.sql b/src/main/resources/database/mysql/setupDatabase.sql
index 4216edafe04..7a27ca9977a 100644
--- a/src/main/resources/database/mysql/setupDatabase.sql
+++ b/src/main/resources/database/mysql/setupDatabase.sql
@@ -1231,6 +1231,7 @@ create table o_bbb_template (
    b_max_participants int default null,
    b_max_duration bigint default null,
    b_record bool default null,
+   b_breakout bool default null,
    b_mute_on_start bool default null,
    b_auto_start_recording bool default null,
    b_allow_start_stop_recording bool default null,
diff --git a/src/main/resources/database/oracle/alter_14_2_x_to_14_2_5.sql b/src/main/resources/database/oracle/alter_14_2_x_to_14_2_5.sql
index ea53dae9ed2..893242798d9 100644
--- a/src/main/resources/database/oracle/alter_14_2_x_to_14_2_5.sql
+++ b/src/main/resources/database/oracle/alter_14_2_x_to_14_2_5.sql
@@ -11,6 +11,7 @@ create table o_bbb_template (
    b_max_participants int default null,
    b_max_duration number default null,
    b_record number default null,
+   b_breakout number default null,
    b_mute_on_start number default null,
    b_auto_start_recording number default null,
    b_allow_start_stop_recording number default null,
diff --git a/src/main/resources/database/oracle/setupDatabase.sql b/src/main/resources/database/oracle/setupDatabase.sql
index d761f591f3f..9bfe0f0c975 100644
--- a/src/main/resources/database/oracle/setupDatabase.sql
+++ b/src/main/resources/database/oracle/setupDatabase.sql
@@ -1297,6 +1297,7 @@ create table o_bbb_template (
    b_max_participants int default null,
    b_max_duration number default null,
    b_record number default null,
+   b_breakout number default null,
    b_mute_on_start number default null,
    b_auto_start_recording number default null,
    b_allow_start_stop_recording number default null,
diff --git a/src/main/resources/database/postgresql/alter_14_2_x_to_14_2_5.sql b/src/main/resources/database/postgresql/alter_14_2_x_to_14_2_5.sql
index d354b512c6c..5860b15d591 100644
--- a/src/main/resources/database/postgresql/alter_14_2_x_to_14_2_5.sql
+++ b/src/main/resources/database/postgresql/alter_14_2_x_to_14_2_5.sql
@@ -11,6 +11,7 @@ create table o_bbb_template (
    b_max_participants int8 default null,
    b_max_duration int8 default null,
    b_record bool default null,
+   b_breakout bool default null,
    b_mute_on_start bool default null,
    b_auto_start_recording bool default null,
    b_allow_start_stop_recording bool default null,
diff --git a/src/main/resources/database/postgresql/setupDatabase.sql b/src/main/resources/database/postgresql/setupDatabase.sql
index 438b55748e5..0e5c75b34f0 100644
--- a/src/main/resources/database/postgresql/setupDatabase.sql
+++ b/src/main/resources/database/postgresql/setupDatabase.sql
@@ -1256,6 +1256,7 @@ create table o_bbb_template (
    b_max_participants int8 default null,
    b_max_duration int8 default null,
    b_record bool default null,
+   b_breakout bool default null,
    b_mute_on_start bool default null,
    b_auto_start_recording bool default null,
    b_allow_start_stop_recording bool default null,
-- 
GitLab