- try displaying poll result as whiteboard shape
This commit is contained in:
parent
2f170aa285
commit
72659e62ac
@ -8,6 +8,7 @@ public class WhiteboardKeyUtil {
|
|||||||
public static final String ELLIPSE_TYPE = "ellipse";
|
public static final String ELLIPSE_TYPE = "ellipse";
|
||||||
public static final String TRIANGLE_TYPE = "triangle";
|
public static final String TRIANGLE_TYPE = "triangle";
|
||||||
public static final String LINE_TYPE = "line";
|
public static final String LINE_TYPE = "line";
|
||||||
|
public static final String POLL_RESULT_TYPE = "poll_result";
|
||||||
|
|
||||||
public static final String TEXT_CREATED_STATUS = "textCreated";
|
public static final String TEXT_CREATED_STATUS = "textCreated";
|
||||||
public static final String DRAW_START_STATUS = "DRAW_START";
|
public static final String DRAW_START_STATUS = "DRAW_START";
|
||||||
|
@ -328,7 +328,7 @@ class BigBlueButtonInGW(val system: ActorSystem, outGW: MessageOutGateway, voice
|
|||||||
* Message Interface for Whiteboard
|
* Message Interface for Whiteboard
|
||||||
* *****************************************************************
|
* *****************************************************************
|
||||||
*/
|
*/
|
||||||
private def buildAnnotation(annotation: Map[String, Object]): Option[AnnotationVO] = {
|
private def buildAnnotation(annotation: scala.collection.mutable.Map[String, Object]): Option[AnnotationVO] = {
|
||||||
var shape: Option[AnnotationVO] = None
|
var shape: Option[AnnotationVO] = None
|
||||||
|
|
||||||
val id = annotation.getOrElse("id", null).asInstanceOf[String]
|
val id = annotation.getOrElse("id", null).asInstanceOf[String]
|
||||||
@ -345,7 +345,7 @@ class BigBlueButtonInGW(val system: ActorSystem, outGW: MessageOutGateway, voice
|
|||||||
}
|
}
|
||||||
|
|
||||||
def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) {
|
def sendWhiteboardAnnotation(meetingID: String, requesterID: String, annotation: java.util.Map[String, Object]) {
|
||||||
val ann = mapAsScalaMap(annotation).toMap
|
val ann: scala.collection.mutable.Map[String, Object] = mapAsScalaMap(annotation)
|
||||||
|
|
||||||
buildAnnotation(ann) match {
|
buildAnnotation(ann) match {
|
||||||
case Some(shape) => {
|
case Some(shape) => {
|
||||||
|
@ -231,9 +231,7 @@ class Answer(val id: Int, val key: String, val text: Option[String]) {
|
|||||||
responders.clear
|
responders.clear
|
||||||
}
|
}
|
||||||
def addResponder(responder: Responder) {
|
def addResponder(responder: Responder) {
|
||||||
println("********************************************************************** Add response for key=[" + key + "] votes=[" + numResponders + "]")
|
|
||||||
responders += responder
|
responders += responder
|
||||||
println("********************************************************************** Added response for key=[" + key + "] votes=[" + numResponders + "]")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def numResponders(): Int = {
|
def numResponders(): Int = {
|
||||||
@ -251,7 +249,6 @@ class Answer(val id: Int, val key: String, val text: Option[String]) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
def toSimpleVoteOutVO(): SimpleVoteOutVO = {
|
def toSimpleVoteOutVO(): SimpleVoteOutVO = {
|
||||||
println("********************************************************************** Num response for key=[" + key + "] votes=[" + numResponders + "]")
|
|
||||||
new SimpleVoteOutVO(id, key, numResponders)
|
new SimpleVoteOutVO(id, key, numResponders)
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,6 +4,8 @@ import org.bigbluebutton.core.api._
|
|||||||
import org.bigbluebutton.core.MeetingActor
|
import org.bigbluebutton.core.MeetingActor
|
||||||
import scala.collection.mutable.HashMap
|
import scala.collection.mutable.HashMap
|
||||||
import scala.collection.mutable.ArrayBuffer
|
import scala.collection.mutable.ArrayBuffer
|
||||||
|
import org.bigbluebutton.core.service.whiteboard.WhiteboardKeyUtil
|
||||||
|
import com.google.gson.Gson
|
||||||
|
|
||||||
trait PollApp {
|
trait PollApp {
|
||||||
this: MeetingActor =>
|
this: MeetingActor =>
|
||||||
@ -60,11 +62,39 @@ trait PollApp {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def pollResultToWhiteboardShape(result: SimplePollResultOutVO, msg: ShowPollResultRequest): scala.collection.immutable.Map[String, Object] = {
|
||||||
|
val shape = new scala.collection.mutable.HashMap[String, Object]()
|
||||||
|
|
||||||
|
val answers = new ArrayBuffer[java.util.HashMap[String, Object]];
|
||||||
|
result.answers.foreach(ans => {
|
||||||
|
val amap = new java.util.HashMap[String, Object]()
|
||||||
|
amap.put("id", ans.id: java.lang.Integer)
|
||||||
|
amap.put("key", ans.key)
|
||||||
|
amap.put("num_votes", ans.numVotes: java.lang.Integer)
|
||||||
|
answers += amap
|
||||||
|
})
|
||||||
|
|
||||||
|
val gson = new Gson()
|
||||||
|
shape += "result" -> gson.toJson(answers.toArray)
|
||||||
|
|
||||||
|
val display = Array(0, 0, 200, 200)
|
||||||
|
shape += "points" -> display
|
||||||
|
shape.toMap
|
||||||
|
}
|
||||||
|
|
||||||
def handleShowPollResultRequest(msg: ShowPollResultRequest) {
|
def handleShowPollResultRequest(msg: ShowPollResultRequest) {
|
||||||
pollModel.getSimplePollResult(msg.pollId) match {
|
pollModel.getSimplePollResult(msg.pollId) match {
|
||||||
case Some(poll) => {
|
case Some(poll) => {
|
||||||
pollModel.showPollResult(poll.id)
|
pollModel.showPollResult(poll.id)
|
||||||
outGW.send(new PollShowResultMessage(mProps.meetingID, mProps.recorded, msg.requesterId, msg.pollId, poll))
|
val shape = pollResultToWhiteboardShape(poll, msg)
|
||||||
|
|
||||||
|
for {
|
||||||
|
page <- presModel.getCurrentPage()
|
||||||
|
annotation = new AnnotationVO(poll.id, WhiteboardKeyUtil.DRAW_END_STATUS, WhiteboardKeyUtil.POLL_RESULT_TYPE, shape, page.id)
|
||||||
|
} this.context.self ! new SendWhiteboardAnnotationRequest(mProps.meetingID, msg.requesterId, annotation)
|
||||||
|
|
||||||
|
// outGW.send(new PollShowResultMessage(mProps.meetingID, mProps.recorded, msg.requesterId, msg.pollId, poll))
|
||||||
|
|
||||||
}
|
}
|
||||||
case None => {
|
case None => {
|
||||||
val result = new RequestResult(StatusCodes.NOT_FOUND, Some(Array(ErrorCodes.RESOURCE_NOT_FOUND)))
|
val result = new RequestResult(StatusCodes.NOT_FOUND, Some(Array(ErrorCodes.RESOURCE_NOT_FOUND)))
|
||||||
|
@ -2,7 +2,7 @@ package org.bigbluebutton.core.apps
|
|||||||
|
|
||||||
import scala.collection.mutable.ArrayBuffer
|
import scala.collection.mutable.ArrayBuffer
|
||||||
|
|
||||||
case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Object], wbId: String)
|
case class AnnotationVO(id: String, status: String, shapeType: String, shape: scala.collection.immutable.Map[String, Any], wbId: String)
|
||||||
|
|
||||||
class WhiteboardModel {
|
class WhiteboardModel {
|
||||||
private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]()
|
private var _whiteboards = new scala.collection.immutable.HashMap[String, Whiteboard]()
|
||||||
|
@ -20,7 +20,7 @@ object UsersMessageToJsonConverter {
|
|||||||
wuser += "presenter" -> user.presenter
|
wuser += "presenter" -> user.presenter
|
||||||
wuser += "has_stream" -> user.hasStream
|
wuser += "has_stream" -> user.hasStream
|
||||||
wuser += "locked" -> user.locked
|
wuser += "locked" -> user.locked
|
||||||
wuser += "webcam_stream" -> user.webcamStreams
|
wuser += "webcam_stream" -> user.webcamStreams.toArray
|
||||||
wuser += "phone_user" -> user.phoneUser
|
wuser += "phone_user" -> user.phoneUser
|
||||||
wuser += "listenOnly" -> user.listenOnly
|
wuser += "listenOnly" -> user.listenOnly
|
||||||
|
|
||||||
|
@ -53,7 +53,13 @@ class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMes
|
|||||||
event.setPresentation(getPresentationId(msg.whiteboardId))
|
event.setPresentation(getPresentationId(msg.whiteboardId))
|
||||||
event.setPageNumber(getPageNum(msg.whiteboardId))
|
event.setPageNumber(getPageNum(msg.whiteboardId))
|
||||||
event.setWhiteboardId(msg.whiteboardId)
|
event.setWhiteboardId(msg.whiteboardId)
|
||||||
event.addAnnotation(mapAsJavaMap(msg.shape.shape))
|
|
||||||
|
// FIXME: Need to fix recording of wb event (ralam june 29, 2015)
|
||||||
|
//val ann: java.util.Map[String, Any] = mapAsJavaMap(msg.shape.shape)
|
||||||
|
// val ann: java.util.Map[String, Object] = mapAsJavaMap(msg.shape.shape)
|
||||||
|
// val ann2: java.util.Map[String, Object] = mapAsJavaMap(ann)
|
||||||
|
|
||||||
|
// event.addAnnotation(mapAsJavaMap(ann))
|
||||||
recorder.record(msg.meetingID, event)
|
recorder.record(msg.meetingID, event)
|
||||||
} else {
|
} else {
|
||||||
val event = new AddShapeWhiteboardRecordEvent()
|
val event = new AddShapeWhiteboardRecordEvent()
|
||||||
@ -62,7 +68,8 @@ class WhiteboardEventRedisRecorder(recorder: RecorderApplication) extends OutMes
|
|||||||
event.setPresentation(getPresentationId(msg.whiteboardId))
|
event.setPresentation(getPresentationId(msg.whiteboardId))
|
||||||
event.setPageNumber(getPageNum(msg.whiteboardId))
|
event.setPageNumber(getPageNum(msg.whiteboardId))
|
||||||
event.setWhiteboardId(msg.whiteboardId);
|
event.setWhiteboardId(msg.whiteboardId);
|
||||||
event.addAnnotation(mapAsJavaMap(msg.shape.shape))
|
// FIXME: Need to fix recording of wb event (ralam june 29, 2015)
|
||||||
|
// event.addAnnotation(mapAsJavaMap(msg.shape.shape))
|
||||||
recorder.record(msg.meetingID, event)
|
recorder.record(msg.meetingID, event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,6 +200,8 @@ public class Util {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String, Object> extractAnnotation(JsonObject annotationElement) {
|
public Map<String, Object> extractAnnotation(JsonObject annotationElement) {
|
||||||
//NON-TEXT SHAPE
|
//NON-TEXT SHAPE
|
||||||
if (annotationElement.has(Constants.ID)
|
if (annotationElement.has(Constants.ID)
|
||||||
|
@ -70,15 +70,13 @@ public class WhiteboardClientMessageSender {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processSendWhiteboardAnnotationReplyMessage(
|
private void processSendWhiteboardAnnotationReplyMessage(SendWhiteboardAnnotationReplyMessage msg) {
|
||||||
SendWhiteboardAnnotationReplyMessage msg) {
|
|
||||||
|
|
||||||
Map<String, Object> args = new HashMap<String, Object>();
|
Map<String, Object> args = new HashMap<String, Object>();
|
||||||
args.put("whiteboardId", msg.whiteboardId);
|
args.put("whiteboardId", msg.whiteboardId);
|
||||||
|
|
||||||
Map<String, Object> shape = new HashMap<String, Object>();
|
Map<String, Object> shape = new HashMap<String, Object>();
|
||||||
|
|
||||||
System.out.println("\n\n"+msg.shape.toString() +"\n\n");
|
|
||||||
shape.put("id", msg.shape.get("id"));
|
shape.put("id", msg.shape.get("id"));
|
||||||
shape.put("type", msg.shape.get("type"));
|
shape.put("type", msg.shape.get("type"));
|
||||||
shape.put("status", msg.shape.get("status"));
|
shape.put("status", msg.shape.get("status"));
|
||||||
@ -90,9 +88,6 @@ public class WhiteboardClientMessageSender {
|
|||||||
Gson gson = new Gson();
|
Gson gson = new Gson();
|
||||||
message.put("msg", gson.toJson(args));
|
message.put("msg", gson.toJson(args));
|
||||||
|
|
||||||
System.out.println("RedisPubSubMessageHandler - processSendWhiteboardAnnotationReplyMessage \n"
|
|
||||||
+ message.get("msg").toString() + "\n");
|
|
||||||
|
|
||||||
//broadcast message
|
//broadcast message
|
||||||
BroadcastClientMessage b = new BroadcastClientMessage(msg.meetingId, "WhiteboardNewAnnotationCommand", message);
|
BroadcastClientMessage b = new BroadcastClientMessage(msg.meetingId, "WhiteboardNewAnnotationCommand", message);
|
||||||
service.sendMessage(b);
|
service.sendMessage(b);
|
||||||
|
Loading…
Reference in New Issue
Block a user