[OPENMEETINGS-369,OPENMEETINGS-371,OPENMEETINGS-1613] presenter role is added, 
basic role separation is added


Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/25c24ebc
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/25c24ebc
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/25c24ebc

Branch: refs/heads/master
Commit: 25c24ebc370c737225b8d786f18f1d29ec7baf4f
Parents: 4794f6f
Author: Maxim Solodovnik <[email protected]>
Authored: Sun Apr 30 05:36:28 2017 +0000
Committer: Maxim Solodovnik <[email protected]>
Committed: Sun Apr 30 05:36:28 2017 +0000

----------------------------------------------------------------------
 .../openmeetings/db/entity/room/Room.java       |   1 +
 .../openmeetings/util/message/RoomMessage.java  |   1 +
 .../web/app/Application.properties.xml          |   4 +
 .../apache/openmeetings/web/room/RoomPanel.java |   6 +
 .../web/room/activities/ActivitiesPanel.java    |   9 +
 .../web/room/activities/Activity.java           |   1 +
 .../web/room/sidebar/ClientIconsPanel.html      |   1 +
 .../web/room/sidebar/ClientIconsPanel.java      |   4 +
 .../web/room/sidebar/SelfIconsPanel.html        |   1 +
 .../sidebar/icon/right/PresenterRightIcon.java  |  51 ++++
 .../sidebar/icon/right/WhiteboardRightIcon.java |   5 +
 .../openmeetings/web/room/wb/WbPanel.java       |  47 ++--
 .../org/apache/openmeetings/web/room/wb/wb.js   | 246 ++++++++++---------
 .../src/main/webapp/css/images/wand_add.png     | Bin 0 -> 1871 bytes
 .../src/main/webapp/css/images/wand_delete.png  | Bin 0 -> 1913 bytes
 openmeetings-web/src/main/webapp/css/room.css   |   6 +
 16 files changed, 244 insertions(+), 139 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
index 3e095cf..2afc062 100644
--- 
a/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
+++ 
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/entity/room/Room.java
@@ -96,6 +96,7 @@ public class Room implements IDataProviderEntity {
        public enum Right {
                superModerator
                , moderator
+               , presenter
                , whiteBoard
                , share
                , remoteControl

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
index 63410f4..40cbffc 100644
--- 
a/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
+++ 
b/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/RoomMessage.java
@@ -38,6 +38,7 @@ public class RoomMessage implements IWebSocketPushMessage {
                , rightUpdated
                , activityRemove
                , requestRightModerator
+               , requestRightPresenter
                , requestRightWb
                , requestRightShare
                , requestRightRemote

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
index 3d7c75e..19a3da5 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/Application.properties.xml
@@ -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>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
index 59ea091..b84520e 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/RoomPanel.java
@@ -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;

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
index 7797bc7..a821e85 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/ActivitiesPanel.java
@@ -103,6 +103,10 @@ public class ActivitiesPanel extends BasePanel {
                                                                                
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 BasePanel {
                        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 BasePanel {
                                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 BasePanel {
                        String cls = "ui-state-default";
                        switch (a.getType()) {
                                case reqRightModerator:
+                               case reqRightPresenter:
                                case reqRightWb:
                                case reqRightShare:
                                case reqRightRemote:

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
index 898b7cd..7dd70c4 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/activities/Activity.java
@@ -30,6 +30,7 @@ public class Activity implements Serializable {
                roomEnter
                , roomExit
                , reqRightModerator
+               , reqRightPresenter
                , reqRightWb
                , reqRightShare
                , reqRightRemote

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
index 169d34c..26da192 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.html
@@ -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>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
index b1f4a85..fba0c3e 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/ClientIconsPanel.java
@@ -23,6 +23,7 @@ import org.apache.openmeetings.web.room.RoomPanel;
 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 Panel {
        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 Panel {
                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 Panel {
        
        public void update(IPartialPageRequestHandler handler) {
                rightModer.update(handler);
+               rightPresenter.update(handler);
                rightWb.update(handler);
                rightScreen.update(handler);
                rightRemote.update(handler);

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
index 74a6a61..cfbaa03 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/SelfIconsPanel.html
@@ -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>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
new file mode 100644
index 0000000..a532068
--- /dev/null
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/PresenterRightIcon.java
@@ -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();
+       }
+}

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
index fd64376..611de03 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/right/WhiteboardRightIcon.java
@@ -44,6 +44,11 @@ public class WhiteboardRightIcon extends RoomRightIcon {
        }
 
        @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();

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
index 9c9cd62..dc6d01e 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.java
@@ -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;
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
index 400bf1d..3a396a4 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb.js
@@ -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) {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/webapp/css/images/wand_add.png
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/images/wand_add.png 
b/openmeetings-web/src/main/webapp/css/images/wand_add.png
new file mode 100644
index 0000000..6a7b19e
Binary files /dev/null and 
b/openmeetings-web/src/main/webapp/css/images/wand_add.png differ

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/webapp/css/images/wand_delete.png
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/images/wand_delete.png 
b/openmeetings-web/src/main/webapp/css/images/wand_delete.png
new file mode 100644
index 0000000..c1bab0d
Binary files /dev/null and 
b/openmeetings-web/src/main/webapp/css/images/wand_delete.png differ

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/25c24ebc/openmeetings-web/src/main/webapp/css/room.css
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/webapp/css/room.css 
b/openmeetings-web/src/main/webapp/css/room.css
index 66e71cb..075344b 100644
--- a/openmeetings-web/src/main/webapp/css/room.css
+++ b/openmeetings-web/src/main/webapp/css/room.css
@@ -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);
 }

Reply via email to