You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2016/04/25 20:03:59 UTC

svn commit: r1740868 [2/2] - in /openmeetings/application: branches/3.2.x/openmeetings-util/src/main/java/org/apache/openmeetings/util/message/ branches/3.2.x/openmeetings-web/src/main/java/org/apache/openmeetings/web/app/ branches/3.2.x/openmeetings-w...

Added: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/MuteRightIcon.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/MuteRightIcon.java?rev=1740868&view=auto
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/MuteRightIcon.java (added)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/MuteRightIcon.java Mon Apr 25 18:03:58 2016
@@ -0,0 +1,46 @@
+/*
+ * 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;
+
+import org.apache.openmeetings.web.app.Client;
+import org.apache.openmeetings.web.app.Client.Right;
+import org.apache.openmeetings.web.room.RoomPanel;
+
+public class MuteRightIcon extends RoomRightIcon {
+	private static final long serialVersionUID = 1L;
+	
+	public MuteRightIcon(String id, Client client, RoomPanel room) {
+		super(id, client, Right.mute, room);
+		mainCssClass = "global-mute ";
+	}
+
+	@Override
+	protected String getTitle() {
+		//TODO this need to be fixed
+		String title = self ? "1403" : "1384";
+		/*
+		if (client.hasRight(right)) {
+			title = self ? "1403" : "612";
+		} else {
+			title = self ? "686" : "694";
+		}
+		*/
+		return getString(title);
+	}
+}

Added: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RefreshIcon.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RefreshIcon.java?rev=1740868&view=auto
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RefreshIcon.java (added)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RefreshIcon.java Mon Apr 25 18:03:58 2016
@@ -0,0 +1,62 @@
+/*
+ * 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;
+
+import static org.apache.openmeetings.web.room.sidebar.RoomSidebar.FUNC_ACTION;
+
+import org.apache.openmeetings.web.app.Client;
+import org.apache.openmeetings.web.app.Client.Right;
+import org.apache.openmeetings.web.room.RoomPanel;
+import org.apache.openmeetings.web.room.RoomPanel.Action;
+import org.apache.wicket.core.request.handler.IPartialPageRequestHandler;
+
+public class RefreshIcon extends RoomRightIcon {
+	private static final long serialVersionUID = 1L;
+	
+	public RefreshIcon(String id, Client client, RoomPanel room) {
+		super(id, client, Right.audio, room);
+		mainCssClass = "restart ";
+	}
+
+	@Override
+	protected String getTitle() {
+		return getString("610");
+	}
+	
+	@Override
+	protected String getAlign() {
+		return ALIGN_RIGHT;
+	}
+	
+	@Override
+	protected boolean isClickable() {
+		return false;//TODO broadcasting return self || room.getClient().hasRight(right) && !client.hasRight(Right.superModerator);
+	}
+	
+	@Override
+	protected String getScript() {
+		return String.format("%s('%s', '%s');", FUNC_ACTION, Action.refresh.name(), client.getUid());
+	}
+	
+	@Override
+	public void update(IPartialPageRequestHandler handler) {
+		super.update(handler);
+		setVisible(isClickable());
+	}
+}

Modified: openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RoomRightIcon.java
URL: http://svn.apache.org/viewvc/openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RoomRightIcon.java?rev=1740868&r1=1740867&r2=1740868&view=diff
==============================================================================
--- openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RoomRightIcon.java (original)
+++ openmeetings/application/trunk/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/sidebar/icon/RoomRightIcon.java Mon Apr 25 18:03:58 2016
@@ -29,9 +29,11 @@ import org.apache.wicket.markup.html.Web
 
 public abstract class RoomRightIcon extends WebMarkupContainer {
 	private static final long serialVersionUID = 1L;
-	private static final String CLS_CLICKABLE = "clickable ";
 	private static final String CLS_GRANTED = "granted ";
-	private static final String ICON_CLASS = "ui-icon align-left ";
+	private static final String ICON_CLASS = "ui-icon ";
+	protected static final String ALIGN_LEFT = "align-left ";
+	protected static final String ALIGN_RIGHT = "align-right ";
+	protected static final String CLS_CLICKABLE = "clickable ";
 	protected final RoomPanel room;
 	protected final Right right;
 	protected final boolean self;
@@ -55,24 +57,32 @@ public abstract class RoomRightIcon exte
 	
 	protected abstract String getTitle();
 	
+	protected String getAlign() {
+		return ALIGN_LEFT;
+	}
+	
 	protected boolean isClickable() {
-		return !self && room.getClient().hasRight(Right.moderator);
+		return self || (!self && room.getClient().hasRight(Right.moderator));
 	}
 	
 	protected boolean hasRight() {
 		return client.hasRight(right);
 	}
+
+	protected String getScript() {
+		return String.format("%s('%s', '%s');", FUNC_CHANGE_RIGHT, right.name(), client.getUid());
+	}
 	
 	public void update(IPartialPageRequestHandler handler) {
 		StringBuilder cls = new StringBuilder(ICON_CLASS);
-		cls.append(mainCssClass);
+		cls.append(getAlign()).append(mainCssClass);
 		if (hasRight()) {
 			cls.append(CLS_GRANTED);
 		}
 		if (isClickable()) {
 			//request/remove
 			cls.append(CLS_CLICKABLE);
-			add(AttributeAppender.replace("onclick", String.format("%s('%s', '%s');", FUNC_CHANGE_RIGHT, right.name(), client.getUid())));
+			add(AttributeAppender.replace("onclick", getScript()));
 		}
 		add(AttributeAppender.replace("title", getTitle()));
 		add(AttributeAppender.replace("class", cls));