From e063eedab716a4fd4675f1cfdb1e88fa1aaf318e Mon Sep 17 00:00:00 2001 From: Chad Pilkey Date: Tue, 11 Aug 2015 12:55:30 -0400 Subject: [PATCH] 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; }