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"/>
<mate:Listener type="{TranscriptEvent.TRANSCRIPT_EVENT}" method="handleTranscriptLoadedEvent"/>
<mx:Script>
<![CDATA[
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");
}
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:Module>

View File

@ -10,6 +10,7 @@ package org.bigbluebutton.core.model
private var _meetingMuted:Boolean = false;
private var _lockSettings:LockSettingsVO;
private var _modOnlyMessage:String = null;
public function MeetingModel(enforcer: MeetingModelSingletonEnforcer)
{
@ -44,7 +45,14 @@ package org.bigbluebutton.core.model
public function get meetingMuted():Boolean {
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
{
import com.asfusion.mate.events.Dispatcher;
import mx.controls.Alert;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.main.events.PortTestEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.ConferenceParameters;
import org.bigbluebutton.main.model.PortTestProxy;

View File

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

View File

@ -19,11 +19,14 @@
package org.bigbluebutton.main.model.users
{
import com.asfusion.mate.events.Dispatcher;
import flash.events.TimerEvent;
import flash.external.ExternalInterface;
import flash.net.NetConnection;
import flash.utils.Timer;
import mx.collections.ArrayCollection;
import flash.utils.Timer;
import mx.collections.ArrayCollection;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.core.BBB;
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.UserManager;
import org.bigbluebutton.core.model.Config;
import org.bigbluebutton.core.model.MeetingModel;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
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().record = (result.record != "false");
_conferenceParameters = new ConferenceParameters();
_conferenceParameters.meetingName = result.conferenceName;
_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.SettingsEvent;
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.model.LayoutOptions;
import org.bigbluebutton.main.model.users.events.ConferenceCreatedEvent;
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;

View File

@ -18,9 +18,11 @@
*/
package org.bigbluebutton.modules.chat.services
{
import flash.events.IEventDispatcher;
import flash.events.IEventDispatcher;
import org.bigbluebutton.common.LogUtil;
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.events.PublicChatMessageEvent;
import org.bigbluebutton.modules.chat.vo.ChatMessageVO;
@ -105,6 +107,26 @@ package org.bigbluebutton.modules.chat.services
pcEvent.message = msg;
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.main.events.BBBEvent;
import org.bigbluebutton.main.events.LogoutEvent;
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
import org.bigbluebutton.main.events.UserServicesEvent;
import org.bigbluebutton.main.model.users.UserService;
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.RemovePresentationEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.model.PresentationModel;
import org.bigbluebutton.modules.users.events.MeetingMutedEvent;
public class MessageReceiver implements IMessageListener

View File

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

View File

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