Merge branch 'master' into modify-esl-startup

This commit is contained in:
Richard Alam 2013-05-19 20:48:04 +00:00
commit d25ec67d85
3 changed files with 127 additions and 177 deletions

View File

@ -88,9 +88,12 @@
private var webClosed:Boolean;
private var notified:Boolean;
private var refreshTimer:Timer = new Timer(1000);
private var answersAC:ArrayCollection = new ArrayCollection();
[Bindable] private var answerCollection:ArrayCollection = new ArrayCollection();
private function init():void{
answerCollection = trackingPoll.generateStats();
conference = UserManager.getInstance().getConference();
webPollText.visible = (UsersUtil.amIPresenter() && (!reviewing && trackingPoll.publishToWeb));
btnClosePoll.visible = UsersUtil.amIPresenter();
@ -102,9 +105,6 @@
generate.poll = trackingPoll;
dispatchEvent(generate);
}
refreshTimer.addEventListener(TimerEvent.TIMER, autoRefresh);
refreshTimer.start();
answersAC = trackingPoll.generateStats();
notified = false;
}
@ -151,6 +151,7 @@
public function setUrlBoxText():void{
webPollURLBox.text = webPollUrl;
webPollURLBox.accessibilityName = ResourceUtil.getInstance().getString('bbb.polling.stats.webPollBoxAccessName', [webPollUrl]);
LogUtil.debug("webPollURLBox.Text is : " + webPollURLBox.text);
if (UsersUtil.amIPresenter())
messageForRecording(ResourceUtil.getInstance().getString('bbb.polling.stats.webPollURL') + " " + webPollUrl);
@ -247,142 +248,78 @@
dispatchEvent(stopPollEvent);
}
// function receives Array.length and ArrayCollection
private function createResultsTable(amount:uint, content:Array):void{
var _tx: Text;
var _votes: Text;
var _percent: Text;
var _hb: HBox;
var _line: HRule;
var totalVotes:int = 0;
for (var n:int = 0; n < trackingPoll.votes.length; n++){
totalVotes+= int(trackingPoll.votes[n]);
}
// delete existing rows
resultBox.removeAllChildren();
// creating rows one by one
for (var i:int = 0; i < amount; i++) {
_tx = new Text();
_votes= new Text;
_percent= new Text();
_hb = new HBox();
_line = new HRule();
_line.width = 290;
_tx.name = "option" +i;
_tx.width = 200;
_tx.text =content[i].toString();
_votes.name = "votes" +i;
_votes.width = 30;
_votes.text = trackingPoll.votes[i];
_percent.name = "percent" +i;
_percent.width = 50;
// Percentage is in terms of how many votes each option has in terms of total votes
if (totalVotes > 0){
_percent.text = Math.round(100*(trackingPoll.votes[i]/totalVotes)) + "%";
}else{
// Prevents percentages from displaying misleading results before any votes come in, and from dividing by zero
_percent.text = " ";
}
resultBox.addChild(_hb);
_hb.addChild(_tx);
_hb.addChild(_votes);
_hb.addChild(_percent);
resultBox.addChild(_line);
} // end of loop
didNotVote();
invalidateDisplayList();
resultBox.validateNow();
} // end of function createResultsTable
answerCollection = trackingPoll.generateStats();
answerCollection.addItem(didNotVote());
resultsGrid.dataProvider = answerCollection;
}
private function didNotVote():void{
var _tx:Text = new Text();
var _votes:Text= new Text;
var _hb:HBox = new HBox();
_tx.name = "optionNull";
_tx.width = 200;
_tx.text = ResourceUtil.getInstance().getString('bbb.polling.stats.didNotVote');
_votes.name = "voteNull";
_votes.width = 30;
_votes.text = trackingPoll.didNotVote.toString();
resultBox.addChild(_hb);
_hb.addChild(_tx);
_hb.addChild(_votes);
private function didNotVote():PollStatLineObject{
var pso:PollStatLineObject = new PollStatLineObject();
pso.answer = ResourceUtil.getInstance().getString('bbb.polling.stats.didNotVote');
pso.votes = trackingPoll.didNotVote.toString();
pso.percentage = "";
return pso;
}
]]>
</mx:Script>
<!-- Prototype of Polling Statistics View Design -->
<mx:VBox width="100%"
height="75%"
horizontalAlign="center"
paddingLeft="10"
paddingRight="10"
focusEnabled="true"
accessibilityDescription="Alpha">
<!-- Accessible statistics view -->
<mx:VBox width="100%"
height="75%"
horizontalAlign="center"
paddingLeft="10"
paddingRight="10"
focusEnabled="true">
<mx:HBox width="90%"
paddingTop="10"
focusEnabled="true"
accessibilityDescription="Bravo">
focusEnabled="true">
<mx:Text id="webPollText"
text="{ResourceUtil.getInstance().getString('bbb.polling.stats.webPollURL')}"
width="140"/>
width="140"
/>
</mx:HBox>
<mx:HBox id="webPollBox"
width="90%"
accessibilityDescription="Charlie">
width="90%">
<mx:TextArea id="webPollURLBox"
editable="false"
text=""
height="25"
width="95%"
/>
width="95%"
/>
<!-- tabIndex="{baseIndex+4}" -->
</mx:HBox>
<mx:Text width="200"
paddingTop="15" paddingBottom="10"
<mx:Text width="200"
paddingTop="15" paddingBottom="10"
fontWeight="bold" textAlign="center"
text="{question}"/>
<mx:Box id="resultBox"
width="90%"
height="90%" />
<!-- Viewer's grid used as an example -->
<!--mx:DataGrid id="viewersGrid" dataProvider="{UserManager.getInstance().getConference().users}" editable="false"
>>>>>>> poll-access
dragEnabled="false" width="90%" height="100%" accessibilityName="Users list.">
<mx:columns>
<mx:DataGridColumn dataField="role"
headerText="{ResourceUtil.getInstance().getString('bbb.viewers.viewersGrid.roleItemRenderer')}"
dataTipField="Role"
editable="false"
width="35"
itemRenderer="org.bigbluebutton.modules.viewers.views.RoleItemRenderer"
sortable="false"
id="roleField"/>
<mx:DataGridColumn dataField="name"
headerText="{ResourceUtil.getInstance().getString('bbb.viewers.viewersGrid.nameItemRenderer')}"
editable="true"
width="100"
sortable="false"
itemRenderer="org.bigbluebutton.modules.viewers.views.NameItemRenderer"/>
<mx:DataGridColumn dataField="status"
headerText="{ResourceUtil.getInstance().getString('bbb.viewers.viewersGrid.statusItemRenderer')}"
dataTipField="Status"
id="statusField"
sortable="false"
itemRenderer="org.bigbluebutton.modules.viewers.views.StatusItemRenderer"/>
</mx:columns>
</mx:DataGrid-->
<mx:DataGrid id="resultsGrid"
dataProvider="{answerCollection}"
rowCount="{answerCollection.length}"
width="90%"
accessibilityName="{ResourceUtil.getInstance().getString('bbb.polling.stats.question', [trackingPoll.question])}"
>
<!-- tabIndex="{baseIndex+5}" -->
<mx:columns>
<mx:DataGridColumn id="answerColumn"
dataField="answer"
headerText="{ResourceUtil.getInstance().getString('bbb.polling.stats.answer')}"
wordWrap="true"
/>
<mx:DataGridColumn id="voteColumn"
dataField="votes"
headerText="{ResourceUtil.getInstance().getString('bbb.polling.stats.votes')}"
width="40"
/>
<mx:DataGridColumn id="percentColumn"
dataField="percentage"
headerText="{ResourceUtil.getInstance().getString('bbb.polling.stats.percentage')}"
width="70"
/>
</mx:columns>
</mx:DataGrid>
</mx:VBox>
<mx:ControlBar width="100%" height="10%">
<mx:Spacer width="100%"/>
<mx:Button id="btnRefreshResults"

View File

@ -76,11 +76,16 @@
}
private function onCreationComplete():void{
questionText.text = question;
if (isMultiple)
questionText.text += " " + ResourceUtil.getInstance().getString('bbb.polling.pollPreview.checkAll');
if (isMultiple)
errorMessage.text = ResourceUtil.getInstance().getString('bbb.polling.vote.error.check');
else
errorMessage.text = ResourceUtil.getInstance().getString('bbb.polling.vote.error.radio');
checkInstructions.visible = isMultiple;
ExternalInterface.call("addAlert", errorMessage.text);
//checkInstructions.visible = isMultiple;
createButtons(answers.length,answers);
invalidateDisplayList();
validateNow();
@ -88,8 +93,7 @@
for(var s:String in answers){
lines = lines + ((s.length / 28) + 1);
}
height = height + (lines * 50);
//questionBox.
height = height + ((lines+1) * 45);
}
// This function will receive information and generate radiobuttons on fly
@ -100,35 +104,41 @@
var _tx: Text;
var _hb: HBox;
var _rb_group:RadioButtonGroup = new RadioButtonGroup();
var totalOptions:int = content.length;
// creating buttons one by one
for (var i:int = 0; i < amount; i++) {
for (var i:int = 0; i < amount; i++) {
var indicator:String = ResourceUtil.getInstance().getString('bbb.polling.vote.indicator', [i+1, totalOptions])
_tx = new Text();
_hb = new HBox();
_tx.name = "option" +i;
_tx.width = 200;
// assigning array element to text field
_tx.text =content[i].toString();
answerBox.addChild(_hb);
_tx.text = content[i].toString();
answerBox.addChild(_hb);
// if global var isMultiple is true it means user wants checkboxes,
//otherwise radiobutton (if multiple choices are allowed)
if(isMultiple){
_cb= new CheckBox();
_cb.id = "answers"+i;
_cb.addEventListener(MouseEvent.CLICK, checkBoxClick);
// gap between the buttons
_cb.y=i*20;
// adding buttons to the Horizontal Box
_hb.addChild(_cb);
}else{
_rb = new RadioButton();
_rb.groupName = "answersGroup";
_rb.name = content[i].toString(); // giving button a name of array elelment to process it easier later
_rb.id = "answers"+i;
_cb= new CheckBox();
_cb.id = "answers"+i;
_cb.accessibilityName = indicator + content[i].toString();
_cb.addEventListener(MouseEvent.CLICK, checkBoxClick);
// gap between the buttons
_cb.y=i*20;
//_cb.tabIndex = baseIndex++;
// adding buttons to the Horizontal Box
_hb.addChild(_cb);
}else{
_rb = new RadioButton();
_rb.groupName = "answersGroup";
_rb.name = content[i].toString(); // giving button a name of array elelment to process it easier later
_rb.id = "answers"+i;
_rb.addEventListener(MouseEvent.CLICK, radioClick);
_hb.addChild(_rb);
}
_hb.addChild(_tx); // adding text near button
_rb.accessibilityName = indicator + content[i].toString();
//_rb.tabIndex = baseIndex++;
_hb.addChild(_rb);
}
_hb.addChild(_tx); // adding text near button
} // end of loop
answerBox.validateNow();
} // end of function createButtons
@ -149,8 +159,10 @@
dispatchEvent(voteEvent);
closeWindow();
}
else
else{
errorMessage.visible = true;
ExternalInterface.call("addAlert", errorMessage.text);
}
} // _vote
// As the user clicks CheckBoxes, this function keeps a running tally of which boxes are and are not selected
@ -181,38 +193,39 @@
</mx:Script>
<mx:RadioButtonGroup id="answersGroup"/>
<!-- Prototype of Polling Module Design -->
<mx:VBox accessibilityDescription="The question will go into the V BOX"
width="100%"
height="75%"
horizontalAlign="center"
paddingLeft="10"
paddingRight="10"
focusEnabled="true">
<mx:HBox accessibilityDescription="The question will go into the H BOX"/>
<mx:Text width="200"
paddingTop="30"
paddingBottom="10"
fontWeight="bold"
textAlign="center"
text="{question}"
accessibilityDescription="The question will go into the m x TEXT"
/>
<mx:Text id="checkInstructions"
text="{ResourceUtil.getInstance().getString('bbb.polling.pollPreview.checkAll')}"/>
<mx:Box id="answerBox"
width="90%"
height="90%" />
<mx:Text id="errorMessage"
color="red"
visible="false"/>
<!-- Prototype of Polling Module Design -->
<mx:VBox id="votingBox"
width="90%"
height="90%">
<mx:Panel id="titleShow"
width="90%" >
<mx:VBox paddingTop="10"
paddingLeft="40"
paddingBottom="40"
horizontalAlign="center"
>
<mx:TextArea id="questionText"
width="90%"
fontWeight="bold"
textAlign="center"
editable="false"
borderSkin="{null}"
/>
<mx:Box id="answerBox" />
<mx:Text id="errorMessage"
color="red"
visible="false"/>
</mx:VBox>
</mx:Panel>
</mx:VBox>
<mx:ControlBar width="100%"
horizontalAlign="center">
<mx:Button id="btnAcceptPoll"
label="{ResourceUtil.getInstance().getString('bbb.polling.pollView.vote')}"
click="Vote()"
width="100"
height="30"/>
</mx:ControlBar>
<mx:ControlBar width="100%"
horizontalAlign="center">
<mx:Button id="btnAcceptPoll"
label="{ResourceUtil.getInstance().getString('bbb.polling.pollView.vote')}"
click="Vote()"
width="100"
height="30"
/>
</mx:ControlBar>
</MDIWindow>

View File

@ -168,7 +168,7 @@
}
}
if ((data.role == Role.MODERATOR) || !data.voiceJoined) {
if (!data.voiceJoined) {
lockImg.visible = false;
lockImg.includeInLayout = false;
lockBtn.visible = false;