Merge branch 'master' of github.com:bigbluebutton/bigbluebutton into fix-chat-issues

This commit is contained in:
Richard Alam 2017-11-03 10:11:10 -07:00
commit 3698c08315
24 changed files with 147 additions and 103 deletions

View File

@ -23,8 +23,8 @@ object PermissionCheck {
}
}
private def roleToLevel(user: UserState): Int = {
if (user.presenter) PRESENTER_LEVEL else VIEWER_LEVEL
private def roleToLevel(users: Users2x, user: UserState): Int = {
if (Users2x.userIsInPresenterGroup(users, user.intId) || user.presenter) PRESENTER_LEVEL else VIEWER_LEVEL
}
/**
@ -42,8 +42,8 @@ object PermissionCheck {
case Some(user) =>
println("permissionToLevel = " + permissionToLevel(user) + " permissionLevel=" + permissionLevel)
val permLevelCheck = permissionToLevel(user) >= permissionLevel
println("roleToLevel = " + roleToLevel(user) + " roleLevel=" + roleLevel)
val roleLevelCheck = roleToLevel(user) >= roleLevel
println("roleToLevel = " + roleToLevel(users, user) + " roleLevel=" + roleLevel)
val roleLevelCheck = roleToLevel(users, user) >= roleLevel
println("PERMLEVELCHECK = " + permLevelCheck + " ROLELEVELCHECK=" + roleLevelCheck)
permLevelCheck && roleLevelCheck

View File

@ -3,13 +3,14 @@ package org.bigbluebutton.core.apps.polls
import org.bigbluebutton.common2.domain.PollVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Polls
import org.bigbluebutton.core.running.{ LiveMeeting }
import org.bigbluebutton.core.running.LiveMeeting
trait GetCurrentPollReqMsgHdlr {
this: PollApp2x =>
def handle(msgIn: GetCurrentPollReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def handle(msgIn: GetCurrentPollReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def broadcastEvent(msg: GetCurrentPollReqMsg, hasPoll: Boolean, pvo: Option[PollVO]): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
@ -22,7 +23,7 @@ trait GetCurrentPollReqMsgHdlr {
bus.outGW.send(msgEvent)
}
val pollVO = Polls.handleGetCurrentPollReqMsg(msgIn.header.userId, liveMeeting)
val pollVO = Polls.handleGetCurrentPollReqMsg(state, msgIn.header.userId, liveMeeting)
pollVO match {
case Some(poll) => {

View File

@ -3,13 +3,14 @@ package org.bigbluebutton.core.apps.polls
import org.bigbluebutton.common2.domain.SimplePollResultOutVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Polls
import org.bigbluebutton.core.running.{ LiveMeeting }
import org.bigbluebutton.core.running.LiveMeeting
trait ShowPollResultReqMsgHdlr {
this: PollApp2x =>
def handle(msg: ShowPollResultReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def handle(msg: ShowPollResultReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def broadcastEvent(msg: ShowPollResultReqMsg, result: SimplePollResultOutVO, annot: AnnotationVO): Unit = {
// PollShowResultEvtMsg
@ -34,7 +35,7 @@ trait ShowPollResultReqMsgHdlr {
}
for {
(result, annotationProp) <- Polls.handleShowPollResultReqMsg(msg.header.userId, msg.body.pollId, liveMeeting)
(result, annotationProp) <- Polls.handleShowPollResultReqMsg(state, msg.header.userId, msg.body.pollId, liveMeeting)
} yield {
broadcastEvent(msg, result, annotationProp)

View File

@ -3,13 +3,14 @@ package org.bigbluebutton.core.apps.polls
import org.bigbluebutton.common2.domain.SimplePollOutVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Polls
import org.bigbluebutton.core.running.{ LiveMeeting }
import org.bigbluebutton.core.running.LiveMeeting
trait StartCustomPollReqMsgHdlr {
this: PollApp2x =>
def handle(msg: StartCustomPollReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def handle(msg: StartCustomPollReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def broadcastEvent(msg: StartCustomPollReqMsg, poll: SimplePollOutVO): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
val envelope = BbbCoreEnvelope(PollStartedEvtMsg.NAME, routing)
@ -22,7 +23,7 @@ trait StartCustomPollReqMsgHdlr {
}
for {
pvo <- Polls.handleStartCustomPollReqMsg(msg.header.userId, msg.body.pollId, msg.body.pollType, msg.body.answers, liveMeeting)
pvo <- Polls.handleStartCustomPollReqMsg(state, msg.header.userId, msg.body.pollId, msg.body.pollType, msg.body.answers, liveMeeting)
} yield {
broadcastEvent(msg, pvo)
}

View File

@ -3,13 +3,14 @@ package org.bigbluebutton.core.apps.polls
import org.bigbluebutton.common2.domain.SimplePollOutVO
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Polls
import org.bigbluebutton.core.running.{ LiveMeeting, MeetingActor, OutMsgRouter }
import org.bigbluebutton.core.running.LiveMeeting
trait StartPollReqMsgHdlr {
this: PollApp2x =>
def handle(msg: StartPollReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def handle(msg: StartPollReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def broadcastEvent(msg: StartPollReqMsg, poll: SimplePollOutVO): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
@ -23,7 +24,7 @@ trait StartPollReqMsgHdlr {
}
for {
pvo <- Polls.handleStartPollReqMsg(msg.header.userId, msg.body.pollId, msg.body.pollType, liveMeeting)
pvo <- Polls.handleStartPollReqMsg(state, msg.header.userId, msg.body.pollId, msg.body.pollType, liveMeeting)
} yield {
broadcastEvent(msg, pvo)
}

View File

@ -2,6 +2,7 @@ package org.bigbluebutton.core.apps.polls
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.domain.MeetingState2x
import org.bigbluebutton.core.models.Polls
import org.bigbluebutton.core.running.LiveMeeting
@ -19,17 +20,13 @@ trait StopPollReqMsgHdlr {
bus.outGW.send(msgEvent)
}
def handle(msg: StopPollReqMsg, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
for {
stoppedPollId <- Polls.handleStopPollReqMsg(msg.header.userId, liveMeeting)
} yield {
broadcastPollStoppedEvtMsg(msg.header.userId, stoppedPollId, liveMeeting, bus)
}
def handle(msg: StopPollReqMsg, state: MeetingState2x, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
stopPoll(state, msg.header.userId, liveMeeting, bus)
}
def stopPoll(requesterId: String, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
def stopPoll(state: MeetingState2x, requesterId: String, liveMeeting: LiveMeeting, bus: MessageBus): Unit = {
for {
stoppedPollId <- Polls.handleStopPollReqMsg(requesterId, liveMeeting)
stoppedPollId <- Polls.handleStopPollReqMsg(state, requesterId, liveMeeting)
} yield {
broadcastPollStoppedEvtMsg(requesterId, stoppedPollId, liveMeeting, bus)
}

View File

@ -53,19 +53,6 @@ trait RemovePresentationPodPubMsgHdlr {
case None => state
}
// TODO check if requesterId == ownerId
// TODO check about notifying only the list of authorized?
// val respMsg = buildRemovePresentationPodEvtMsg(
// liveMeeting.props.meetingProp.intId,
// ownerId, pod.id
// )
// bus.outGW.send(respMsg)
//
// log.warning("RemovePresentationPodPubMsgHdlr new podId=" + pod.id)
//
// val pods = state.presentationPodManager.removePod(pod)
// state.update(pods)
}
}

View File

@ -13,17 +13,6 @@ trait RemoveUserFromPresenterGroupCmdMsgHdlr {
def handleRemoveUserFromPresenterGroupCmdMsg(msg: RemoveUserFromPresenterGroupCmdMsg) {
def broadcastRemoveUserFromPresenterGroup(meetingId: String, userId: String, requesterId: String): Unit = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(UserRemovedFromPresenterGroupEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(UserRemovedFromPresenterGroupEvtMsg.NAME, meetingId, userId)
val body = UserRemovedFromPresenterGroupEvtMsgBody(userId, requesterId)
val event = UserRemovedFromPresenterGroupEvtMsg(header, body)
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
outGW.send(msgEvent)
}
if (applyPermissionCheck && !PermissionCheck.isAllowed(PermissionCheck.MOD_LEVEL, PermissionCheck.VIEWER_LEVEL, liveMeeting.users2x, msg.header.userId)) {
val meetingId = liveMeeting.props.meetingProp.intId
val reason = "No permission to remove user from presenter group."
@ -37,7 +26,7 @@ trait RemoveUserFromPresenterGroupCmdMsgHdlr {
} yield {
if (requester.role == Roles.MODERATOR_ROLE) {
Users2x.removeUserFromPresenterGroup(liveMeeting.users2x, userId)
broadcastRemoveUserFromPresenterGroup(liveMeeting.props.meetingProp.intId, userId, requesterId)
outGW.send(buildRemoveUserFromPresenterGroup(liveMeeting.props.meetingProp.intId, userId, requesterId))
}
}
}

View File

@ -40,7 +40,12 @@ trait UserLeaveReqMsgHdlr {
)
// request ongoing poll to end
pollApp.stopPoll(u.intId, liveMeeting, msgBus)
pollApp.stopPoll(state, u.intId, liveMeeting, msgBus)
}
if (Users2x.userIsInPresenterGroup(liveMeeting.users2x, u.intId)) {
Users2x.removeUserFromPresenterGroup(liveMeeting.users2x, u.intId)
outGW.send(buildRemoveUserFromPresenterGroup(liveMeeting.props.meetingProp.intId, u.intId, u.intId))
}
def broadcastEvent(vu: VoiceUserState): Unit = {

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.core.models
import org.bigbluebutton.common2.domain._
import org.bigbluebutton.common2.msgs.AnnotationVO
import org.bigbluebutton.core.apps.WhiteboardKeyUtil
import org.bigbluebutton.core.domain.MeetingState2x
import scala.collection.mutable.ArrayBuffer
import scala.collection.mutable.HashMap
@ -10,7 +11,8 @@ import org.bigbluebutton.core.running.LiveMeeting
object Polls {
def handleStartPollReqMsg(userId: String, pollId: String, pollType: String, lm: LiveMeeting): Option[SimplePollOutVO] = {
def handleStartPollReqMsg(state: MeetingState2x, userId: String, pollId: String, pollType: String,
lm: LiveMeeting): Option[SimplePollOutVO] = {
def createPoll(pollId: String, numRespondents: Int): Option[Poll] = {
for {
poll <- PollFactory.createPoll(pollId, pollType, numRespondents, None)
@ -21,7 +23,9 @@ object Polls {
}
for {
page <- lm.presModel.getCurrentPage()
pod <- state.presentationPodManager.getDefaultPod()
pres <- pod.getCurrentPresentation()
page <- pres.getCurrentPage(pres)
pageId: String = if (pollId.contains("deskshare")) "deskshare" else page.id
stampedPollId: String = pageId + "/" + System.currentTimeMillis()
numRespondents: Int = Users2x.numUsers(lm.users2x) - 1 // subtract the presenter
@ -34,9 +38,11 @@ object Polls {
}
}
def handleStopPollReqMsg(userId: String, lm: LiveMeeting): Option[String] = {
def handleStopPollReqMsg(state: MeetingState2x, userId: String, lm: LiveMeeting): Option[String] = {
for {
page <- lm.presModel.getCurrentPage()
pod <- state.presentationPodManager.getDefaultPod()
pres <- pod.getCurrentPresentation()
page <- pres.getCurrentPage(pres)
curPoll <- getRunningPollThatStartsWith(page.id, lm.polls)
} yield {
stopPoll(curPoll.id, lm.polls)
@ -44,14 +50,16 @@ object Polls {
}
}
def handleShowPollResultReqMsg(requesterId: String, pollId: String, lm: LiveMeeting): Option[(SimplePollResultOutVO, AnnotationVO)] = {
def handleShowPollResultReqMsg(state: MeetingState2x, requesterId: String, pollId: String, lm: LiveMeeting): Option[(SimplePollResultOutVO, AnnotationVO)] = {
def updateWhiteboardAnnotation(annotation: AnnotationVO): AnnotationVO = {
lm.wbModel.updateAnnotation(annotation.wbId, annotation.userId, annotation)
}
def send(poll: SimplePollResultOutVO, shape: scala.collection.immutable.Map[String, Object]): Option[AnnotationVO] = {
for {
page <- lm.presModel.getCurrentPage()
pod <- state.presentationPodManager.getDefaultPod()
pres <- pod.getCurrentPresentation()
page <- pres.getCurrentPage(pres)
} yield {
val pageId = if (poll.id.contains("deskshare")) "deskshare" else page.id
val updatedShape = shape + ("whiteboardId" -> pageId)
@ -80,9 +88,11 @@ object Polls {
}
}
def handleGetCurrentPollReqMsg(requesterId: String, lm: LiveMeeting): Option[PollVO] = {
def handleGetCurrentPollReqMsg(state: MeetingState2x, requesterId: String, lm: LiveMeeting): Option[PollVO] = {
val poll = for {
page <- lm.presModel.getCurrentPage()
pod <- state.presentationPodManager.getDefaultPod()
pres <- pod.getCurrentPresentation()
page <- pres.getCurrentPage(pres)
curPoll <- getRunningPollThatStartsWith(page.id, lm.polls)
} yield curPoll
@ -113,7 +123,7 @@ object Polls {
}
def handleStartCustomPollReqMsg(requesterId: String, pollId: String, pollType: String,
def handleStartCustomPollReqMsg(state: MeetingState2x, requesterId: String, pollId: String, pollType: String,
answers: Seq[String], lm: LiveMeeting): Option[SimplePollOutVO] = {
def createPoll(pollId: String, numRespondents: Int): Option[Poll] = {
@ -126,7 +136,9 @@ object Polls {
}
for {
page <- lm.presModel.getCurrentPage()
pod <- state.presentationPodManager.getDefaultPod()
pres <- pod.getCurrentPresentation()
page <- pres.getCurrentPage(pres)
pageId: String = if (pollId.contains("deskshare")) "deskshare" else page.id
stampedPollId: String = pageId + "/" + System.currentTimeMillis()
numRespondents: Int = Users2x.numUsers(lm.users2x) - 1 // subtract the presenter

View File

@ -15,7 +15,7 @@ object PresentationPodFactory {
val currentPresenter = ownerId
// we hardcode the podId of the default presentation pod for the purposes of having bbb-web know the podId
// in advance (so we can fully process default.pdf) // TODO change to a generated podId
// in advance (so we can fully process default.pdf)
PresentationPod("DEFAULT_PRESENTATION_POD", ownerId, currentPresenter, Map.empty)
}
}
@ -35,6 +35,10 @@ case class PresentationInPod(id: String, name: String, current: Boolean = false,
}
}
def getCurrentPage(pres: PresentationInPod): Option[PageVO] = {
pres.pages.values find (p => p.current)
}
}
case class PresentationPod(id: String, ownerId: String, currentPresenter: String,
@ -116,6 +120,7 @@ case class PresentationPodManager(presentationPods: collection.immutable.Map[Str
def getNumberOfPods(): Int = presentationPods.size
def getPod(podId: String): Option[PresentationPod] = presentationPods.get(podId)
def getDefaultPod(): Option[PresentationPod] = presentationPods.get("DEFAULT_PRESENTATION_POD")
def getAllPresentationPodsInMeeting(): Vector[PresentationPod] = presentationPods.values.toVector
def updatePresentationPod(presPod: PresentationPod): PresentationPodManager = addPod(presPod)

View File

@ -218,4 +218,13 @@ trait HandlerHelpers extends SystemConfiguration {
BbbCommonEnvCoreMsg(envelope, event)
}
def buildRemoveUserFromPresenterGroup(meetingId: String, userId: String, requesterId: String): BbbCommonEnvCoreMsg = {
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, meetingId, userId)
val envelope = BbbCoreEnvelope(UserRemovedFromPresenterGroupEvtMsg.NAME, routing)
val header = BbbClientMsgHeader(UserRemovedFromPresenterGroupEvtMsg.NAME, meetingId, userId)
val body = UserRemovedFromPresenterGroupEvtMsgBody(userId, requesterId)
val event = UserRemovedFromPresenterGroupEvtMsg(header, body)
BbbCommonEnvCoreMsg(envelope, event)
}
}

View File

@ -243,12 +243,12 @@ class MeetingActor(
case m: ClientToServerLatencyTracerMsg => handleClientToServerLatencyTracerMsg(m)
// Poll
case m: StartPollReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: StartCustomPollReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: StopPollReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: ShowPollResultReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: StartPollReqMsg => pollApp.handle(m, state, liveMeeting, msgBus) // passing state but not modifying it
case m: StartCustomPollReqMsg => pollApp.handle(m, state, liveMeeting, msgBus) // passing state but not modifying it
case m: StopPollReqMsg => pollApp.handle(m, state, liveMeeting, msgBus) // passing state but not modifying it
case m: ShowPollResultReqMsg => pollApp.handle(m, state, liveMeeting, msgBus) // passing state but not modifying it
case m: HidePollResultReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: GetCurrentPollReqMsg => pollApp.handle(m, liveMeeting, msgBus)
case m: GetCurrentPollReqMsg => pollApp.handle(m, state, liveMeeting, msgBus) // passing state but not modifying it
case m: RespondToPollReqMsg => pollApp.handle(m, liveMeeting, msgBus)
// Breakout
@ -371,7 +371,7 @@ class MeetingActor(
def handlePresenterChange(msg: AssignPresenterReqMsg): Unit = {
// Stop poll if one is running as presenter left
pollApp.stopPoll(msg.header.userId, liveMeeting, msgBus)
pollApp.stopPoll(state, msg.header.userId, liveMeeting, msgBus)
// switch user presenter status for old and new presenter
usersApp.handleAssignPresenterReqMsg(msg)

View File

@ -509,6 +509,4 @@
<target name="modules" depends="init-ant-contrib, generate-html-wrapper, compile-screenshare-standalone,
build-webcam-preview-standalone, build-webcam-view-standalone, compile-bbb" description="Build BBB client without locales" />
<target name="cleanandmake" depends="clean-build-all" description="Build BBB client including locales" />
<target name="build-poll" depends="init-ant-contrib, build-polling" description="Build only the polling module." />
</project>

View File

@ -129,6 +129,7 @@ function stopWebRTCAudioTestJoinConference(){
transferTimeout = setTimeout( function() {
console.log("Call transfer failed. No response after 3 seconds");
webRTCCallback({'status': 'failed', 'errorcode': 1008});
releaseUserMedia();
currentSession = null;
if (userAgent != null) {
var userAgentTemp = userAgent;
@ -287,7 +288,7 @@ function webrtc_call(username, voiceBridge, callback, isListenOnly) {
}
// if the user requests to proceed as listen only (does not require media) or media is already acquired,
// proceed with making the call
if (isListenOnly || userMicMedia !== undefined) {
if (isListenOnly || userMicMedia != null) {
makeCallFunc();
} else {
callback({'status':'mediarequest'});
@ -387,6 +388,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
callTimeout = setTimeout(function() {
console.log('Ten seconds without updates sending timeout code');
callback({'status':'failed', 'errorcode': 1006}); // Failure on call
releaseUserMedia();
currentSession = null;
if (userAgent != null) {
var userAgentTemp = userAgent;
@ -414,6 +416,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
iceGatheringTimeout = setTimeout(function() {
console.log('Thirty seconds without ICE gathering finishing');
callback({'status':'failed', 'errorcode': 1011}); // ICE Gathering Failed
releaseUserMedia();
currentSession = null;
if (userAgent != null) {
var userAgentTemp = userAgent;
@ -439,6 +442,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
console.log('call failed with cause: '+ cause);
if (currentSession) {
releaseUserMedia();
if (callActive === false) {
callback({'status':'failed', 'errorcode': 1004, 'cause': cause}); // Failure on call
currentSession = null;
@ -463,7 +467,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
if (currentSession) {
console.log('call ended ' + currentSession.endTime);
releaseUserMedia();
if (callPurposefullyEnded === true) {
callback({'status':'ended'});
} else {
@ -480,6 +484,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
if (currentSession) {
console.log('call canceled');
releaseUserMedia();
clearTimeout(callTimeout);
currentSession = null;
} else {
@ -498,6 +503,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
iceConnectedTimeout = setTimeout(function() {
console.log('5 seconds without ICE finishing');
callback({'status':'failed', 'errorcode': 1010}); // ICE negotiation timeout
releaseUserMedia();
currentSession = null;
if (userAgent != null) {
var userAgentTemp = userAgent;
@ -511,6 +517,7 @@ function make_call(username, voiceBridge, server, callback, recall, isListenOnly
currentSession.mediaHandler.on('iceConnectionFailed', function() {
console.log('received ice negotiation failed');
callback({'status':'failed', 'errorcode': 1007}); // Failure on call
releaseUserMedia();
currentSession = null;
clearTimeout(iceConnectedTimeout);
if (userAgent != null) {
@ -564,6 +571,22 @@ function webrtc_hangup(callback) {
}
}
function releaseUserMedia() {
if (!!userMicMedia) {
console.log("Releasing media tracks");
userMicMedia.getAudioTracks().forEach(function(track) {
track.stop();
});
userMicMedia.getVideoTracks().forEach(function(track) {
track.stop();
});
userMicMedia = null;
}
}
function isWebRTCAvailable() {
if (bowser.msedge) {
return false;

View File

@ -7,7 +7,7 @@ package org.bigbluebutton.modules.polling.model
private var _currentPoll:SimplePoll;
private var _polls:ArrayCollection
private var _polls:ArrayCollection;
private var _initialized:Boolean = false;

View File

@ -41,8 +41,9 @@ package org.bigbluebutton.modules.polling.service
ans.push(new SimpleAnswer(Number(String(a.id)), a.key));
}
model.setCurrentPoll(new SimplePoll(pollId, ans));
dispatcher.dispatchEvent(new PollStartedEvent(new SimplePoll(pollId, ans)));
var simplePollInstance:SimplePoll = new SimplePoll(pollId, ans);
model.setCurrentPoll(simplePollInstance);
dispatcher.dispatchEvent(new PollStartedEvent(simplePollInstance));
}
public function handlePollStoppedMesage(msg:Object):void {

View File

@ -28,6 +28,7 @@ package org.bigbluebutton.modules.polling.service
import org.bigbluebutton.modules.polling.model.PollingModel;
import org.bigbluebutton.modules.polling.model.SimplePoll;
import org.bigbluebutton.modules.present.model.Presentation;
import org.bigbluebutton.modules.present.model.PresentationModel;
import org.bigbluebutton.modules.present.model.PresentationPodManager;
public class PollingService
@ -54,16 +55,19 @@ package org.bigbluebutton.modules.polling.service
private function generatePollId():String {
// TODO podId is currently not set (the call assumes only one presentation pod
// var curPres:Presentation = PresentationPodManager.getPod(this.podId).getCurrentPresentation();
// if (curPres != null) {
// var date:Date = new Date();
//
// var pollId:String;
// pollId = curPres.id + "/" + curPres.getCurrentPage().num + "/" + date.time;
//
// return pollId;
// }
var presentationModel: PresentationModel = PresentationPodManager.getInstance().getDefaultPresentationPod();
if (presentationModel == null) {
return null;
}
var curPres:Presentation = presentationModel.getCurrentPresentation();
if (curPres != null) {
var date:Date = new Date();
var pollId:String;
pollId = curPres.id + "/" + curPres.getCurrentPage().num + "/" + date.time;
return pollId;
}
return null;
}

View File

@ -49,8 +49,6 @@ package org.bigbluebutton.modules.present.managers
public class PresentManager
{
private const DEFAULT_POD_ID:String = "DEFAULT_PRESENTATION_POD";
private var globalDispatcher:Dispatcher;
private var winManager:PresentationWindowManager;
private var podsManager: PresentationPodManager;
@ -82,10 +80,10 @@ package org.bigbluebutton.modules.present.managers
var podId: String = e.podId;
var ownerId: String = e.ownerId;
if (podId == DEFAULT_POD_ID && winManager.containsPodId(podId)) {
if (podId == PresentationPodManager.DEFAULT_POD_ID && winManager.containsPodId(podId)) {
// update model
podsManager.updateOwnershipOfDefaultPod(ownerId);
var defWindow: PresentationWindow = winManager.findWindowByPodId(DEFAULT_POD_ID);
var defWindow: PresentationWindow = winManager.findWindowByPodId(PresentationPodManager.DEFAULT_POD_ID);
defWindow.setOwnerId(ownerId);
} else {
if (ownerId == "") {
@ -101,7 +99,7 @@ package org.bigbluebutton.modules.present.managers
newWindow.visible = true;
newWindow.showControls = presentOptions.showWindowControls;
var selectedWinId:String = winManager.addWindow(podId, newWindow, podId == DEFAULT_POD_ID);
var selectedWinId:String = winManager.addWindow(podId, newWindow, podId == PresentationPodManager.DEFAULT_POD_ID);
if (selectedWinId != null) {
newWindow.setWindowId(selectedWinId);

View File

@ -11,6 +11,7 @@ package org.bigbluebutton.modules.present.model {
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
import org.bigbluebutton.modules.present.events.PresentationPodRemoved;
import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent;
import org.bigbluebutton.modules.present.model.PresentationModel;
public class PresentationPodManager {
@ -22,6 +23,8 @@ package org.bigbluebutton.modules.present.model {
private var globalDispatcher:Dispatcher;
private var presentationService: PresentationService;
public static const DEFAULT_POD_ID:String = "DEFAULT_PRESENTATION_POD";
/**
* This class is a singleton. Please initialize it using the getInstance() method.
@ -72,6 +75,11 @@ package org.bigbluebutton.modules.present.model {
return resultingPod;
}
public function getDefaultPresentationPod(): PresentationModel {
var pod: PresentationModel = getPod(DEFAULT_POD_ID);
return pod || null;
}
public function handleAddPresentationPod(podId: String, ownerId: String): void {
for (var i:int = 0; i < _presentationPods.length; i++) {
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
@ -122,9 +130,11 @@ package org.bigbluebutton.modules.present.model {
}
public function updateOwnershipOfDefaultPod(ownerId: String): void {
var pod: PresentationModel = getPod("DEFAULT_PRESENTATION_POD");
var pod: PresentationModel = getDefaultPresentationPod();
if (pod != null) {
pod.setOwnerId(ownerId);
}
}
}
}

View File

@ -148,7 +148,7 @@ package org.bigbluebutton.modules.present.services
podManager.getPod(podId).removeAllPresentations();
}
public function removePresentation(podId: String, presentationID:String):void {
public function presentationWasRemoved(podId: String, presentationID:String):void {
var removedEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.PRESENTATION_REMOVED_EVENT, podId);
removedEvent.presentationName = presentationID;
dispatcher.dispatchEvent(removedEvent);

View File

@ -177,7 +177,7 @@ package org.bigbluebutton.modules.present.services.messaging
private function handleRemovePresentationEvtMsg(msg:Object):void {
var podId: String = msg.body.podId as String;
var presentationId: String = msg.body.presentationId as String;
service.removePresentation(podId, presentationId);
service.presentationWasRemoved(podId, presentationId);
}
private function handlePresentationConversionCompletedEvtMsg(msg:Object):void {

View File

@ -203,7 +203,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
listOfPodControls.push({label: ResourceUtil.getInstance().getString('bbb.presentation.multipod.controls.newPresentationWindowOpen'),
icon: getStyle('iconClearStatus'), handler: newPresentationWindowHandler});
if (this.podId != "DEFAULT_PRESENTATION_POD") {
if (this.podId != PresentationPodManager.DEFAULT_POD_ID) {
listOfPodControls.push({label: ResourceUtil.getInstance().getString('bbb.presentation.multipod.controls.closePresentationWindowOpen'),
icon: getStyle('iconClearStatus'), handler: closePresentationWindowHandler});
}
@ -295,9 +295,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
return;
}
}
// show podId
// presentationPodControls.selectedItem = presentationPodControls.dataProvider.getItemAt(0);
}
private function handleSetPresenterInPodRespEvent(event: SetPresenterInPodRespEvent): void {
@ -941,6 +938,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function pollStartedHandler(e:PollStartedEvent):void {
if (this.podId != PresentationPodManager.DEFAULT_POD_ID) {
return;
}
// the event for this doesn't exist yet
if (amITheCurrentPodPresenter()) {
// display the results view
@ -996,7 +996,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
pollVoteBox.visible = pollVoteBox.includeInLayout = true;
} else if (state == "presenter" && amITheCurrentPodPresenter()) {
if (this.podId == PresentationPodManager.DEFAULT_POD_ID) { // only allow polling from the default pod
pollStartBtn.visible = true;
}
fileAndPollControls.visible = fileAndPollControls.includeInLayout= true;
navigationControls.visible = navigationControls.includeInLayout= true;

View File

@ -418,7 +418,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
public function acceptOverlayCanvas(_podId: String, overlay:WhiteboardCanvas):void{
if (_podId != this.podId) {
if (_podId != this.podId || PresentationPodManager.getInstance().getPod(_podId) == null) {
return;
}