From 6dd2dc0a2631e082d6cb49d3d4d3b5d9f9b0e17d Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Wed, 3 Jul 2013 19:14:14 +0000 Subject: [PATCH] - fix show poll result --- .../core/apps/poll/PollModel.scala | 56 ++++++++++++++++--- .../modules/polling/events/PollEvent.as | 1 + .../modules/polling/managers/PollManager.as | 2 +- .../polling/managers/PollingWindowManager.as | 2 +- .../modules/polling/maps/PollingEventMap.mxml | 2 +- .../polling/views/CreatedPollsRenderer.mxml | 10 ++++ 6 files changed, 61 insertions(+), 12 deletions(-) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala index 7c0633ef2c..c944c58a1b 100755 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/poll/PollModel.scala @@ -10,20 +10,58 @@ class PollModel { 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") + addSamplePoll1() + addSamplePoll2() + addSamplePoll3() + } + + def addSamplePoll1() { + val r1 = new ResponseVO("0", "Visa") + val r2 = new ResponseVO("1", "MasterCard") + val r3 = new ResponseVO("2", "AmEx") + val r4 = new ResponseVO("3", "Diners Club") - var q = new QuestionVO("q1", true, "What is my name?", Array(r1, r2, r3)) - val pvo = new PollVO("pollID-100", "sample poll", Array(q)) + var q = new QuestionVO("q1", false, "What type of credit card do you prefer?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-101", "Preferred Credit Card", Array(q)) createPoll(pvo) - respondToQuestion("pollID-100", "q1", "1", new Responder("user1", "Juan Tamad")) - respondToQuestion("pollID-100", "q1", "0", new Responder("user2", "Asyong Aksaya")) + respondToQuestion("pollID-101", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-101", "q1", "0", new Responder("user2", "Asyong Aksaya")) + } + + def addSamplePoll2() { + val r1 = new ResponseVO("0", "Visa") + val r2 = new ResponseVO("1", "MasterCard") + val r3 = new ResponseVO("2", "AmEx") + val r4 = new ResponseVO("3", "Diners Club") + + var q = new QuestionVO("q1", true, "Which credit cards do you own?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-102", "Owned Credit Cards", Array(q)) + + createPoll(pvo) + + respondToQuestion("pollID-102", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-102", "q1", "0", new Responder("user2", "Asyong Aksaya")) } - + + def addSamplePoll3() { + val r1 = new ResponseVO("0", "Dumaguete") + val r2 = new ResponseVO("1", "Cebu") + val r3 = new ResponseVO("2", "Zamboanga") + val r4 = new ResponseVO("3", "None of the above") + + var q = new QuestionVO("q1", true, "What is the capital of the Philippines?", Array(r1, r2, r3, r4)) + val pvo = new PollVO("pollID-103", "Philippine Capital", Array(q)) + + createPoll(pvo) + + respondToQuestion("pollID-103", "q1", "1", new Responder("user1", "Juan Tamad")) + respondToQuestion("pollID-103", "q1", "0", new Responder("user2", "Asyong")) + respondToQuestion("pollID-103", "q1", "2", new Responder("user3", "Pedro")) + respondToQuestion("pollID-103", "q1", "3", new Responder("user4", "Aksaya")) + } + def numPolls():Int = { polls.size } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/PollEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/PollEvent.as index 9e3f9cefaf..270a734102 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/PollEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/events/PollEvent.as @@ -15,6 +15,7 @@ package org.bigbluebutton.modules.polling.events public static const STOP_POLL:String = "stop poll event"; public static const REMOVE_POLL:String = "remove poll event"; public static const EDIT_POLL_REQUEST:String = "request to edit poll event"; + public static const SHOW_POLL_RESULT:String = "request to show result poll event"; private var _pollID:String; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollManager.as index 2d40504d45..4915cb367c 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollManager.as @@ -34,7 +34,7 @@ package org.bigbluebutton.modules.polling.managers public function handleInitPollModuleEvent():void { dispatcher.dispatchEvent(new GetPollsEvent()); - createSamplePolls(); + // createSamplePolls(); } private function createSamplePolls():void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollingWindowManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollingWindowManager.as index 3f9badceb8..a678612ead 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollingWindowManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/managers/PollingWindowManager.as @@ -110,7 +110,7 @@ package org.bigbluebutton.modules.polling.managers openWindow(takePollWindow); } - public function handleOpenPollResultWindowEvent(event:OpenPollResultWindowEvent):void { + public function handleOpenPollResultWindowEvent(event:PollEvent):void { resultsWindow.viewModel = _viewModel; resultsWindow.pollID = event.pollID; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollingEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollingEventMap.mxml index 6fd69400cf..f6e990636f 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollingEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/maps/PollingEventMap.mxml @@ -63,7 +63,7 @@ - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/CreatedPollsRenderer.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/CreatedPollsRenderer.mxml index e8e26dd16f..c3681ae649 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/CreatedPollsRenderer.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/CreatedPollsRenderer.mxml @@ -29,9 +29,19 @@ globalDispatch.dispatchEvent(event); } + + private function showPollResult():void { + var event:PollEvent = new PollEvent(PollEvent.SHOW_POLL_RESULT, data.id); + globalDispatch.dispatchEvent(event); + + } ]]> +