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:
parent
7addfaf434
commit
0f119bf44a
@ -110,10 +110,7 @@
|
|||||||
|
|
||||||
<module name="SharedNotesModule" url="SharedNotesModule.swf?v=VERSION"
|
<module name="SharedNotesModule" url="SharedNotesModule.swf?v=VERSION"
|
||||||
uri="rtmp://HOST/bigbluebutton"
|
uri="rtmp://HOST/bigbluebutton"
|
||||||
host="http://HOST/bigbluebutton/notes.jsp"
|
|
||||||
refreshDelay="500"
|
refreshDelay="500"
|
||||||
responseTimeout="3000"
|
|
||||||
enablePlayback="false"
|
|
||||||
autoStart="true"
|
autoStart="true"
|
||||||
showButton="false"
|
showButton="false"
|
||||||
dependsOn="ViewersModule"
|
dependsOn="ViewersModule"
|
||||||
|
@ -7,18 +7,16 @@ package org.bigbluebutton.modules.sharednotes
|
|||||||
[Bindable]
|
[Bindable]
|
||||||
public var refreshDelay:int = 500;
|
public var refreshDelay:int = 500;
|
||||||
|
|
||||||
[Bindable]
|
|
||||||
public var responseTimeout:int = 3000;
|
|
||||||
|
|
||||||
[Bindable]
|
|
||||||
public var enablePlayback:Boolean = false;
|
|
||||||
|
|
||||||
[Bindable]
|
[Bindable]
|
||||||
public var position:String = "bottom-left";
|
public var position:String = "bottom-left";
|
||||||
|
|
||||||
[Bindable]
|
[Bindable]
|
||||||
public var autoStart:Boolean = false;
|
public var autoStart:Boolean = false;
|
||||||
|
|
||||||
|
[Bindable]
|
||||||
|
public var showButton:Boolean = false;
|
||||||
|
|
||||||
|
|
||||||
public function SharedNotesOptions()
|
public function SharedNotesOptions()
|
||||||
{
|
{
|
||||||
var vxml:XML = BBB.getConfigForModule("SharedNotesModule");
|
var vxml:XML = BBB.getConfigForModule("SharedNotesModule");
|
||||||
@ -26,17 +24,14 @@ package org.bigbluebutton.modules.sharednotes
|
|||||||
if (vxml.@refreshDelay != undefined) {
|
if (vxml.@refreshDelay != undefined) {
|
||||||
refreshDelay = Number(vxml.@refreshDelay);
|
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) {
|
if (vxml.@position != undefined) {
|
||||||
position = vxml.@position.toString();
|
position = vxml.@position.toString();
|
||||||
}
|
}
|
||||||
if (vxml.@autoStart != undefined) {
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,17 +27,31 @@ package org.bigbluebutton.modules.sharednotes.maps
|
|||||||
import org.bigbluebutton.modules.sharednotes.views.ToolbarButton;
|
import org.bigbluebutton.modules.sharednotes.views.ToolbarButton;
|
||||||
import org.bigbluebutton.modules.sharednotes.views.SharedNotesWindow;
|
import org.bigbluebutton.modules.sharednotes.views.SharedNotesWindow;
|
||||||
import org.bigbluebutton.common.events.OpenWindowEvent;
|
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 {
|
public class SharedNotesEventMapDelegate {
|
||||||
private var sharedNotesButton:ToolbarButton;
|
private var sharedNotesButton:ToolbarButton = null;
|
||||||
private var globalDispatcher:Dispatcher;
|
private var globalDispatcher:Dispatcher;
|
||||||
private var window:SharedNotesWindow;
|
private var window:SharedNotesWindow;
|
||||||
|
private var options:SharedNotesOptions = new SharedNotesOptions();
|
||||||
|
|
||||||
public function SharedNotesEventMapDelegate() {
|
public function SharedNotesEventMapDelegate() {
|
||||||
sharedNotesButton = new ToolbarButton();
|
|
||||||
globalDispatcher = new Dispatcher();
|
globalDispatcher = new Dispatcher();
|
||||||
window = new SharedNotesWindow();
|
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 {
|
public function showWindow():void {
|
||||||
@ -55,11 +69,13 @@ package org.bigbluebutton.modules.sharednotes.maps
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function addToolbarButton():void {
|
public function addToolbarButton():void {
|
||||||
|
LogUtil.debug("ADD BUTTON " + options.showButton);
|
||||||
|
if(options.showButton) {
|
||||||
var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
|
var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
|
||||||
event.button = sharedNotesButton;
|
event.button = sharedNotesButton;
|
||||||
globalDispatcher.dispatchEvent(event);
|
globalDispatcher.dispatchEvent(event);
|
||||||
|
}
|
||||||
|
if(!options.autoStart)
|
||||||
window.visible = false;
|
window.visible = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
resize="onResize()"
|
resize="onResize()"
|
||||||
showCloseButton="false">
|
showCloseButton="false">
|
||||||
|
|
||||||
<mate:Listener type="{GetCurrentDocumentEvent.GET_CURRENT_DOCUMENT}" method="onSyncing"/>
|
|
||||||
<mate:Listener type="{CurrentDocumentEvent.CURRENT_DOCUMENT}" method="addRemoteDocument"/>
|
<mate:Listener type="{CurrentDocumentEvent.CURRENT_DOCUMENT}" method="addRemoteDocument"/>
|
||||||
<mate:Listener type="{ReceivePatchEvent.RECEIVE_PATCH_EVENT}" method="receivePatch" />
|
<mate:Listener type="{ReceivePatchEvent.RECEIVE_PATCH_EVENT}" method="receivePatch" />
|
||||||
|
|
||||||
@ -93,11 +93,10 @@
|
|||||||
textArea.visible = true;
|
textArea.visible = true;
|
||||||
textArea.setCanvas(getMdiCanvas(parent) as MDICanvas);
|
textArea.setCanvas(getMdiCanvas(parent) as MDICanvas);
|
||||||
btnBackPlayback.visible = false;
|
btnBackPlayback.visible = false;
|
||||||
btnPlayback.visible = options.enablePlayback;
|
btnPlayback.visible = false;
|
||||||
playbackSlider.visible = false;
|
playbackSlider.visible = false;
|
||||||
lblPlaybackVersion.visible = false;
|
lblPlaybackVersion.visible = false;
|
||||||
|
|
||||||
//textArea.addEventListener(Event.CHANGE, onTextChange);
|
|
||||||
textArea.addEventListener(KeyboardEvent.KEY_DOWN, function(e:Event):void {
|
textArea.addEventListener(KeyboardEvent.KEY_DOWN, function(e:Event):void {
|
||||||
if (!sendUpdateTimer.running) {
|
if (!sendUpdateTimer.running) {
|
||||||
sendUpdateTimer.reset();
|
sendUpdateTimer.reset();
|
||||||
@ -108,17 +107,10 @@
|
|||||||
|
|
||||||
sendUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:Event):void {
|
sendUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:Event):void {
|
||||||
sendPatch();
|
sendPatch();
|
||||||
//dispatchEvent(new Event(SharedNotesDispatcher.SEND_PATCH_EVENT));
|
|
||||||
});
|
});
|
||||||
_dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
|
_dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
|
||||||
//addEventListener(ServerConnection.SYNCED_EVENT, onSynced);
|
|
||||||
//addEventListener(ServerConnection.SYNCING_EVENT, onSyncing);
|
|
||||||
|
|
||||||
addEventListener(MDIWindowEvent.RESIZE, onResize);
|
addEventListener(MDIWindowEvent.RESIZE, onResize);
|
||||||
//addEventListener(MDIWindowEvent.CLOSE, function(e:Event):void { if (client) client.shutdown(); });
|
|
||||||
|
|
||||||
//client = new Client(this);
|
|
||||||
|
|
||||||
onResize();
|
onResize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +125,7 @@
|
|||||||
sendPatchEvent.beginIndex = textArea.selectionBeginIndex;
|
sendPatchEvent.beginIndex = textArea.selectionBeginIndex;
|
||||||
sendPatchEvent.endIndex = textArea.selectionEndIndex;
|
sendPatchEvent.endIndex = textArea.selectionEndIndex;
|
||||||
//patchHistory.push(messageToSend.patchData);
|
//patchHistory.push(messageToSend.patchData);
|
||||||
_undoHistory.addItem([0,sendPatchEvent.patch]);
|
//_undoHistory.addItem([0,sendPatchEvent.patch]);
|
||||||
_dispatcher.dispatchEvent(sendPatchEvent);
|
_dispatcher.dispatchEvent(sendPatchEvent);
|
||||||
_document = clientText;
|
_document = clientText;
|
||||||
textArea.editable = true;
|
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 {
|
private function receivePatch(e:ReceivePatchEvent):void {
|
||||||
if (e.patch != "") {
|
if (e.patch != "") {
|
||||||
@ -179,7 +141,7 @@
|
|||||||
_document = result;
|
_document = result;
|
||||||
textArea.patchClientText(e.patch, e.beginIndex, e.endIndex);
|
textArea.patchClientText(e.patch, e.beginIndex, e.endIndex);
|
||||||
LogUtil.debug("ADD PATCH SERVER");
|
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 availableWidth:int = this.width - this.borderMetrics.left - this.borderMetrics.right;
|
||||||
const availableHeight:int = this.height - this.borderMetrics.top - this.borderMetrics.bottom;
|
const availableHeight:int = this.height - this.borderMetrics.top - this.borderMetrics.bottom;
|
||||||
|
|
||||||
if (options.enablePlayback) {
|
//if (options.enablePlayback) {
|
||||||
if (BOTTOM_PADDING < Math.max(btnPlayback.height, btnBackPlayback.height) + 4)
|
// if (BOTTOM_PADDING < Math.max(btnPlayback.height, btnBackPlayback.height) + 4)
|
||||||
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.x = btnBackPlayback.x = LEFT_PADDING;
|
||||||
btnPlayback.y = btnBackPlayback.y = availableHeight - BOTTOM_PADDING + (BOTTOM_PADDING - Math.max(btnPlayback.height, btnBackPlayback.height)) / 2;
|
// btnPlayback.y = btnBackPlayback.y = availableHeight - BOTTOM_PADDING + (BOTTOM_PADDING - Math.max(btnPlayback.height, btnBackPlayback.height)) / 2;
|
||||||
} else {
|
//} else {
|
||||||
btnPlayback.x = btnBackPlayback.x = 0;
|
btnPlayback.x = btnBackPlayback.x = 0;
|
||||||
btnPlayback.y = btnBackPlayback.y = 0;
|
btnPlayback.y = btnBackPlayback.y = 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
textArea.width = textArea.measuredWidth = txtPlayback.width = availableWidth - RIGHT_PADDING - LEFT_PADDING;
|
textArea.width = textArea.measuredWidth = txtPlayback.width = availableWidth - RIGHT_PADDING - LEFT_PADDING;
|
||||||
textArea.height = textArea.measuredHeight = txtPlayback.height = availableHeight - TOP_PADDING - BOTTOM_PADDING;
|
textArea.height = textArea.measuredHeight = txtPlayback.height = availableHeight - TOP_PADDING - BOTTOM_PADDING;
|
||||||
@ -312,7 +274,7 @@
|
|||||||
|
|
||||||
protected function btnSave_clickHandler(event:MouseEvent):void
|
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 {
|
override public function close(event:MouseEvent=null):void {
|
||||||
//new Dispatcher().dispatchEvent(new Event(SHARED_NOTES_CLOSED, true));
|
//new Dispatcher().dispatchEvent(new Event(SHARED_NOTES_CLOSED, true));
|
||||||
super.close(event);
|
super.close(event);
|
||||||
|
@ -41,6 +41,9 @@
|
|||||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||||
import org.bigbluebutton.modules.sharednotes.events.ToolbarButtonWindowEvent;
|
import org.bigbluebutton.modules.sharednotes.events.ToolbarButtonWindowEvent;
|
||||||
import org.bigbluebutton.modules.sharednotes.events.JoinSharedNotesEvent;
|
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")]
|
[Embed(source="images/note_edit.png")]
|
||||||
public var notes:Class;
|
public var notes:Class;
|
||||||
@ -52,20 +55,25 @@
|
|||||||
private var dispatcher:Dispatcher;
|
private var dispatcher:Dispatcher;
|
||||||
private var window:SharedNotesWindow;
|
private var window:SharedNotesWindow;
|
||||||
private var _join:Boolean = false;
|
private var _join:Boolean = false;
|
||||||
|
private var options:SharedNotesOptions = new SharedNotesOptions();
|
||||||
|
|
||||||
private function init():void{
|
private function init():void{
|
||||||
_join = false;
|
_join = false;
|
||||||
dispatcher = new Dispatcher();
|
dispatcher = new Dispatcher();
|
||||||
this.addEventListener(SharedNotesWindow.SHARED_NOTES_CLOSED, closeEventHandler);
|
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 (!this.selected) {
|
||||||
if(!_join) {
|
if(!_join) {
|
||||||
_join = true;
|
_join = true;
|
||||||
dispatcher.dispatchEvent(new JoinSharedNotesEvent());
|
dispatcher.dispatchEvent(new JoinSharedNotesEvent());
|
||||||
}
|
}
|
||||||
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.SHOW_WINDOW));
|
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.SHOW_WINDOW));
|
||||||
|
dispatcher.dispatchEvent(new GetCurrentDocumentEvent());
|
||||||
this.selected = true;
|
this.selected = true;
|
||||||
} else {
|
} else {
|
||||||
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.HIDE_WINDOW));
|
dispatcher.dispatchEvent(new ToolbarButtonWindowEvent(ToolbarButtonWindowEvent.HIDE_WINDOW));
|
||||||
|
@ -75,14 +75,15 @@ package org.bigbluebutton.modules.sharednotes.views.components
|
|||||||
return textField.text;
|
return textField.text;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function saveNotesToFile():void {
|
public function saveNotesToFile(title:String):void {
|
||||||
this.textFieldText
|
var filename:String = title.replace(/\s+/g, '-').toLowerCase();
|
||||||
var _fileRef:FileReference = new FileReference();
|
var _fileRef:FileReference = new FileReference();
|
||||||
_fileRef.addEventListener(Event.COMPLETE, function(e:Event):void {
|
_fileRef.addEventListener(Event.COMPLETE, function(e:Event):void {
|
||||||
Alert.show(ResourceUtil.getInstance().getString('bbb.sharedNotes.save.complete'), "", Alert.OK, _canvas);
|
Alert.show(ResourceUtil.getInstance().getString('bbb.sharedNotes.save.complete'), "", Alert.OK, _canvas);
|
||||||
});
|
});
|
||||||
_fileRef.save(this.textFieldText, "sharedNotes.txt");
|
_fileRef.save(this.textFieldText, filename+".txt");
|
||||||
LogUtil.debug("Tamanho Máximo: " + this.maxVerticalScrollPosition);
|
|
||||||
|
//Future code to add zoom and font format
|
||||||
//var format:TextFormat = new TextFormat();
|
//var format:TextFormat = new TextFormat();
|
||||||
//format.color = 0x0000FF;
|
//format.color = 0x0000FF;
|
||||||
//this.textField.setTextFormat( format, selectionBeginIndex, selectionBeginIndex+1 ) ;
|
//this.textField.setTextFormat( format, selectionBeginIndex, selectionBeginIndex+1 ) ;
|
||||||
@ -116,9 +117,9 @@ package org.bigbluebutton.modules.sharednotes.views.components
|
|||||||
else
|
else
|
||||||
cursorLine = this.textField.getLineIndexOfChar(endIndex);
|
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;
|
this.verticalScrollPosition+=desloc;
|
||||||
|
|
||||||
LogUtil.debug("relative: " + relativePositon);
|
LogUtil.debug("relative: " + relativePositon);
|
||||||
|
Loading…
Reference in New Issue
Block a user