openmeetings-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From solo...@apache.org
Subject openmeetings git commit: [OPENMEETINGS-1744] basic rename is implemented
Date Sun, 05 Nov 2017 18:09:45 GMT
Repository: openmeetings
Updated Branches:
  refs/heads/master df7f854c1 -> 1f95fe12c


[OPENMEETINGS-1744] basic rename is implemented


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

Branch: refs/heads/master
Commit: 1f95fe12c70e660e7bf8a194cf221dd67f3ebf87
Parents: df7f854
Author: Maxim Solodovnik <solomax666@gmail.com>
Authored: Mon Nov 6 01:09:16 2017 +0700
Committer: Maxim Solodovnik <solomax666@gmail.com>
Committed: Mon Nov 6 01:09:37 2017 +0700

----------------------------------------------------------------------
 .../openmeetings/db/dto/room/Whiteboard.java    |  3 +-
 .../openmeetings/web/room/wb/WbAction.java      |  1 +
 .../openmeetings/web/room/wb/WbPanel.html       |  2 +-
 .../openmeetings/web/room/wb/WbPanel.java       | 19 ++++++++---
 .../apache/openmeetings/web/room/wb/wb-area.js  | 34 +++++++++++++++++++-
 5 files changed, 52 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1f95fe12/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
----------------------------------------------------------------------
diff --git a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
index 8fbdf20..6b80349 100644
--- a/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
+++ b/openmeetings-db/src/main/java/org/apache/openmeetings/db/dto/room/Whiteboard.java
@@ -158,8 +158,9 @@ public class Whiteboard implements Serializable {
 		return name;
 	}
 
-	public void setName(String name) {
+	public Whiteboard setName(String name) {
 		this.name = name;
+		return this;
 	}
 
 	public int getSlide() {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1f95fe12/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbAction.java
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbAction.java
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbAction.java
index dc3eef1..3a65411 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbAction.java
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbAction.java
@@ -22,6 +22,7 @@ public enum WbAction {
 	createWb
 	, removeWb
 	, activateWb
+	, renameWb
 	, setSlide
 	, createObj
 	, modifyObj

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1f95fe12/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
index 9a4309d..27d943f 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/WbPanel.html
@@ -35,7 +35,7 @@
 			<div class="next clickable om-icon big"></div>
 		</div>
 		<ul><li id="wb-area-tab">
-			<a>[title]</a>
+			<a><span>[title]</span></a>
 		</li></ul>
 		<button id="wb-tab-close" type="button" class="ui-button ui-corner-all ui-widget ui-button-icon-only
ui-dialog-titlebar-close" wicket:message="title:85">
 			<span class="ui-button-icon ui-icon ui-icon-closethick"></span>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1f95fe12/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 fb3d537..d42b153 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
@@ -304,12 +304,23 @@ public class WbPanel extends AbstractWbPanel {
 					}
 				}
 					break;
+				case renameWb:
+				{
+					Whiteboard wb = WhiteboardCache.get(roomId).get(obj.optLong("wbId", -1));
+					if (wb != null) {
+						WhiteboardCache.update(roomId, wb.setName(obj.getString("name")));
+						sendWbAll(WbAction.renameWb, obj);
+					}
+				}
+					break;
 				case setSlide:
 				{
-					Whiteboard wb = WhiteboardCache.get(roomId).get(obj.getLong("wbId"));
-					wb.setSlide(obj.optInt("slide", 0));
-					WhiteboardCache.update(roomId, wb);
-					sendWbOthers(WbAction.setSlide, obj);
+					Whiteboard wb = WhiteboardCache.get(roomId).get(obj.optLong("wbId", -1));
+					if (wb != null) {
+						wb.setSlide(obj.optInt("slide", 0));
+						WhiteboardCache.update(roomId, wb);
+						sendWbOthers(WbAction.setSlide, obj);
+					}
 				}
 					break;
 				case clearAll:

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/1f95fe12/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-area.js
----------------------------------------------------------------------
diff --git a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-area.js
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-area.js
index eb5f3ab..71cc2d4 100644
--- a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-area.js
+++ b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/wb/wb-area.js
@@ -62,6 +62,18 @@ var DrawWbArea = function() {
 			}
 		});
 	}
+	function _setTabName(li, name) {
+		return li.find('a').attr('title', name)
+			.find('span').text(name)
+	}
+	function _renameTab(obj) {
+		container.find('.wb-tabbar li').each(function(idx) {
+			if (obj.wbId === 1 * $(this).data('wb-id')) {
+				_setTabName($(this), obj.name)
+				return false;
+			}
+		});
+	}
 	function _resizeWbs() {
 		const w = area.width(), hh = area.height()
 			, wbTabs = area.find(".tabs.ui-tabs")
@@ -184,7 +196,23 @@ var DrawWbArea = function() {
 		const tid = self.getWbTabId(obj.wbId)
 			, li = $('#wb-area-tab').clone().attr('id', '').data('wb-id', obj.wbId)
 			, wb = $('#wb-area').clone().attr('id', tid);
-		li.find('a').text(obj.name).attr('title', obj.name).attr('href', "#" + tid);
+		li.find('a').attr('href', "#" + tid);
+		_setTabName(li, obj.name)
+			.dblclick(function() {
+				if (role !== PRESENTER) {
+					return;
+				}
+				const editor = $('<input name="newName" type="text" style="color: black;"/>')
+					, name = $(this).hide().after(editor.val(obj.name));
+				editor.focus().blur(function() {
+					const newName = $(this).val();
+					if (newName !== "") {
+						wbAction('renameWb', JSON.stringify({wbId: obj.wbId, name: newName}));
+					}
+					$(this).remove();
+					name.show();
+				});
+			});
 
 		tabs.find(".ui-tabs-nav").append(li);
 		tabs.append(wb);
@@ -206,6 +234,10 @@ var DrawWbArea = function() {
 		if (!_inited) return;
 		_activateTab(obj.wbId);
 	}
+	self.renameWb = function(obj) {
+		if (!_inited) return;
+		_renameTab(obj);
+	}
 	self.load = function(json) {
 		if (!_inited) return;
 		self.getWb(json.wbId).load(json.obj);


Mime
View raw message