Merge branch 'make-users-user-conn-invoke' of https://github.com/bigbluebutton/bigbluebutton into make-users-user-conn-invoke

This commit is contained in:
Markos Calderon 2013-07-02 18:51:09 -05:00
commit 136f332f21
25 changed files with 307 additions and 133 deletions

View File

@ -45,10 +45,10 @@ class PollMessageConverter {
i += 1
}
//new PollVO(randomAlphanumericString(12), title, cvoArray.toArray)
new PollVO(randomAlphanumericString(12), title, cvoArray.toArray)
// Hardocde for now for testing
new PollVO("pollID", title, cvoArray.toArray)
//new PollVO("pollID", title, cvoArray.toArray)
}
def convertUpdatePollMessage(msg:String):PollVO = {

View File

@ -7,6 +7,23 @@ class PollModel {
private val polls = new HashMap[String, Poll]()
createSamplePoll
def createSamplePoll() {
val r1 = new ResponseVO("0", "Answer 1")
val r2 = new ResponseVO("1", "Answer 2")
val r3 = new ResponseVO("2", "Answer 3")
val r4 = new ResponseVO("3", "Answer 4")
var q = new QuestionVO("q1", true, "What is my name?", Array(r1, r2, r3))
val pvo = new PollVO("pollID-100", "sample poll", Array(q))
createPoll(pvo)
respondToQuestion("pollID-100", "q1", "1", new Responder("user1", "Juan Tamad"))
respondToQuestion("pollID-100", "q1", "0", new Responder("user2", "Asyong Aksaya"))
}
def numPolls():Int = {
polls.size
}

View File

@ -13,6 +13,8 @@ import org.bigbluebutton.core.apps.poll.messages.PollCreatedOutMsg
import org.bigbluebutton.conference.meeting.messaging.red5.DirectClientMessage
import com.google.gson.Gson
import org.bigbluebutton.conference.meeting.messaging.red5.BroadcastClientMessage
import java.util.ArrayList
import org.bigbluebutton.core.apps.poll.PollVO
class PollClientMessageSender(service: ConnectionInvokerService) extends OutMessageListener2 {
@ -32,8 +34,17 @@ class PollClientMessageSender(service: ConnectionInvokerService) extends OutMess
private def handleGetPollsReplyOutMsg(msg: GetPollsReplyOutMsg) {
val gson = new Gson();
val message = new java.util.HashMap[String, Object]()
message.put("msg", gson.toJson(msg.polls))
val collection = new ArrayList[PollVO]();
msg.polls.foreach(p => {
collection.add(p)
})
message.put("msg", gson.toJson(collection))
// println("PollClientMessageSender - Handling GetPollsReplyOutMsg \n" + message.get("msg") + "\n")
var m = new DirectClientMessage(msg.meetingID, msg.requesterID, "pollGetPollsReply", message);
service.sendMessage(m);
}

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.modules.polling.events
{
import flash.events.Event;
public class InitPollModuleEvent extends Event
{
public static const INITIALIZE_POLL_MODULE:String = "initialize poll module event";
public function InitPollModuleEvent()
{
super(INITIALIZE_POLL_MODULE, true, false);
}
}
}

View File

@ -0,0 +1,14 @@
package org.bigbluebutton.modules.polling.events
{
import flash.events.Event;
public class OpenCreatePollWindowEvent extends Event
{
public static const OPEN_CREATE_POLL_WINDOW:String = "open create poll window event";
public function OpenCreatePollWindowEvent()
{
super(OPEN_CREATE_POLL_WINDOW, true, false);
}
}
}

View File

@ -1,16 +1,19 @@
package org.bigbluebutton.modules.polling.managers
{
import org.bigbluebutton.modules.polling.model.PollingModel;
import com.asfusion.mate.events.Dispatcher;
import flash.events.IEventDispatcher;
import org.bigbluebutton.modules.polling.events.GetPollsEvent;
import org.bigbluebutton.modules.polling.model.PollingModel;
public class PollManager
{
public static const LOG:String = "[PollManager] - ";
// Injected by Mate
public var model:PollingModel;
public var dispatcher:IEventDispatcher;
public function PollManager()
{
@ -20,5 +23,9 @@ package org.bigbluebutton.modules.polling.managers
public function handleStartModuleEvent(module:PollingModule):void {
}
public function handleInitPollModuleEvent():void {
dispatcher.dispatchEvent(new GetPollsEvent());
}
}
}

View File

@ -68,9 +68,9 @@ package org.bigbluebutton.modules.polling.managers
private var pollingWindow:PollingViewWindow;
private var statsWindow:PollingStatsWindow;
private var updatePollWindow:UpdatePollWindow = new UpdatePollWindow();
private var takePollWindow:TakePollWindow = new TakePollWindow();
private var takePollWindow:TakePollWindow;
private var pollMainWindow:PollMainWindow = new PollMainWindow();
private var createPollWindow:CreatePollWindow;
private var createPollWindow:CreatePollWindow = new CreatePollWindow();
private var resultsWindow:DisplayResultWindow = new DisplayResultWindow();
private var testCreateWindow:PollCreateWindow;
@ -96,7 +96,12 @@ package org.bigbluebutton.modules.polling.managers
openWindow(pollMainWindow);
}
public function handleOpenCreatePollWindowEvent():void {
openWindow(createPollWindow);
}
public function handleOpenTakePollWindowEvent(event:OpenTakePollWindowEvent):void {
takePollWindow = new TakePollWindow();
takePollWindow.viewModel = _viewModel;
takePollWindow.pollID = event.pollID;

View File

@ -22,8 +22,7 @@
<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.events.FlexEvent;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.modules.polling.events.*;
@ -46,7 +45,11 @@
<EventHandlers type="{ModuleEvent.STOP}">
</EventHandlers>
<EventHandlers type="{InitPollModuleEvent.INITIALIZE_POLL_MODULE}">
<MethodInvoker generator="{PollManager}" method="handleInitPollModuleEvent"/>
</EventHandlers>
<EventHandlers type="{CreatePollEvent.CREATE_POLL}">
<MethodInvoker generator="{PollingService}" method="handleCreatePollEvent" arguments="{event}"/>
</EventHandlers>
@ -78,11 +81,12 @@
<Injectors target="{PollManager}">
<ObjectBuilder generator="{PollingModel}" cache="global"/>
<PropertyInjector targetKey="model" source="{PollingModel}"/>
<PropertyInjector targetKey="dispatcher" source="{scope.dispatcher}"/>
</Injectors>
<Injectors target="{PollingService}">
<ObjectBuilder generator="{PollDataProcessor}" cache="global"/>
<PropertyInjector targetKey="dataService" source="{ShortCircuitPollDataService}"/>
<PropertyInjector targetKey="dataService" source="{NetworkPollDataService}"/>
</Injectors>
<Injectors target="{NetworkPollDataService}">

View File

@ -22,24 +22,25 @@
<mx:Script>
<![CDATA[
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.modules.polling.events.GenerateWebKeyEvent;
import org.bigbluebutton.modules.polling.events.ModuleEvent;
import org.bigbluebutton.modules.polling.events.OpenPollMainWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollResultWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollUpdateWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenSavedPollEvent;
import org.bigbluebutton.modules.polling.events.OpenTakePollWindowEvent;
import org.bigbluebutton.modules.polling.events.PollGetPollEvent;
import org.bigbluebutton.modules.polling.events.PollGetTitlesEvent;
import org.bigbluebutton.modules.polling.events.PollReturnTitlesEvent;
import org.bigbluebutton.modules.polling.events.PollingInstructionsWindowEvent;
import org.bigbluebutton.modules.polling.events.PollingViewWindowEvent;
import org.bigbluebutton.modules.polling.events.ReviewResultsEvent;
import org.bigbluebutton.modules.polling.managers.PollingManager;
import org.bigbluebutton.modules.polling.managers.PollingWindowManager;
import org.bigbluebutton.modules.polling.model.PollingModel;
import org.bigbluebutton.main.events.MadePresenterEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.modules.polling.events.GenerateWebKeyEvent;
import org.bigbluebutton.modules.polling.events.ModuleEvent;
import org.bigbluebutton.modules.polling.events.OpenCreatePollWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollMainWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollResultWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollUpdateWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenSavedPollEvent;
import org.bigbluebutton.modules.polling.events.OpenTakePollWindowEvent;
import org.bigbluebutton.modules.polling.events.PollGetPollEvent;
import org.bigbluebutton.modules.polling.events.PollGetTitlesEvent;
import org.bigbluebutton.modules.polling.events.PollReturnTitlesEvent;
import org.bigbluebutton.modules.polling.events.PollingInstructionsWindowEvent;
import org.bigbluebutton.modules.polling.events.PollingViewWindowEvent;
import org.bigbluebutton.modules.polling.events.ReviewResultsEvent;
import org.bigbluebutton.modules.polling.managers.PollingManager;
import org.bigbluebutton.modules.polling.managers.PollingWindowManager;
import org.bigbluebutton.modules.polling.model.PollingModel;
]]>
</mx:Script>
@ -52,7 +53,11 @@
<EventHandlers type="{ModuleEvent.STOP}">
</EventHandlers>
<EventHandlers type="{OpenCreatePollWindowEvent.OPEN_CREATE_POLL_WINDOW}">
<MethodInvoker generator="{PollingWindowManager}" method="handleOpenCreatePollWindowEvent" />
</EventHandlers>
<EventHandlers type="{OpenPollMainWindowEvent.OPEN_POLL_MAIN_WINDOW}">
<MethodInvoker generator="{PollingWindowManager}" method="handleOpenPollMainWindowEvent" />
</EventHandlers>

View File

@ -76,7 +76,7 @@ package org.bigbluebutton.modules.polling.model
var r:ResultVO = results.results[i] as ResultVO;
var q:Question = getQuestion(r.questionID);
if (q != null) {
q.updateResult(r.responseID, r.responseCount);
q.updateResult(r.responseID, r.responder);
}
}
}

View File

@ -12,6 +12,7 @@ package org.bigbluebutton.modules.polling.model
public function PollingViewModel(model: PollingModel)
{
trace("************** Initing PollingViewModel ***************************");
_model = model;
}
@ -48,15 +49,16 @@ package org.bigbluebutton.modules.polling.model
addSample1();
addSample2();
addSample3();
trace("*** PollingViewModel num polls = [" + _model.getPolls().length + "] **** \n");
}
private function addSample1():void {
var _questions:Array = new Array();
var _resps1:Array = new Array();
_resps1.push(new Response("1", "Answer 1"));
_resps1.push(new Response("2", "Answer 2"));
_resps1.push(new Response("3", "Answer 3"));
_resps1.push(new Response("1", "Answer 1", new Array()));
_resps1.push(new Response("2", "Answer 2", new Array()));
_resps1.push(new Response("3", "Answer 3", new Array()));
var _q1:Question = new Question("qID", true, "What is my name?", _resps1);
@ -71,8 +73,8 @@ package org.bigbluebutton.modules.polling.model
var _questions:Array = new Array();
var _resps1:Array = new Array();
_resps1.push(new Response("1", "Chicken"));
_resps1.push(new Response("2", "Egg"));
_resps1.push(new Response("1", "Chicken", new Array()));
_resps1.push(new Response("2", "Egg", new Array()));
var _q1:Question = new Question("qID", false, "Which came first?", _resps1);
@ -87,17 +89,17 @@ package org.bigbluebutton.modules.polling.model
var _questions:Array = new Array();
var _resps1:Array = new Array();
_resps1.push(new Response("1", "Dumaguete"));
_resps1.push(new Response("2", "Cebu"));
_resps1.push(new Response("3", "Zamboanga"));
_resps1.push(new Response("4", "None of the above"));
_resps1.push(new Response("1", "Dumaguete", new Array()));
_resps1.push(new Response("2", "Cebu", new Array()));
_resps1.push(new Response("3", "Zamboanga", new Array()));
_resps1.push(new Response("4", "None of the above", new Array()));
var _q1:Question = new Question("qID", false, "What is the capital of the Philippines?", _resps1);
_q1.updateResult("1", 667);
_q1.updateResult("2", 367);
_q1.updateResult("3", 467);
_q1.updateResult("4", 567);
_q1.updateResult("1", new Responder("user1", "Asyong"));
_q1.updateResult("2", new Responder("user2", "Pedro"));
_q1.updateResult("3", new Responder("user3", "Bardagol"));
_q1.updateResult("4", new Responder("user4", "Juan"));
_questions.push(_q1);

View File

@ -30,10 +30,10 @@ package org.bigbluebutton.modules.polling.model
return _question;
}
public function updateResult(responseID:String, count:int):void {
public function updateResult(responseID:String, responder:Responder):void {
for (var i:int = 0; i < _responses.length; i++) {
var r:Response = _responses[i] as Response;
if (r.id == responseID) r.updateResult(count);
if (r.id == responseID) r.addResponder(responder);
}
}

View File

@ -0,0 +1,22 @@
package org.bigbluebutton.modules.polling.model
{
public class Responder
{
private var _userID:String;
private var _username:String;
public function Responder(userID:String, username:String)
{
_userID = userID;
_username = username;
}
public function get userID():String {
return _userID;
}
public function get username():String {
return _username;
}
}
}

View File

@ -5,16 +5,17 @@ package org.bigbluebutton.modules.polling.model
private var _id:String;
private var _response:String;
private var _responseCount:int = 0;
private var _responders:Array;
public function Response(id:String, response:String)
public function Response(id:String, response:String, responders:Array)
{
_id = id;
_response = response;
_responders = responders;
}
public function updateResult(count:int):void {
_responseCount = count;
public function addResponder(r:Responder):void {
_responders.push(r);
}
public function get id():String {
@ -26,7 +27,7 @@ package org.bigbluebutton.modules.polling.model
}
public function get numResponses():int {
return _responseCount;
return _responders.length;
}
}
}

View File

@ -1,10 +1,14 @@
package org.bigbluebutton.modules.polling.service
{
import flash.events.IEventDispatcher;
import flash.events.IEventDispatcher;
import org.bigbluebutton.modules.polling.events.PollEvent;
import org.bigbluebutton.modules.polling.model.Poll;
import org.bigbluebutton.modules.polling.model.PollingModel;
import org.bigbluebutton.modules.polling.model.Question;
import org.bigbluebutton.modules.polling.model.Responder;
import org.bigbluebutton.modules.polling.model.Response;
public class PollDataProcessor
{
@ -15,7 +19,67 @@ package org.bigbluebutton.modules.polling.service
public var dispatcher:IEventDispatcher;
public function handleGetPollsReply(msg:Object):void {
trace("*** Poll getPollsReply " + msg.msg + " **** \n");
trace(LOG + "*** getPollsReply " + msg.msg + " **** \n");
var polls:Array = JSON.parse(msg.msg) as Array;
trace(LOG + "*** getPollsReply " + polls.length + " **** \n");
for (var i:int = 0; i < polls.length; i++) {
var map:Object = polls[i];
var id:String = map.id;
var title:String = map.title;
var questions:Array = map.questions as Array;
var qs:Array = new Array();
for (var j:int = 0; j < questions.length; j++) {
qs.push(buildQuestion(questions[j]));
}
var poll:Poll = new Poll(id, title, qs);
model.createPoll(poll);
}
trace(LOG + "*** getPollsReply num polls = [" + model.getPolls().length + "] **** \n")
}
private function buildQuestion(question:Object):Question {
var resps:Array = question.responses as Array;
var _resps1:Array = buildResponses(resps);
trace(LOG + "*** buildQuestion [" + question.id + "," + question.multiResponse + "," + question.question + "] **** \n")
var _q1:Question = new Question(question.id, question.multiResponse, question.question, _resps1);
return _q1;
}
private function buildResponses(resps:Array):Array {
var _resps1:Array = new Array();
for (var i:int = 0; i < resps.length; i++) {
var r:Object = resps[1];
var responders:Array = buildResponders(r);
_resps1.push(new Response(r.id, r.text, responders));
}
return _resps1;
}
private function buildResponders(response:Object):Array {
var responders:Array = new Array();
var users:Array = response.responders as Array;
for (var k:int = 0; k < users.length; k++) {
responders.push(new Responder(users[k].userID, users[k].name));
}
return responders;
}
public function handlePollResultUpdatedMesage(msg:Object):void {
@ -29,7 +93,7 @@ package org.bigbluebutton.modules.polling.service
}
public function handlePollCreatedMesage(msg:Object):void {
trace("*** Poll Created " + msg.msg + " **** \n");
trace(LOG + "*** Poll Created " + msg.msg + " **** \n");
var map:Object = JSON.parse(msg.msg);
@ -40,13 +104,13 @@ package org.bigbluebutton.modules.polling.service
var poll:Poll = new Poll(id, title, questions);
model.createPoll(poll);
trace("*** Poll Created id=[" + map.id + "] title=[" + map.title + "] questions = [" + questions.length + "] **** \n");
trace(LOG + "*** Poll Created id=[" + map.id + "] title=[" + map.title + "] questions = [" + questions.length + "] **** \n");
dispatcher.dispatchEvent(new PollEvent(PollEvent.POLL_CREATED, poll.id));
}
}
public function handlePollUpdatedMesage(msg:Object):void {
trace("*** Poll updated " + msg.msg + " **** \n");
trace(LOG + "*** Poll updated " + msg.msg + " **** \n");
/*
if (model.hasPoll(msg.id)) {
var id:String = msg.id;
@ -60,7 +124,7 @@ package org.bigbluebutton.modules.polling.service
}
public function handlePollDestroyedMesage(msg:Object):void {
trace("*** Poll destroyed " + msg.msg + " **** \n");
trace(LOG + "*** Poll destroyed " + msg.msg + " **** \n");
/*
if (model.hasPoll(msg.id)) {
model.destroyPoll(msg.id);
@ -71,7 +135,7 @@ package org.bigbluebutton.modules.polling.service
}
public function handlePollStartedMesage(msg:Object):void {
trace("*** Poll started " + msg.msg + " **** \n");
trace(LOG + "*** Poll started " + msg.msg + " **** \n");
/*
if (model.hasPoll(msg.id)) {
model.startPoll(msg.id);
@ -82,7 +146,7 @@ package org.bigbluebutton.modules.polling.service
}
public function handlePollStoppedMesage(msg:Object):void {
trace("*** Poll stopped " + msg.msg + " **** \n");
trace(LOG + "*** Poll stopped " + msg.msg + " **** \n");
/*
if (model.hasPoll(msg.id)) {
model.stopPoll(msg.id);

View File

@ -13,7 +13,7 @@
private function startPoll():void {
trace(LOG + "::startPoll() " + data.id);
var event:OpenTakePollWindowEvent = new OpenTakePollWindowEvent(data.id);
globalDispatch.dispatchEvent(event);
globalDispatch.dispatchEvent(event);
}
private function deletePoll():void {
@ -22,7 +22,7 @@
]]>
</mx:Script>
<mx:Label id="pollTitleLabel" text="{data.title}" styleName="presentationNameLabelStyle" width="80%"/>
<mx:Button id="showBtn" label="{ResourceUtil.getInstance().getString('bbb.fileupload.showBtn')}"
<mx:Button id="showBtn" label="Start"
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.showBtn.toolTip')}"
styleName="presentationUploadShowButtonStyle"
click="startPoll()" enabled="true"/>

View File

@ -1,54 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" borderStyle="none" horizontalAlign="center"
headerHeight="0" borderThicknessBottom="0" borderThicknessLeft="0"
borderThicknessRight="0" borderThicknessTop="0">
borderThicknessRight="0" borderThicknessTop="0" creationComplete="preInit()">
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import org.bigbluebutton.modules.polling.model.PollingViewModel;
import org.bigbluebutton.modules.polling.model.QuestionVO;
public var viewModel:PollingViewModel;
public var pollID:String;
[Bindable] public var sampleData:ArrayCollection = new ArrayCollection([
{Response:"Chicken", numResponses:4},
{Response:"Hen", numResponses:3},
{Response:"egg", numResponses:6}]);
[Bindable] private var _responses:Array;
private function preInit():void {
var q1:QuestionVO = viewModel.getPoll(pollID).questions[0] as QuestionVO;
_responses = q1.answers;
}
]]>
</mx:Script>
<!--mx:PieChart id="pieChart"
dataProvider="{sampleData}"
showDataTips="true"
width="100%"
height="100%">
<mx:series>
<mx:PieSeries id="pieSeries"
field="numResponses"
nameField="Response"
filters="[]"
labelPosition="callout" />
</mx:series>
</mx:PieChart>
<mx:ControlBar width="100%">
<mx:Legend dataProvider="{pieChart}"
direction="horizontal"
labelPlacement="right"
horizontalGap="100"
width="100%" />
</mx:ControlBar-->
<mx:ColumnChart id="barChart" dataProvider="{sampleData}" showDataTips="true">
<mx:ColumnChart id="barChart" dataProvider="{_responses}" showDataTips="true">
<mx:horizontalAxis>
<mx:CategoryAxis
dataProvider="{sampleData}"
categoryField="Response"
dataProvider="{_responses}"
categoryField="response"
/>
</mx:horizontalAxis>
<mx:series>
<mx:ColumnSeries
xField="Response"
xField="response"
yField="numResponses"
displayName="Number of responses"
/>

View File

@ -12,11 +12,7 @@
public var viewModel:PollingViewModel;
public var pollID:String;
[Bindable] public var sampleData:ArrayCollection = new ArrayCollection([
{response:"Chicken", numResponses:4},
{response:"Hen", numResponses:3},
{response:"egg", numResponses:6}]);
[Bindable] private var _responses:Array;
[Bindable] private var _responses:Array;
private function preInit():void {
var q1:QuestionVO = viewModel.getPoll(pollID).questions[0] as QuestionVO;
@ -26,7 +22,7 @@
]]>
</mx:Script>
<mx:PieChart id="pieChart"
dataProvider="{sampleData}"
dataProvider="{_responses}"
showDataTips="true"
width="100%"
height="100%">

View File

@ -114,7 +114,7 @@
</mx:VBox>
<mx:HBox width="100%" height="35" horizontalAlign="right">
<mx:Button label="Create" styleName="presentationUploadShowButtonStyle"/>
<mx:Button label="Create" styleName="presentationUploadShowButtonStyle" click="createPoll()"/>
<mx:Spacer width="5"/>
<mx:Button label="Cancel" styleName="presentationUploadShowButtonStyle"/>
<mx:Spacer width="5"/>

View File

@ -4,6 +4,9 @@
borderThicknessRight="0" borderThicknessTop="0" creationComplete="onPreInit()" >
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.modules.polling.events.OpenCreatePollWindowEvent;
import org.bigbluebutton.modules.polling.model.PollingViewModel;
import org.bigbluebutton.util.i18n.ResourceUtil;
@ -15,6 +18,8 @@
private function onPreInit():void {
_polls = viewModel.polls;
trace("************** PollMainPanel num polls = [" + _polls.length + "]");
}
private function isDuplicateAnswers(arr:Array):Boolean{
@ -32,8 +37,9 @@
private function updateCamera():void {
private function createPoll():void {
var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(new OpenCreatePollWindowEvent());
}
]]>
</mx:Script>
@ -71,7 +77,7 @@
<mx:Label id="customPollsLabel" text="Create a custom poll" styleName="presentationNamesLabelStyle"/>
</mx:HBox>
<mx:HBox width="100%" height="30" horizontalAlign="center">
<mx:Button label="Create Custom Poll" height="25"/>
<mx:Button label="Create Custom Poll" height="25" click="createPoll()"/>
</mx:HBox>
<mx:Spacer height="3"/>
</mx:VBox>

View File

@ -1,25 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()">
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="onCreationComplete()" >
<mx:Script>
<![CDATA[
import mx.controls.CheckBox;
import mx.controls.RadioButton;
import mx.controls.RadioButtonGroup;
import mx.events.ItemClickEvent;
import mx.events.ItemClickEvent;
import org.bigbluebutton.modules.polling.model.PollVO;
import org.bigbluebutton.modules.polling.model.PollingViewModel;
import org.bigbluebutton.modules.polling.model.QuestionVO;
import org.bigbluebutton.modules.polling.model.Response;
public var qvo:QuestionVO;
public var responseCollector:ResponseCollector;
public var viewModel:PollingViewModel;
public var pollID:String;
private var _qvo:QuestionVO;
private var _poll:PollVO;
[Bindable] public var responseCollector:ResponseCollector;
[Bindable] private var _question:String;
[Bindable] private var _responses:Array;
private function onCreationComplete():void {
_question = qvo.question;
_responses = qvo.answers;
trace("******************************* QUESTION RENDERER CREATION COMPLETE ********************************");
_poll = viewModel.getPoll(pollID);
_qvo = _poll.questions[0] as QuestionVO;
_question = _qvo.question;
_responses = _qvo.answers;
if (qvo.multiResponse) {
if (_qvo.multiResponse) {
renderMultiSelectResponse();
} else {
renderMultiChoiceResponse();
@ -27,6 +38,7 @@
}
private var _checkboxes:Array = new Array();
private function renderMultiSelectResponse():void {
for (var i:int = 0; i < _responses.length; i++) {
var r:Response = _responses[i] as Response;
@ -65,14 +77,14 @@
}
}
responseCollector.addResponse(new Responses(qvo.id, sr));
responseCollector.addResponse(new Responses(_qvo.id, sr));
}
private function handleCard(event:ItemClickEvent):void {
trace("Chose [" + event.index + "] + value = [" + rbGroup.selection.id + "]");
var sr:Array = new Array();
sr.push(rbGroup.selection.id);
responseCollector.addResponse(new Responses(qvo.id, sr));
responseCollector.addResponse(new Responses(_qvo.id, sr));
}
]]>

View File

@ -12,29 +12,21 @@
[Bindable] private var baseIndex:int;
public var viewModel:PollingViewModel;
public var pollID:String;
[Bindable] public var viewModel:PollingViewModel;
[Bindable] public var pollID:String;
private var poll:PollVO;
[Bindable] private var _title:String;
[Bindable] private var _qvo:QuestionVO;
private var _pollID:String;
[Bindable] private var responseCollector:ResponseCollector;
private function preInit():void {
poll = viewModel.getSamplePoll();
//poll = viewModel.getPoll(pollID);
poll = viewModel.getPoll(pollID);
_title = poll.title;
_pollID = poll.id;
_qvo = poll.questions[0] as QuestionVO;
trace("*********************Title = [" + _title + "]");
if (_qvo == null) trace("*********************_qvo is null!!!!!!!**************");
else trace("*********************_qvo is NOT null!!!!!!!**************");
responseCollector = new ResponseCollector(_pollID);
responseCollector = new ResponseCollector(pollID);
}
public function updatePoll():void {
@ -79,6 +71,10 @@
}
}
}
public function onClose():void {
invalidateDisplayList();
}
]]>
</mx:Script>
<mx:HBox width="100%" height="25" horizontalAlign="left">
@ -99,7 +95,7 @@
</mx:HBox>
<mx:Spacer height="3"/>
<poll:QuestionRenderer qvo="{_qvo}" responseCollector="{responseCollector}"/>
<poll:QuestionRenderer viewModel="{viewModel}" pollID="{pollID}" responseCollector="{responseCollector}"/>
<mx:Spacer height="5"/>

View File

@ -39,9 +39,15 @@ Notes.mxml is the main view of the SharedNotes application
return MainCanvas.POPUP;
}
override public function close(event:MouseEvent = null):void {
invalidateDisplayList();
takePollPanel.onClose();
super.close(event);
}
]]>
</mx:Script>
<poll:TakePollPanel width="100%" height="100%" viewModel="{viewModel}" pollID="{pollID}"/>
<poll:TakePollPanel id="takePollPanel" width="100%" height="100%" viewModel="{viewModel}" pollID="{pollID}"/>
</MDIWindow>

View File

@ -27,23 +27,26 @@
xmlns:mate="http://mate.asfusion.com/"
toolTip="{ResourceUtil.getInstance().getString('bbb.polling.toolbar.toolTip')}"
implements="org.bigbluebutton.common.IBbbToolbarComponent"
initialize="init();"
initialize="init();" creationComplete="onCreationComplete()"
click="createAndShow();"
icon="{pollIcon}"
accessibilityName="{ResourceUtil.getInstance().getString('bbb.polling.buttonName')}"
>
<mx:Script>
<![CDATA[
import flash.events.FocusEvent;
import flash.events.FocusEvent;
import mx.collections.ArrayCollection;
import mx.controls.Menu;
import mx.events.MenuEvent;
import mx.events.MenuEvent;
import org.bigbluebutton.common.Images;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.model.users.Conference;
import org.bigbluebutton.main.views.MainToolbar;
import org.bigbluebutton.modules.polling.events.InitPollModuleEvent;
import org.bigbluebutton.modules.polling.events.OpenPollMainWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollResultWindowEvent;
import org.bigbluebutton.modules.polling.events.OpenPollUpdateWindowEvent;
@ -71,6 +74,10 @@
[Bindable] public var titleList:Array;
[Bindable] public var pollList:ArrayCollection;
public function onCreationComplete():void {
dispatchEvent(new InitPollModuleEvent());
}
public function init():void {
LogUtil.debug("Initializing Polling toolbar button.");
myMenuData = new ArrayCollection();

View File

@ -1,16 +1,18 @@
package org.bigbluebutton.modules.polling.vo
{
import org.bigbluebutton.modules.polling.model.Responder;
public class ResultVO
{
private var _questionID:String;
private var _responseID:String;
private var _responseCount:int;
private var _responder:Responder;
public function ResultVO(questionID:String, responseID:String, responseCount:int)
public function ResultVO(questionID:String, responseID:String, responder:Responder)
{
_questionID = questionID;
_responseID = responseID;
_responseCount = responseCount;
_responder = responder;
}
public function get questionID():String {
@ -21,8 +23,8 @@ package org.bigbluebutton.modules.polling.vo
return _responseID;
}
public function get responseCount():int {
return _responseCount;
public function get responder():Responder {
return _responder;
}
}
}