Added new logoutTImer feature.

This commit is contained in:
Ghazi Triki 2017-09-21 20:12:59 +01:00
parent e8f3205683
commit 9b997392f0
13 changed files with 98 additions and 10 deletions

View File

@ -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();

View File

@ -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<String, String> 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<String, String> m) {
metadata = m;
return this;

View File

@ -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

View File

@ -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 = "";

View File

@ -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;

View File

@ -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();

View File

@ -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;

View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Button xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
click="restartTimer()">
<fx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flash.utils.setTimeout;
import org.bigbluebutton.main.events.LogoutEvent;
import org.bigbluebutton.util.i18n.ResourceUtil;
private var idleTimer:Timer;
public function startTimer(minutes:int):void {
this.visible = true;
idleTimer = new Timer(1000, minutes * 60);
idleTimer.addEventListener(TimerEvent.TIMER, timerEventHandler);
idleTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEventHandler);
idleTimer.start();
}
private function restartTimer():void {
idleTimer.stop();
idleTimer.reset();
idleTimer.start();
}
private function timerEventHandler(event:TimerEvent):void {
var remainingSeconds:int = idleTimer.repeatCount - idleTimer.currentCount;
var formattedTime:String = (Math.floor(remainingSeconds / 60)) + ":" + (remainingSeconds % 60 >= 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);
}
]]>
</fx:Script>
</mx:Button>

View File

@ -217,6 +217,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
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 <http://www.gnu.org/licenses/>.
styleName="helpLinkButtonStyle"
toolTip="{ResourceUtil.getInstance().getString('bbb.mainToolbar.helpBtn')}"
accessibilityName="{ResourceUtil.getInstance().getString('bbb.micSettings.access.helpButton')}"/>
<views:IdleLogoutButton id="idleLogoutButton" height="30" visible="false" includeInLayout="{idleLogoutButton.visible}"/>
<mx:Button id="btnLogout" styleName="logoutButtonStyle"
toolTip="{ResourceUtil.getInstance().getString('bbb.mainToolbar.logoutBtn.toolTip')}" right="10" click="confirmLogout()" height="30"/>
toolTip="{ResourceUtil.getInstance().getString('bbb.mainToolbar.logoutBtn.toolTip')}"
right="10" height="30" click="confirmLogout()"/>
</mx:HBox>
</mx:HBox>

View File

@ -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{

View File

@ -102,7 +102,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function closeToolbar(e:StopWhiteboardModuleEvent):void{
closeMenus();
parent.removeChild(this);
if (parent) {
parent.removeChild(this);
}
}
private function closeMenus() : void {

View File

@ -261,7 +261,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function closeToolbar(e:StopWhiteboardModuleEvent):void {
parent.removeChild(this);
if (parent) {
parent.removeChild(this);
}
}
private function handleMouseIn(e:MouseEvent):void {

View File

@ -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