From 08b0ffda1a1353cb43f4b06c47d804fbede63370 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 11 Aug 2015 11:58:16 -0400 Subject: [PATCH 1/4] improved the poll graphic scaling --- .../modules/polling/views/PollGraphic.as | 23 +++++++++++-------- .../business/shapes/PollResultObject.as | 21 ++++++++++------- 2 files changed, 27 insertions(+), 17 deletions(-) mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollGraphic.as mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollGraphic.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollGraphic.as old mode 100644 new mode 100755 index 32813161cc..55a864aff1 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollGraphic.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollGraphic.as @@ -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}, @@ -87,20 +87,23 @@ package org.bigbluebutton.modules.polling.views super.updateDisplayList(unscaledWidth, unscaledHeight); graphics.clear(); - + if (_data != null && _data.length > 0) { graphics.lineStyle(2); graphics.beginFill(bgFill, 1.0); 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); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as old mode 100644 new mode 100755 index 10d0befdf8..a730d42ea6 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as @@ -36,11 +36,11 @@ 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; private var _textFields:Array; @@ -87,13 +87,16 @@ 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 // 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("PollGraphic - extraVPixels {0}", [extraVPixels]); + LOGGER.debug("PollGraphic - extraVPixels {0}", [extraVPixels]); var largestVal:int = -1; var totalCount:Number = 0; //find largest value @@ -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); From 6e3ea8dbb001ee3f272dc63f90c4b1b87b1715a8 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 11 Aug 2015 11:58:50 -0400 Subject: [PATCH 2/4] make sure the poll whiteboard object clears on redraw --- .../modules/whiteboard/business/shapes/PollResultObject.as | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as index a730d42ea6..85e8b32e1b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/whiteboard/business/shapes/PollResultObject.as @@ -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); From e063eedab716a4fd4675f1cfdb1e88fa1aaf318e Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 11 Aug 2015 12:55:30 -0400 Subject: [PATCH 3/4] quick poll matches true/false, yes/no --- .../modules/polling/views/QuickPollButton.as | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/QuickPollButton.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/QuickPollButton.as index e325c17569..4a1af077b6 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/QuickPollButton.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/QuickPollButton.as @@ -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; } From bfd6e15ad759e939fa8bf4f17587609f8149c763 Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 11 Aug 2015 15:35:12 -0400 Subject: [PATCH 4/4] moved stuff around in PollResultsModal --- .../branding/default/style/css/BBBDefault.css | 3 ++- .../locale/en_US/bbbResources.properties | 1 + .../modules/polling/views/PollResultsModal.as | 22 ++++++++++++------- 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-client/branding/default/style/css/BBBDefault.css b/bigbluebutton-client/branding/default/style/css/BBBDefault.css index 41f50a4d42..10aa02d8b8 100755 --- a/bigbluebutton-client/branding/default/style/css/BBBDefault.css +++ b/bigbluebutton-client/branding/default/style/css/BBBDefault.css @@ -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 { diff --git a/bigbluebutton-client/locale/en_US/bbbResources.properties b/bigbluebutton-client/locale/en_US/bbbResources.properties index f31270ce3e..9593f748de 100755 --- a/bigbluebutton-client/locale/en_US/bbbResources.properties +++ b/bigbluebutton-client/locale/en_US/bbbResources.properties @@ -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 diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as index 37bcd04698..be9cfc0833 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/polling/views/PollResultsModal.as @@ -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 {