+
+
+
+
+
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
index 5860a1bec..e58494973 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/chat.js
@@ -1,5 +1,6 @@
var ChatBoxUI = Class.extend({
name:null,
+ userInfo:null,
userName:null,
pingRegex:null,
mentionRegex:null,
@@ -35,7 +36,8 @@ var ChatBoxUI = Class.extend({
toggleChatButton:null,
- init:function (name, div, url, showList, playerListener, showHideSystemButton, showLockButton, displayChatListener, allowDiscord=false) {
+
+ init:function (name, div, url, showList, playerListener, showHideSystemButton, displayChatListener, allowDiscord=false) {
var that = this;
this.hiddenClasses = new Array();
@@ -61,16 +63,12 @@ var ChatBoxUI = Class.extend({
that.appendMessage("Unknown chat problem occured (error=" + xhr.status + ")", "warningMessage");
});
this.enableDiscord = allowDiscord;
-
+
this.comm.getPlayerInfo(function(json)
{
- that.userName = json;
- that.pingRegex = new RegExp("@" + json + "\\b");
- that.mentionRegex = new RegExp("(?)\\b" + json + "\\b");
+ that.initPlayerInfo(json);
}, this.chatErrorMap());
-
-
if (this.name != null) {
if(this.name == "Game Hall")
@@ -158,31 +156,13 @@ var ChatBoxUI = Class.extend({
this.hideMessageClass("systemMessage");
}
- // if (showLockButton) {
- // this.lockButton = $("").button(
- // {icons:{
- // primary:"ui-icon-locked"
- // }, text:false});
- // this.lockButton.click(
- // function () {
- // if (that.lockChat) {
- // $('#lockChatButton').button("option", "icons", {primary:'ui-icon-locked'});
- // that.lockChat = false;
- // } else {
- // $('#lockChatButton').button("option", "icons", {primary:'ui-icon-unlocked'});
- // that.lockChat = true;
- // }
- // });
- // }
-
if (showList) {
this.chatListDiv = $("");
this.div.append(this.chatListDiv);
}
if (this.hideSystemButton != null)
this.div.append(this.hideSystemButton);
- // if (this.lockButton != null)
- // this.div.append(this.lockButton);
+
this.div.append(this.chatTalkDiv);
this.comm.startChat(this.name,
@@ -205,6 +185,13 @@ var ChatBoxUI = Class.extend({
this.talkBoxHeight = 0;
}
},
+
+ initPlayerInfo:function (playerInfo) {
+ this.userInfo = playerInfo;
+ this.userName = this.userInfo.name;
+ this.pingRegex = new RegExp("@" + this.userName + "\\b");
+ this.mentionRegex = new RegExp("(?)\\b" + this.userName + "\\b");
+ },
hideMessageClass:function (msgClass) {
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
index 28d801da6..d7c66bc12 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/communication.js
@@ -723,6 +723,12 @@ var GempLotrCommunication = Class.extend({
});
},
+ //NEVER EVER EVER use this for actual authentication
+ // This is strictly to simplify things like auto-hiding
+ // of the admin panel. If you actually need functionality
+ // gated behind authorization, it goes on the server
+ // and not in here.
+
getPlayerInfo:function (callback, errorMap) {
$.ajax({
type:"GET",
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js
index 07049e464..3fdbe2287 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/gameUi.js
@@ -535,7 +535,7 @@ var GempLotrGameUI = Class.extend({
}
var chatRoomName = (this.replayMode ? null : ("Game" + getUrlParam("gameId")));
- this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, true, displayChatListener);
+ this.chatBox = new ChatBoxUI(chatRoomName, $("#chatBox"), this.communication.url, false, playerListener, false, displayChatListener);
this.chatBox.chatUpdateInterval = 3000;
if (!this.spectatorMode && !this.replayMode) {
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
index 121ee98c5..ffe2e4fc3 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/js/gemp-022/hallUi.js
@@ -11,6 +11,8 @@ var GempLotrHallUI = Class.extend({
tablesDiv:null,
buttonsDiv:null,
+ adminTab:null,
+ userInfo:null,
pocketDiv:null,
pocketValue:null,
@@ -19,24 +21,25 @@ var GempLotrHallUI = Class.extend({
init:function (url, chat) {
var that = this;
+ this.chat = chat;
+
this.comm = new GempLotrCommunication(url, function (xhr, ajaxOptions, thrownError) {
if (thrownError != "abort") {
if (xhr != null) {
if (xhr.status == 401) {
- chat.appendMessage("Game hall problem - You're not logged in, go to the main page to log in", "warningMessage");
+ that.chat.appendMessage("Game hall problem - You're not logged in, go to the main page to log in", "warningMessage");
return;
} else {
- chat.appendMessage("The game hall had a problem communicating with the server (" + xhr.status + "), no new updates will be displayed.", "warningMessage");
- chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage");
+ that.chat.appendMessage("The game hall had a problem communicating with the server (" + xhr.status + "), no new updates will be displayed.", "warningMessage");
+ that.chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage");
return;
}
}
- chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage");
- chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage");
+ that.chat.appendMessage("The game hall had a problem communicating with the server, no new updates will be displayed.", "warningMessage");
+ that.chat.appendMessage("Reload the browser page (press F5) to resume the game hall functionality.", "warningMessage");
}
});
-
- this.chat = chat;
+
this.tablesDiv = $("#tablesDiv");
this.tableDescInput = $("#tableDescInput");
this.isPrivateCheckbox = $("#isPrivateCheckbox");
@@ -46,6 +49,23 @@ var GempLotrHallUI = Class.extend({
this.decksSelect = $("#decksSelect");
this.timerSelect = $("#timerSelect");
this.buttonsDiv = $("#buttonsDiv");
+
+ this.adminTab = $("#tabs > ul :nth-child(7)");
+ this.adminTab.hide();
+
+ this.comm.getPlayerInfo(function(json)
+ {
+ that.userInfo = json;
+ if(that.userInfo.type.includes("a") || that.userInfo.type.includes("l"))
+ {
+ that.adminTab.show();
+ }
+ else
+ {
+ that.adminTab.hide();
+ }
+ });
+
var hallSettingsStr = $.cookie("hallSettings");
if (hallSettingsStr == null)
diff --git a/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html b/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html
index 13dace688..9c734ca72 100644
--- a/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html
+++ b/gemp-lotr/gemp-lotr-async/src/main/web/leagueAdmin.html
@@ -1,288 +1,2 @@
-
-
- Gemp-LotR League Administration
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
League
-
-
Add sealed league
-
-
-
-
Add solo-draft league
-
-
-
-
Add constructed league
-
-
-
-
-
+You don't need this anymore :)
+Go to the main hall and click on the Admin tab instead.
\ No newline at end of file
diff --git a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java
index c23b5732b..1642c101e 100644
--- a/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java
+++ b/gemp-lotr/gemp-lotr-logic/src/main/java/com/gempukku/lotro/game/Player.java
@@ -75,4 +75,18 @@ public class Player {
public int hashCode() {
return _name != null ? _name.hashCode() : 0;
}
+
+ public PlayerDefinition GetUserInfo() {
+ return new PlayerDefinition(_name, _type);
+ }
+
+ public class PlayerDefinition {
+ public String name;
+ public String type;
+
+ public PlayerDefinition(String name, String info) {
+ this.name = name;
+ type = info;
+ }
+ }
}