From 66b96398e63eca4c687e9734a922f8e71446a7ee Mon Sep 17 00:00:00 2001 From: Felipe Cecagno Date: Fri, 13 Nov 2015 14:33:43 -0200 Subject: [PATCH] show the disabled record button for viewers; hide confirmation alert if the moderator lose its role --- .../bigbluebutton/main/views/MainToolbar.mxml | 9 +++-- .../main/views/RecordButton.mxml | 39 ++++++++++++++----- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml index 399a8cb405..5a69e16dd8 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml @@ -191,11 +191,12 @@ with BigBlueButton; if not, see . } private function refreshModeratorButtonsVisibility(e:*):void { - showGuestSettingsButton = UsersUtil.amIModerator() - && UserManager.getInstance().getConference().getMyUser() != null - && !UserManager.getInstance().getConference().getMyUser().waitingForAcceptance; + var userLoaded:Boolean = UserManager.getInstance().getConference().getMyUser() != null + && ! UserManager.getInstance().getConference().getMyUser().waitingForAcceptance; - showRecordButton = showGuestSettingsButton && UserManager.getInstance().getConference().record; + showGuestSettingsButton = userLoaded && UsersUtil.amIModerator(); + + showRecordButton = userLoaded && UserManager.getInstance().getConference().record; } public function addButton(name:String):Button{ diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/RecordButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/RecordButton.mxml index ca51d3d2d6..f114ae72fe 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/RecordButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/RecordButton.mxml @@ -44,6 +44,7 @@ with BigBlueButton; if not, see . import mx.controls.Alert; import mx.events.CloseEvent; + import mx.managers.PopUpManager; import org.bigbluebutton.core.managers.UserManager; import org.bigbluebutton.core.model.MeetingModel; @@ -57,6 +58,7 @@ with BigBlueButton; if not, see . private var recordingFlag:Boolean; private var firstAudioJoin:Boolean = true; private var layoutOptions:LayoutOptions = null; + private var _confirmationAlert:Alert = null; [Embed(source="/org/bigbluebutton/common/assets/images/record.png")] private var recordReminderIcon:Class; @@ -65,26 +67,42 @@ with BigBlueButton; if not, see . ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged); // Listen for locale changing } - private function confirmChangeRecordingStatus():void { - trace("Confirming recording status change!!!!"); - - // need to save the flag in case of any remote update on the recording status - recordingFlag = !this.selected; + private function hideConfirmationAlert():void { + if (_confirmationAlert != null) { + if (_confirmationAlert.visible) { + PopUpManager.removePopUp(_confirmationAlert); + } + _confirmationAlert = null; + } + } + + private function showConfirmationAlert():void { + hideConfirmationAlert(); var message:String = recordingFlag? ResourceUtil.getInstance().getString('bbb.mainToolbar.recordBtn.confirm.message.start'): ResourceUtil.getInstance().getString('bbb.mainToolbar.recordBtn.confirm.message.stop'); // Confirm logout using built-in alert - var alert:Alert = Alert.show(message, ResourceUtil.getInstance().getString('bbb.mainToolbar.recordBtn.confirm.title'), Alert.YES | Alert.NO, this, alertChangeRecordingStatus, null, Alert.YES); + _confirmationAlert = Alert.show(message, ResourceUtil.getInstance().getString('bbb.mainToolbar.recordBtn.confirm.title'), Alert.YES | Alert.NO, this, onCloseConfirmationDialog, null, Alert.YES); var newX:Number = this.x; var newY:Number = this.y + this.height + 5; - alert.validateNow(); - alert.move(newX, newY); + _confirmationAlert.validateNow(); + _confirmationAlert.move(newX, newY); //Accessibility.updateProperties(); } - private function alertChangeRecordingStatus(e:CloseEvent):void { + private function confirmChangeRecordingStatus():void { + trace("Confirming recording status change!!!!"); + + // need to save the flag in case of any remote update on the recording status + recordingFlag = !this.selected; + + showConfirmationAlert(); + } + + private function onCloseConfirmationDialog(e:CloseEvent):void { + hideConfirmationAlert(); // check to see if the YES button was pressed if (e.detail==Alert.YES) { doChangeRecordingStatus(); @@ -116,6 +134,9 @@ with BigBlueButton; if not, see . resourcesChanged(); this.enabled = UserManager.getInstance().getConference().amIModerator() && MeetingModel.getInstance().meeting.allowStartStopRecording; + if (! this.enabled) { + hideConfirmationAlert(); + } } private function onRecordingStatusChanged(event:BBBEvent):void {