You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2016/04/21 19:34:08 UTC
svn commit: r1740367 - in /openmeetings/application:
branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/
branches/3.2.x/openmeetings-flash/src/main/swf/base/
branches/3.2.x/openmeetings-flash/src/main/swf/base/hiber...
Author: solomax
Date: Thu Apr 21 17:34:08 2016
New Revision: 1740367
URL: http://svn.apache.org/viewvc?rev=1740367&view=rev
Log:
[OPENMEETINGS-1120] activities seems to work as expected
Removed:
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/activitylist/
Modified:
openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/hibernate/hibRtmpConnection.lzx
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainAttributes.lzx
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainMethods.lzx
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/library.lzx
openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/roomSidebar/baseRoomSidebar.lzx
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java
openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java
Modified: openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java Thu Apr 21 17:34:08 2016
@@ -68,6 +68,7 @@ import org.apache.wicket.Application;
import org.apache.wicket.protocol.ws.WebSocketSettings;
import org.apache.wicket.protocol.ws.api.IWebSocketConnection;
import org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry;
+import org.apache.wicket.util.string.Strings;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IClient;
@@ -783,39 +784,6 @@ public class ScopeApplicationAdapter ext
}
}
-
- /**
- * Adds a Moderator by its publicSID
- *
- * @param publicSID
- * @return -1
- */
- public long addModerator(String publicSID) {
- try {
- log.debug("----------- addModerator: " + publicSID);
-
- Client currentClient = sessionManager.getClientByPublicSID(publicSID, null);
-
- if (currentClient == null) {
- return -1L;
- }
- Long roomId = currentClient.getRoomId();
-
- currentClient.setIsMod(true);
- // Put the mod-flag to true for this client
- sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
-
- List<Client> currentMods = sessionManager.getCurrentModeratorByRoom(roomId);
-
- //Send message to all users
- sendMessageToCurrentScope("setNewModeratorByList", currentMods, true);
-
- } catch (Exception err) {
- log.error("[addModerator]", err);
- }
- return -1L;
- }
-
@SuppressWarnings("unchecked")
public void setNewCursorPosition(Object item) {
try {
@@ -851,32 +819,7 @@ public class ScopeApplicationAdapter ext
sendMessageToCurrentScope("setNewModeratorByList", currentMods, true);
} catch (Exception err) {
- log.error("[addModerator]", err);
- }
- return -1L;
- }
-
- public long setBroadCastingFlag(String publicSID, boolean value, boolean canVideo, Integer interviewPodId) {
- try {
- log.debug("----------- setBroadCastingFlag: " + publicSID);
-
- Client currentClient = sessionManager.getClientByPublicSID(publicSID, null);
-
- if (currentClient == null) {
- return -1L;
- }
-
- currentClient.setIsBroadcasting(value);
- currentClient.setCanVideo(value && canVideo); //set to false in case NOT broadcasting
- currentClient.setInterviewPodId(interviewPodId);
-
- // Put the mod-flag to true for this client
- sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
-
- // Notify all clients of the same scope (room)
- sendMessageToCurrentScope("setNewBroadCastingFlag", currentClient, true);
- } catch (Exception err) {
- log.error("[setBroadCastingFlag]", err);
+ log.error("[removeModerator]", err);
}
return -1L;
}
@@ -1457,14 +1400,9 @@ public class ScopeApplicationAdapter ext
log.debug("sendMessageByRoomAndDomain " + roomId);
- IScope globalScope = getContext().getGlobalScope();
- IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
-
- log.debug("webAppKeyScope " + webAppKeyScope);
+ IScope scope = getRoomScope(roomId.toString());
- IScope scopeHibernate = webAppKeyScope.getScope(roomId.toString());
-
- new MessageSender(scopeHibernate, "newMessageByRoomAndDomain", message) {
+ new MessageSender(scope, "newMessageByRoomAndDomain", message) {
@Override
public boolean filter(IConnection conn) {
IClient client = conn.getClient();
@@ -1660,6 +1598,17 @@ public class ScopeApplicationAdapter ext
sendMessageToCurrentScope(remoteMethodName, newMessage, sendSelf, false);
}
+ public void sendToScope(final Long roomId, String method, Object obj) {
+ new MessageSender(getRoomScope("" + roomId), method, obj) {
+ @Override
+ public boolean filter(IConnection conn) {
+ Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
+ return rcl.isScreenClient()
+ || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId) || userDao.get(rcl.getUserId()) == null;
+ }
+ }.start();
+ }
+
/**
* Only temporary for load test, with return argument for the client to have a result
*
@@ -1862,11 +1811,6 @@ public class ScopeApplicationAdapter ext
public void sendMessageWithClientByPublicSID(Object message, String publicSID) {
try {
- // ApplicationContext appCtx = getContext().getApplicationContext();
- IScope globalScope = getContext().getGlobalScope();
-
- IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
-
if (publicSID == null) {
log.warn("'null' publicSID was passed to sendMessageWithClientByPublicSID");
return;
@@ -1878,20 +1822,14 @@ public class ScopeApplicationAdapter ext
if (currentClient == null) {
throw new Exception("Could not Find RoomClient on List publicSID: " + publicSID);
}
- // default Scope Name
- String scopeName = "hibernate";
- if (currentClient.getRoomId() != null) {
- scopeName = currentClient.getRoomId().toString();
- }
-
- IScope scopeHibernate = webAppKeyScope.getScope(scopeName);
+ IScope scope = getRoomScope("" + currentClient.getRoomId());
// log.debug("scopeHibernate "+scopeHibernate);
- if (scopeHibernate != null) {
+ if (scope != null) {
// Notify the clients of the same scope (room) with userId
- for (IConnection conn : webAppKeyScope.getScope(scopeName).getClientConnections()) {
+ for (IConnection conn : scope.getClientConnections()) {
IClient client = conn.getClient();
if (SessionVariablesUtil.isScreenClient(client)) {
// screen sharing clients do not receive events
@@ -2089,24 +2027,14 @@ public class ScopeApplicationAdapter ext
}
public IScope getRoomScope(String room) {
- try {
-
+ if (Strings.isEmpty(room)) {
+ return null;
+ } else {
IScope globalScope = getContext().getGlobalScope();
IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
- String scopeName = "hibernate";
- // If set then its a NON default Scope
- if (room.length() != 0) {
- scopeName = room;
- }
-
- IScope scopeHibernate = webAppKeyScope.getScope(scopeName);
-
- return scopeHibernate;
- } catch (Exception err) {
- log.error("[getRoomScope]", err);
+ return webAppKeyScope.getScope(room);
}
- return null;
}
/*
Modified: openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/hibernate/hibRtmpConnection.lzx
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/hibernate/hibRtmpConnection.lzx?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/hibernate/hibRtmpConnection.lzx (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/hibernate/hibRtmpConnection.lzx Thu Apr 21 17:34:08 2016
@@ -194,6 +194,7 @@
client.nickNameSet = this.nickNameSet;
client.startedPublishing = this.startedPublishing;
client.newPoll = this.newPoll;
+ client.clientUpdated = clientUpdated;
</handler>
<handler name="ondisconnect">
@@ -774,9 +775,6 @@
if (value == null || value.screenClient) {
return;
}
- if (canvas.currentActivityList != null) {
- canvas.currentActivityList.addMessageRequest(value, canvas.getLabelName(1367), new Date().getTime());
- }
this.roomDisconnectUser(value, value.publicSID);
]]>
</method>
@@ -856,52 +854,6 @@
]]>
</method>
- <!--
- Adds this User to the List of current Moderators
- -->
- <netRemoteCallHib name="addModerator" funcname="addModerator">
- <attribute name="publicSIDOfNewModerator" value="0" type="string" />
- <netparam name="vars"><method name="getValue">return parent.publicSIDOfNewModerator;</method></netparam>
- <handler name="ondata" args="value">
- <![CDATA[
- //The onResult-Handler will be called be the rtmpconnection
- if ($debug) Debug.write(" addModerator : ",value);
- ]]>
- </handler>
- </netRemoteCallHib>
-
- <netRemoteCallHib name="removeModerator" funcname="removeModerator">
- <attribute name="publicSIDOfNewModerator" value="0" type="string" />
- <netparam name="vars"><method name="getValue">return parent.publicSIDOfNewModerator;</method></netparam>
- <handler name="ondata" args="value">
- <![CDATA[
- //The onResult-Handler will be called be the rtmpconnection
- //Debug.write(" onResult setModerator : ",value);
- ]]>
- </handler>
- </netRemoteCallHib>
-
- <!--
- public synchronized Long setBroadCastingFlag(String publicSID, boolean value, boolean canVideo, Integer podId)
- -->
- <netRemoteCallHib name="setBroadCastingFlag" funcname="setBroadCastingFlag">
- <attribute name="publicSIDOfNewModerator" value="0" type="string" />
- <attribute name="isAllowedToBroadCastAV" value="false" type="boolean" />
- <attribute name="canVideo" value="false" type="boolean" />
- <attribute name="avsettings" value="av" type="string" />
- <attribute name="interviewPodId" value="0" type="number" />
- <netparam><method name="getValue">return parent.publicSIDOfNewModerator;</method></netparam>
- <netparam><method name="getValue">return parent.isAllowedToBroadCastAV;</method></netparam>
- <netparam><method name="getValue">return parent.canVideo;</method></netparam>
- <netparam><method name="getValue">return parent.interviewPodId;</method></netparam>
- <handler name="ondata" args="value">
- <![CDATA[
- //The onResult-Handler will be called be the rtmpconnection
- //Debug.write(" onResult setModerator : ",value);
- ]]>
- </handler>
- </netRemoteCallHib>
-
<method name="setNewBroadCastingFlag" args="value">
<![CDATA[
//The onResult-Handler will be called be the rtmpconnection
@@ -999,31 +951,6 @@
</handler>
</netRemoteCallHib>
- <!--
- public synchronized Long applyForModeration(String publicSID)
- -->
- <netRemoteCallHib name="applyForModeration" funcname="applyForModeration"
- remotecontext="$once{ canvas.thishib }">
- <netparam><method name="getValue">return canvas.publicSID;</method></netparam>
- <handler name="ondata" args="value">
- <![CDATA[
- //The onResult-Handler will be called be the rtmpconnection
- if ($debug) Debug.write("applyForModeration : ",value);
- if (value == 1) {
- //Do add direct
- parent.addModerator.publicSIDOfNewModerator = canvas.publicSID;
- parent.addModerator.doCall();
- } else if (value == 2) {
- //Ask the Moderator
- var tDate = new Date();
- parent.sendMessageWithClient.sendMessage("applyForModeration",tDate.getTime());
- } else if (value == 3) {
- new lz.labelerrorPopup(canvas,{errorlabelid:696});
- }
- ]]>
- </handler>
- </netRemoteCallHib>
-
<netRemoteCallHib name="setCanDraw" funcname="whiteboardservice.setCanDraw"
remotecontext="$once{ canvas.thishib }">
<attribute name="publicSID" value="" type="string" />
@@ -1102,6 +1029,22 @@
</handler>
</netRemoteCallHib>
+ <method name="clientUpdated" args="client">
+ <![CDATA[
+ var u = canvas._videocontainer._participants.getUserListItemByPublicSID(client.publicSID);
+ if (!!u && !!client) {
+ u.update(client);
+ }
+ if ($debug) Debug.write("drawAllowStatus changes ###### ");
+ if (client.publicSID == canvas.publicSID) {
+ canvas.setAttribute("isAllowedToDraw", client.canDraw);
+ canvas.setAttribute("isAllowedToScreenShare", client.canShare);
+ canvas.setAttribute("isAllowedToRemoteControl", client.canRemote);
+ canvas.setAttribute("ismoderator", client.isMod);
+ }
+ ]]>
+ </method>
+
<method name="sendVarsToMessage" args="value">
<![CDATA[
//The onResult-Handler will be called be the rtmpconnection
@@ -1250,33 +1193,6 @@
} else if (value.message[0]=='updateGiveAudioStatus') {
canvas.setExclusiveAudioAllowStatus(value.message[1]);
canvas.setAttribute("exclusiveAudioAllowStatus",value.message[1]);
- } else if (value.message[0]=='applyForModeration'){
- if ($debug) Debug.write("Somebody wants the Moderation ",value.client);
- canvas.currentActivityList.addModerationRequest(value.client,value.message[1]);
- } else if (value.message[0]=='applyForScreen'){
- if ($debug) Debug.write("Somebody wants to share/record Screen ",value.client);
- canvas.currentActivityList.addScreenRequest(value.client,value.message[1]);
- } else if (value.message[0]=='applyForRemote'){
- if ($debug) Debug.write("Somebody wants to remote control screen ",value.client);
- canvas.currentActivityList.addRemoteRequest(value.client,value.message[1]);
- } else if (value.message[0]=='applyForWhiteboard'){
- if ($debug) Debug.write("Somebody wants to draw on Whiteboard ",value.client);
- canvas.currentActivityList.addWhiteboardRequest(value.client,value.message[1]);
- } else if (value.message[0]=='applyForA'){
- if ($debug) Debug.write("Somebody wants to share A ",value.client);
- canvas.currentActivityList.addAudioRequest(value.client,value.message[1]);
- } else if (value.message[0]=='applyForAV'){
- if ($debug) Debug.write("Somebody wants to share AV ",value.client);
- canvas.currentActivityList.addAudioAndVideoRequest(value.client,value.message[1]);
- } else if (value.message[0]=='hideActivityObj'){
- if ($debug) Debug.write("Somebody wants to hideActivityObj ",value.client);
- canvas.currentActivityList.hideActivityObj(value);
- } else if (value.message[0]=='applyForMuteOn'){
- canvas.currentActivityList.applyForMuteOn(value.client,value.message[1]);
- } else if (value.message[0]=='applyForMuteOff'){
- canvas.currentActivityList.applyForMuteOff(value.client,value.message[1]);
- } else if (value.message[0]=='applyForGiveExclusiveAudioOn'){
- canvas.currentActivityList.applyForGiveExclusiveAudioOn(value.client,value.message[1]);
} else if (value.message[0] == 'personal') {
var pSID = value.client.publicSID;
var vo = canvas._videocontainer._participants.getUserListItemByPublicSID(pSID);
Modified: openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainAttributes.lzx
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainAttributes.lzx?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainAttributes.lzx (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainAttributes.lzx Thu Apr 21 17:34:08 2016
@@ -448,9 +448,4 @@ and some more references to temp-objects
}
</method>
-<!--
- Holds a reference to the current activity list, if there is one
- -->
-<attribute name="currentActivityList" value="null" />
-
</library>
Modified: openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainMethods.lzx
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainMethods.lzx?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainMethods.lzx (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/base/mainMethods.lzx Thu Apr 21 17:34:08 2016
@@ -382,25 +382,6 @@
</method>
<!---
- Sets the flags isAllowedToDraw, isAllowedToScreenShare, isAllowedToRemoteControl
- and broadcasts the three rights to SWF10 container
- -->
- <method name="setDrawAllowStatus" args="roomClientObj">
- <![CDATA[
- var u = canvas._videocontainer._participants.getUserListItemByPublicSID(roomClientObj.publicSID);
- if (!!u && !!roomClientObj) {
- u.update(roomClientObj);
- }
- if ($debug) Debug.write("drawAllowStatus changes ###### ");
- if (roomClientObj.publicSID == canvas.publicSID) {
- canvas.setAttribute("isAllowedToDraw", roomClientObj.canDraw);
- canvas.setAttribute("isAllowedToScreenShare", roomClientObj.canShare);
- canvas.setAttribute("isAllowedToRemoteControl", roomClientObj.canRemote);
- }
- ]]>
- </method>
-
- <!---
Sets the flag for the isAllowedToGiveExclusiveAudio status and broadcasts it to the
SWF10 container
-->
Modified: openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/library.lzx
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/library.lzx?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/library.lzx (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/library.lzx Thu Apr 21 17:34:08 2016
@@ -66,7 +66,6 @@
<include href="innerlistViewEventUserListTable.lzx" />
<include href="moderationMiniIconsEventUserList.lzx" />
- <include href="activitylist/" />
<include href="roomSidebar/" />
<include href="appointmentNotificationPopUp.lzx" />
<include href="baseRoomInnerList.lzx" />
Modified: openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/roomSidebar/baseRoomSidebar.lzx
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/roomSidebar/baseRoomSidebar.lzx?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/roomSidebar/baseRoomSidebar.lzx (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-flash/src/main/swf/modules/conference/flexibleConferenceRoom/roomSidebar/baseRoomSidebar.lzx Thu Apr 21 17:34:08 2016
@@ -72,8 +72,6 @@
<fileExplorer name="_files" y="22" width="$once{ parent.width-12 }" height="${ parent.height-222 }" visible="false" />
- <activityList name="_activityList" />
-
<view name="_minimizeSidebar" x="${ parent.width - 10 }" width="10" y="1" bgcolor="0xE0E1EB" height="${ parent.height-1 }">
<handler name="onclick">
if (!canvas.isInterview) {
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java Thu Apr 21 17:34:08 2016
@@ -220,8 +220,8 @@ public class Application extends Authent
}
}
- public static boolean isUserOnline(String uid) {
- return ONLINE_USERS.containsKey(uid);
+ public static Client getOnlineClient(String uid) {
+ return uid == null ? null : ONLINE_USERS.get(uid);
}
public static boolean isUserOnline(Long userId) {
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java Thu Apr 21 17:34:08 2016
@@ -18,16 +18,20 @@
*/
package org.apache.openmeetings.web.room;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.web.app.Application.getBean;
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
-import org.apache.openmeetings.db.entity.room.Client;
import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.core.session.SessionManager;
-import org.red5.server.api.IConnection;
+import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
+import org.apache.openmeetings.db.entity.room.Client;
+import org.apache.openmeetings.web.app.Client.Right;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
public class RoomBroadcaster {
+ private static final Logger log = Red5LoggerFactory.getLogger(RoomBroadcaster.class, webAppRootKey);
+
public static Client getClient(String publicSid) {
ClientSessionInfo csi = getBean(SessionManager.class).getClientByPublicSIDAnyServer(publicSid);
return csi == null ? null : csi.getRcl();
@@ -38,17 +42,30 @@ public class RoomBroadcaster {
if (rc == null) {
return;
}
- final Long roomId = rc.getRoomId();
- final SessionManager sessionMgr = getBean(SessionManager.class);
- final UserDao userDao = getBean(UserDao.class);
+ broadcast(rc.getRoomId(), method, obj);
+ }
+
+ public static void broadcast(Long roomId, String method, Object obj) {
ScopeApplicationAdapter sa = getBean(ScopeApplicationAdapter.class);
- sa.new MessageSender(sa.getRoomScope("" + roomId), method, obj) {
- @Override
- public boolean filter(IConnection conn) {
- Client rcl = sessionMgr.getClientByStreamId(conn.getClient().getId(), null);
- return rcl.isScreenClient()
- || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId) || userDao.get(rcl.getUserId()) == null;
- }
- }.start();
+ sa.sendToScope(roomId, method, obj);
+ }
+
+ public static void sendUpdatedClient(org.apache.openmeetings.web.app.Client client) {
+ org.apache.openmeetings.db.entity.room.Client rcl = getClient(client.getUid());
+ log.debug("----------- sendUpdatedClient ");
+
+ if (rcl == null) {
+ return;
+ }
+ rcl.setIsSuperModerator(client.hasRight(Right.superModerator));
+ rcl.setIsMod(client.hasRight(Right.moderator));
+ rcl.setIsBroadcasting(client.hasRight(Right.audio));
+ rcl.setCanVideo(client.hasRight(Right.video));
+ rcl.setCanDraw(client.hasRight(Right.whiteBoard));
+
+ // Put the mod-flag to true for this client
+ getBean(SessionManager.class).updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
+ // Notify all clients of the same scope (room)
+ broadcast(client.getRoomId(), "clientUpdated", rcl);
}
}
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java Thu Apr 21 17:34:08 2016
@@ -43,6 +43,7 @@ import org.apache.openmeetings.util.mess
import org.apache.openmeetings.util.message.TextRoomMessage;
import org.apache.openmeetings.web.app.Application;
import org.apache.openmeetings.web.app.Client;
+import org.apache.openmeetings.web.app.Client.Right;
import org.apache.openmeetings.web.common.BasePanel;
import org.apache.openmeetings.web.room.activities.ActivitiesPanel;
import org.apache.openmeetings.web.room.activities.Activity;
@@ -117,6 +118,8 @@ public class RoomPanel extends BasePanel
//private String recordingUser = null;
//private String sharingUser = null;
//private String publishingUser = null;
+
+ //TODO FIXME conference room should send setBroadCastingFlag(String uid, boolean isBroadcasting, boolean canVideo, Integer interviewPodId) on enter !!!!!!!!!!
}
@Override
@@ -263,23 +266,29 @@ public class RoomPanel extends BasePanel
roomClosed.open(handler);
break;
case requestRightModerator:
- if (isModerator(getUserId(), r.getId()) && !isModerator(m.getUserId(), r.getId())) {
+ if (getClient().hasRight(Right.moderator) && !isModerator(m.getUserId(), r.getId())) {
TextRoomMessage tm = (TextRoomMessage)m;
activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightModerator), handler);
}
break;
+ case requestRightAv:
+ if (getClient().hasRight(Right.moderator) && !hasRight(m.getUserId(), r.getId(), Right.audio) && !hasRight(m.getUserId(), r.getId(), Right.video)) {
+ TextRoomMessage tm = (TextRoomMessage)m;
+ activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightAv), handler);
+ }
+ break;
+ case requestRightWb:
+ if (getClient().hasRight(Right.moderator) && !hasRight(m.getUserId(), r.getId(), Right.whiteBoard)) {
+ TextRoomMessage tm = (TextRoomMessage)m;
+ activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightWb), handler);
+ }
+ break;
case activityRemove:
{
TextRoomMessage tm = (TextRoomMessage)m;
activities.remove(tm.getText(), handler);
}
break;
- case requestRightAv:
- break;
- case requestRightWb:
- break;
- default:
- break;
}
}
}
@@ -333,8 +342,12 @@ public class RoomPanel extends BasePanel
}
public static boolean isModerator(long userId, long roomId) {
+ return hasRight(userId, roomId, Right.moderator);
+ }
+
+ public static boolean hasRight(long userId, long roomId, Client.Right r) {
for (Client c : getRoomUsers(roomId)) {
- if (c.getUserId() == userId && c.hasRight(Client.Right.moderator)) {
+ if (c.getUserId() == userId && c.hasRight(r)) {
return true;
}
}
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java Thu Apr 21 17:34:08 2016
@@ -19,7 +19,7 @@
package org.apache.openmeetings.web.room;
import static org.apache.openmeetings.web.app.Application.getBean;
-import static org.apache.openmeetings.web.app.Application.isUserOnline;
+import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import java.io.File;
@@ -52,7 +52,7 @@ public abstract class RoomResourceRefere
//no-op expected
}
WebSession ws = WebSession.get();
- if (id != null && ws.isSignedIn() && !Strings.isEmpty(uid) && isUserOnline(uid)) {
+ if (id != null && ws.isSignedIn() && !Strings.isEmpty(uid) && getOnlineClient(uid) != null) {
//TODO ADDITIONALLY CHECK Rights !! and room !!
return getBean(FileExplorerItemDao.class).get(id);
}
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java Thu Apr 21 17:34:08 2016
@@ -20,12 +20,11 @@ package org.apache.openmeetings.web.room
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.web.app.Application.getBean;
-import static org.apache.openmeetings.web.app.Application.getRoomUsers;
+import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import static org.apache.openmeetings.web.room.RoomPanel.isModerator;
+import static org.apache.openmeetings.web.room.RoomPanel.broadcast;
import static org.apache.openmeetings.web.util.CallbackFunctionHelper.getNamedFunction;
import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
-import static org.apache.openmeetings.web.room.RoomPanel.broadcast;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -41,6 +40,7 @@ import org.apache.openmeetings.util.mess
import org.apache.openmeetings.web.app.Client;
import org.apache.openmeetings.web.app.Client.Right;
import org.apache.openmeetings.web.common.BasePanel;
+import org.apache.openmeetings.web.room.RoomBroadcaster;
import org.apache.openmeetings.web.room.RoomPanel;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
@@ -94,29 +94,35 @@ public class ActivitiesPanel extends Bas
remove(uid, target);
break;
case decline:
- if (isModerator(getUserId(), roomId)) {
+ if (room.getClient().hasRight(Client.Right.moderator)) {
broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
}
break;
case accept:
- if (isModerator(getUserId(), roomId)) {
+ Client client = getOnlineClient(uid);
+ if (room.getClient().hasRight(Client.Right.moderator) && client != null && roomId == client.getRoomId()) {
switch (a.getType()) {
case requestRightModerator:
- Client client = null;
- for (Client c : getRoomUsers(room.getRoom().getId())) { //FIXME TODO add Map somewhere
- if (c.getUid().equals(uid)) {
- client = c;
- break;
- }
- }
- if (client != null) {
- client.getRights().add(Right.moderator);
- broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
- broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
- }
+ client.getRights().add(Right.moderator);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
+ break;
+ case requestRightAv:
+ client.getRights().add(Right.audio);
+ client.getRights().add(Right.video);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
+ break;
+ case requestRightWb:
+ client.getRights().add(Right.whiteBoard);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
break;
default:
- break;
+ break;
}
}
break;
@@ -165,6 +171,22 @@ public class ActivitiesPanel extends Bas
}
//ask question 693
break;
+ case requestRightAv:
+ {
+ User u = getBean(UserDao.class).get(a.getSender());
+ text = String.format("%s %s %s [%s]", u.getFirstname(), u.getLastname(), getString("695"), df.get().format(a.getCreated()));
+ accept.setVisible(true);
+ decline.setVisible(true);
+ }
+ break;
+ case requestRightWb:
+ {
+ User u = getBean(UserDao.class).get(a.getSender());
+ text = String.format("%s %s %s [%s]", u.getFirstname(), u.getLastname(), getString("694"), df.get().format(a.getCreated()));
+ accept.setVisible(true);
+ decline.setVisible(true);
+ }
+ break;
}
item.add(new WebMarkupContainer("close").add(new AttributeAppender("onclick", String.format("activityAction(%s, '%s', '%s');", roomId, Action.close.name(), a.getUid()))));
item.add(accept, decline, new Label("text", text));
@@ -175,6 +197,10 @@ public class ActivitiesPanel extends Bas
switch (a.getType()) {
case requestRightModerator:
return "ui-state-highlight";
+ case requestRightAv:
+ return "ui-state-highlight";
+ case requestRightWb:
+ return "ui-state-highlight";
case roomEnter:
case roomExit:
}
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java Thu Apr 21 17:34:08 2016
@@ -27,6 +27,8 @@ public class Activity implements Seriali
roomEnter
, roomExit
, requestRightModerator
+ , requestRightAv
+ , requestRightWb
}
private final String uid;
private final Long sender;
Modified: openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java (original)
+++ openmeetings/application/branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java Thu Apr 21 17:34:08 2016
@@ -261,8 +261,8 @@ public class RoomMenuPanel extends Panel
shareMenuItem.setEnabled(shareVisible);
//FIXME TODO apply* should be enabled if moder is in room
applyModerMenuItem.setEnabled(!moder);
- applyWbMenuItem.setEnabled(!moder);
- applyAvMenuItem.setEnabled(!moder);
+ applyWbMenuItem.setEnabled(!room.getClient().hasRight(Client.Right.whiteBoard));
+ applyAvMenuItem.setEnabled(!room.getClient().hasRight(Client.Right.audio) || !room.getClient().hasRight(Client.Right.video));
pollCreateMenuItem.setEnabled(moder);
pollVoteMenuItem.setEnabled(pollExists && notExternalUser && !getBean(PollDao.class).hasVoted(r.getId(), getUserId()));
pollResultMenuItem.setEnabled(pollExists || getBean(PollDao.class).getArchived(r.getId()).size() > 0);
Modified: openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java (original)
+++ openmeetings/application/trunk/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/red5/ScopeApplicationAdapter.java Thu Apr 21 17:34:08 2016
@@ -68,6 +68,7 @@ import org.apache.wicket.Application;
import org.apache.wicket.protocol.ws.WebSocketSettings;
import org.apache.wicket.protocol.ws.api.IWebSocketConnection;
import org.apache.wicket.protocol.ws.api.registry.IWebSocketConnectionRegistry;
+import org.apache.wicket.util.string.Strings;
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.adapter.ApplicationAdapter;
import org.red5.server.api.IClient;
@@ -783,39 +784,6 @@ public class ScopeApplicationAdapter ext
}
}
-
- /**
- * Adds a Moderator by its publicSID
- *
- * @param publicSID
- * @return -1
- */
- public long addModerator(String publicSID) {
- try {
- log.debug("----------- addModerator: " + publicSID);
-
- Client currentClient = sessionManager.getClientByPublicSID(publicSID, null);
-
- if (currentClient == null) {
- return -1L;
- }
- Long roomId = currentClient.getRoomId();
-
- currentClient.setIsMod(true);
- // Put the mod-flag to true for this client
- sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
-
- List<Client> currentMods = sessionManager.getCurrentModeratorByRoom(roomId);
-
- //Send message to all users
- sendMessageToCurrentScope("setNewModeratorByList", currentMods, true);
-
- } catch (Exception err) {
- log.error("[addModerator]", err);
- }
- return -1L;
- }
-
@SuppressWarnings("unchecked")
public void setNewCursorPosition(Object item) {
try {
@@ -851,32 +819,7 @@ public class ScopeApplicationAdapter ext
sendMessageToCurrentScope("setNewModeratorByList", currentMods, true);
} catch (Exception err) {
- log.error("[addModerator]", err);
- }
- return -1L;
- }
-
- public long setBroadCastingFlag(String publicSID, boolean value, boolean canVideo, Integer interviewPodId) {
- try {
- log.debug("----------- setBroadCastingFlag: " + publicSID);
-
- Client currentClient = sessionManager.getClientByPublicSID(publicSID, null);
-
- if (currentClient == null) {
- return -1L;
- }
-
- currentClient.setIsBroadcasting(value);
- currentClient.setCanVideo(value && canVideo); //set to false in case NOT broadcasting
- currentClient.setInterviewPodId(interviewPodId);
-
- // Put the mod-flag to true for this client
- sessionManager.updateClientByStreamId(currentClient.getStreamid(), currentClient, false, null);
-
- // Notify all clients of the same scope (room)
- sendMessageToCurrentScope("setNewBroadCastingFlag", currentClient, true);
- } catch (Exception err) {
- log.error("[setBroadCastingFlag]", err);
+ log.error("[removeModerator]", err);
}
return -1L;
}
@@ -1457,14 +1400,9 @@ public class ScopeApplicationAdapter ext
log.debug("sendMessageByRoomAndDomain " + roomId);
- IScope globalScope = getContext().getGlobalScope();
- IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
-
- log.debug("webAppKeyScope " + webAppKeyScope);
+ IScope scope = getRoomScope(roomId.toString());
- IScope scopeHibernate = webAppKeyScope.getScope(roomId.toString());
-
- new MessageSender(scopeHibernate, "newMessageByRoomAndDomain", message) {
+ new MessageSender(scope, "newMessageByRoomAndDomain", message) {
@Override
public boolean filter(IConnection conn) {
IClient client = conn.getClient();
@@ -1660,6 +1598,17 @@ public class ScopeApplicationAdapter ext
sendMessageToCurrentScope(remoteMethodName, newMessage, sendSelf, false);
}
+ public void sendToScope(final Long roomId, String method, Object obj) {
+ new MessageSender(getRoomScope("" + roomId), method, obj) {
+ @Override
+ public boolean filter(IConnection conn) {
+ Client rcl = sessionManager.getClientByStreamId(conn.getClient().getId(), null);
+ return rcl.isScreenClient()
+ || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId) || userDao.get(rcl.getUserId()) == null;
+ }
+ }.start();
+ }
+
/**
* Only temporary for load test, with return argument for the client to have a result
*
@@ -1862,11 +1811,6 @@ public class ScopeApplicationAdapter ext
public void sendMessageWithClientByPublicSID(Object message, String publicSID) {
try {
- // ApplicationContext appCtx = getContext().getApplicationContext();
- IScope globalScope = getContext().getGlobalScope();
-
- IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
-
if (publicSID == null) {
log.warn("'null' publicSID was passed to sendMessageWithClientByPublicSID");
return;
@@ -1878,20 +1822,14 @@ public class ScopeApplicationAdapter ext
if (currentClient == null) {
throw new Exception("Could not Find RoomClient on List publicSID: " + publicSID);
}
- // default Scope Name
- String scopeName = "hibernate";
- if (currentClient.getRoomId() != null) {
- scopeName = currentClient.getRoomId().toString();
- }
-
- IScope scopeHibernate = webAppKeyScope.getScope(scopeName);
+ IScope scope = getRoomScope("" + currentClient.getRoomId());
// log.debug("scopeHibernate "+scopeHibernate);
- if (scopeHibernate != null) {
+ if (scope != null) {
// Notify the clients of the same scope (room) with userId
- for (IConnection conn : webAppKeyScope.getScope(scopeName).getClientConnections()) {
+ for (IConnection conn : scope.getClientConnections()) {
IClient client = conn.getClient();
if (SessionVariablesUtil.isScreenClient(client)) {
// screen sharing clients do not receive events
@@ -2089,24 +2027,14 @@ public class ScopeApplicationAdapter ext
}
public IScope getRoomScope(String room) {
- try {
-
+ if (Strings.isEmpty(room)) {
+ return null;
+ } else {
IScope globalScope = getContext().getGlobalScope();
IScope webAppKeyScope = globalScope.getScope(OpenmeetingsVariables.webAppRootKey);
- String scopeName = "hibernate";
- // If set then its a NON default Scope
- if (room.length() != 0) {
- scopeName = room;
- }
-
- IScope scopeHibernate = webAppKeyScope.getScope(scopeName);
-
- return scopeHibernate;
- } catch (Exception err) {
- log.error("[getRoomScope]", err);
+ return webAppKeyScope.getScope(room);
}
- return null;
}
/*
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.java Thu Apr 21 17:34:08 2016
@@ -220,8 +220,8 @@ public class Application extends Authent
}
}
- public static boolean isUserOnline(String uid) {
- return ONLINE_USERS.containsKey(uid);
+ public static Client getOnlineClient(String uid) {
+ return uid == null ? null : ONLINE_USERS.get(uid);
}
public static boolean isUserOnline(Long userId) {
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomBroadcaster.java Thu Apr 21 17:34:08 2016
@@ -18,16 +18,20 @@
*/
package org.apache.openmeetings.web.room;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.web.app.Application.getBean;
-import org.apache.openmeetings.db.dao.user.UserDao;
-import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
-import org.apache.openmeetings.db.entity.room.Client;
import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
import org.apache.openmeetings.core.session.SessionManager;
-import org.red5.server.api.IConnection;
+import org.apache.openmeetings.db.dto.server.ClientSessionInfo;
+import org.apache.openmeetings.db.entity.room.Client;
+import org.apache.openmeetings.web.app.Client.Right;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
public class RoomBroadcaster {
+ private static final Logger log = Red5LoggerFactory.getLogger(RoomBroadcaster.class, webAppRootKey);
+
public static Client getClient(String publicSid) {
ClientSessionInfo csi = getBean(SessionManager.class).getClientByPublicSIDAnyServer(publicSid);
return csi == null ? null : csi.getRcl();
@@ -38,17 +42,30 @@ public class RoomBroadcaster {
if (rc == null) {
return;
}
- final Long roomId = rc.getRoomId();
- final SessionManager sessionMgr = getBean(SessionManager.class);
- final UserDao userDao = getBean(UserDao.class);
+ broadcast(rc.getRoomId(), method, obj);
+ }
+
+ public static void broadcast(Long roomId, String method, Object obj) {
ScopeApplicationAdapter sa = getBean(ScopeApplicationAdapter.class);
- sa.new MessageSender(sa.getRoomScope("" + roomId), method, obj) {
- @Override
- public boolean filter(IConnection conn) {
- Client rcl = sessionMgr.getClientByStreamId(conn.getClient().getId(), null);
- return rcl.isScreenClient()
- || rcl.getRoomId() == null || !rcl.getRoomId().equals(roomId) || userDao.get(rcl.getUserId()) == null;
- }
- }.start();
+ sa.sendToScope(roomId, method, obj);
+ }
+
+ public static void sendUpdatedClient(org.apache.openmeetings.web.app.Client client) {
+ org.apache.openmeetings.db.entity.room.Client rcl = getClient(client.getUid());
+ log.debug("----------- sendUpdatedClient ");
+
+ if (rcl == null) {
+ return;
+ }
+ rcl.setIsSuperModerator(client.hasRight(Right.superModerator));
+ rcl.setIsMod(client.hasRight(Right.moderator));
+ rcl.setIsBroadcasting(client.hasRight(Right.audio));
+ rcl.setCanVideo(client.hasRight(Right.video));
+ rcl.setCanDraw(client.hasRight(Right.whiteBoard));
+
+ // Put the mod-flag to true for this client
+ getBean(SessionManager.class).updateClientByStreamId(rcl.getStreamid(), rcl, false, null);
+ // Notify all clients of the same scope (room)
+ broadcast(client.getRoomId(), "clientUpdated", rcl);
}
}
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java Thu Apr 21 17:34:08 2016
@@ -43,6 +43,7 @@ import org.apache.openmeetings.util.mess
import org.apache.openmeetings.util.message.TextRoomMessage;
import org.apache.openmeetings.web.app.Application;
import org.apache.openmeetings.web.app.Client;
+import org.apache.openmeetings.web.app.Client.Right;
import org.apache.openmeetings.web.app.WebSession;
import org.apache.openmeetings.web.common.BasePanel;
import org.apache.openmeetings.web.room.activities.ActivitiesPanel;
@@ -134,6 +135,8 @@ public class RoomPanel extends BasePanel
//private String recordingUser = null;
//private String sharingUser = null;
//private String publishingUser = null;
+
+ //TODO FIXME conference room should send setBroadCastingFlag(String uid, boolean isBroadcasting, boolean canVideo, Integer interviewPodId) on enter !!!!!!!!!!
}
@Override
@@ -282,23 +285,29 @@ public class RoomPanel extends BasePanel
roomClosed.open(handler);
break;
case requestRightModerator:
- if (isModerator(getUserId(), r.getId()) && !isModerator(m.getUserId(), r.getId())) {
+ if (getClient().hasRight(Right.moderator) && !isModerator(m.getUserId(), r.getId())) {
TextRoomMessage tm = (TextRoomMessage)m;
activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightModerator), handler);
}
break;
+ case requestRightAv:
+ if (getClient().hasRight(Right.moderator) && !hasRight(m.getUserId(), r.getId(), Right.audio) && !hasRight(m.getUserId(), r.getId(), Right.video)) {
+ TextRoomMessage tm = (TextRoomMessage)m;
+ activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightAv), handler);
+ }
+ break;
+ case requestRightWb:
+ if (getClient().hasRight(Right.moderator) && !hasRight(m.getUserId(), r.getId(), Right.whiteBoard)) {
+ TextRoomMessage tm = (TextRoomMessage)m;
+ activities.add(new Activity(tm.getText(), m.getUserId(), Activity.Type.requestRightWb), handler);
+ }
+ break;
case activityRemove:
{
TextRoomMessage tm = (TextRoomMessage)m;
activities.remove(tm.getText(), handler);
}
break;
- case requestRightAv:
- break;
- case requestRightWb:
- break;
- default:
- break;
}
}
}
@@ -364,8 +373,12 @@ public class RoomPanel extends BasePanel
}
public static boolean isModerator(long userId, long roomId) {
+ return hasRight(userId, roomId, Right.moderator);
+ }
+
+ public static boolean hasRight(long userId, long roomId, Client.Right r) {
for (Client c : getRoomUsers(roomId)) {
- if (c.getUserId() == userId && c.hasRight(Client.Right.moderator)) {
+ if (c.getUserId() == userId && c.hasRight(r)) {
return true;
}
}
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomResourceReference.java Thu Apr 21 17:34:08 2016
@@ -19,7 +19,7 @@
package org.apache.openmeetings.web.room;
import static org.apache.openmeetings.web.app.Application.getBean;
-import static org.apache.openmeetings.web.app.Application.isUserOnline;
+import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import java.io.File;
@@ -52,7 +52,7 @@ public abstract class RoomResourceRefere
//no-op expected
}
WebSession ws = WebSession.get();
- if (id != null && ws.isSignedIn() && !Strings.isEmpty(uid) && isUserOnline(uid)) {
+ if (id != null && ws.isSignedIn() && !Strings.isEmpty(uid) && getOnlineClient(uid) != null) {
//TODO ADDITIONALLY CHECK Rights !! and room !!
return getBean(FileExplorerItemDao.class).get(id);
}
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java Thu Apr 21 17:34:08 2016
@@ -20,12 +20,11 @@ package org.apache.openmeetings.web.room
import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
import static org.apache.openmeetings.web.app.Application.getBean;
-import static org.apache.openmeetings.web.app.Application.getRoomUsers;
+import static org.apache.openmeetings.web.app.Application.getOnlineClient;
import static org.apache.openmeetings.web.app.WebSession.getUserId;
-import static org.apache.openmeetings.web.room.RoomPanel.isModerator;
+import static org.apache.openmeetings.web.room.RoomPanel.broadcast;
import static org.apache.openmeetings.web.util.CallbackFunctionHelper.getNamedFunction;
import static org.apache.wicket.ajax.attributes.CallbackParameter.explicit;
-import static org.apache.openmeetings.web.room.RoomPanel.broadcast;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -41,6 +40,7 @@ import org.apache.openmeetings.util.mess
import org.apache.openmeetings.web.app.Client;
import org.apache.openmeetings.web.app.Client.Right;
import org.apache.openmeetings.web.common.BasePanel;
+import org.apache.openmeetings.web.room.RoomBroadcaster;
import org.apache.openmeetings.web.room.RoomPanel;
import org.apache.wicket.Component;
import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
@@ -94,29 +94,35 @@ public class ActivitiesPanel extends Bas
remove(uid, target);
break;
case decline:
- if (isModerator(getUserId(), roomId)) {
+ if (room.getClient().hasRight(Client.Right.moderator)) {
broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
}
break;
case accept:
- if (isModerator(getUserId(), roomId)) {
+ Client client = getOnlineClient(uid);
+ if (room.getClient().hasRight(Client.Right.moderator) && client != null && roomId == client.getRoomId()) {
switch (a.getType()) {
case requestRightModerator:
- Client client = null;
- for (Client c : getRoomUsers(room.getRoom().getId())) { //FIXME TODO add Map somewhere
- if (c.getUid().equals(uid)) {
- client = c;
- break;
- }
- }
- if (client != null) {
- client.getRights().add(Right.moderator);
- broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
- broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
- }
+ client.getRights().add(Right.moderator);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
+ break;
+ case requestRightAv:
+ client.getRights().add(Right.audio);
+ client.getRights().add(Right.video);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
+ break;
+ case requestRightWb:
+ client.getRights().add(Right.whiteBoard);
+ broadcast(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, uid));
+ broadcast(new RoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.rightUpdated));
+ RoomBroadcaster.sendUpdatedClient(client);
break;
default:
- break;
+ break;
}
}
break;
@@ -165,6 +171,22 @@ public class ActivitiesPanel extends Bas
}
//ask question 693
break;
+ case requestRightAv:
+ {
+ User u = getBean(UserDao.class).get(a.getSender());
+ text = String.format("%s %s %s [%s]", u.getFirstname(), u.getLastname(), getString("695"), df.get().format(a.getCreated()));
+ accept.setVisible(true);
+ decline.setVisible(true);
+ }
+ break;
+ case requestRightWb:
+ {
+ User u = getBean(UserDao.class).get(a.getSender());
+ text = String.format("%s %s %s [%s]", u.getFirstname(), u.getLastname(), getString("694"), df.get().format(a.getCreated()));
+ accept.setVisible(true);
+ decline.setVisible(true);
+ }
+ break;
}
item.add(new WebMarkupContainer("close").add(new AttributeAppender("onclick", String.format("activityAction(%s, '%s', '%s');", roomId, Action.close.name(), a.getUid()))));
item.add(accept, decline, new Label("text", text));
@@ -175,6 +197,10 @@ public class ActivitiesPanel extends Bas
switch (a.getType()) {
case requestRightModerator:
return "ui-state-highlight";
+ case requestRightAv:
+ return "ui-state-highlight";
+ case requestRightWb:
+ return "ui-state-highlight";
case roomEnter:
case roomExit:
}
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java Thu Apr 21 17:34:08 2016
@@ -27,6 +27,8 @@ public class Activity implements Seriali
roomEnter
, roomExit
, requestRightModerator
+ , requestRightAv
+ , requestRightWb
}
private final String uid;
private final Long sender;
Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java?rev=1740367&r1=1740366&r2=1740367&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/menu/RoomMenuPanel.java Thu Apr 21 17:34:08 2016
@@ -261,8 +261,8 @@ public class RoomMenuPanel extends Panel
shareMenuItem.setEnabled(shareVisible);
//FIXME TODO apply* should be enabled if moder is in room
applyModerMenuItem.setEnabled(!moder);
- applyWbMenuItem.setEnabled(!moder);
- applyAvMenuItem.setEnabled(!moder);
+ applyWbMenuItem.setEnabled(!room.getClient().hasRight(Client.Right.whiteBoard));
+ applyAvMenuItem.setEnabled(!room.getClient().hasRight(Client.Right.audio) || !room.getClient().hasRight(Client.Right.video));
pollCreateMenuItem.setEnabled(moder);
pollVoteMenuItem.setEnabled(pollExists && notExternalUser && !getBean(PollDao.class).hasVoted(r.getId(), getUserId()));
pollResultMenuItem.setEnabled(pollExists || getBean(PollDao.class).getArchived(r.getId()).size() > 0);