From 082e57c565a32059c1eec1f241efbc7c682aa1fe Mon Sep 17 00:00:00 2001 From: jtrobinson Date: Thu, 9 Aug 2012 18:14:20 +0000 Subject: [PATCH] Trying to back up Chat Module changes --- .../resources/prod/BigBlueButton.html | 1 + .../resources/prod/lib/bbb_blinker.js | 19 ++ bigbluebutton-client/src/BigBlueButton.mxml | 1 - .../modules/chat/views/ChatView.mxml | 165 +++++------------- 4 files changed, 63 insertions(+), 123 deletions(-) mode change 100644 => 100755 bigbluebutton-client/resources/prod/BigBlueButton.html mode change 100644 => 100755 bigbluebutton-client/resources/prod/lib/bbb_blinker.js diff --git a/bigbluebutton-client/resources/prod/BigBlueButton.html b/bigbluebutton-client/resources/prod/BigBlueButton.html old mode 100644 new mode 100755 index c6a55a52f6..cbd9f01c21 --- a/bigbluebutton-client/resources/prod/BigBlueButton.html +++ b/bigbluebutton-client/resources/prod/BigBlueButton.html @@ -39,5 +39,6 @@ +
diff --git a/bigbluebutton-client/resources/prod/lib/bbb_blinker.js b/bigbluebutton-client/resources/prod/lib/bbb_blinker.js old mode 100644 new mode 100755 index 0510e14a4a..3f1b74f281 --- a/bigbluebutton-client/resources/prod/lib/bbb_blinker.js +++ b/bigbluebutton-client/resources/prod/lib/bbb_blinker.js @@ -27,3 +27,22 @@ var clearblink = function() document.title = 'BigBlueButton'; } +var i = 1; +function addAlert(message){ + var target = document.getElementById( 'notifications' ), + contentDiv = document.createElement( "div" ); + contentDiv.id = "alertDiv" + i; + i++; + contentDiv.innerHTML = "

" + message + "

"; + contentDiv.style.display = "block"; + target.appendChild( contentDiv ); + target.hide(); + target.show(); + contentDiv.hide(); + contentDiv.show(); +} + +function determineBrowser() +{ + return navigator.appName; +} \ No newline at end of file diff --git a/bigbluebutton-client/src/BigBlueButton.mxml b/bigbluebutton-client/src/BigBlueButton.mxml index 4ce763d7d4..2dab52161a 100755 --- a/bigbluebutton-client/src/BigBlueButton.mxml +++ b/bigbluebutton-client/src/BigBlueButton.mxml @@ -19,7 +19,6 @@ $Id: $ --> - ' + word + ' '; - else if (word.indexOf("www.") != -1) parsedString += ' ' + word + ' '; - else if (word.indexOf("https://") != -1) parsedString += ' ' + word + ' '; - else parsedString += word + ' '; + else if (word.indexOf("www.") != -1) parsedString += ' ' + word + ' '; + else if (word.indexOf("https://") != -1) parsedString += ' ' + word + ' '; + else parsedString += word + ' '; + } + return parsedString; } - return parsedString; - } private function sendPublicChatMessage(message:String):void { var publicEvent:SendPublicChatMessageEvent = new SendPublicChatMessageEvent(SendPublicChatMessageEvent.SEND_PUBLIC_CHAT_MESSAGE_EVENT); @@ -383,11 +379,8 @@ private function createChatBoxFor(userid:String):ChatBox { var chatBox:ChatBox = new ChatBox(); chatBox.id = getParticipantName(userid); - LogUtil.debug("WATERFALL: chatBox.id = " + chatBox.id); chatBox.label = getParticipantName(userid); - LogUtil.debug("WATERFALL: chatBox.label = " + chatBox.label); chatBox.name = userid; - LogUtil.debug("WATERFALL: chatBox.name = " + chatBox.name); if (chatTabs.numChildren >= 2){ chatTabs.addChildAt(chatBox, chatTabs.numChildren - 1); @@ -395,21 +388,6 @@ else{ chatTabs.addChild(chatBox); } - //* - var childIndex:int; - childIndex = chatTabs.getChildIndex(chatBox); - LogUtil.debug("WATERFALL: ChatBox is at index " + childIndex); - if (childIndex == 0){ - //chatTabs.getChildAt(childIndex).parent.accessibilityProperties.name = PUBLIC_TAB + "NAME"; - this.accessibilityProperties.description = PUBLIC_TAB + "DESCRIPTION"; - } - else if (childIndex == chatTabs.numChildren-1){ - this.accessibilityProperties.description = PLUS_TAB; - } - else{} - - Accessibility.updateProperties(); - //*/ return chatBox; } @@ -426,11 +404,10 @@ } // Receive public chat messages - private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void { - LogUtil.debug("Got PublicChatMessageEvent from userid [ " + event.chatobj.userid + " ]"); + private function handlePublicChatMessageEvent(event:PublicChatMessageEvent):void { + //LogUtil.debug("Got PublicChatMessageEvent from userid [ " + event.chatobj.userid + " ]"); if(event.chatobj.userid != "") - event.chatobj.message = parseURLs(event.chatobj.message); - + event.chatobj.message = parseURLs(event.chatobj.message); showMessage(PUBLIC_CHAT_USERID, event.chatobj, autoTranslation); if ((! UserManager.getInstance().getConference().amIThisUser(new Number(event.chatobj.userid))) && (event.chatobj.userid != "")){ if (Accessibility.active){ @@ -440,6 +417,7 @@ ExternalInterface.call("startblink", ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting'), ResourceUtil.getInstance().getString('bbb.chat.publicMsgAwaiting2')); } } + globalDispatcher.dispatchEvent(new BBBEvent(BBBEvent.RECEIVED_PUBLIC_CHAT_MESSAGE_EVENT, event.chatobj.message)); } @@ -484,8 +462,7 @@ } } if (newItem){ - // Add a private chat event (with all associated information) to the privateWaiting array, - // and a PrivateFocusTracker to the privateFocus array to track whether to play the sound + // Add a private chat event (with all associated information) to the privateWaiting array privateWaiting.addItem(event); chatTabs.getChildByName(event.message.chatobj.userid).addEventListener(FocusEvent.FOCUS_IN, privateChatFocus); chatTabs.getChildByName(event.message.chatobj.userid).addEventListener(FocusEvent.FOCUS_OUT, privateChatUnfocus); @@ -494,7 +471,6 @@ } public function publicChatFocus(event:FocusEvent):void{ - //LogUtil.debug("WATERFALL: publicChatFocus active, removing publicWaiting"); publicFocus = true; if (publicWaiting) ExternalInterface.call("clearblink"); @@ -502,8 +478,6 @@ } public function privateChatFocus(event:FocusEvent):void{ - //LogUtil.debug("WATERFALL: Event target is " + event.target); - //LogUtil.debug("WATERFALL: Event target name is " + event.target.name); if (event.target.name == "chatMessagesList"){ var removed:Boolean = false; @@ -535,22 +509,32 @@ } // Listens to the notification timer, and checks if there are messages waiting - // The notifications kept repeating as I was still focused from the last message, and after I hit space. Try comparing latestMessage to currentMessage; maybe store a Boolean? private function checkNotifications(event:TimerEvent):void{ var debugDate:Date = new Date(); + var browserName:String; if (publicWaiting && !publicFocus){ LogUtil.debug("The time is " + debugDate.getHours() + ":" + debugDate.getMinutes() + ":" + debugDate.getSeconds() + " and there are new public messages."); - publicSound.play(); + //browserName = ExternalInterface.call("determineBrowser", PUBLIC_TAB_NEW); + //if (browserName == "Microsoft Internet Explorer") + // publicSound.play(); + //else + ExternalInterface.call("addAlert", PUBLIC_TAB_NEW); } - // Clearing public notes works, but for some reason private chat tabs are not appearing - // The tab appears on the second message you send if (privateWaiting.length && !privateFocus){ - privateSound.play(); - /*LogUtil.debug("The time is " + debugDate.getHours() + ":" + debugDate.getMinutes() + ":" + debugDate.getSeconds() + " and there are new private messages from: "); - for (var i:int = 0; i < privateWaiting.length; i++){ - LogUtil.debug(privateWaiting.getItemAt(i).message.chatobj.username); - }*/ + browserName = ExternalInterface.call("determineBrowser", PUBLIC_TAB_NEW); + if (browserName == "Microsoft Internet Explorer"){ + privateSound.play(); + } + else { + var names:String = ""; + for (var i:int = 0; i < privateWaiting.length; i++){ + names += " " + privateWaiting.getItemAt(i).message.chatobj.username; + if (i < privateWaiting.length - 1) + names += ","; + } + ExternalInterface.call("addAlert", PRIVATE_TAB_NEW + names); + } } } @@ -568,86 +552,25 @@ // This is slightly mis-named; it removes the notification of this sender sending a private message for notification purposes private function removePrivateSender(senderID:String):Boolean{ var success:Boolean = false; - //LogUtil.debug("WATERFALL: Trying to remove sender " + senderID); if (privateWaiting.length){ for (var i:int = 0; i < privateWaiting.length; i++){ if (senderID == privateWaiting.getItemAt(i).message.chatobj.userid){ privateWaiting.removeItemAt(i); success = true; i = privateWaiting.length; - //LogUtil.debug("WATERFALL: Removed sender " + senderID); } } } return success; } - - /* - // Descriptions for accessibilty properties - private static const PUBLIC_TAB:String = "PUBLIC CHAT"; - private static const PUBLIC_TAB_NEW:String = "NEW MESSAGE IN PUBLIC CHAT"; - private static const PRIVATE_TAB:String = "PRIVATE CHAT WITH "; - private static const PRIVATE_TAB_NEW:String = "NEW MESSAGE IN PRIVATE CHAT WITH "; - private static const PLUS_TAB:String = "CHAT OPTIONS TAB"; - */ - - - // All uses of updateTabNames temporarily disabled, as it is not working for mysterious reasons - // It's intended use is to let a screen reader tell the user if there are new messages in the currently focused tab or not - private function updateTabNames():void{ - LogUtil.debug("Entering updateTabNames"); - if (chatTabs.selectedIndex == 0){ // Public Chat tab - LogUtil.debug("Entering public tab logic"); - if (publicWaiting){ - LogUtil.debug("Entering public waiting logic"); - this.accessibilityProperties.description = PUBLIC_TAB_NEW; - } - else{ - LogUtil.debug("Entering public no-waiting logic"); - this.accessibilityProperties.description = PUBLIC_TAB; - } - LogUtil.debug("Leaving public logic"); - } - else if (chatTabs.selectedIndex == chatTabs.numChildren - 1){ // Options tab - LogUtil.debug("Entering options logic"); - this.accessibilityProperties.description = PLUS_TAB; - LogUtil.debug("Leaving options logic"); - } - else{ // Any Private Chat tab - LogUtil.debug("Entering private logic"); - var otherUserID:String = chatTabs.getChildAt(chatTabs.selectedIndex).name; - var otherUserName:String = UserManager.getInstance().getConference().getParticipant(int(otherUserID)).name; - LogUtil.debug("WATERFALL: Just to be sure, user ID " + otherUserID + " has the name " + otherUserName); - if (getPrivateSenders().contains(otherUserID)){ // New messages - LogUtil.debug("Entering private new-message logic"); - this.accessibilityProperties.description = PRIVATE_TAB_NEW + otherUserName; - LogUtil.debug("Leaving private new-message logic"); - } - else{ // No new messages - LogUtil.debug("Entering private no-new-message logic"); - this.accessibilityProperties.description = PRIVATE_TAB + otherUserName; - LogUtil.debug("Leaving private no-new-message logic"); - } - LogUtil.debug("Leaving private logic"); - } - Accessibility.updateProperties(); - //focusManager.setFocus(this); - LogUtil.debug("WATERFALL: Description is now: "+ this.accessibilityProperties.description); - LogUtil.debug("Leaving updateTableNames"); - } - - // About to change description again - // From (chatTabs.selectedIndex).accessibilityProperties.description - // To this.accessibilityProperties.description - + private function focusPreviousChatTab(e:ShortcutEvent):void{ if (chatTabs.selectedIndex > 0){ chatTabs.selectedIndex--; } else{ chatTabs.selectedIndex = chatTabs.numChildren - 1; - } - //updateTabNames(); + } } private function focusNextChatTab(e:ShortcutEvent):void{ @@ -657,7 +580,6 @@ else{ chatTabs.selectedIndex = 0; } - //updateTabNames(); } private function participantHasChatBox(id:String):Boolean { @@ -670,7 +592,6 @@ return chatTabs.getChildByName(id) as ChatBox; } - /* it should receive the ChatObject */ private function showMessage(sender:String, chatobj:ChatObject, translate:Boolean):void{ var chatBox:ChatBox; if (! participantHasChatBox(sender)) {