Merge branch 'add-mod-only-welcom-message'

This commit is contained in:
Richard Alam 2014-08-20 07:39:24 -07:00
commit de2abebe87
12 changed files with 150 additions and 95 deletions

20
bigbluebutton-client/src/ChatModule.mxml Executable file → Normal file
View File

@ -28,8 +28,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<maps:ChatEventMap id="chatLocalEventMap"/> <maps:ChatEventMap id="chatLocalEventMap"/>
<mate:Listener type="{TranscriptEvent.TRANSCRIPT_EVENT}" method="handleTranscriptLoadedEvent"/>
<mx:Script> <mx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
@ -122,24 +120,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
trace("Received PRIVATE CHAT MESSAGE EVENT"); trace("Received PRIVATE CHAT MESSAGE EVENT");
} }
private function handleTranscriptLoadedEvent(event:Event):void {
LogUtil.debug("Handling TranscriptLoadedEvent");
var welcome:String = _attributes.welcome as String;
if (welcome != "") {
// var welcomeEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
// var chatobj:ChatMessageVO = new ChatMessageVO();
// chatobj.message = welcome;
// chatobj.username = " ";
// chatobj.color = "0";
// chatobj.time = ChatUtil.getCurrentTime();
// chatobj.language = "en";
// chatobj.userid = "";
// welcomeEvent.chatobj = chatobj;
// var globalDispatcher:Dispatcher = new Dispatcher();
// globalDispatcher.dispatchEvent(welcomeEvent);
}
}
]]> ]]>
</mx:Script> </mx:Script>
</mx:Module> </mx:Module>

View File

@ -10,6 +10,7 @@ package org.bigbluebutton.core.model
private var _meetingMuted:Boolean = false; private var _meetingMuted:Boolean = false;
private var _lockSettings:LockSettingsVO; private var _lockSettings:LockSettingsVO;
private var _modOnlyMessage:String = null;
public function MeetingModel(enforcer: MeetingModelSingletonEnforcer) public function MeetingModel(enforcer: MeetingModelSingletonEnforcer)
{ {
@ -44,7 +45,14 @@ package org.bigbluebutton.core.model
public function get meetingMuted():Boolean { public function get meetingMuted():Boolean {
return _meetingMuted; return _meetingMuted;
} }
public function set modOnlyMessage(msg:String):void {
_modOnlyMessage = msg;
}
public function get modOnlyMessage():String {
return _modOnlyMessage;
}
} }
} }

View File

@ -19,12 +19,9 @@
package org.bigbluebutton.main.model.modules package org.bigbluebutton.main.model.modules
{ {
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import mx.controls.Alert; import mx.controls.Alert;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.PortTestEvent; import org.bigbluebutton.main.events.PortTestEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.ConferenceParameters; import org.bigbluebutton.main.model.ConferenceParameters;
import org.bigbluebutton.main.model.PortTestProxy; import org.bigbluebutton.main.model.PortTestProxy;

View File

@ -18,15 +18,13 @@
*/ */
package org.bigbluebutton.main.model.users package org.bigbluebutton.main.model.users
{ {
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.*; import flash.events.*;
import flash.net.URLLoader; import flash.net.URLLoader;
import flash.net.URLRequest; import flash.net.URLRequest;
import flash.net.URLRequestMethod; import flash.net.URLRequestMethod;
import flash.net.URLVariables; import flash.net.URLVariables;
import flash.net.navigateToURL; import flash.net.navigateToURL;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.model.Me; import org.bigbluebutton.core.model.Me;
@ -40,6 +38,8 @@ package org.bigbluebutton.main.model.users
public class JoinService public class JoinService
{ {
private static const LOG:String = "Users::JoinService - ";
private var request:URLRequest = new URLRequest(); private var request:URLRequest = new URLRequest();
private var vars:URLVariables = new URLVariables(); private var vars:URLVariables = new URLVariables();
@ -54,13 +54,13 @@ package org.bigbluebutton.main.model.users
var date:Date = new Date(); var date:Date = new Date();
// url += "?a=" + date.time // url += "?a=" + date.time
LogUtil.debug("JoinService:load(...) " + url); LogUtil.debug("JoinService:load(...) " + url);
request = new URLRequest(url); request = new URLRequest(url);
request.method = URLRequestMethod.GET; request.method = URLRequestMethod.GET;
urlLoader.addEventListener(Event.COMPLETE, handleComplete); urlLoader.addEventListener(Event.COMPLETE, handleComplete);
urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler); urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); urlLoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
urlLoader.load(request); urlLoader.load(request);
} }
public function addJoinResultListener(listener:Function):void { public function addJoinResultListener(listener:Function):void {
@ -79,33 +79,55 @@ package org.bigbluebutton.main.model.users
} }
private function handleComplete(e:Event):void { private function handleComplete(e:Event):void {
var xml:XML = new XML(e.target.data) var result:Object = JSON.parse(e.target.data);
trace(LOG + "Enter response = " + JSON.stringify(result));
var returncode:String = xml.returncode;
var returncode:String = result.response.returncode;
if (returncode == 'FAILED') { if (returncode == 'FAILED') {
LogUtil.debug("Join FAILED = " + xml); trace(LOG + "Join FAILED = " + JSON.stringify(result));
var dispatcher:Dispatcher = new Dispatcher(); var dispatcher:Dispatcher = new Dispatcher();
dispatcher.dispatchEvent(new MeetingNotFoundEvent(xml.logoutURL)); dispatcher.dispatchEvent(new MeetingNotFoundEvent(result.response.logoutURL));
} else if (returncode == 'SUCCESS') { } else if (returncode == 'SUCCESS') {
LogUtil.debug("Join SUCESS = " + xml); trace("Join SUCESS = " + JSON.stringify(result));
trace("JoinService::handleComplete() Join SUCESS = " + xml); var user:Object = new Object();
var user:Object = {username:xml.fullname, conference:xml.conference, user.username = result.response.fullname;
conferenceName:xml.confname, externMeetingID:xml.externMeetingID, user.conference = result.response.conference;
meetingID:xml.meetingID, externUserID:xml.externUserID, user.conferenceName = result.response.confname;
internalUserId:xml.internalUserID, user.externMeetingID = result.response.externMeetingID;
role:xml.role, room:xml.room, authToken:xml.room, record:xml.record, user.meetingID = result.response.meetingID;
webvoiceconf:xml.webvoiceconf, dialnumber:xml.dialnumber, user.externUserID = result.response.externUserID;
voicebridge:xml.voicebridge, mode:xml.mode, welcome:xml.welcome, logoutUrl:xml.logoutUrl, user.internalUserId = result.response.internalUserID;
defaultLayout:xml.defaultLayout, avatarURL:xml.avatarURL}; user.role = result.response.role;
user.room = result.response.room;
user.authToken = result.response.room;
user.record = result.response.record;
user.webvoiceconf = result.response.webvoiceconf;
user.dialnumber = result.response.dialnumber;
user.voicebridge = result.response.voicebridge;
user.mode = result.response.mode;
user.welcome = result.response.welcome;
user.logoutUrl = result.response.logoutUrl;
user.defaultLayout = result.response.defaultLayout;
user.avatarURL = result.response.avatarURL
if (result.response.hasOwnProperty("modOnlyMessage")) {
user.modOnlyMessage = result.response.modOnlyMessage;
MeetingModel.getInstance().modOnlyMessage = user.modOnlyMessage;
}
user.customdata = new Object(); user.customdata = new Object();
if(xml.customdata) { if (result.response.customdata) {
for each(var cdnode:XML in xml.customdata.elements()){ var cdata:Array = result.response.customdata as Array;
LogUtil.debug("checking user customdata: "+ cdnode.name() + " = " + cdnode); trace(LOG + "num custom data = " + cdata.length);
user.customdata[cdnode.name()] = cdnode.toString(); for each (var item:Object in cdata) {
} trace(LOG + item.toString());
for (var id:String in item) {
var value:String = item[id] as String;
trace(id + " = " + value);
user.customdata[id] = value;
}
}
} }
UsersModel.getInstance().me = new MeBuilder(user.internalUserId, user.username).withAvatar(user.avatarURL) UsersModel.getInstance().me = new MeBuilder(user.internalUserId, user.username).withAvatar(user.avatarURL)

View File

@ -19,11 +19,14 @@
package org.bigbluebutton.main.model.users package org.bigbluebutton.main.model.users
{ {
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.TimerEvent; import flash.events.TimerEvent;
import flash.external.ExternalInterface; import flash.external.ExternalInterface;
import flash.net.NetConnection; import flash.net.NetConnection;
import flash.utils.Timer; import flash.utils.Timer;
import mx.collections.ArrayCollection;
import mx.collections.ArrayCollection;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
@ -34,6 +37,7 @@ package org.bigbluebutton.main.model.users
import org.bigbluebutton.core.managers.UserConfigManager; import org.bigbluebutton.core.managers.UserConfigManager;
import org.bigbluebutton.core.managers.UserManager; import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.core.model.Config; import org.bigbluebutton.core.model.Config;
import org.bigbluebutton.core.model.MeetingModel;
import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent; import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.events.UserServicesEvent; import org.bigbluebutton.main.events.UserServicesEvent;
@ -99,6 +103,8 @@ package org.bigbluebutton.main.model.users
UserManager.getInstance().getConference().dialNumber = result.dialnumber; UserManager.getInstance().getConference().dialNumber = result.dialnumber;
UserManager.getInstance().getConference().record = (result.record != "false"); UserManager.getInstance().getConference().record = (result.record != "false");
_conferenceParameters = new ConferenceParameters(); _conferenceParameters = new ConferenceParameters();
_conferenceParameters.meetingName = result.conferenceName; _conferenceParameters.meetingName = result.conferenceName;
_conferenceParameters.externMeetingID = result.externMeetingID; _conferenceParameters.externMeetingID = result.externMeetingID;

View File

@ -58,7 +58,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.main.events.LogoutEvent; import org.bigbluebutton.main.events.LogoutEvent;
import org.bigbluebutton.main.events.SettingsEvent; import org.bigbluebutton.main.events.SettingsEvent;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.LayoutOptions; import org.bigbluebutton.main.model.LayoutOptions;
import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent; import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent;
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent; import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;

View File

@ -18,9 +18,11 @@
*/ */
package org.bigbluebutton.modules.chat.services package org.bigbluebutton.modules.chat.services
{ {
import flash.events.IEventDispatcher; import flash.events.IEventDispatcher;
import org.bigbluebutton.common.LogUtil; import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.model.MeetingModel;
import org.bigbluebutton.modules.chat.ChatConstants; import org.bigbluebutton.modules.chat.ChatConstants;
import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent; import org.bigbluebutton.modules.chat.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO; import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
@ -105,6 +107,26 @@ package org.bigbluebutton.modules.chat.services
pcEvent.message = msg; pcEvent.message = msg;
dispatcher.dispatchEvent(pcEvent); dispatcher.dispatchEvent(pcEvent);
} }
if (UsersUtil.amIModerator()) {
if (MeetingModel.getInstance().modOnlyMessage != null) {
var msg:ChatMessageVO = new ChatMessageVO();
msg.chatType = ChatConstants.PUBLIC_CHAT;
msg.fromUserID = SPACE;
msg.fromUsername = SPACE;
msg.fromColor = "86187";
msg.fromLang = "en";
msg.fromTime = new Date().getTime();
msg.fromTimezoneOffset = new Date().getTimezoneOffset();
msg.toUserID = SPACE;
msg.toUsername = SPACE;
msg.message = MeetingModel.getInstance().modOnlyMessage;
var pcEvent:PublicChatMessageEvent = new PublicChatMessageEvent(PublicChatMessageEvent.PUBLIC_CHAT_MESSAGE_EVENT);
pcEvent.message = msg;
dispatcher.dispatchEvent(pcEvent);
}
}
} }
} }
} }

View File

@ -28,7 +28,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.core.events.VoiceConfEvent; import org.bigbluebutton.core.events.VoiceConfEvent;
import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.LogoutEvent; import org.bigbluebutton.main.events.LogoutEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.events.UserServicesEvent; import org.bigbluebutton.main.events.UserServicesEvent;
import org.bigbluebutton.main.model.users.UserService; import org.bigbluebutton.main.model.users.UserService;
import org.bigbluebutton.main.model.users.events.BroadcastStartedEvent; import org.bigbluebutton.main.model.users.events.BroadcastStartedEvent;

View File

@ -47,7 +47,6 @@ package org.bigbluebutton.modules.users.services
import org.bigbluebutton.modules.present.events.NavigationEvent; import org.bigbluebutton.modules.present.events.NavigationEvent;
import org.bigbluebutton.modules.present.events.RemovePresentationEvent; import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
import org.bigbluebutton.modules.present.events.UploadEvent; import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.model.PresentationModel;
import org.bigbluebutton.modules.users.events.MeetingMutedEvent; import org.bigbluebutton.modules.users.events.MeetingMutedEvent;
public class MessageReceiver implements IMessageListener public class MessageReceiver implements IMessageListener

View File

@ -148,7 +148,11 @@ class ApiController {
} }
Meeting newMeeting = paramsProcessorUtil.processCreateParams(params); Meeting newMeeting = paramsProcessorUtil.processCreateParams(params);
if (! StringUtils.isEmpty(params.moderatorOnlyMessage)) {
newMeeting.setModeratorOnlyMessage(params.moderatorOnlyMessage);
}
meetingService.createMeeting(newMeeting); meetingService.createMeeting(newMeeting);
// See if the request came with pre-uploading of presentation. // See if the request came with pre-uploading of presentation.
@ -303,9 +307,12 @@ class ApiController {
//Return a Map with the user custom data //Return a Map with the user custom data
Map<String,String> userCustomData = paramsProcessorUtil.getUserCustomData(params); Map<String,String> userCustomData = paramsProcessorUtil.getUserCustomData(params);
userCustomData.put("foo", "fooval");
userCustomData.put("bar", "barvalue");
//Currently, it's associated with the externalUserID //Currently, it's associated with the externalUserID
if(userCustomData.size()>0) if (userCustomData.size() > 0)
meetingService.addUserCustomData(meeting.getInternalId(),externUserID,userCustomData); meetingService.addUserCustomData(meeting.getInternalId(), externUserID, userCustomData);
String configxml = null; String configxml = null;
@ -1312,46 +1319,52 @@ class ApiController {
response.addHeader("Cache-Control", "no-cache") response.addHeader("Cache-Control", "no-cache")
withFormat { withFormat {
xml { json {
render(contentType:"text/xml") { render(contentType: "application/json") {
response() { response = {
returncode("FAILED") returncode = "FAILED"
message("Could not find conference.") message = "Could not find conference."
logoutURL(logoutUrl) logoutURL = logoutUrl
} }
} }
} }
} }
} else { } else {
Map<String,String> userCustomData = paramsProcessorUtil.getUserCustomData(params);
log.info("Found conference for " + us.fullname) log.info("Found conference for " + us.fullname)
response.addHeader("Cache-Control", "no-cache") response.addHeader("Cache-Control", "no-cache")
withFormat { withFormat {
xml { json {
render(contentType:"text/xml") { render(contentType: "application/json") {
response() { response = {
returncode("SUCCESS") returncode = "SUCCESS"
fullname(us.fullname) fullname = us.fullname
confname(us.conferencename) confname = us.conferencename
meetingID(us.meetingID) meetingID = us.meetingID
externMeetingID(us.externMeetingID) externMeetingID = us.externMeetingID
externUserID(us.externUserID) externUserID = us.externUserID
internalUserID(us.internalUserId) internalUserID = us.internalUserId
role(us.role) role = us.role
conference(us.conference) conference = us.conference
room(us.room) room = us.room
voicebridge(us.voicebridge) voicebridge = us.voicebridge
dialnumber(meeting.getDialNumber()) dialnumber = meeting.getDialNumber()
webvoiceconf(us.webvoiceconf) webvoiceconf = us.webvoiceconf
mode(us.mode) mode = us.mode
record(us.record) record = us.record
welcome(us.welcome) welcome = us.welcome
logoutUrl(us.logoutUrl) if (! StringUtils.isEmpty(meeting.moderatorOnlyMessage))
defaultLayout(us.defaultLayout) modOnlyMessage = meeting.moderatorOnlyMessage
avatarURL(us.avatarURL) logoutUrl = us.logoutUrl
customdata(){ defaultLayout = us.defaultLayout
meeting.getUserCustomData(us.externUserID).each{ k,v -> avatarURL = us.avatarURL
"$k"("$v") customdata = array {
} userCustomData.each { k, v ->
// Somehow we need to prepend something (custdata) for the JSON to work
custdata "$k" : v
}
} }
} }
} }

View File

@ -376,8 +376,8 @@ public class MeetingService implements MessageListener {
public void addUserCustomData(String meetingId, String userID, Map<String,String> userCustomData){ public void addUserCustomData(String meetingId, String userID, Map<String,String> userCustomData){
Meeting m = getMeeting(meetingId); Meeting m = getMeeting(meetingId);
if(m != null){ if (m != null){
m.addUserCustomData(userID,userCustomData); m.addUserCustomData(userID, userCustomData);
} }
} }

View File

@ -44,6 +44,7 @@ public class Meeting {
private String moderatorPass; private String moderatorPass;
private String viewerPass; private String viewerPass;
private String welcomeMsg; private String welcomeMsg;
private String modOnlyMessage;
private String logoutUrl; private String logoutUrl;
private int maxUsers; private int maxUsers;
private boolean record; private boolean record;
@ -74,6 +75,7 @@ public class Meeting {
metadata = builder.metadata; metadata = builder.metadata;
createdTime = builder.createdTime; createdTime = builder.createdTime;
userCustomData = new HashMap<String, Object>(); userCustomData = new HashMap<String, Object>();
users = new ConcurrentHashMap<String, User>(); users = new ConcurrentHashMap<String, User>();
configs = new ConcurrentHashMap<String, Config>(); configs = new ConcurrentHashMap<String, Config>();
@ -138,6 +140,14 @@ public class Meeting {
return endTime; return endTime;
} }
public void setModeratorOnlyMessage(String msg) {
modOnlyMessage = msg;
}
public String getModeratorOnlyMessage() {
return modOnlyMessage;
}
public void setEndTime(long t) { public void setEndTime(long t) {
endTime = t; endTime = t;
} }