Removed from config template old sharedNotes options that aren't needed.

Default file name to save file is the sharedNotes window name with all
characters lowercased and all spaces transformed to '-'.
Added config options to sharedNotes.
This commit is contained in:
Hugo Lazzari 2013-04-09 14:58:38 -03:00
parent 7addfaf434
commit 0f119bf44a
6 changed files with 66 additions and 91 deletions

View File

@ -109,11 +109,8 @@
/>-->
<module name="SharedNotesModule" url="SharedNotesModule.swf?v=VERSION"
uri="rtmp://HOST/bigbluebutton"
host="http://HOST/bigbluebutton/notes.jsp"
uri="rtmp://HOST/bigbluebutton"
refreshDelay="500"
responseTimeout="3000"
enablePlayback="false"
autoStart="true"
showButton="false"
dependsOn="ViewersModule"

View File

@ -7,18 +7,16 @@ package org.bigbluebutton.modules.sharednotes
[Bindable]
public var refreshDelay:int = 500;
[Bindable]
public var responseTimeout:int = 3000;
[Bindable]
public var enablePlayback:Boolean = false;
[Bindable]
public var position:String = "bottom-left";
[Bindable]
public var autoStart:Boolean = false;
[Bindable]
public var showButton:Boolean = false;
public function SharedNotesOptions()
{
var vxml:XML = BBB.getConfigForModule("SharedNotesModule");
@ -26,19 +24,16 @@ package org.bigbluebutton.modules.sharednotes
if (vxml.@refreshDelay != undefined) {
refreshDelay = Number(vxml.@refreshDelay);
}
if (vxml.@responseTimeout != undefined) {
responseTimeout = Number(vxml.@responseTimeout);
}
if (vxml.@enablePlayback != undefined) {
enablePlayback = (vxml.@enablePlayback.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@position != undefined) {
position = vxml.@position.toString();
}
if (vxml.@autoStart != undefined) {
autoStart = (vxml.@autoJoin.toString().toUpperCase() == "TRUE") ? true : false;
autoStart = (vxml.@autoStart.toString().toUpperCase() == "TRUE") ? true : false;
}
if (vxml.@showButton != undefined) {
showButton = (vxml.@showButton.toString().toUpperCase() == "TRUE") ? true : false;
}
}
}
}
}
}

View File

@ -27,17 +27,31 @@ package org.bigbluebutton.modules.sharednotes.maps
import org.bigbluebutton.modules.sharednotes.views.ToolbarButton;
import org.bigbluebutton.modules.sharednotes.views.SharedNotesWindow;
import org.bigbluebutton.common.events.OpenWindowEvent;
import org.bigbluebutton.modules.sharednotes.SharedNotesOptions;
import org.bigbluebutton.modules.sharednotes.events.JoinSharedNotesEvent;
import org.bigbluebutton.modules.sharednotes.events.GetCurrentDocumentEvent;
import org.bigbluebutton.common.LogUtil;
public class SharedNotesEventMapDelegate {
private var sharedNotesButton:ToolbarButton;
private var sharedNotesButton:ToolbarButton = null;
private var globalDispatcher:Dispatcher;
private var window:SharedNotesWindow;
private var options:SharedNotesOptions = new SharedNotesOptions();
public function SharedNotesEventMapDelegate() {
sharedNotesButton = new ToolbarButton();
globalDispatcher = new Dispatcher();
window = new SharedNotesWindow();
hideWindow();
if(options.showButton) {
sharedNotesButton = new ToolbarButton();
} else {
if(options.autoStart) {
showWindow();
globalDispatcher.dispatchEvent(new JoinSharedNotesEvent());
globalDispatcher.dispatchEvent(new GetCurrentDocumentEvent());
}
}
}
public function showWindow():void {
@ -55,12 +69,14 @@ package org.bigbluebutton.modules.sharednotes.maps
}
public function addToolbarButton():void {
var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
event.button = sharedNotesButton;
globalDispatcher.dispatchEvent(event);
window.visible = false;
LogUtil.debug("ADD BUTTON " + options.showButton);
if(options.showButton) {
var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
event.button = sharedNotesButton;
globalDispatcher.dispatchEvent(event);
}
if(!options.autoStart)
window.visible = false;
}

View File

@ -31,7 +31,7 @@
resize="onResize()"
showCloseButton="false">
<mate:Listener type="{GetCurrentDocumentEvent.GET_CURRENT_DOCUMENT}" method="onSyncing"/>
<mate:Listener type="{CurrentDocumentEvent.CURRENT_DOCUMENT}" method="addRemoteDocument"/>
<mate:Listener type="{ReceivePatchEvent.RECEIVE_PATCH_EVENT}" method="receivePatch" />
@ -93,11 +93,10 @@
textArea.visible = true;
textArea.setCanvas(getMdiCanvas(parent) as MDICanvas);
btnBackPlayback.visible = false;
btnPlayback.visible = options.enablePlayback;
btnPlayback.visible = false;
playbackSlider.visible = false;
lblPlaybackVersion.visible = false;
//textArea.addEventListener(Event.CHANGE, onTextChange);
textArea.addEventListener(KeyboardEvent.KEY_DOWN, function(e:Event):void {
if (!sendUpdateTimer.running) {
sendUpdateTimer.reset();
@ -108,17 +107,10 @@
sendUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:Event):void {
sendPatch();
//dispatchEvent(new Event(SharedNotesDispatcher.SEND_PATCH_EVENT));
});
_dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
//addEventListener(ServerConnection.SYNCED_EVENT, onSynced);
//addEventListener(ServerConnection.SYNCING_EVENT, onSyncing);
addEventListener(MDIWindowEvent.RESIZE, onResize);
//addEventListener(MDIWindowEvent.CLOSE, function(e:Event):void { if (client) client.shutdown(); });
//client = new Client(this);
addEventListener(MDIWindowEvent.RESIZE, onResize);
onResize();
}
@ -133,7 +125,7 @@
sendPatchEvent.beginIndex = textArea.selectionBeginIndex;
sendPatchEvent.endIndex = textArea.selectionEndIndex;
//patchHistory.push(messageToSend.patchData);
_undoHistory.addItem([0,sendPatchEvent.patch]);
//_undoHistory.addItem([0,sendPatchEvent.patch]);
_dispatcher.dispatchEvent(sendPatchEvent);
_document = clientText;
textArea.editable = true;
@ -141,37 +133,7 @@
}
}
private function undoLastChange():void {
var newText:String = _initialDocument;
var myLastPatch:Array = null;
var myLastPatchIndex:int = -1;
sendUpdateTimer.stop();
for (var i:int = 0; i < _undoHistory.length; i++)
{
var patchArray:Array = _undoHistory[i];
LogUtil.debug("Number: " + patchArray[0] + " Index: " + i);
if(patchArray[0] == 0) {
myLastPatch = patchArray;
myLastPatchIndex = i;
}
newText = DiffPatch.patch(patchArray[1], newText);
}
if(myLastPatchIndex != -1) {
LogUtil.debug("Removi Number: " + _undoHistory[myLastPatchIndex][0] + " Index: " + myLastPatchIndex);
newText = DiffPatch.unpatch(_undoHistory[myLastPatchIndex][1], newText);
_undoHistory.removeItemAt(myLastPatchIndex);
textArea.editable = false;
onSyncing();
var sendPatchEvent:SendPatchEvent = new SendPatchEvent();
sendPatchEvent.patch = DiffPatch.diff(_document, newText);
_document = newText;
textArea.text = newText;
_dispatcher.dispatchEvent(sendPatchEvent);
textArea.editable = true;
onSynced();
}
sendUpdateTimer.start();
}
private function receivePatch(e:ReceivePatchEvent):void {
if (e.patch != "") {
@ -179,7 +141,7 @@
_document = result;
textArea.patchClientText(e.patch, e.beginIndex, e.endIndex);
LogUtil.debug("ADD PATCH SERVER");
_undoHistory.addItem([1,e.patch]);
//_undoHistory.addItem([1,e.patch]);
}
}
@ -230,15 +192,15 @@
const availableWidth:int = this.width - this.borderMetrics.left - this.borderMetrics.right;
const availableHeight:int = this.height - this.borderMetrics.top - this.borderMetrics.bottom;
if (options.enablePlayback) {
if (BOTTOM_PADDING < Math.max(btnPlayback.height, btnBackPlayback.height) + 4)
BOTTOM_PADDING = Math.max(btnPlayback.height, btnBackPlayback.height) + 4;
btnPlayback.x = btnBackPlayback.x = LEFT_PADDING;
btnPlayback.y = btnBackPlayback.y = availableHeight - BOTTOM_PADDING + (BOTTOM_PADDING - Math.max(btnPlayback.height, btnBackPlayback.height)) / 2;
} else {
//if (options.enablePlayback) {
// if (BOTTOM_PADDING < Math.max(btnPlayback.height, btnBackPlayback.height) + 4)
// BOTTOM_PADDING = Math.max(btnPlayback.height, btnBackPlayback.height) + 4;
// btnPlayback.x = btnBackPlayback.x = LEFT_PADDING;
// btnPlayback.y = btnBackPlayback.y = availableHeight - BOTTOM_PADDING + (BOTTOM_PADDING - Math.max(btnPlayback.height, btnBackPlayback.height)) / 2;
//} else {
btnPlayback.x = btnBackPlayback.x = 0;
btnPlayback.y = btnBackPlayback.y = 0;
}
//}
textArea.width = textArea.measuredWidth = txtPlayback.width = availableWidth - RIGHT_PADDING - LEFT_PADDING;
textArea.height = textArea.measuredHeight = txtPlayback.height = availableHeight - TOP_PADDING - BOTTOM_PADDING;
@ -312,7 +274,7 @@
protected function btnSave_clickHandler(event:MouseEvent):void
{
textArea.saveNotesToFile();
textArea.saveNotesToFile(title);
}
@ -337,10 +299,6 @@
}
public function get responseTimeout():int {
return options.responseTimeout;
}
override public function close(event:MouseEvent=null):void {
//new Dispatcher().dispatchEvent(new Event(SHARED_NOTES_CLOSED, true));
super.close(event);

View File

@ -41,6 +41,9 @@
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.modules.sharednotes.events.ToolbarButtonWindowEvent;
import org.bigbluebutton.modules.sharednotes.events.JoinSharedNotesEvent;
import org.bigbluebutton.modules.sharednotes.events.GetCurrentDocumentEvent;
import org.bigbluebutton.modules.sharednotes.SharedNotesOptions;
[Embed(source="images/note_edit.png")]
public var notes:Class;
@ -52,20 +55,25 @@
private var dispatcher:Dispatcher;
private var window:SharedNotesWindow;
private var _join:Boolean = false;
private var options:SharedNotesOptions = new SharedNotesOptions();
private function init():void{
_join = false;
dispatcher = new Dispatcher();
this.addEventListener(SharedNotesWindow.SHARED_NOTES_CLOSED, closeEventHandler);
if(options.autoStart) {
openNotesWindow();
}
}
private function openNotesWindow():void{
public function openNotesWindow(event:Event = null):void{
if (!this.selected) {
if(!_join) {
_join = true;
dispatcher.dispatchEvent(new JoinSharedNotesEvent());
}
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.SHOW_WINDOW));
dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
this.selected = true;
} else {
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.HIDE_WINDOW));

View File

@ -75,14 +75,15 @@ package org.bigbluebutton.modules.sharednotes.views.components
return textField.text;
}
public function saveNotesToFile():void {
this.textFieldText
public function saveNotesToFile(title:String):void {
var filename:String = title.replace(/\s+/g, '-').toLowerCase();
var _fileRef:FileReference = new FileReference();
_fileRef.addEventListener(Event.COMPLETE, function(e:Event):void {
Alert.show(ResourceUtil.getInstance().getString('bbb.sharedNotes.save.complete'), "", Alert.OK, _canvas);
});
_fileRef.save(this.textFieldText, "sharedNotes.txt");
LogUtil.debug("Tamanho Máximo: " + this.maxVerticalScrollPosition);
_fileRef.save(this.textFieldText, filename+".txt");
//Future code to add zoom and font format
//var format:TextFormat = new TextFormat();
//format.color = 0x0000FF;
//this.textField.setTextFormat( format, selectionBeginIndex, selectionBeginIndex+1 ) ;
@ -116,9 +117,9 @@ package org.bigbluebutton.modules.sharednotes.views.components
else
cursorLine = this.textField.getLineIndexOfChar(endIndex);
var relativePositon = cursorLine - this.verticalScrollPosition;
var relativePositon:Number = cursorLine - this.verticalScrollPosition;
var desloc = relativePositon - oldPosition;
var desloc:Number = relativePositon - oldPosition;
this.verticalScrollPosition+=desloc;
LogUtil.debug("relative: " + relativePositon);