From 9b997392f064f6dcdb16e9eaea69702025d63fc1 Mon Sep 17 00:00:00 2001 From: Ghazi Triki Date: Thu, 21 Sep 2017 20:12:59 +0100 Subject: [PATCH] Added new logoutTImer feature. --- .../api/ParamsProcessorUtil.java | 12 +++-- .../org/bigbluebutton/api/domain/Meeting.java | 13 +++++ .../locale/en_US/bbbResources.properties | 1 + .../src/org/bigbluebutton/core/model/Me.as | 1 + .../main/model/users/EnterApiResponse.as | 1 + .../main/model/users/JoinService.as | 1 + .../main/model/users/UserService.as | 3 +- .../main/views/IdleLogoutButton.mxml | 52 +++++++++++++++++++ .../bigbluebutton/main/views/MainToolbar.mxml | 10 +++- .../present/managers/PresentManager.as | 5 +- .../views/WhiteboardTextToolbar.mxml | 4 +- .../whiteboard/views/WhiteboardToolbar.mxml | 4 +- .../web/controllers/ApiController.groovy | 1 + 13 files changed, 98 insertions(+), 10 deletions(-) create mode 100644 bigbluebutton-client/src/org/bigbluebutton/main/views/IdleLogoutButton.mxml diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java index 774f3a28b3..7f6ae4a21f 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/ParamsProcessorUtil.java @@ -37,10 +37,6 @@ import java.util.regex.Pattern; import org.apache.commons.codec.digest.DigestUtils; import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.StringUtils; -import org.bigbluebutton.api.domain.Meeting; -import org.bigbluebutton.api.util.ParamsUtil; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.ClientProtocolException; @@ -49,6 +45,10 @@ import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.util.EntityUtils; +import org.bigbluebutton.api.domain.Meeting; +import org.bigbluebutton.api.util.ParamsUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class ParamsProcessorUtil { private static Logger log = LoggerFactory.getLogger(ParamsProcessorUtil.class); @@ -347,6 +347,7 @@ public class ParamsProcessorUtil { boolean record = processRecordMeeting(params.get("record")); int maxUsers = processMaxUser(params.get("maxParticipants")); int meetingDuration = processMeetingDuration(params.get("duration")); + int logoutTimer = processMeetingDuration(params.get("logoutTimer")); // set is breakout room property boolean isBreakout = false; @@ -442,6 +443,7 @@ public class ParamsProcessorUtil { .withMaxUsers(maxUsers).withModeratorPass(modPass) .withViewerPass(viewerPass).withRecording(record) .withDuration(meetingDuration).withLogoutUrl(logoutUrl) + .withLogoutTimer(logoutTimer) .withTelVoice(telVoice).withWebVoice(webVoice) .withDialNumber(dialNumber) .withDefaultAvatarURL(defaultAvatarURL) @@ -451,7 +453,7 @@ public class ParamsProcessorUtil { .withMetadata(meetingInfo) .withWelcomeMessageTemplate(welcomeMessageTemplate) .withWelcomeMessage(welcomeMessage).isBreakout(isBreakout) - .withGuestPolicy(guestPolicy) + .withGuestPolicy(guestPolicy) .build(); String configXML = getDefaultConfigXML(); diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java b/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java index ac8a3097f6..cd0fd6c939 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/api/domain/Meeting.java @@ -45,6 +45,7 @@ public class Meeting { private String welcomeMsg; private String modOnlyMessage = ""; private String logoutUrl; + private int logoutTimer = 0; private int maxUsers; private boolean record; private boolean autoStartRecording = false; @@ -76,6 +77,7 @@ public class Meeting { moderatorPass = builder.moderatorPass; maxUsers = builder.maxUsers; logoutUrl = builder.logoutUrl; + logoutTimer = builder.logoutTimer; defaultAvatarURL = builder.defaultAvatarURL; record = builder.record; autoStartRecording = builder.autoStartRecording; @@ -266,6 +268,10 @@ public class Meeting { public int getMaxUsers() { return maxUsers; } + + public int getLogoutTimer() { + return logoutTimer; + } public boolean isRecord() { return record; @@ -410,6 +416,7 @@ public class Meeting { private String welcomeMsgTemplate; private String welcomeMsg; private String logoutUrl; + private int logoutTimer; private Map metadata; private String dialNumber; private String defaultAvatarURL; @@ -508,6 +515,12 @@ public class Meeting { return this; } + public Builder withLogoutTimer(int l) { + logoutTimer = l; + return this; + } + + public Builder withMetadata(Map m) { metadata = m; return this; diff --git a/bigbluebutton-client/locale/en_US/bbbResources.properties b/bigbluebutton-client/locale/en_US/bbbResources.properties index 3d2a79a97d..fc10cc98f9 100755 --- a/bigbluebutton-client/locale/en_US/bbbResources.properties +++ b/bigbluebutton-client/locale/en_US/bbbResources.properties @@ -95,6 +95,7 @@ bbb.inactivityWarning.cancel = Cancel bbb.mainToolbar.helpBtn = Help bbb.mainToolbar.logoutBtn = Logout bbb.mainToolbar.logoutBtn.toolTip = Log Out +bbb.mainToolbar.idleLogoutBtn = {0} | Reset Logout Timer bbb.mainToolbar.langSelector = Select language bbb.mainToolbar.settingsBtn = Settings bbb.mainToolbar.settingsBtn.toolTip = Open Settings diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/model/Me.as b/bigbluebutton-client/src/org/bigbluebutton/core/model/Me.as index 6d51044bf5..9324ab8d6c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/model/Me.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/model/Me.as @@ -20,6 +20,7 @@ package org.bigbluebutton.core.model public var authToken:String = ""; public var layout:String = ""; public var logoutURL:String = ""; + public var logoutTimer:int=0; public var welcome:String = ""; public var avatarURL:String = ""; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/EnterApiResponse.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/EnterApiResponse.as index 9a95afeb8d..75e82373b0 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/EnterApiResponse.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/EnterApiResponse.as @@ -11,6 +11,7 @@ package org.bigbluebutton.main.model.users public var authToken: String; public var customdata:Object = new Object(); public var logoutUrl: String; + public var logoutTimer : int; public var defaultLayout: String; public var avatarURL: String; public var dialnumber: String; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/JoinService.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/JoinService.as index 1671901e23..4123ea0506 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/JoinService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/JoinService.as @@ -158,6 +158,7 @@ package org.bigbluebutton.main.model.users apiResponse.welcome = result.response.welcome; apiResponse.logoutUrl = processLogoutUrl(result.response); + apiResponse.logoutTimer = result.response.logoutTimer; apiResponse.defaultLayout = result.response.defaultLayout; apiResponse.avatarURL = result.response.avatarURL apiResponse.customdata = new Object(); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as index dce4e2d859..65d1389400 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/UserService.as @@ -103,7 +103,8 @@ package org.bigbluebutton.main.model.users LiveMeeting.inst().me.externalId = result.extUserId; LiveMeeting.inst().me.authToken = result.authToken; LiveMeeting.inst().me.layout = result.defaultLayout; - LiveMeeting.inst().me.logoutURL = result.logoutUrl; + LiveMeeting.inst().me.logoutURL = result.logoutUrl; + LiveMeeting.inst().me.logoutTimer = result.logoutTimer; LiveMeeting.inst().me.role = result.role; LiveMeeting.inst().me.welcome = result.welcome; LiveMeeting.inst().me.avatarURL = result.avatarURL; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/IdleLogoutButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/IdleLogoutButton.mxml new file mode 100644 index 0000000000..702b0354cf --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/IdleLogoutButton.mxml @@ -0,0 +1,52 @@ + + + + + = 10 ? "" : "0") + (remainingSeconds % 60); + + this.label = ResourceUtil.getInstance().getString("bbb.mainToolbar.idleLogoutBtn", [formattedTime]); + } + + private function timerCompleteEventHandler(event:TimerEvent):void { + this.visible = false; + + idleTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler); + idleTimer.addEventListener(TimerEvent.TIMER, timerEventHandler); + + var dispatcher:Dispatcher = new Dispatcher(); + setTimeout( function():void {dispatchEvent(new LogoutEvent(LogoutEvent.USER_LOGGED_OUT));}, 500); + } + ]]> + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml index c79431a49f..f0ecb8e80f 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml @@ -217,6 +217,12 @@ with BigBlueButton; if not, see . sequence = StringUtils.substringBefore(sequence, ")"); breakoutLabel.text = ResourceUtil.getInstance().getString("bbb.users.breakout.youareinroom", [sequence]); } + + if (LiveMeeting.inst().me.logoutTimer > 0 ) { + idleLogoutButton.startTimer(LiveMeeting.inst().me.logoutTimer); + } else { + rightBox.removeChild(idleLogoutButton); + } logFlashPlayerCapabilities(); } @@ -580,8 +586,10 @@ with BigBlueButton; if not, see . styleName="helpLinkButtonStyle" toolTip="{ResourceUtil.getInstance().getString('bbb.mainToolbar.helpBtn')}" accessibilityName="{ResourceUtil.getInstance().getString('bbb.micSettings.access.helpButton')}"/> + + toolTip="{ResourceUtil.getInstance().getString('bbb.mainToolbar.logoutBtn.toolTip')}" + right="10" height="30" click="confirmLogout()"/> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as index 6a79c5cce9..3cfc7d6945 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as @@ -26,6 +26,7 @@ package org.bigbluebutton.modules.present.managers import mx.core.FlexGlobals; import org.bigbluebutton.common.IBbbModuleWindow; + import org.bigbluebutton.common.events.CloseWindowEvent; import org.bigbluebutton.common.events.OpenWindowEvent; import org.bigbluebutton.core.Options; import org.bigbluebutton.core.PopUpUtil; @@ -57,7 +58,9 @@ package org.bigbluebutton.modules.present.managers } public function handleStopModuleEvent():void{ - presentWindow.close(); + var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT); + event.window = presentWindow; + globalDispatcher.dispatchEvent(event); } private function openWindow(window:IBbbModuleWindow):void{ diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardTextToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardTextToolbar.mxml index 021677edd3..faca26c77c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardTextToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardTextToolbar.mxml @@ -102,7 +102,9 @@ with BigBlueButton; if not, see . private function closeToolbar(e:StopWhiteboardModuleEvent):void{ closeMenus(); - parent.removeChild(this); + if (parent) { + parent.removeChild(this); + } } private function closeMenus() : void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml index a857dd2662..9720858c9f 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/views/WhiteboardToolbar.mxml @@ -261,7 +261,9 @@ with BigBlueButton; if not, see . } private function closeToolbar(e:StopWhiteboardModuleEvent):void { - parent.removeChild(this); + if (parent) { + parent.removeChild(this); + } } private function handleMouseIn(e:MouseEvent):void { diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index 7e269ad70e..1b66c241f2 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -1352,6 +1352,7 @@ class ApiController { mode = us.mode record = us.record isBreakout = meeting.isBreakout() + logoutTimer = meeting.getLogoutTimer() allowStartStopRecording = meeting.getAllowStartStopRecording() webcamsOnlyForModerator = meeting.getWebcamsOnlyForModerator() welcome = us.welcome