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 2017/04/30 05:36:29 UTC

svn commit: r1793245 - in /openmeetings/application/trunk: openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/ openmeetings-util/src/main/java/org/apache/openmeetings/util/message/ openmeetings-web/src/main/java/org/apache/openmeeting...

Author: solomax
Date: Sun Apr 30 05:36:28 2017
New Revision: 1793245

URL: http://svn.apache.org/viewvc?rev=1793245&view=rev
Log:
[OPENMEETINGS-369,OPENMEETINGS-371,OPENMEETINGS-1613] presenter role is added, basic role separation is added

Added:
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
    openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_add.png   (with props)
    openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_delete.png   (with props)
Modified:
    openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
    openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
    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/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/sidebar/ClientIconsPanel.html
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
    openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
    openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css

Modified: openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java (original)
+++ openmeetings/application/trunk/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java Sun Apr 30 05:36:28 2017
@@ -96,6 +96,7 @@ public class Room implements IDataProvid
 	public enum Right {
 		superModerator
 		, moderator
+		, presenter
 		, whiteBoard
 		, share
 		, remoteControl

Modified: openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java (original)
+++ openmeetings/application/trunk/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java Sun Apr 30 05:36:28 2017
@@ -38,6 +38,7 @@ public class RoomMessage implements IWeb
 		, rightUpdated
 		, activityRemove
 		, requestRightModerator
+		, requestRightPresenter
 		, requestRightWb
 		, requestRightShare
 		, requestRightRemote

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml Sun Apr 30 05:36:28 2017
@@ -1905,4 +1905,8 @@
 	<entry key="recordings.root.group">Group recordings</entry>
 	<entry key="restricted.group.files">Group files are restricted</entry>
 	<entry key="find.user">Find user</entry>
+	<entry key="right.presenter.allowed.self">You granted right to be presenter in this room</entry>
+	<entry key="right.presenter.remove">Remove right to be presenter in this room</entry>
+	<entry key="right.presenter.request">would like to have right to be presenter in this room</entry>
+	<entry key="right.presenter.request.self">I would like to have right to be presenter in this room</entry>
 </properties>

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=1793245&r1=1793244&r2=1793245&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 Sun Apr 30 05:36:28 2017
@@ -429,6 +429,9 @@ public class RoomPanel extends BasePanel
 					case requestRightModerator:
 						activities.add(new Activity((TextRoomMessage)m, Activity.Type.reqRightModerator), handler);
 						break;
+					case requestRightPresenter:
+						activities.add(new Activity((TextRoomMessage)m, Activity.Type.reqRightPresenter), handler);
+						break;
 					case requestRightWb:
 						activities.add(new Activity((TextRoomMessage)m, Activity.Type.reqRightWb), handler);
 						break;
@@ -579,6 +582,9 @@ public class RoomPanel extends BasePanel
 			case moderator:
 				reqType = Type.requestRightModerator;
 				break;
+			case presenter:
+				reqType = Type.requestRightPresenter;
+				break;
 			case whiteBoard:
 				reqType = Type.requestRightWb;
 				break;

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=1793245&r1=1793244&r2=1793245&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 Sun Apr 30 05:36:28 2017
@@ -103,6 +103,10 @@ public class ActivitiesPanel extends Bas
 										sendRoom(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, id));
 										room.allowRight(client, Right.audio, Right.video);
 										break;
+									case reqRightPresenter:
+										sendRoom(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, id));
+										room.allowRight(client, Right.presenter);
+										break;
 									case reqRightWb:
 										sendRoom(new TextRoomMessage(room.getRoom().getId(), getUserId(), RoomMessage.Type.activityRemove, id));
 										room.allowRight(client, Right.whiteBoard);
@@ -161,6 +165,7 @@ public class ActivitiesPanel extends Bas
 			boolean self = getUserId().equals(a.getSender());
 			switch (a.getType()) {
 				case reqRightModerator:
+				case reqRightPresenter:
 				case reqRightWb:
 				case reqRightShare:
 				case reqRightRemote:
@@ -192,6 +197,9 @@ public class ActivitiesPanel extends Bas
 				case reqRightModerator:
 					text = String.format("%s %s [%s]", name, getString("room.action.request.right.moderator"), df.format(a.getCreated()));
 					break;
+				case reqRightPresenter:
+					text = String.format("%s %s [%s]", name, getString("right.presenter.request"), df.format(a.getCreated()));
+					break;
 				case reqRightWb:
 					text = String.format("%s %s [%s]", name, getString("694"), df.format(a.getCreated()));
 					break;
@@ -226,6 +234,7 @@ public class ActivitiesPanel extends Bas
 			String cls = "ui-state-default";
 			switch (a.getType()) {
 				case reqRightModerator:
+				case reqRightPresenter:
 				case reqRightWb:
 				case reqRightShare:
 				case reqRightRemote:

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=1793245&r1=1793244&r2=1793245&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 Sun Apr 30 05:36:28 2017
@@ -30,6 +30,7 @@ public class Activity implements Seriali
 		roomEnter
 		, roomExit
 		, reqRightModerator
+		, reqRightPresenter
 		, reqRightWb
 		, reqRightShare
 		, reqRightRemote

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html Sun Apr 30 05:36:28 2017
@@ -22,6 +22,7 @@
 <wicket:panel>
 	<span wicket:id="right-video"></span>
 	<span wicket:id="right-audio"></span>
+	<span wicket:id="right-presenter"></span>
 	<span wicket:id="right-wb"></span>
 	<span wicket:id="right-screen-share"></span>
 	<span wicket:id="right-remote-control"></span>

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java Sun Apr 30 05:36:28 2017
@@ -23,6 +23,7 @@ import org.apache.openmeetings.web.room.
 import org.apache.openmeetings.web.room.sidebar.icon.right.AudioRightIcon;
 import org.apache.openmeetings.web.room.sidebar.icon.right.ExclusiveRightIcon;
 import org.apache.openmeetings.web.room.sidebar.icon.right.ModeratorRightIcon;
+import org.apache.openmeetings.web.room.sidebar.icon.right.PresenterRightIcon;
 import org.apache.openmeetings.web.room.sidebar.icon.right.RemoteControlRightIcon;
 import org.apache.openmeetings.web.room.sidebar.icon.right.ScreenShareRightIcon;
 import org.apache.openmeetings.web.room.sidebar.icon.right.VideoRightIcon;
@@ -34,6 +35,7 @@ public class ClientIconsPanel extends Pa
 	private static final long serialVersionUID = 1L;
 	private final ModeratorRightIcon rightModer;
 	private final WhiteboardRightIcon rightWb;
+	private final PresenterRightIcon rightPresenter;
 	private final ScreenShareRightIcon rightScreen;
 	private final RemoteControlRightIcon rightRemote;
 	private final AudioRightIcon rightAudio;
@@ -45,6 +47,7 @@ public class ClientIconsPanel extends Pa
 		setOutputMarkupId(true);
 		setOutputMarkupPlaceholderTag(true);
 		add(rightModer = new ModeratorRightIcon("right-moder", client, room));
+		add(rightPresenter = new PresenterRightIcon("right-presenter", client, room));
 		add(rightWb = new WhiteboardRightIcon("right-wb", client, room));
 		add(rightScreen = new ScreenShareRightIcon("right-screen-share", client, room));
 		add(rightRemote = new RemoteControlRightIcon("right-remote-control", client, room));
@@ -61,6 +64,7 @@ public class ClientIconsPanel extends Pa
 	
 	public void update(IPartialPageRequestHandler handler) {
 		rightModer.update(handler);
+		rightPresenter.update(handler);
 		rightWb.update(handler);
 		rightScreen.update(handler);
 		rightRemote.update(handler);

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html Sun Apr 30 05:36:28 2017
@@ -25,6 +25,7 @@
 	<span wicket:id="cam"></span>
 	<span wicket:id="right-audio"></span>
 	<span wicket:id="mic"></span>
+	<span wicket:id="right-presenter"></span>
 	<span wicket:id="right-wb"></span>
 	<span wicket:id="right-screen-share"></span>
 	<span wicket:id="right-remote-control"></span>

Added: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java?rev=1793245&view=auto
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java (added)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java Sun Apr 30 05:36:28 2017
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openmeetings.web.room.sidebar.icon.right;
+
+import org.apache.openmeetings.db.entity.basic.Client;
+import org.apache.openmeetings.db.entity.room.Room;
+import org.apache.openmeetings.db.entity.room.Room.Right;
+import org.apache.openmeetings.db.entity.room.Room.RoomElement;
+import org.apache.openmeetings.web.room.RoomPanel;
+
+public class PresenterRightIcon extends RoomRightIcon {
+	private static final long serialVersionUID = 1L;
+
+	public PresenterRightIcon(String id, Client client, RoomPanel room) {
+		super(id, client, Right.presenter, room);
+		mainCssClass = "right presenter bumper ";
+	}
+
+	@Override
+	protected String getTitle() {
+		String title;
+		if (client.hasRight(right)) {
+			title = self ? "right.presenter.allowed.self" : "right.presenter.remove";
+		} else {
+			title = self ? "right.presenter.request.self" : "right.presenter.request";
+		}
+		return getString(title);
+	}
+
+	@Override
+	protected boolean visible() {
+		Room r = room.getRoom();
+		return Room.Type.interview != r.getType() && !r.isHidden(RoomElement.Whiteboard) && super.visible();
+	}
+}

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java Sun Apr 30 05:36:28 2017
@@ -44,6 +44,11 @@ public class WhiteboardRightIcon extends
 	}
 
 	@Override
+	protected boolean hasRight() {
+		return client.hasRight(Right.presenter) || client.hasRight(right);
+	}
+
+	@Override
 	protected boolean visible() {
 		Room r = room.getRoom();
 		return Room.Type.interview != r.getType() && !r.isHidden(RoomElement.Whiteboard) && super.visible();

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java Sun Apr 30 05:36:28 2017
@@ -90,7 +90,6 @@ public class WbPanel extends Panel {
 	public static final String PARAM_OBJ = "obj";
 	private final static ResourceReference WB_JS_REFERENCE = new JavaScriptResourceReference(WbPanel.class, "wb.js");
 	private final static ResourceReference FABRIC_JS_REFERENCE = new JavaScriptResourceReference(WbPanel.class, "fabric.js");
-	private boolean readOnly = true;
 	private final Long roomId;
 	private final RoomPanel rp;
 	private long wb2save = -1;
@@ -127,12 +126,13 @@ public class WbPanel extends Panel {
 					}
 				}
 
-				//wb-right
-				if (rp.getClient().hasRight(Right.whiteBoard)) {
+				Client c = rp.getClient();
+				//presenter-right
+				if (c.hasRight(Right.presenter)) {
 					switch (a) {
 						case createWb:
 						{
-							Whiteboard wb = getBean(WhiteboardCache.class).add(roomId, rp.getClient().getUser().getLanguageId());
+							Whiteboard wb = getBean(WhiteboardCache.class).add(roomId, c.getUser().getLanguageId());
 							sendWbAll(Action.createWb, getAddWbJson(wb.getId(), wb.getName()));
 						}
 							break;
@@ -161,6 +161,19 @@ public class WbPanel extends Panel {
 							sendWbOthers(Action.setSlide, obj);
 						}
 							break;
+						case clearAll:
+						{
+							Whiteboard wb = getBean(WhiteboardCache.class).get(roomId).get(obj.getLong("wbId"));
+							clearAll(wb);
+						}
+							break;
+						default:
+							break;
+					}
+				}
+				//wb-right
+				if (c.hasRight(Right.presenter) || c.hasRight(Right.whiteBoard)) {
+					switch (a) {
 						case createObj:
 						{
 							Whiteboard wb = getBean(WhiteboardCache.class).get(roomId).get(obj.getLong("wbId"));
@@ -195,12 +208,6 @@ public class WbPanel extends Panel {
 							sendWbAll(Action.deleteObj, obj);
 						}
 							break;
-						case clearAll:
-						{
-							Whiteboard wb = getBean(WhiteboardCache.class).get(roomId).get(obj.getLong("wbId"));
-							clearAll(wb);
-						}
-							break;
 						case clearSlide:
 						{
 							Whiteboard wb = getBean(WhiteboardCache.class).get(roomId).get(obj.getLong("wbId"));
@@ -212,6 +219,8 @@ public class WbPanel extends Panel {
 							wb2save = obj.getLong("wbId");
 							fileName.open(target);
 							break;
+						default:
+							break;
 					}
 				}
 			} catch (Exception e) {
@@ -327,19 +336,15 @@ public class WbPanel extends Panel {
 		return new JSONObject().put("wbId", id).put("name", name);
 	}
 
-	public boolean isReadOnly() {
-		return readOnly;
-	}
-
-	public WbPanel setReadOnly(boolean readOnly) {
-		this.readOnly = readOnly;
-		return this;
-	}
-
 	public WbPanel update(IPartialPageRequestHandler handler) {
-		readOnly = !rp.getClient().hasRight(Right.whiteBoard);
+		String role = "none";
+		if (rp.getClient().hasRight(Right.presenter)) {
+			role = "presenter";
+		} else if (rp.getClient().hasRight(Right.whiteBoard)) {
+			role = "whiteBoard";
+		}
 		if (handler != null) {
-			handler.appendJavaScript(String.format("setRoomSizes();WbArea.setReadOnly(%s);", readOnly));
+			handler.appendJavaScript(String.format("setRoomSizes();WbArea.setRole('%s');", role));
 		}
 		return this;
 	}

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js Sun Apr 30 05:36:28 2017
@@ -22,6 +22,9 @@
  * @license MIT license
  * @link http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript/21963136#21963136
  **/
+const PRESENTER = 'presenter';
+const WHITEBOARD = 'whiteBoard';
+const NONE = 'none';
 var UUID = (function() {
 	var self = {};
 	var lut = [];
@@ -486,7 +489,7 @@ var Wb = function() {
 	const ACTIVE = 'active';
 	const BUMPER = 100;
 	var wb = {id: -1}, a, t, s, canvases = [], mode, slide = 0, width = 0, height = 0
-			, minWidth = 0, minHeight = 0, readOnly = null;
+			, minWidth = 0, minHeight = 0, role = null;
 
 	function getBtn(m) {
 		return !!t ? t.find(".om-icon." + (m || mode)) : null;
@@ -568,100 +571,107 @@ var Wb = function() {
 				}
 			}
 		});
-		if (readOnly) {
-			initToolBtn('apointer', true, APointer(wb));
-		} else {
-			initToolBtn('pointer', true, Pointer(wb, s));
-			initToolBtn('apointer', false, APointer(wb));
-			initToolBtn('text', false, Text(wb, s));
-			initToolBtn('paint', false, Paint(wb, s));
-			initToolBtn('line', false, Line(wb, s));
-			initToolBtn('uline', false, ULine(wb, s));
-			initToolBtn('rect', false, Rect(wb, s));
-			initToolBtn('ellipse', false, Ellipse(wb, s));
-			initToolBtn('arrow', false, Arrow(wb, s));
-			initCliparts();
-			t.find(".om-icon.settings").click(function() {
-				s.show();
-			});
-			t.find('.om-icon.clear-all').click(function() {
-				confirmDlg('clear-all-confirm', function() { wbAction('clearAll', JSON.stringify({wbId: wb.id})); });
-			});
-			t.find('.om-icon.clear-slide').click(function() {
-				confirmDlg('clear-slide-confirm', function() { wbAction('clearSlide', JSON.stringify({wbId: wb.id, slide: slide})); });
-			});
-			t.find('.om-icon.save').click(function() {
-				wbAction('save', JSON.stringify({wbId: wb.id}));
-			});
-			s.find('.wb-prop-b, .wb-prop-i')
-				.button()
-				.click(function() {
-					$(this).toggleClass('ui-state-active selected');
+		var _firstToolItem = true;
+		var clearAll = t.find('.om-icon.clear-all');
+		switch (role) {
+			case PRESENTER:
+				clearAll.click(function() {
+					confirmDlg('clear-all-confirm', function() { wbAction('clearAll', JSON.stringify({wbId: wb.id})); });
+				}).removeClass('disabled');
+			case WHITEBOARD:
+				if (role === WHITEBOARD) {
+					clearAll.addClass('disabled');
+				}
+				initToolBtn('pointer', _firstToolItem, Pointer(wb, s));
+				_firstToolItem = false;
+				initToolBtn('text', _firstToolItem, Text(wb, s));
+				initToolBtn('paint', _firstToolItem, Paint(wb, s));
+				initToolBtn('line', _firstToolItem, Line(wb, s));
+				initToolBtn('uline', _firstToolItem, ULine(wb, s));
+				initToolBtn('rect', _firstToolItem, Rect(wb, s));
+				initToolBtn('ellipse', _firstToolItem, Ellipse(wb, s));
+				initToolBtn('arrow', _firstToolItem, Arrow(wb, s));
+				initCliparts();
+				t.find(".om-icon.settings").click(function() {
+					s.show();
 				});
-			s.find('.wb-prop-lock-color, .wb-prop-lock-fill')
-				.button({icon: 'ui-icon-locked', showLabel: false})
-				.click(function() {
-					var btn = getBtn();
-					var isColor = $(this).hasClass('wb-prop-lock-color');
-					var c = s.find(isColor ? '.wb-prop-color' : '.wb-prop-fill');
-					var enabled = $(this).button('option', 'icon') == 'ui-icon-locked';
-					$(this).button('option', 'icon', enabled ? 'ui-icon-unlocked' : 'ui-icon-locked');
-					c.prop('disabled', !enabled);
-					btn.data('obj')[isColor ? 'stroke' : 'fill'].enabled = enabled;
+				t.find('.om-icon.clear-slide').click(function() {
+					confirmDlg('clear-slide-confirm', function() { wbAction('clearSlide', JSON.stringify({wbId: wb.id, slide: slide})); });
 				});
-			s.find('.wb-prop-color').change(function() {
-				var btn = getBtn();
-				if (btn.length == 1) {
-					var v = $(this).val();
-					btn.data('obj').stroke.color = v;
-					if ('paint' == mode) {
-						wb.eachCanvas(function(canvas) {
-							canvas.freeDrawingBrush.color = v;
-						});
+				t.find('.om-icon.save').click(function() {
+					wbAction('save', JSON.stringify({wbId: wb.id}));
+				});
+				s.find('.wb-prop-b, .wb-prop-i')
+					.button()
+					.click(function() {
+						$(this).toggleClass('ui-state-active selected');
+					});
+				s.find('.wb-prop-lock-color, .wb-prop-lock-fill')
+					.button({icon: 'ui-icon-locked', showLabel: false})
+					.click(function() {
+						var btn = getBtn();
+						var isColor = $(this).hasClass('wb-prop-lock-color');
+						var c = s.find(isColor ? '.wb-prop-color' : '.wb-prop-fill');
+						var enabled = $(this).button('option', 'icon') == 'ui-icon-locked';
+						$(this).button('option', 'icon', enabled ? 'ui-icon-unlocked' : 'ui-icon-locked');
+						c.prop('disabled', !enabled);
+						btn.data('obj')[isColor ? 'stroke' : 'fill'].enabled = enabled;
+					});
+				s.find('.wb-prop-color').change(function() {
+					var btn = getBtn();
+					if (btn.length == 1) {
+						var v = $(this).val();
+						btn.data('obj').stroke.color = v;
+						if ('paint' == mode) {
+							wb.eachCanvas(function(canvas) {
+								canvas.freeDrawingBrush.color = v;
+							});
+						}
 					}
-				}
-			});
-			s.find('.wb-prop-width').change(function() {
-				var btn = getBtn();
-				if (btn.length == 1) {
-					var v = 1 * $(this).val();
-					btn.data('obj').stroke.width = v;
-					if ('paint' == mode) {
-						wb.eachCanvas(function(canvas) {
-							canvas.freeDrawingBrush.width = v;
-						});
+				});
+				s.find('.wb-prop-width').change(function() {
+					var btn = getBtn();
+					if (btn.length == 1) {
+						var v = 1 * $(this).val();
+						btn.data('obj').stroke.width = v;
+						if ('paint' == mode) {
+							wb.eachCanvas(function(canvas) {
+								canvas.freeDrawingBrush.width = v;
+							});
+						}
 					}
-				}
-			});
-			s.find('.wb-prop-opacity').change(function() {
-				var btn = getBtn();
-				if (btn.length == 1) {
-					var v = (1 * $(this).val()) / 100;
-					btn.data('obj').opacity = v;
-					if ('paint' == mode) {
-						wb.eachCanvas(function(canvas) {
-							canvas.freeDrawingBrush.opacity = v;
-						});
+				});
+				s.find('.wb-prop-opacity').change(function() {
+					var btn = getBtn();
+					if (btn.length == 1) {
+						var v = (1 * $(this).val()) / 100;
+						btn.data('obj').opacity = v;
+						if ('paint' == mode) {
+							wb.eachCanvas(function(canvas) {
+								canvas.freeDrawingBrush.opacity = v;
+							});
+						}
 					}
-				}
-			});
-			s.find('.ui-dialog-titlebar-close').click(function() {
-				s.hide();
-			});
-			s.draggable({
-				scroll: false
-				, containment: "body"
-				, start: function(event, ui) {
-					if (!!s.css("bottom")) {
-						s.css("bottom", "").css("right", "");
+				});
+				s.find('.ui-dialog-titlebar-close').click(function() {
+					s.hide();
+				});
+				s.draggable({
+					scroll: false
+					, containment: "body"
+					, start: function(event, ui) {
+						if (!!s.css("bottom")) {
+							s.css("bottom", "").css("right", "");
+						}
 					}
-				}
-				, drag: function(event, ui) {
-					if (s.position().x + s.width() >= s.parent().width()) {
-						return false;
+					, drag: function(event, ui) {
+						if (s.position().x + s.width() >= s.parent().width()) {
+							return false;
+						}
 					}
-				}
-			});
+				});
+			case NONE:
+				initToolBtn('apointer', _firstToolItem, APointer(wb));
 		}
 	}
 	function _findObject(o) {
@@ -763,7 +773,7 @@ var Wb = function() {
 	}
 	//events
 	function wbObjCreatedHandler(o) {
-		if (readOnly && o.type != 'pointer') return;
+		if (role === NONE && o.type != 'pointer') return;
 
 		var json = {};
 		switch(o.type) {
@@ -796,7 +806,7 @@ var Wb = function() {
 	};
 	function objModifiedHandler(e) {
 		var o = e.target;
-		if (readOnly && o.type != 'pointer') return;
+		if (role === NONE && o.type != 'pointer') return;
 
 		o.includeDefaultValues = false;
 		wbAction('modifyObj', JSON.stringify({
@@ -833,7 +843,7 @@ var Wb = function() {
 	}
 	function showCurentSlide() {
 		a.find('.scroll-container .canvas-container').each(function(idx) {
-			if (readOnly) {
+			if (role === NONE) {
 				if (idx == slide) {
 					$(this).show();
 				} else {
@@ -858,7 +868,7 @@ var Wb = function() {
 			'wb:object:created': wbObjCreatedHandler
 			, 'object:modified': objModifiedHandler
 		});
-		if (readOnly) {
+		if (role === NONE) {
 			canvas.off({
 				'object:added': objAddedHandler
 				, 'object:selected': objSelectedHandler
@@ -888,7 +898,7 @@ var Wb = function() {
 		canvas.slide = sl;
 		canvases.push(canvas);
 		var cc = $('#' + cid).closest('.canvas-container');
-		if (readOnly) {
+		if (role === NONE) {
 			if (sl == slide) {
 				cc.show();
 			} else {
@@ -897,17 +907,17 @@ var Wb = function() {
 		}
 		setHandlers(canvas);
 	}
-	wb.setReadOnly = function(ro) {
-		if (readOnly != ro) {
+	wb.setRole = function(_role) {
+		if (role != _role) {
 			var btn = getBtn();
 			if (!!btn && btn.length == 1) {
 				btn.data().deactivate();
 			}
 			a.find('.tools').remove();
 			a.find('.wb-settings').remove();
-			readOnly = ro;
+			role = _role;
 			var sc = a.find('.scroll-container');
-			if (readOnly) {
+			if (role === NONE) {
 				t = $('#wb-tools-readonly').clone().attr('id', '');
 				a.append(t);
 				sc.off('scroll', scrollHandler);
@@ -925,11 +935,11 @@ var Wb = function() {
 			internalInit();
 		}
 	};
-	wb.init = function(_wbId, tid, ro) {
+	wb.init = function(_wbId, tid, _role) {
 		wb.id = _wbId;
 		a = $('#' + tid);
 		addCanvas();
-		wb.setReadOnly(ro);
+		wb.setRole(_role);
 	};
 	wb.resize = function(w, h) {
 		if (t.position().left + t.width() > a.width()) {
@@ -951,7 +961,7 @@ var Wb = function() {
 	};
 	wb.setSlide = function(_sl) {
 		slide = _sl;
-		if (readOnly) {
+		if (role === NONE) {
 			showCurentSlide();
 		} else {
 			a.find('.scroll-container .canvas-container')[slide].scrollIntoView();
@@ -1033,7 +1043,7 @@ var Wb = function() {
 	return wb;
 };
 var WbArea = (function() {
-	var container, area, tabs, scroll, readOnly = true, self = {};
+	var container, area, tabs, scroll, role = NONE, self = {};
 
 	function refreshTabs() {
 		tabs.tabs("refresh").find('ul').removeClass('ui-corner-all').removeClass('ui-widget-header');
@@ -1104,7 +1114,7 @@ var WbArea = (function() {
 		wbTabs.find(".ui-tabs-panel .scroll-container").height(wbah);
 	}
 	function _addCloseBtn(li) {
-		if (readOnly) {
+		if (role != PRESENTER) {
 			return;
 		}
 		li.append($('#wb-tab-close').clone().attr('id', ''));
@@ -1121,19 +1131,12 @@ var WbArea = (function() {
 	self.getCanvas = function(id) {
 		return self.getWb(id).getCanvas();
 	};
-	self.setReadOnly = function(ro) {
-		readOnly = ro;
+	self.setRole = function(_role) {
+		role = _role;
 		var tabsNav = tabs.find(".ui-tabs-nav");
-		tabsNav.sortable(readOnly ? "disable" : "enable");
+		tabsNav.sortable(role === PRESENTER ? "enable" : "disable");
 		var prev = tabs.find('.prev.om-icon'), next = tabs.find('.next.om-icon');
-		if (readOnly) {
-			if (prev.length > 0) {
-				prev.parent().remove();
-				next.parent().remove();
-				tabsNav.find('li button').remove();
-			}
-			$(window).off('keyup', deleteHandler);
-		} else {
+		if (role === PRESENTER) {
 			if (prev.length == 0) {
 				var cc = tabs.find('.wb-tabbar .scroll-container')
 					, left = $('#wb-tabbar-ctrls-left').clone().attr('id', '')
@@ -1154,9 +1157,16 @@ var WbArea = (function() {
 				});
 				$(window).keyup(deleteHandler);
 			}
+		} else {
+			if (prev.length > 0) {
+				prev.parent().remove();
+				next.parent().remove();
+				tabsNav.find('li button').remove();
+			}
+			$(window).off('keyup', deleteHandler);
 		}
 		tabs.find(".ui-tabs-panel").each(function(idx) {
-			$(this).data().setReadOnly(readOnly);
+			$(this).data().setRole(role);
 		});
 	}
 	self.init = function() {
@@ -1165,7 +1175,7 @@ var WbArea = (function() {
 			beforeActivate: function(e, ui) {
 				var res = true;
 				if (e.originalEvent && e.originalEvent.type === 'click') {
-					res = !readOnly;
+					res = role === PRESENTER;
 				}
 				return res;
 			}
@@ -1181,7 +1191,7 @@ var WbArea = (function() {
 				refreshTabs();
 			}
 		});
-		self.setReadOnly(readOnly);
+		self.setRole(role);
 	};
 	self.destroy = function() {
 		$(window).off('keyup', deleteHandler);
@@ -1198,13 +1208,13 @@ var WbArea = (function() {
 		_addCloseBtn(li);
 	
 		var wbo = Wb();
-		wbo.init(obj.wbId, tid, readOnly);
+		wbo.init(obj.wbId, tid, role);
 		wb.data(wbo);
 		_resizeWbs();
 	}
 	self.createWb = function(obj) {
 		self.create(obj);
-		self.setReadOnly(readOnly);
+		self.setRole(role);
 		_activateTab(obj.wbId);
 	};
 	self.activateWb = function(obj) {

Added: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_add.png
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_add.png?rev=1793245&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_add.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_delete.png
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_delete.png?rev=1793245&view=auto
==============================================================================
Binary file - no diff available.

Propchange: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/images/wand_delete.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css?rev=1793245&r1=1793244&r2=1793245&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/webapp/css/room.css Sun Apr 30 05:36:28 2017
@@ -284,6 +284,12 @@
 .right.moderator.ui-icon.granted {
 	background-image: url(images/user_delete.png);
 }
+.right.presenter.ui-icon {
+	background-image: url(images/wand_add.png);
+}
+.right.presenter.ui-icon.granted {
+	background-image: url(images/wand_delete.png);
+}
 .right.wb.ui-icon {
 	background-image: url(images/pencil_add.png);
 }