Merge pull request #2725 from ritzalam/implement-custom-poll
Implement custom poll
This commit is contained in:
commit
2e7238ae74
@ -50,7 +50,7 @@ libraryDependencies ++= {
|
||||
"com.google.code.gson" % "gson" % "1.7.1",
|
||||
"redis.clients" % "jedis" % "2.1.0",
|
||||
"org.apache.commons" % "commons-lang3" % "3.2",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.11"
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.12"
|
||||
)}
|
||||
|
||||
|
||||
|
@ -1,10 +1,12 @@
|
||||
package org.bigbluebutton.core.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bigbluebutton.common.messages.*;
|
||||
|
||||
public interface IBigBlueButtonInGW {
|
||||
|
||||
void handleBigBlueButtonMessage(IBigBlueButtonMessage message);
|
||||
|
||||
void isAliveAudit(String aliveID);
|
||||
void statusMeetingAudit(String meetingID);
|
||||
void endMeeting(String meetingID);
|
||||
|
@ -6,7 +6,7 @@ import org.bigbluebutton.common.messages.CreateMeetingMessage;
|
||||
import org.bigbluebutton.common.messages.DestroyMeetingMessage;
|
||||
import org.bigbluebutton.common.messages.EndMeetingMessage;
|
||||
import org.bigbluebutton.common.messages.GetAllMeetingsRequest;
|
||||
import org.bigbluebutton.common.messages.IPublishedMessage;
|
||||
import org.bigbluebutton.common.messages.IBigBlueButtonMessage;
|
||||
import org.bigbluebutton.common.messages.KeepAliveMessage;
|
||||
import org.bigbluebutton.common.messages.MessageFromJsonConverter;
|
||||
import org.bigbluebutton.common.messages.MessagingConstants;
|
||||
@ -33,7 +33,7 @@ public class MeetingMessageReceiver implements MessageHandler {
|
||||
// LOG.debug("Checking message: " + pattern + " " + channel + " " + message);
|
||||
if (channel.equalsIgnoreCase(MessagingConstants.TO_MEETING_CHANNEL)) {
|
||||
// System.out.println("Meeting message: " + channel + " " + message);
|
||||
IPublishedMessage msg = MessageFromJsonConverter.convert(message);
|
||||
IBigBlueButtonMessage msg = MessageFromJsonConverter.convert(message);
|
||||
|
||||
if (msg != null) {
|
||||
if (msg instanceof EndMeetingMessage) {
|
||||
@ -96,7 +96,7 @@ public class MeetingMessageReceiver implements MessageHandler {
|
||||
System.out.println("Failed to decode message: [" + message + "]");
|
||||
}
|
||||
} else if (channel.equalsIgnoreCase(MessagingConstants.TO_SYSTEM_CHANNEL)) {
|
||||
IPublishedMessage msg = MessageFromJsonConverter.convert(message);
|
||||
IBigBlueButtonMessage msg = MessageFromJsonConverter.convert(message);
|
||||
|
||||
if (msg != null) {
|
||||
if (msg instanceof KeepAliveMessage) {
|
||||
|
@ -2,6 +2,7 @@ package org.bigbluebutton.core.pubsub.receivers;
|
||||
|
||||
import org.bigbluebutton.common.messages.*;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
@ -40,6 +41,10 @@ public class PollingMessageReceiver implements MessageHandler{
|
||||
} else if (ShowPollResultRequestMessage.SHOW_POLL_RESULT_REQUEST.equals(messageName)){
|
||||
ShowPollResultRequestMessage msg = ShowPollResultRequestMessage.fromJson(message);
|
||||
bbbGW.showPollResult(msg.meetingId, msg.requesterId, msg.pollId, msg.show);
|
||||
} else if (StartCustomPollRequestMessage.START_CUSTOM_POLL_REQUEST.equals(messageName)){
|
||||
Gson gson = new Gson();
|
||||
StartCustomPollRequestMessage msg = gson.fromJson(message, StartCustomPollRequestMessage.class);
|
||||
bbbGW.handleBigBlueButtonMessage(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,11 +15,21 @@ import scala.concurrent.duration._
|
||||
import scala.util.Success
|
||||
import scala.util.Failure
|
||||
import org.bigbluebutton.core.service.recorder.RecorderApplication
|
||||
import org.bigbluebutton.common.messages.IBigBlueButtonMessage;
|
||||
import org.bigbluebutton.common.messages.StartCustomPollRequestMessage
|
||||
|
||||
class BigBlueButtonInGW(val system: ActorSystem, recorderApp: RecorderApplication, messageSender: MessageSender, voiceEventRecorder: VoiceEventRecorder) extends IBigBlueButtonInGW {
|
||||
val log = system.log
|
||||
val bbbActor = system.actorOf(BigBlueButtonActor.props(system, recorderApp, messageSender, voiceEventRecorder), "bigbluebutton-actor")
|
||||
|
||||
def handleBigBlueButtonMessage(message: IBigBlueButtonMessage) {
|
||||
message match {
|
||||
case msg: StartCustomPollRequestMessage => {
|
||||
bbbActor ! new StartCustomPollRequest(msg.payload.meetingId, msg.payload.requesterId, msg.payload.pollType, msg.payload.answers)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Meeting
|
||||
def createMeeting2(meetingID: String, externalMeetingID: String, meetingName: String, record: Boolean,
|
||||
voiceBridge: String, duration: Long, autoStartRecording: Boolean,
|
||||
|
@ -154,8 +154,8 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: OutMessageGateway)
|
||||
handleSetRecordingStatus(msg)
|
||||
case msg: GetRecordingStatus =>
|
||||
handleGetRecordingStatus(msg)
|
||||
// case msg: CreatePollRequest =>
|
||||
// handleCreatePollRequest(msg)
|
||||
case msg: StartCustomPollRequest =>
|
||||
handleStartCustomPollRequest(msg)
|
||||
case msg: StartPollRequest =>
|
||||
handleStartPollRequest(msg)
|
||||
case msg: StopPollRequest =>
|
||||
|
@ -78,6 +78,7 @@ case class PresentationConversionCompleted(meetingID: String, messageKey: String
|
||||
|
||||
// Polling
|
||||
//case class CreatePollRequest(meetingID: String, requesterId: String, pollId: String, pollType: String) extends InMessage
|
||||
case class StartCustomPollRequest(meetingID: String, requesterId: String, pollType: String, answers: Seq[String]) extends InMessage
|
||||
case class StartPollRequest(meetingID: String, requesterId: String, pollType: String) extends InMessage
|
||||
case class StopPollRequest(meetingID: String, requesterId: String) extends InMessage
|
||||
case class ShowPollResultRequest(meetingID: String, requesterId: String, pollId: String) extends InMessage
|
||||
|
@ -6,9 +6,9 @@ import scala.collection.mutable.ArrayBuffer
|
||||
object PollType {
|
||||
val YesNoPollType = "YN"
|
||||
val TrueFalsePollType = "TF"
|
||||
val CustomPollType = "CUSTOM"
|
||||
val LetterPollType = "A-"
|
||||
val NumberPollType = "1-"
|
||||
|
||||
}
|
||||
|
||||
object PollFactory {
|
||||
@ -70,7 +70,30 @@ object PollFactory {
|
||||
questionOption
|
||||
}
|
||||
|
||||
private def createQuestion(qType: String): Option[Question] = {
|
||||
private def buildAnswers(answers: Seq[String]): Array[Answer] = {
|
||||
val ans = new Array[Answer](answers.length)
|
||||
for (i <- 0 until answers.length) {
|
||||
ans(i) = new Answer(i, answers(i), Some(answers(i)))
|
||||
}
|
||||
|
||||
ans
|
||||
}
|
||||
|
||||
private def processCustomPollType(qType: String, multiResponse: Boolean, answers: Option[Seq[String]]): Option[Question] = {
|
||||
var questionOption: Option[Question] = None
|
||||
|
||||
answers.foreach { ans =>
|
||||
val someAnswers = buildAnswers(ans)
|
||||
val question = new Question(0, PollType.CustomPollType, multiResponse, None, someAnswers)
|
||||
questionOption = Some(question)
|
||||
}
|
||||
|
||||
questionOption
|
||||
}
|
||||
|
||||
private def createQuestion(qType: String, answers: Option[Seq[String]]): Option[Question] = {
|
||||
println("**** Creating quesion")
|
||||
|
||||
val qt = qType.toUpperCase()
|
||||
var questionOption: Option[Question] = None
|
||||
|
||||
@ -78,19 +101,21 @@ object PollFactory {
|
||||
questionOption = Some(processYesNoPollType(qt))
|
||||
} else if (qt.matches(PollType.TrueFalsePollType)) {
|
||||
questionOption = Some(processTrueFalsePollType(qt))
|
||||
} else if (qt.matches(PollType.CustomPollType)) {
|
||||
questionOption = processCustomPollType(qt, false, answers)
|
||||
} else if (qt.startsWith(PollType.LetterPollType)) {
|
||||
questionOption = processLetterPollType(qt, false)
|
||||
} else if (qt.startsWith(PollType.NumberPollType)) {
|
||||
processNumberPollType(qt, false)
|
||||
questionOption = processNumberPollType(qt, false)
|
||||
}
|
||||
|
||||
questionOption
|
||||
}
|
||||
|
||||
def createPoll(id: String, pollType: String, numRespondents: Int): Option[Poll] = {
|
||||
def createPoll(id: String, pollType: String, numRespondents: Int, answers: Option[Seq[String]]): Option[Poll] = {
|
||||
var poll: Option[Poll] = None
|
||||
|
||||
createQuestion(pollType) match {
|
||||
createQuestion(pollType, answers) match {
|
||||
case Some(question) => {
|
||||
poll = Some(new Poll(id, Array(question), numRespondents, None))
|
||||
}
|
||||
|
@ -135,6 +135,28 @@ trait PollApp {
|
||||
}
|
||||
}
|
||||
|
||||
def handleStartCustomPollRequest(msg: StartCustomPollRequest) {
|
||||
log.debug("Received StartCustomPollRequest for pollType=[" + msg.pollType + "]")
|
||||
|
||||
presModel.getCurrentPage() foreach { page =>
|
||||
val pollId = page.id + "/" + System.currentTimeMillis()
|
||||
|
||||
val numRespondents = usersModel.numUsers() - 1 // subtract the presenter
|
||||
PollFactory.createPoll(pollId, msg.pollType, numRespondents, Some(msg.answers)) foreach (poll => pollModel.addPoll(poll))
|
||||
|
||||
pollModel.getSimplePoll(pollId) match {
|
||||
case Some(poll) => {
|
||||
pollModel.startPoll(poll.id)
|
||||
outGW.send(new PollStartedMessage(mProps.meetingID, mProps.recorded, msg.requesterId, pollId, poll))
|
||||
}
|
||||
case None => {
|
||||
val result = new RequestResult(StatusCodes.NOT_FOUND, Some(Array(ErrorCodes.RESOURCE_NOT_FOUND)))
|
||||
sender ! new StartPollReplyMessage(mProps.meetingID, mProps.recorded, result, msg.requesterId, pollId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def handleStartPollRequest(msg: StartPollRequest) {
|
||||
log.debug("Received StartPollRequest for pollType=[" + msg.pollType + "]")
|
||||
|
||||
@ -142,7 +164,7 @@ trait PollApp {
|
||||
val pollId = page.id + "/" + System.currentTimeMillis()
|
||||
|
||||
val numRespondents = usersModel.numUsers() - 1 // subtract the presenter
|
||||
PollFactory.createPoll(pollId, msg.pollType, numRespondents) foreach (poll => pollModel.addPoll(poll))
|
||||
PollFactory.createPoll(pollId, msg.pollType, numRespondents, None) foreach (poll => pollModel.addPoll(poll))
|
||||
|
||||
pollModel.getSimplePoll(pollId) match {
|
||||
case Some(poll) => {
|
||||
|
@ -26,7 +26,7 @@ class RedisPublisher(val system: ActorSystem) extends SystemConfiguration {
|
||||
// system.scheduler.schedule(2 seconds, 5 seconds)(redis.publish("bigbluebutton:to-bbb-apps:users", "pattern value"))
|
||||
|
||||
def publish(channel: String, data: String) {
|
||||
// println("PUBLISH TO [" + channel + "]: \n [" + data + "]")
|
||||
println("PUBLISH TO [" + channel + "]: \n [" + data + "]")
|
||||
redis.publish(channel, data)
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ libraryDependencies ++= {
|
||||
"com.google.code.gson" % "gson" % "1.7.1",
|
||||
"redis.clients" % "jedis" % "2.1.0",
|
||||
"org.apache.commons" % "commons-lang3" % "3.2",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.11",
|
||||
"org.bigbluebutton" % "bbb-common-message" % "0.0.12",
|
||||
"org.bigbluebutton" % "bbb-fsesl-client" % "0.0.2"
|
||||
)}
|
||||
|
||||
|
@ -4,7 +4,7 @@ name := "bbb-common-message"
|
||||
|
||||
organization := "org.bigbluebutton"
|
||||
|
||||
version := "0.0.11"
|
||||
version := "0.0.12"
|
||||
|
||||
// We want to have our jar files in lib_managed dir.
|
||||
// This way we'll have the right path when we import
|
||||
@ -20,6 +20,9 @@ libraryDependencies ++= {
|
||||
"com.google.code.gson" % "gson" % "1.7.1"
|
||||
)}
|
||||
|
||||
libraryDependencies += "junit" % "junit" % "4.11" % "test"
|
||||
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
|
||||
|
||||
seq(Revolver.settings: _*)
|
||||
|
||||
//-----------
|
||||
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class AssignPresenterRequestMessage implements IPublishedMessage {
|
||||
public class AssignPresenterRequestMessage implements IBigBlueButtonMessage {
|
||||
public static final String ASSIGN_PRESENTER_REQUEST = "assign_presenter_request_message";
|
||||
public final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class CreateMeetingMessage implements IPublishedMessage {
|
||||
public class CreateMeetingMessage implements IBigBlueButtonMessage {
|
||||
public static final String CREATE_MEETING_REQUEST_EVENT = "create_meeting_request";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class DestroyMeetingMessage implements IPublishedMessage {
|
||||
public class DestroyMeetingMessage implements IBigBlueButtonMessage {
|
||||
public static final String DESTROY_MEETING_REQUEST_EVENT = "destroy_meeting_request_event";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class DisconnectAllUsersMessage implements IPublishedMessage {
|
||||
public class DisconnectAllUsersMessage implements IBigBlueButtonMessage {
|
||||
public static final String DISCONNECT_All_USERS = "disconnect_all_users_message";
|
||||
public final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class DisconnectUserMessage implements IPublishedMessage {
|
||||
public class DisconnectUserMessage implements IBigBlueButtonMessage {
|
||||
public static final String DISCONNECT_USER = "disconnect_user_message";
|
||||
public final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class EndMeetingMessage implements IPublishedMessage {
|
||||
public class EndMeetingMessage implements IBigBlueButtonMessage {
|
||||
public static final String END_MEETING_REQUEST_EVENT = "end_meeting_request_event";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class GetAllMeetingsRequest implements IPublishedMessage {
|
||||
public class GetAllMeetingsRequest implements IBigBlueButtonMessage {
|
||||
public static final String GET_ALL_MEETINGS_REQUEST_EVENT = "get_all_meetings_request";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetChatHistory implements IPublishedMessage {
|
||||
public class GetChatHistory implements IBigBlueButtonMessage {
|
||||
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -3,7 +3,7 @@ package org.bigbluebutton.common.messages;
|
||||
import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
public class GetChatHistoryRequestMessage implements IPublishedMessage {
|
||||
public class GetChatHistoryRequestMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_CHAT_HISTORY_REQUEST = "get_chat_history_request";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetLockSettingsMessage implements IPublishedMessage {
|
||||
public class GetLockSettingsMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_LOCK_SETTINGS = "get_lock_settings";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetPresentationInfoMessage implements IPublishedMessage {
|
||||
public class GetPresentationInfoMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_PRESENTATION_INFO = "get_presentation_info";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -8,7 +8,7 @@ import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetPresentationInfoReplyMessage implements IPublishedMessage {
|
||||
public class GetPresentationInfoReplyMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_PRESENTATION_INFO_REPLY = "get_presentation_info_reply";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetSlideInfoMessage implements IPublishedMessage {
|
||||
public class GetSlideInfoMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_SLIDE_INFO = "get_slide_info";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GetUsersRequestMessage implements IPublishedMessage {
|
||||
public class GetUsersRequestMessage implements IBigBlueButtonMessage {
|
||||
public static final String GET_USERS_REQUEST = "get_users_request_message";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class GoToSlideMessage implements IPublishedMessage {
|
||||
public class GoToSlideMessage implements IBigBlueButtonMessage {
|
||||
public static final String GO_TO_SLIDE = "go_to_slide";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public interface IPublishedMessage {
|
||||
public interface IBigBlueButtonMessage {
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class KeepAliveMessage implements IPublishedMessage {
|
||||
public class KeepAliveMessage implements IBigBlueButtonMessage {
|
||||
public static final String KEEP_ALIVE_REQUEST = "keep_alive_request";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class LockUserMessage implements IPublishedMessage {
|
||||
public class LockUserMessage implements IBigBlueButtonMessage {
|
||||
public static final String LOCK_USER = "lock_user";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import com.google.gson.JsonParser;
|
||||
|
||||
public class MessageFromJsonConverter {
|
||||
|
||||
public static IPublishedMessage convert(String message) {
|
||||
public static IBigBlueButtonMessage convert(String message) {
|
||||
JsonParser parser = new JsonParser();
|
||||
JsonObject obj = (JsonObject) parser.parse(message);
|
||||
|
||||
@ -41,7 +41,7 @@ public class MessageFromJsonConverter {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static IPublishedMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) {
|
||||
private static IBigBlueButtonMessage processValidateAuthTokenMessage(JsonObject header, JsonObject payload) {
|
||||
String id = payload.get(Constants.MEETING_ID).getAsString();
|
||||
String userid = payload.get(Constants.USER_ID).getAsString();
|
||||
String authToken = payload.get(Constants.AUTH_TOKEN).getAsString();
|
||||
@ -51,7 +51,7 @@ public class MessageFromJsonConverter {
|
||||
sessionId);
|
||||
}
|
||||
|
||||
private static IPublishedMessage processCreateMeeting(JsonObject payload) {
|
||||
private static IBigBlueButtonMessage processCreateMeeting(JsonObject payload) {
|
||||
String id = payload.get(Constants.MEETING_ID).getAsString();
|
||||
String externalId = payload.get(Constants.EXTERNAL_MEETING_ID).getAsString();
|
||||
String name = payload.get(Constants.NAME).getAsString();
|
||||
@ -70,17 +70,17 @@ public class MessageFromJsonConverter {
|
||||
moderatorPassword, viewerPassword, createTime, createDate);
|
||||
}
|
||||
|
||||
private static IPublishedMessage processDestroyMeeting(JsonObject payload) {
|
||||
private static IBigBlueButtonMessage processDestroyMeeting(JsonObject payload) {
|
||||
String id = payload.get(Constants.MEETING_ID).getAsString();
|
||||
return new DestroyMeetingMessage(id);
|
||||
}
|
||||
|
||||
private static IPublishedMessage processEndMeetingMessage(JsonObject payload) {
|
||||
private static IBigBlueButtonMessage processEndMeetingMessage(JsonObject payload) {
|
||||
String id = payload.get(Constants.MEETING_ID).getAsString();
|
||||
return new EndMeetingMessage(id);
|
||||
}
|
||||
|
||||
private static IPublishedMessage processKeepAlive(JsonObject payload) {
|
||||
private static IBigBlueButtonMessage processKeepAlive(JsonObject payload) {
|
||||
String id = payload.get(Constants.KEEP_ALIVE_ID).getAsString();
|
||||
return new KeepAliveMessage(id);
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class MessageHeader {
|
||||
|
||||
public String name;
|
||||
public String version;
|
||||
public Long timestamp;
|
||||
public String replyTo;
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class RegisterUserMessage implements IPublishedMessage {
|
||||
public class RegisterUserMessage implements IBigBlueButtonMessage {
|
||||
public static final String REGISTER_USER = "register_user_request";
|
||||
public final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class RemovePresentationMessage implements IPublishedMessage {
|
||||
public class RemovePresentationMessage implements IBigBlueButtonMessage {
|
||||
public static final String REMOVE_PRESENTATION = "remove_presentation";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class ResizeAndMoveSlideMessage implements IPublishedMessage {
|
||||
public class ResizeAndMoveSlideMessage implements IBigBlueButtonMessage {
|
||||
public static final String RESIZE_AND_MOVE_SLIDE = "resize_and_move_slide";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendConversionCompletedMessage implements IPublishedMessage {
|
||||
public class SendConversionCompletedMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_CONVERSION_COMPLETED = "send_conversion_completed";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendConversionUpdateMessage implements IPublishedMessage {
|
||||
public class SendConversionUpdateMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_CONVERSION_UPDATE = "send_conversion_update";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendCursorUpdateMessage implements IPublishedMessage {
|
||||
public class SendCursorUpdateMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_CURSOR_UPDATE = "send_cursor_update";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -6,7 +6,7 @@ import java.util.Map;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendLockSettingsMessage implements IPublishedMessage {
|
||||
public class SendLockSettingsMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_LOCK_SETTINGS = "send_lock_settings";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendPageCountErrorMessage implements IPublishedMessage {
|
||||
public class SendPageCountErrorMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_PAGE_COUNT_ERROR = "send_page_count_error";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendPrivateChatMessage implements IPublishedMessage {
|
||||
public class SendPrivateChatMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_PRIVATE_CHAT_MESSAGE = "send_private_chat_message";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.Map;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendPublicChatMessage implements IPublishedMessage {
|
||||
public class SendPublicChatMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_PUBLIC_CHAT_MESSAGE = "send_public_chat_message";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SendSlideGeneratedMessage implements IPublishedMessage {
|
||||
public class SendSlideGeneratedMessage implements IBigBlueButtonMessage {
|
||||
public static final String SEND_SLIDE_GENERATED = "send_slide_generated";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class SharePresentationMessage implements IPublishedMessage {
|
||||
public class SharePresentationMessage implements IBigBlueButtonMessage {
|
||||
public static final String SHARE_PRESENTATION = "share_presentation";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -0,0 +1,9 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
public class StartCustomPollRequestMessage implements IBigBlueButtonMessage {
|
||||
|
||||
public static final String START_CUSTOM_POLL_REQUEST = "start_custom_poll_request_message";
|
||||
|
||||
public MessageHeader header;
|
||||
public StartCustomPollRequestMessagePayload payload;
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class StartCustomPollRequestMessagePayload {
|
||||
public String pollType;
|
||||
public ArrayList<String> answers;
|
||||
public String pollId;
|
||||
public String requesterId;
|
||||
public String meetingId;
|
||||
}
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class UserConnectedToGlobalAudio implements IPublishedMessage {
|
||||
public class UserConnectedToGlobalAudio implements IBigBlueButtonMessage {
|
||||
public static final String USER_CONNECTED_TO_GLOBAL_AUDIO = "user_connected_to_global_audio";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class UserDisconnectedFromGlobalAudio implements IPublishedMessage {
|
||||
public class UserDisconnectedFromGlobalAudio implements IBigBlueButtonMessage {
|
||||
public static final String USER_DISCONNECTED_FROM_GLOBAL_AUDIO = "user_disconnected_from_global_audio";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
|
||||
public class ValidateAuthTokenMessage implements IPublishedMessage {
|
||||
public class ValidateAuthTokenMessage implements IBigBlueButtonMessage {
|
||||
public static final String VALIDATE_AUTH_TOKEN = "validate_auth_token";
|
||||
public static final String VERSION = "0.0.1";
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
package org.bigbluebutton.common.messages;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class StartCustomPollRequestMessageTest {
|
||||
|
||||
@Test
|
||||
public void testStartCustomPollRequestMessage() {
|
||||
System.out.println("FOOO!");
|
||||
|
||||
StartCustomPollRequestMessage msg = new StartCustomPollRequestMessage();
|
||||
MessageHeader header = new MessageHeader();
|
||||
header.name = "start_custom_poll";
|
||||
header.timestamp = 7574118L;
|
||||
header.version = "0.0.1";
|
||||
|
||||
StartCustomPollRequestMessagePayload payload = new StartCustomPollRequestMessagePayload();
|
||||
payload.pollType = "custom";
|
||||
payload.pollId = "bar";
|
||||
payload.requesterId = "me";
|
||||
|
||||
ArrayList<String> answers = new ArrayList<String>();
|
||||
answers.add("Red");
|
||||
answers.add("Green");
|
||||
answers.add("Blue");
|
||||
|
||||
payload.answers = answers;
|
||||
|
||||
msg.header = header;
|
||||
msg.payload = payload;
|
||||
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(msg);
|
||||
System.out.println(json);
|
||||
|
||||
StartCustomPollRequestMessage rxMsg = gson.fromJson(json, StartCustomPollRequestMessage.class);
|
||||
|
||||
System.out.println(rxMsg.payload.answers.get(0));
|
||||
Assert.assertEquals(rxMsg.header.name, "start_custom_poll");
|
||||
}
|
||||
}
|
@ -112,7 +112,7 @@ dependencies {
|
||||
compile 'com.google.code.gson:gson:1.7.1'
|
||||
providedCompile 'org.apache.commons:commons-lang3:3.2'
|
||||
|
||||
compile 'org.bigbluebutton:bbb-common-message:0.0.11'
|
||||
compile 'org.bigbluebutton:bbb-common-message:0.0.12'
|
||||
}
|
||||
|
||||
test {
|
||||
|
@ -1,7 +1,6 @@
|
||||
package org.bigbluebutton.red5.pubsub;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.bigbluebutton.common.messages.*;
|
||||
import org.bigbluebutton.red5.pubsub.redis.MessageSender;
|
||||
|
||||
@ -19,6 +18,10 @@ public class MessagePublisher {
|
||||
sender.send(MessagingConstants.TO_POLLING_CHANNEL, msg.toJson());
|
||||
}
|
||||
|
||||
public void sendPollingMessage(String json) {
|
||||
sender.send(MessagingConstants.TO_POLLING_CHANNEL, json);
|
||||
}
|
||||
|
||||
public void startPoll(String meetingId, String requesterId, String pollId, String pollType) {
|
||||
StartPollRequestMessage msg = new StartPollRequestMessage(meetingId, requesterId, pollId, pollType);
|
||||
sender.send(MessagingConstants.TO_POLLING_CHANNEL, msg.toJson());
|
||||
|
@ -56,6 +56,13 @@ public class PollingService {
|
||||
red5GW.showPollResult(meetingID, userId, pollId, show);
|
||||
}
|
||||
|
||||
public void sendPollingMessage(String json) {
|
||||
String meetingID = Red5.getConnectionLocal().getScope().getName();
|
||||
String userId = getBbbSession().getInternalUserID();
|
||||
|
||||
red5GW.sendPollingMessage(json);
|
||||
}
|
||||
|
||||
public void startPoll(Map<String, Object> message) {
|
||||
String meetingID = Red5.getConnectionLocal().getScope().getName();
|
||||
String userId = getBbbSession().getInternalUserID();
|
||||
|
58
bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml
Normal file → Executable file
58
bigbluebutton-client/src/org/bigbluebutton/modules/chat/views/ChatBox.mxml
Normal file → Executable file
@ -82,10 +82,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.events.LockControlEvent;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.events.ShortcutEvent;
|
||||
import org.bigbluebutton.main.events.UserJoinedEvent;
|
||||
import org.bigbluebutton.main.events.UserLeftEvent;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
import org.bigbluebutton.main.model.users.BBBUser;
|
||||
import org.bigbluebutton.main.model.users.Conference;
|
||||
import org.bigbluebutton.modules.chat.ChatConstants;
|
||||
@ -99,6 +99,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.chat.model.ChatConversation;
|
||||
import org.bigbluebutton.modules.chat.model.ChatOptions;
|
||||
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
|
||||
import org.bigbluebutton.modules.polling.events.StartCustomPollEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
private static const LOGGER:ILogger = getClassLogger(ChatBox);
|
||||
@ -568,25 +569,44 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
LOGGER.debug("------------------------------");
|
||||
}
|
||||
|
||||
private function sendStartCustomPollEvent(answers:Array):void {
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatchEvent(new StartCustomPollEvent("Custom", answers));
|
||||
}
|
||||
|
||||
private function sendPublicChatMessage(message:String):void {
|
||||
var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT);
|
||||
var cm:ChatMessageVO = new ChatMessageVO();
|
||||
cm.chatType = ChatConstants.PUBLIC_CHAT;
|
||||
cm.fromUserID = UsersUtil.getMyUserID();
|
||||
cm.fromUsername = UsersUtil.getMyUsername();
|
||||
// get the color value from ColorPicker
|
||||
cm.fromColor = cmpColorPicker.selectedColor.toString();
|
||||
// Get the current UTC time and the timezone for this sender.
|
||||
// The receiver will have to convert this to local time.
|
||||
var now:Date = new Date();
|
||||
cm.fromTime = now.valueOf();
|
||||
cm.fromTimezoneOffset = now.getTimezoneOffset();
|
||||
|
||||
//cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message));
|
||||
cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message)));
|
||||
|
||||
publicEvent.chatMessage = cm;
|
||||
globalDispatcher.dispatchEvent(publicEvent);
|
||||
//var pollRegex:RegExp = /^@poll\s+?((?:[^,]+?\s*?,\s*?)*?[^,]+?)\s*?$/;
|
||||
var pollRegex:RegExp = /^@poll\s+?(.+)\s*?$/;
|
||||
var matchedArray:Array = message.match(pollRegex);
|
||||
|
||||
if (pollRegex.test(message)) {
|
||||
var tmpAnswers: Array = matchedArray[1].split(",");
|
||||
var answers:Array = new Array();
|
||||
for (var i:int = 0; i < tmpAnswers.length; i++) {
|
||||
var t:String = tmpAnswers[i] as String;
|
||||
answers.push(StringUtil.trim(t));
|
||||
}
|
||||
sendStartCustomPollEvent(answers);
|
||||
} else {
|
||||
var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT);
|
||||
var cm:ChatMessageVO = new ChatMessageVO();
|
||||
cm.chatType = ChatConstants.PUBLIC_CHAT;
|
||||
cm.fromUserID = UsersUtil.getMyUserID();
|
||||
cm.fromUsername = UsersUtil.getMyUsername();
|
||||
// get the color value from ColorPicker
|
||||
cm.fromColor = cmpColorPicker.selectedColor.toString();
|
||||
// Get the current UTC time and the timezone for this sender.
|
||||
// The receiver will have to convert this to local time.
|
||||
var now:Date = new Date();
|
||||
cm.fromTime = now.valueOf();
|
||||
cm.fromTimezoneOffset = now.getTimezoneOffset();
|
||||
|
||||
//cm.message = ChatUtil.parseURLs(ChatUtil.cleanup(message));
|
||||
cm.message = ExternalInterface.call('parseURLs', (ChatUtil.cleanup(message)));
|
||||
|
||||
publicEvent.chatMessage = cm;
|
||||
globalDispatcher.dispatchEvent(publicEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private function sendPrivateChatMessage(message:String):void {
|
||||
|
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2010 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 2.1 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.polling.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class StartCustomPollEvent extends Event
|
||||
{
|
||||
public static const START:String = "start custom poll";
|
||||
|
||||
public var pollType: String;
|
||||
public var answers: Array;
|
||||
|
||||
public function StartCustomPollEvent(pollType: String, answers: Array)
|
||||
{
|
||||
super(START, true, false);
|
||||
this.pollType = pollType;
|
||||
this.answers = answers;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -38,6 +38,10 @@
|
||||
|
||||
<EventHandlers type="{InitPollModuleEvent.INITIALIZE_POLL_MODULE}"/>
|
||||
|
||||
<EventHandlers type="{StartCustomPollEvent.START}">
|
||||
<MethodInvoker generator="{PollingService}" method="handleStartCustomPollEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{StartPollEvent.START}">
|
||||
<MethodInvoker generator="{PollingService}" method="handleStartPollEvent" arguments="{event}"/>
|
||||
</EventHandlers>
|
||||
|
@ -3,7 +3,9 @@ package org.bigbluebutton.modules.polling.service
|
||||
|
||||
public interface IPollDataService
|
||||
{
|
||||
|
||||
|
||||
function startCustomPoll(pollId: String, pollType: String, answers:Array):void;
|
||||
|
||||
function startPoll(pollId:String, pollType: String):void;
|
||||
|
||||
function stopPoll(pollID:String):void;
|
||||
|
38
bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as
Normal file → Executable file
38
bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/MessageSender.as
Normal file → Executable file
@ -22,11 +22,47 @@ package org.bigbluebutton.modules.polling.service
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.as3commons.logging.util.jsonXify;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.managers.ConnectionManager;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.core.managers.ConnectionManager;
|
||||
|
||||
public class MessageSender
|
||||
{
|
||||
private static const LOGGER:ILogger = getClassLogger(MessageSender);
|
||||
|
||||
public function startCustomPoll(pollId:String, pollType: String, answers:Array):void
|
||||
{
|
||||
|
||||
|
||||
var header:Object = new Object();
|
||||
header["timestamp"] = (new Date()).time;
|
||||
header["name"] = "start_custom_poll_request_message";
|
||||
header["version"] = "0.0.1";
|
||||
|
||||
var payload:Object = new Object();
|
||||
payload["pollType"] = pollType;
|
||||
payload["answers"] = answers;
|
||||
payload["meetingId"] = UsersUtil.getInternalMeetingID();
|
||||
payload["pollId"] = pollId;
|
||||
payload["requesterId"] = UsersUtil.getMyUserID();
|
||||
|
||||
var map:Object = new Object();
|
||||
map["header"] = header;
|
||||
map["payload"] = payload;
|
||||
|
||||
LOGGER.debug("startCustomPoll [{0}]", [jsonXify(map)]);
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
_nc.sendMessage("poll.sendPollingMessage",
|
||||
function(result:String):void {
|
||||
LOGGER.debug(result);
|
||||
},
|
||||
function(status:String):void {
|
||||
LOGGER.error(status);
|
||||
},
|
||||
JSON.stringify(map)
|
||||
);
|
||||
}
|
||||
|
||||
public function startPoll(pollId:String, pollType: String):void
|
||||
{
|
||||
var map:Object = new Object();
|
||||
|
@ -12,7 +12,12 @@ package org.bigbluebutton.modules.polling.service
|
||||
public function NetworkPollDataService(sender: MessageSender) {
|
||||
this.sender = sender;
|
||||
}
|
||||
|
||||
|
||||
public function startCustomPoll(pollId:String, pollType: String, answers: Array):void
|
||||
{
|
||||
sender.startCustomPoll(pollId, pollType, answers);
|
||||
}
|
||||
|
||||
public function startPoll(pollId:String, pollType: String):void
|
||||
{
|
||||
sender.startPoll(pollId, pollType);
|
||||
|
11
bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as
Normal file → Executable file
11
bigbluebutton-client/src/org/bigbluebutton/modules/polling/service/PollingService.as
Normal file → Executable file
@ -21,13 +21,14 @@ package org.bigbluebutton.modules.polling.service
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.modules.polling.events.ShowPollResultEvent;
|
||||
import org.bigbluebutton.modules.polling.events.StartCustomPollEvent;
|
||||
import org.bigbluebutton.modules.polling.events.StartPollEvent;
|
||||
import org.bigbluebutton.modules.polling.events.StopPollEvent;
|
||||
import org.bigbluebutton.modules.polling.events.VotePollEvent;
|
||||
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.PresentationModel;
|
||||
|
||||
public class PollingService
|
||||
{
|
||||
@ -62,7 +63,13 @@ package org.bigbluebutton.modules.polling.service
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public function handleStartCustomPollEvent(event:StartCustomPollEvent):void {
|
||||
var pollId:String = generatePollId();
|
||||
if (pollId == null) return;
|
||||
dataService.startCustomPoll(pollId, event.pollType, event.answers);
|
||||
}
|
||||
|
||||
public function handleStartPollEvent(event:StartPollEvent):void {
|
||||
var pollId:String = generatePollId();
|
||||
if (pollId == null) return;
|
||||
|
@ -124,7 +124,12 @@ package org.bigbluebutton.modules.polling.views
|
||||
var answers:Array = poll.answers;
|
||||
for (var j:int = 0; j < answers.length; j++) {
|
||||
var a:SimpleAnswer = answers[j] as SimpleAnswer;
|
||||
resultData.push({a:ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key), v:0});
|
||||
var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key);
|
||||
|
||||
if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") {
|
||||
localizedKey = a.key
|
||||
}
|
||||
resultData.push({a:localizedKey, v:0});
|
||||
}
|
||||
|
||||
_pollGraphic.data = resultData;
|
||||
@ -146,7 +151,13 @@ package org.bigbluebutton.modules.polling.views
|
||||
var answers:Array = e.result.answers;
|
||||
for (var j:int = 0; j < answers.length; j++) {
|
||||
var a:SimpleAnswerResult = answers[j] as SimpleAnswerResult;
|
||||
resultData.push({a:ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key), v:a.numVotes});
|
||||
var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.' + a.key);
|
||||
|
||||
if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") {
|
||||
localizedKey = a.key;
|
||||
}
|
||||
|
||||
resultData.push({a:localizedKey, v:a.numVotes});
|
||||
}
|
||||
|
||||
_pollGraphic.data = resultData;
|
||||
|
@ -69,12 +69,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<![CDATA[
|
||||
import flash.geom.Point;
|
||||
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import mx.controls.Menu;
|
||||
import mx.events.MenuEvent;
|
||||
import mx.managers.PopUpManager;
|
||||
|
||||
import flexlib.mdi.events.MDIWindowEvent;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.common.IBbbModuleWindow;
|
||||
@ -87,6 +87,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.polling.events.PollShowResultEvent;
|
||||
import org.bigbluebutton.modules.polling.events.PollStartedEvent;
|
||||
import org.bigbluebutton.modules.polling.events.PollStoppedEvent;
|
||||
import org.bigbluebutton.modules.polling.events.StartCustomPollEvent;
|
||||
import org.bigbluebutton.modules.polling.events.StartPollEvent;
|
||||
import org.bigbluebutton.modules.polling.events.VotePollEvent;
|
||||
import org.bigbluebutton.modules.polling.views.PollResultsModal;
|
||||
@ -621,6 +622,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
constructedLabel += "/" + ResourceUtil.getInstance().getString("bbb.polling.answer."+String.fromCharCode(65+i));
|
||||
pollMenuData.push({label: constructedLabel});
|
||||
}
|
||||
pollMenuData.push({label: "Custom"});
|
||||
}
|
||||
|
||||
private function onPollStartButtonClicked():void {
|
||||
@ -647,6 +649,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
}
|
||||
|
||||
private function sendStartCustomPollEvent(pollType:String):void {
|
||||
// Let's reset the page to display full size so we can display the result
|
||||
// on the bottom right-corner.
|
||||
onResetZoom();
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
var answers:Array = new Array("Red", "Green", "Blue");
|
||||
dispatchEvent(new StartCustomPollEvent(pollType, answers));
|
||||
}
|
||||
|
||||
private function sendStartPollEvent(pollType:String):void {
|
||||
// Let's reset the page to display full size so we can display the result
|
||||
// on the bottom right-corner.
|
||||
@ -658,7 +669,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function menuClickHandler(e:MenuEvent):void {
|
||||
if(pollMenuData[e.index] != undefined) {
|
||||
// start the requested poll
|
||||
var pollEvent:StartPollEvent = null;
|
||||
switch (e.index) {
|
||||
case 0:
|
||||
sendStartPollEvent("YN");
|
||||
@ -682,7 +692,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
sendStartPollEvent("A-6");
|
||||
break;
|
||||
case 7:
|
||||
sendStartPollEvent("A-7");
|
||||
sendStartCustomPollEvent("Custom");
|
||||
//sendStartPollEvent("A-7");
|
||||
break;
|
||||
case 8:
|
||||
sendStartCustomPollEvent("Custom");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -713,7 +727,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
var numBtns:int = e.poll.answers.length;
|
||||
for (var i:int=0; i<numBtns; i++) {
|
||||
voteBtn = new Button();
|
||||
voteBtn.label = ResourceUtil.getInstance().getString('bbb.polling.answer.'+e.poll.answers[i].key);
|
||||
var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.'+e.poll.answers[i].key);
|
||||
|
||||
if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") {
|
||||
localizedKey = e.poll.answers[i].key;
|
||||
}
|
||||
|
||||
voteBtn.label = localizedKey;
|
||||
voteBtn.name = e.poll.answers[i].id;
|
||||
voteBtn.addEventListener(MouseEvent.CLICK, voteButtonClickHandler);
|
||||
pollVoteBox.addChild(voteBtn);
|
||||
|
@ -272,7 +272,12 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
|
||||
var ans:Array = new Array();
|
||||
for (var j:int = 0; j < answers.length; j++) {
|
||||
var ar:Object = answers[j];
|
||||
var rs:Object = {a: ResourceUtil.getInstance().getString('bbb.polling.answer.' + ar.key), v: ar.num_votes as Number};
|
||||
var localizedKey: String = ResourceUtil.getInstance().getString('bbb.polling.answer.' + ar.key);
|
||||
|
||||
if (localizedKey == null || localizedKey == "" || localizedKey == "undefined") {
|
||||
localizedKey = ar.key;
|
||||
}
|
||||
var rs:Object = {a: localizedKey, v: ar.num_votes as Number};
|
||||
LOGGER.debug("poll result a=[{0}] v=[{1}]", [ar.key, ar.num_votes]);
|
||||
ans.push(rs);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user