Created an event and function to enable/disable the DownloadPres button when there are/aren't presentations available for downloading.

Added an icon and css for the disabled state of this button.

refs #1851
This commit is contained in:
RafaFP 2016-01-14 18:36:27 +00:00
parent 7e4946865a
commit c349846584
5 changed files with 37 additions and 5 deletions

View File

@ -297,7 +297,7 @@ DataGrid {
.presentationUploadButtonStyle, .presentationBackButtonStyle, .presentationBackButtonDisabledStyle, .presentationForwardButtonStyle, .presentationForwardButtonDisabledStyle,
.presentationFitToWidthButtonStyle, .presentationFitToPageButtonStyle, .presentationDownloadButtonStyle
.presentationFitToWidthButtonStyle, .presentationFitToPageButtonStyle, .presentationDownloadButtonStyle, .presentationDownloadButtonDisabledStyle
{
textIndent: 0;
paddingLeft: 10;
@ -347,6 +347,10 @@ DataGrid {
.presentationDownloadButtonStyle {
icon: Embed('assets/images/ic_file_download_16px.png');
}
.presentationDownloadButtonDisabledStyle {
icon: Embed('assets/images/ic_file_download_grey_16px.png');
}
.presentationZoomSliderStyle{
labelOffset: 0;

Binary file not shown.

After

Width:  |  Height:  |  Size: 251 B

View File

@ -27,6 +27,9 @@ package org.bigbluebutton.modules.present.events
// Presentation has been removed from server.
public static const PRESENTATION_REMOVED_EVENT:String = "Presentation Removed Event";
// Presentation removed from the list of downloadable events.
public static const PRESENTATION_NOT_DOWNLOADABLE_EVENT:String = "Presentation Can't Be Downloaded Event";
public var presentationName:String;

View File

@ -169,6 +169,8 @@ package org.bigbluebutton.modules.present.services
}
model.removePresentation(presentationID);
var notDownloadableEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.PRESENTATION_NOT_DOWNLOADABLE_EVENT);
dispatcher.dispatchEvent(notDownloadableEvent); //this event will trigger the disabling of the download button.
}
}
}

View File

@ -60,8 +60,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<mate:Listener type="{ShortcutEvent.FIT_TO_PAGE}" method="remotePage" />
<mate:Listener type="{ShortcutEvent.MINIMIZE_PRES}" method="remoteMinimize" />
<mate:Listener type="{ShortcutEvent.MAXIMIZE_PRES}" method="remoteMaximize" />
<mate:Listener type="{RemovePresentationEvent.PRESENTATION_NOT_DOWNLOADABLE_EVENT}" method="handlePresentationNotDownloadable" />
<mx:Script>
<![CDATA[
import flash.geom.Point;
@ -94,6 +94,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.events.DownloadEvent;
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
import org.bigbluebutton.modules.present.managers.Slide;
import org.bigbluebutton.modules.present.model.Page;
import org.bigbluebutton.modules.present.model.PresentationModel;
@ -376,6 +377,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
displaySlideNavigationControls(false, !!page)
}
onResetZoom();
downloadAvailable();
}
@ -601,6 +603,27 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
}
private function handlePresentationNotDownloadable(e:RemovePresentationEvent):void{
downloadAvailable();
}
private function downloadAvailable():void{
var isAnyPres:ArrayCollection = PresentationModel.getInstance().getDownloadablePresentations();
if(isAnyPres.length != 0){
trace(LOG+"Enabling dowload presentation button. There are " + isAnyPres.length + " presentations available for downloading.");
downloadPres.enabled = true;
downloadPres.styleName = "presentationDownloadButtonStyle";
}
else
{
trace(LOG+"Disabling download presentation button. There are " + isAnyPres.length + " presentations available for downloading.");
downloadPres.enabled = false;
downloadPres.styleName = "presentationDownloadButtonDisabledStyle";
}
}
]]>
</mx:Script>
@ -610,9 +633,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<views:SlideView id="slideView" width="100%" height="100%" visible="false" mouseDown="mouseDown = true"
mouseUp="mouseDown = false" verticalScrollPolicy="off" horizontalScrollPolicy="off" tabIndex="{baseIndex+4}"/>
<mx:ControlBar id="presCtrlBar" name="presCtrlBar" width="100%" height="{CONTROL_BAR_HEIGHT}" styleName="presentationWindowControlsStyle" >
<mx:Button id="downloadPres" visible="true" height="30" width="30" styleName="presentationDownloadButtonStyle"
<mx:Button id="downloadPres" visible="true" height="30" width="30" styleName="presentationDownloadButtonDisabledStyle"
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.downloadPresBtn.toolTip')}"
click="onDownloadButtonClicked()" tabIndex="{baseIndex+5}"/>
click="onDownloadButtonClicked()" tabIndex="{baseIndex+5}" creationComplete="downloadAvailable()"/>
<mx:Button id="uploadPres" visible="false" height="30" width="30" styleName="presentationUploadButtonStyle"
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.uploadPresBtn.toolTip')}"
click="onUploadButtonClicked()" tabIndex="{baseIndex+5}"/>