Merge pull request #757 from capilkey/misc-polling-changes

Misc polling changes
This commit is contained in:
Richard Alam 2015-08-11 16:39:11 -04:00
commit ca2de434d5
6 changed files with 74 additions and 29 deletions

View File

@ -103,7 +103,8 @@ ToolTip {
.pollResondersLabelStyle {
color: #444444;
fontFamily: Arial;
fontSize: 12;
fontSize: 13;
fontWeight: bold;
}
Button, .logoutButtonStyle, .chatSendButtonStyle, .helpLinkButtonStyle, .cameraDisplaySettingsWindowProfileComboStyle, .cameraDisplaySettingsWindowCameraSelector, .languageSelectorStyle, .testJavaLinkButtonStyle, .recordButtonStyleNormal, .recordButtonStyleStart, .recordButtonStyleStop, .micSettingsWindowHelpButtonStyle {

View File

@ -504,6 +504,7 @@ bbb.polling.closeButton.label = Close
bbb.polling.pollModal.title = Poll
bbb.polling.respondersLabel.novotes = No Users Responded
bbb.polling.respondersLabel.text = {0} Users Responded
bbb.polling.respondersLabel.finished = Done
bbb.polling.answer.Yes = Yes
bbb.polling.answer.No = No
bbb.polling.answer.True = True

View File

@ -37,10 +37,10 @@ package org.bigbluebutton.modules.polling.views
//private const w:uint = 280;
private const bgFill:uint = 0xFFFFFF;
private const colFill:uint = 0x000000;
private const vpadding:Number = 10;
private const hpadding:Number = 5;
private const labelStartWidth:int = 40;
private const percentStartWidth:int = 40;
private const vPaddingPercent:Number = 0.25;
private const hPaddingPercent:Number = 0.1;
private const labelWidthPercent:Number = 0.3;
private const labelMaxWidthInPixels:int = 40;
private var sampledata:Array = [{a:"A", v:3},
{a:"B", v:1},
@ -94,13 +94,16 @@ package org.bigbluebutton.modules.polling.views
graphics.drawRect(sx, sy, unscaledWidth, unscaledHeight);
graphics.endFill();
var vpadding:int = (unscaledHeight*vPaddingPercent)/(_data.length+1);
var hpadding:int = (unscaledWidth*hPaddingPercent)/(4);
var actualRH:Number = (unscaledHeight-vpadding*(_data.length+1)) / _data.length;
LOGGER.debug("as raw {0} int {1}" + [actualRH, int(actualRH)]);
LOGGER.debug("PollGraphic - as raw {0} int {1}", [actualRH, int(actualRH)]);
// Current problem is that the rowHeight is truncated. It would be nice if the extra pixels
// could be distributed for a more even look.
var avgRowHeight:int = (unscaledHeight-vpadding*(_data.length+1)) / _data.length;
var extraVPixels:int = unscaledHeight - (_data.length * (avgRowHeight+vpadding) + vpadding);
LOGGER.debug("extraVPixels {0}", [extraVPixels]);
LOGGER.debug("PollGraphic - extraVPixels {0}", [extraVPixels]);
var largestVal:int = -1;
var totalCount:Number = 0;
//find largest value
@ -117,6 +120,8 @@ package org.bigbluebutton.modules.polling.views
var minFontSize:int = 20;
var currFontSize:int;
var startingLabelWidth:Number = Math.min(labelWidthPercent*unscaledWidth, labelMaxWidthInPixels);
graphics.lineStyle(2);
graphics.beginFill(colFill, 1.0);
for (var j:int=0, vp:int=extraVPixels, ry:int=0, curRowHeight:int=0; j<_data.length; j++) {
@ -133,7 +138,7 @@ package org.bigbluebutton.modules.polling.views
// add row label
answerText = _textFields[currTFIdx++];
answerText.text = _data[j].a;
answerText.width = labelStartWidth;
answerText.width = startingLabelWidth;
answerText.height = curRowHeight;
answerText.selectable = false;
//addChild(answerText);
@ -148,7 +153,7 @@ package org.bigbluebutton.modules.polling.views
percentText = _textFields[currTFIdx++];;// new TextField();
var percentNum:Number = (totalCount == 0 ? 0 : ((_data[j].v/totalCount)*100));
percentText.text = Math.round(percentNum).toString() + "%";
percentText.width = percentStartWidth;
percentText.width = startingLabelWidth;
percentText.height = curRowHeight;
percentText.selectable = false;
//addChild(percentText);

View File

@ -34,7 +34,7 @@ package org.bigbluebutton.modules.polling.views
super();
styleName = "micSettingsWindowStyle";
width = 300;
width = 400;
height = 300;
setStyle("verticalGap", 15);
showCloseButton = false;
@ -56,23 +56,25 @@ package org.bigbluebutton.modules.polling.views
hrule.percentWidth = 100;
addChild(hrule);
_pollGraphic = new PollGraphic();
_pollGraphic.data = null;
_pollGraphic.width = 300;
_pollGraphic.minWidth = 130;
addChild(_pollGraphic);
_respondersLabel = new Label();
_respondersLabel.styleName = "pollResondersLabelStyle";
_respondersLabel.text = " ";// ResourceUtil.getInstance().getString('bbb.polling.respondersLabel.novotes');
addChild(_respondersLabel);
_pollGraphic = new PollGraphic();
_pollGraphic.data = null;
_pollGraphic.width = 200;
_pollGraphic.minWidth = 130;
addChild(_pollGraphic);
hrule = new HRule();
hrule.percentWidth = 100;
addChild(hrule);
var botBox:HBox = new HBox();
botBox.percentWidth = 90;
botBox.setStyle("gap", 10);
botBox.setStyle("horizontalAlign", "right");
_publishBtn = new Button();
_publishBtn.label = ResourceUtil.getInstance().getString('bbb.polling.publishButton.label');
@ -113,7 +115,11 @@ package org.bigbluebutton.modules.polling.views
}
_pollGraphic.data = resultData;
_respondersLabel.text = ResourceUtil.getInstance().getString('bbb.polling.respondersLabel.text', [e.result.numResponders + "/" + e.result.numRespondents]);
if (e.result.numResponders != e.result.numRespondents) {
_respondersLabel.text = e.result.numResponders + "/" + e.result.numRespondents;
} else {
_respondersLabel.text = ResourceUtil.getInstance().getString('bbb.polling.respondersLabel.finished');
}
}
private function handlePublishClick(e:MouseEvent):void {

View File

@ -30,8 +30,23 @@ package org.bigbluebutton.modules.polling.views {
}
private function parseSlideText(text:String):void {
var regEx:RegExp = new RegExp("\n[^\s][\.\)]", "g");
var matchedArray:Array = text.match(regEx);
var numRegex:RegExp = new RegExp("\n[^\s][\.\)]", "g");
var ynRegex:RegExp = new RegExp((ResourceUtil.getInstance().getString("bbb.polling.answer.Yes")+
"\s*/\s*"+
ResourceUtil.getInstance().getString("bbb.polling.answer.No")).toLowerCase());
var nyRegex:RegExp = new RegExp((ResourceUtil.getInstance().getString("bbb.polling.answer.No")+
"\s*/\s*"+
ResourceUtil.getInstance().getString("bbb.polling.answer.Yes")).toLowerCase());
var tfRegex:RegExp = new RegExp((ResourceUtil.getInstance().getString("bbb.polling.answer.True")+
"\s*/\s*"+
ResourceUtil.getInstance().getString("bbb.polling.answer.False")).toLowerCase());
var ftRegex:RegExp = new RegExp((ResourceUtil.getInstance().getString("bbb.polling.answer.False")+
"\s*/\s*"+
ResourceUtil.getInstance().getString("bbb.polling.answer.True")).toLowerCase());
text = text.toLowerCase();
var matchedArray:Array = text.match(numRegex);
LOGGER.debug("Parse Result: {0} {1}", [matchedArray.length, matchedArray.join(" ")]);
if (matchedArray.length > 1) {
var constructedLabel:String = ResourceUtil.getInstance().getString("bbb.polling.answer."+String.fromCharCode(65));
@ -42,6 +57,18 @@ package org.bigbluebutton.modules.polling.views {
label = constructedLabel;
name = "A-"+len;
visible = true;
} else if (text.search(ynRegex) > -1 || text.search(nyRegex) > -1) {
label = ResourceUtil.getInstance().getString("bbb.polling.answer.Yes")+
"/"+
ResourceUtil.getInstance().getString("bbb.polling.answer.No");
name = "YN";
visible = true;
} else if (text.search(tfRegex) > -1 || text.search(ftRegex) > -1) {
label = ResourceUtil.getInstance().getString("bbb.polling.answer.True")+
"/"+
ResourceUtil.getInstance().getString("bbb.polling.answer.False");
name = "TF";
visible = true;
} else {
visible = false;
}

View File

@ -36,10 +36,10 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
//private const w:uint = 280;
private const bgFill:uint = 0xFFFFFF;
private const colFill:uint = 0x000000;
private const vpadding:Number = 10;
private const hpadding:Number = 5;
private const labelStartWidth:int = 40;
private const percentStartWidth:int = 40;
private const vPaddingPercent:Number = 0.25;
private const hPaddingPercent:Number = 0.1;
private const labelWidthPercent:Number = 0.3;
private const labelMaxWidthInPixels:int = 40;
private var sampledata:Array = [{a:"A", v:3}, {a:"B", v:1}, {a:"C", v:5}, {a:"D", v:8}];
private var _data:Array;
@ -79,7 +79,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
}
private function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void {
// graphics.clear();
graphics.clear();
if (_data != null && _data.length > 0) {
graphics.lineStyle(2);
@ -87,6 +87,9 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
graphics.drawRect(0, 0, unscaledWidth, unscaledHeight);
graphics.endFill();
var vpadding:int = (unscaledHeight*vPaddingPercent)/(_data.length+1);
var hpadding:int = (unscaledWidth*hPaddingPercent)/(4);
var actualRH:Number = (unscaledHeight-vpadding*(_data.length+1)) / _data.length;
LOGGER.debug("PollGraphic - as raw {0} int {1}", [actualRH, int(actualRH)]);
// Current problem is that the rowHeight is truncated. It would be nice if the extra pixels
@ -110,6 +113,8 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
var minFontSize:int = 20;
var currFontSize:int;
var startingLabelWidth:Number = Math.min(labelWidthPercent*unscaledWidth, labelMaxWidthInPixels);
graphics.lineStyle(2);
graphics.beginFill(colFill, 1.0);
for (var j:int=0, vp:int=extraVPixels, ry:int=0, curRowHeight:int=0; j<_data.length; j++) {
@ -126,7 +131,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
// add row label
answerText = _textFields[currTFIdx++];
answerText.text = _data[j].a;
answerText.width = labelStartWidth;
answerText.width = startingLabelWidth;
answerText.height = curRowHeight;
answerText.selectable = false;
//addChild(answerText);
@ -141,7 +146,7 @@ package org.bigbluebutton.modules.whiteboard.business.shapes
percentText = _textFields[currTFIdx++];;// new TextField();
var percentNum:Number = (totalCount == 0 ? 0 : ((_data[j].v/totalCount)*100));
percentText.text = Math.round(percentNum).toString() + "%";
percentText.width = percentStartWidth;
percentText.width = startingLabelWidth;
percentText.height = curRowHeight;
percentText.selectable = false;
//addChild(percentText);