Admin panel improvements
- Added shutdown enter/exit and JSON card reload to the admin panel. - Greatly expanded the MOTD functionality in the admin panel. - Converted server cache clear command to the new admin panel.
This commit is contained in:
@@ -291,6 +291,9 @@ public class GempukkuHttpRequestHandler extends SimpleChannelInboundHandler<Full
|
||||
|
||||
if (json == null)
|
||||
json = "{}";
|
||||
|
||||
if(!json.startsWith("{") && !json.startsWith("["))
|
||||
json = "{ \"response\": \"" + json + "\"}";
|
||||
// Build the response object.
|
||||
FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(json.getBytes(CharsetUtil.UTF_8)), headers, EmptyHttpHeaders.INSTANCE);
|
||||
sendResponse(ctx, request, response);
|
||||
|
||||
@@ -68,15 +68,17 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
|
||||
@Override
|
||||
public void handleRequest(String uri, HttpRequest request, Map<Type, Object> context, ResponseWriter responseWriter, String remoteIp) throws Exception {
|
||||
if (uri.equals("/clearCache") && request.method() == HttpMethod.GET) {
|
||||
if (uri.equals("/clearCache") && request.method() == HttpMethod.POST) {
|
||||
clearCache(request, responseWriter);
|
||||
} else if (uri.equals("/shutdown") && request.method() == HttpMethod.GET) {
|
||||
} else if (uri.equals("/shutdown") && request.method() == HttpMethod.POST) {
|
||||
shutdown(request, responseWriter);
|
||||
} else if (uri.equals("/reloadCards") && request.method() == HttpMethod.GET) {
|
||||
} else if (uri.equals("/reloadCards") && request.method() == HttpMethod.POST) {
|
||||
reloadCards(request, responseWriter);
|
||||
} else if (uri.equals("/setMotd") && request.method() == HttpMethod.POST) {
|
||||
} else if (uri.equals("/getMOTD") && request.method() == HttpMethod.GET) {
|
||||
getMotd(request, responseWriter);
|
||||
}else if (uri.equals("/setMOTD") && request.method() == HttpMethod.POST) {
|
||||
setMotd(request, responseWriter);
|
||||
} else if (uri.equals("/previewSealedLeague") && request.method() == HttpMethod.POST) {
|
||||
}else if (uri.equals("/previewSealedLeague") && request.method() == HttpMethod.POST) {
|
||||
previewSealedLeague(request, responseWriter);
|
||||
} else if (uri.equals("/addSealedLeague") && request.method() == HttpMethod.POST) {
|
||||
addSealedLeague(request, responseWriter);
|
||||
@@ -570,16 +572,29 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
}
|
||||
}
|
||||
|
||||
private void getMotd(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException, IOException {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String motd = _hallServer.getMOTD();
|
||||
|
||||
responseWriter.writeJsonResponse(motd);
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void setMotd(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException, IOException {
|
||||
validateAdmin(request);
|
||||
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
String motd = getFormParameterSafely(postDecoder, "motd");
|
||||
String motd = getFormParameterSafely(postDecoder, "motd");
|
||||
|
||||
_hallServer.setMOTD(motd);
|
||||
_hallServer.setMOTD(motd);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
@@ -588,12 +603,18 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
private void shutdown(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException {
|
||||
validateAdmin(request);
|
||||
|
||||
QueryStringDecoder queryDecoder = new QueryStringDecoder(request.uri());
|
||||
boolean shutdown = Boolean.parseBoolean(getQueryParameterSafely(queryDecoder, "shutdown"));
|
||||
HttpPostRequestDecoder postDecoder = new HttpPostRequestDecoder(request);
|
||||
try {
|
||||
boolean shutdown = Boolean.parseBoolean(getFormParameterSafely(postDecoder, "shutdown"));
|
||||
|
||||
_hallServer.setShutdown(shutdown);
|
||||
_hallServer.setShutdown(shutdown);
|
||||
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
responseWriter.writeHtmlResponse("OK");
|
||||
} catch (Exception e) {
|
||||
responseWriter.writeHtmlResponse("Error handling request");
|
||||
} finally {
|
||||
postDecoder.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
private void reloadCards(HttpRequest request, ResponseWriter responseWriter) throws HttpProcessingException {
|
||||
@@ -616,7 +637,7 @@ public class AdminRequestHandler extends LotroServerRequestHandler implements Ur
|
||||
|
||||
int after = _cacheManager.getTotalCount();
|
||||
|
||||
responseWriter.writeHtmlResponse("Before: " + before + "<br>OK<br>After: " + after);
|
||||
responseWriter.writeHtmlResponse("Before: " + before + "<br><br>After: " + after);
|
||||
}
|
||||
|
||||
private void validateAdmin(HttpRequest request) throws HttpProcessingException {
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
$("#admin-tabs > ol > li").removeClass("ui-corner-top").addClass("ui-corner-left");
|
||||
|
||||
$("#landingTab").parent().hide();
|
||||
$("#landing").hide();
|
||||
|
||||
if(!hall.userInfo.type.includes("a"))
|
||||
{
|
||||
$("#generalTab").parent().hide();
|
||||
@@ -22,46 +24,16 @@
|
||||
<div id="adminMain" class="hall-tab flex-horiz">
|
||||
<div id="admin-tabs" class="sub-tabs">
|
||||
<ol>
|
||||
<li><a id="landingTab" href="#Landing"></a></li>
|
||||
<li><a id="generalTab" href="#generalAdmin">General Admin</a></li>
|
||||
<li><a id="landingTab" href="#landing"></a></li>
|
||||
<li><a id="generalTab" href="includes/admin/generalAdmin.html">General Admin</a></li>
|
||||
<li><a id="leagueTab" href="includes/admin/leagueAdmin.html">League Admin</a></li>
|
||||
<li><a id="banTab" href="#banAdmin">My Stats</a></li>
|
||||
<li><a id="banTab" href="#banAdmin">Ban Users</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
<div id="landing" style="display:none">
|
||||
<div id="landing" style="">
|
||||
</div>
|
||||
<div id="generalAdmin">
|
||||
<div class="article">
|
||||
<h1>Cache</h1>
|
||||
<a href="/gemp-lotr-server/admin/clearCache">Clear cache</a>
|
||||
|
||||
<h1>Message of the Day</h1>
|
||||
|
||||
<form method="POST" action="/gemp-lotr-server/admin/setMotd">
|
||||
MotD: <input type="text" name="motd"><br/>
|
||||
<input type="submit" value="Set MotD">
|
||||
</form>
|
||||
|
||||
<h1>Collections</h1>
|
||||
|
||||
<h2>Add items</h2>
|
||||
|
||||
<form method="POST" action="/gemp-lotr-server/admin/addItems">
|
||||
Type: <input type="text" name="collectionType"><br/>
|
||||
Product: <textarea rows="5" cols="20" name="product"></textarea><br/>
|
||||
Players: <textarea rows="5" cols="20" name="players"></textarea><br/>
|
||||
<input type="submit" value="Add items">
|
||||
</form>
|
||||
|
||||
<h2>Add items to collection</h2>
|
||||
|
||||
<form method="POST" action="/gemp-lotr-server/admin/addItemsToCollection">
|
||||
Type: <input type="text" name="collectionType"><br/>
|
||||
Reason: <input type="text" name="reason"><br/>
|
||||
Product: <textarea rows="5" cols="20" name="product"></textarea><br/>
|
||||
<input type="submit" value="Add items to collection">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div id="banAdmin">
|
||||
<div class="article">
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<script type="text/javascript">
|
||||
$("#generalAdmin").ready(
|
||||
function () {
|
||||
$("#shutdown-button").button().click(
|
||||
function () {
|
||||
let execute = confirm("Are you sure you want to enter shutdown mode? This will cancel all currently waiting tables and send a site-wide chat alert informing players the server will restart soon. (Currently playing tables will be unaffected.)");
|
||||
|
||||
if(!execute)
|
||||
return;
|
||||
|
||||
$("#shutdown-response").html("Processing...");
|
||||
|
||||
hall.comm.setShutdownMode(true, function (string) {
|
||||
$("#shutdown-response").html(string);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("#cancel-shutdown-button").button().click(
|
||||
function () {
|
||||
$("#shutdown-response").html("Processing...");
|
||||
|
||||
hall.comm.setShutdownMode(false, function (string) {
|
||||
$("#shutdown-response").html(string);
|
||||
});
|
||||
});
|
||||
|
||||
$("#clear-cache-button").button().click(
|
||||
function () {
|
||||
$("#cache-response").html("Processing...");
|
||||
|
||||
hall.comm.clearServerCache(function (string) {
|
||||
$("#cache-response").html(string);
|
||||
});
|
||||
});
|
||||
|
||||
$("#reload-cards-button").button().click(
|
||||
function () {
|
||||
$("#cards-response").html("Processing...");
|
||||
|
||||
hall.comm.reloadCardDefinitions(function (string) {
|
||||
$("#cards-response").html(string);
|
||||
});
|
||||
});
|
||||
|
||||
// $('#motd-text').bind("oninput", function() {
|
||||
// $("#motd-preview").html($('#motd-text').val());
|
||||
// });
|
||||
|
||||
$("#motd-button").button().click(
|
||||
function () {
|
||||
$("#motd-response").html("Processing...");
|
||||
|
||||
hall.comm.setMOTD($("#motd-text").val(), function (string) {
|
||||
$("#motd-response").html("Response: " + string);
|
||||
});
|
||||
});
|
||||
|
||||
hall.comm.getMOTD(function (json) {
|
||||
$("#motd-text").val(json.response);
|
||||
$("#motd-preview").html(json.response);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
<div id="generalAdmin" >
|
||||
|
||||
<table class="tables" style="width:100%">
|
||||
<tr >
|
||||
<th>Action</th>
|
||||
<th style="min-width:200px">Result</th>
|
||||
<th>Description</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<button id="shutdown-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" style="padding:4px;display:flex;">
|
||||
Enter Shutdown Mode
|
||||
</button>
|
||||
|
||||
<button id="cancel-shutdown-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" style="padding:4px;display:flex;">
|
||||
Exit Shutdown Mode
|
||||
</button>
|
||||
</td>
|
||||
<td id="shutdown-response"></td>
|
||||
<td>
|
||||
Puts the server into shutdown mode (cancels queues, disallows new table creation, otherwise leaves current tables open). Puts a site-wide chat alert telling players the server will restart soon.
|
||||
<br><br>
|
||||
Canceling shutdown mode puts out another chat-wide alert and players may resume setting up tables.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<button id="clear-cache-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" style="padding:4px;display:flex;">
|
||||
Clear Server Cache
|
||||
</button>
|
||||
|
||||
</td>
|
||||
<td id="cache-response"></td>
|
||||
<td>
|
||||
All database operations have their results cached in memory to alleviate load on the DB while the server is running. This command clears that cache and forces any database calls to get the actual DB data.
|
||||
<br><br>
|
||||
Also clears the internal caches of the League and Tournament services, forcing standings to be re-calculated.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>
|
||||
<button id="reload-cards-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" style="padding:4px;display:flex;">
|
||||
Reload JSON Card Definitions
|
||||
</button>
|
||||
|
||||
</td>
|
||||
<td id="cards-response"></td>
|
||||
<td>
|
||||
New-style card definitions are JSON text files, and as such can be hot-reloaded at will. This command will reload all definitions from file for cards that have been converted.
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>
|
||||
|
||||
<h1>Message of the Day</h1>
|
||||
<div>
|
||||
<p>Sets the MOTD in the Game Hall just beneath the action bar at the top of the window. Supports HTML.</p>
|
||||
|
||||
<div id="motd-response"></div>
|
||||
|
||||
<div class="flex-horiz" style="gap:25px">
|
||||
<div class="flex-vert" style="flex-basis:50%;">
|
||||
<textarea type="text" id="motd-text" style="min-width:50%" oninput='$("#motd-preview").html($("#motd-text").val());'></textarea>
|
||||
<br />
|
||||
<button id="motd-button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false" style="padding:4px;max-width:100px;">
|
||||
Set MOTD
|
||||
</button>
|
||||
</div>
|
||||
<div id="motd-preview" style="flex-basis:50%;word-wrap:break-word;max-width:100%"></div>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
|
||||
<!-- <form method="POST" action="javascript:;" onsubmit="submitMOTD(this)" action="/gemp-lotr-server/admin/setMotd">
|
||||
Hall MOTD: <textarea type="text" name="motd"><br/>
|
||||
<input type="submit" value="Set MotD">
|
||||
</form> -->
|
||||
</div>
|
||||
|
||||
<h1>Collections</h1>
|
||||
|
||||
<h2>Add items</h2>
|
||||
|
||||
<form method="POST" action="/gemp-lotr-server/admin/addItems">
|
||||
Type: <input type="text" name="collectionType"><br/>
|
||||
Product: <textarea rows="5" cols="20" name="product"></textarea><br/>
|
||||
Players: <textarea rows="5" cols="20" name="players"></textarea><br/>
|
||||
<input type="submit" value="Add items">
|
||||
</form>
|
||||
|
||||
<h2>Add items to collection</h2>
|
||||
|
||||
<form method="POST" action="/gemp-lotr-server/admin/addItemsToCollection">
|
||||
Type: <input type="text" name="collectionType"><br/>
|
||||
Reason: <input type="text" name="reason"><br/>
|
||||
Product: <textarea rows="5" cols="20" name="product"></textarea><br/>
|
||||
<input type="submit" value="Add items to collection">
|
||||
</form>
|
||||
</div>
|
||||
@@ -1,288 +1,242 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Gemp-LotR League Administration</title>
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 12px;
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
}
|
||||
<style type="text/css">
|
||||
|
||||
.leagueName {
|
||||
font-size: 150%;
|
||||
font-weight: bolder;
|
||||
}
|
||||
.leagueName {
|
||||
font-size: 150%;
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
.serieName {
|
||||
font-size: 120%;
|
||||
font-weight: bolder;
|
||||
}
|
||||
</style>
|
||||
.serieName {
|
||||
font-size: 120%;
|
||||
font-weight: bolder;
|
||||
}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="css/dark-hive/jquery-ui-1.8.16.custom.css">
|
||||
<link rel="stylesheet" type="text/css" href="css/jquery.contextMenu.css">
|
||||
<link rel="stylesheet" type="text/css" href="js/jquery/styles/jquery.spinnercontrol.css">
|
||||
|
||||
<script type="text/javascript" src="js/jquery/jquery-1.6.2.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery-ui-1.8.16.custom.min.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.cookie.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.spinnercontrol.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.layout.js"></script>
|
||||
<script type="text/javascript" src="js/jquery/jquery.touchSwipe.js"></script>
|
||||
<script type="text/javascript">
|
||||
function submitFormToAddress(url, formElem, success, error) {
|
||||
var data = {};
|
||||
|
||||
<script type="text/javascript" src="js/gemp-022/inheritance.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/common.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/logging.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/chat.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/communication.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/deliveryService.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/commonUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/cardFilter.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/gemp-022/jCardGroup.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/hobbit.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/set40.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/jCards.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/PC_Cards.js"></script>
|
||||
|
||||
<script type="text/javascript" src="js/gemp-022/hallUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/leagueResultsUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/tournamentResultsUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/statsUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/playerStatsUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/gameHistoryUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/deckBuildingUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/gameUi.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/gameAnimations.js"></script>
|
||||
<script type="text/javascript" src="js/gemp-022/merchantUi.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function submitFormToAddress(url, formElem, success, error) {
|
||||
var data = {};
|
||||
|
||||
var inputs = $("input[type='text'], option:selected", formElem).each(
|
||||
function () {
|
||||
var input = $(this);
|
||||
var name = null;
|
||||
var value = null;
|
||||
if (input.prop("tagName") == "INPUT") {
|
||||
name = input.attr("name");
|
||||
value = input.val();
|
||||
} else if (input.prop("tagName") == "OPTION") {
|
||||
name = input.parents("select").attr("name");
|
||||
value = input.attr("value");
|
||||
}
|
||||
if (name != null && value != null) {
|
||||
if (data[name] == null)
|
||||
data[name] = new Array();
|
||||
data[name].push(value);
|
||||
}
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:serverDomain+url,
|
||||
cache:false,
|
||||
data:data,
|
||||
traditional:true,
|
||||
success:success,
|
||||
error:error,
|
||||
dataType:"xml"
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(
|
||||
var inputs = $("input[type='text'], option:selected", formElem).each(
|
||||
function () {
|
||||
var previewDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen:false,
|
||||
closeOnEscape:true,
|
||||
resizable:true,
|
||||
modal:true,
|
||||
title:"Preview window"
|
||||
});
|
||||
|
||||
var displayPreview = function (xml) {
|
||||
var root = xml.documentElement;
|
||||
if (root.tagName == 'league') {
|
||||
var league = root;
|
||||
|
||||
var leagueName = league.getAttribute("name");
|
||||
var cost = parseInt(league.getAttribute("cost"));
|
||||
|
||||
previewDialog.append("<div class='leagueName'>" + leagueName + "</div>");
|
||||
|
||||
var costStr = formatPrice(cost);
|
||||
previewDialog.append("<div class='leagueCost'><b>Cost:</b> " + costStr + "</div>");
|
||||
|
||||
var series = league.getElementsByTagName("serie");
|
||||
for (var j = 0; j < series.length; j++) {
|
||||
|
||||
var serie = series[j];
|
||||
var serieName = serie.getAttribute("type");
|
||||
var serieStart = serie.getAttribute("start");
|
||||
var serieEnd = serie.getAttribute("end");
|
||||
var maxMatches = serie.getAttribute("maxMatches");
|
||||
var format = serie.getAttribute("format");
|
||||
var collection = serie.getAttribute("collection");
|
||||
var limited = serie.getAttribute("limited");
|
||||
|
||||
var serieText = serieName + " - " + getDateString(serieStart) + " to " + getDateString(serieEnd);
|
||||
previewDialog.append("<div class='serieName'>" + serieText + "</div>");
|
||||
|
||||
previewDialog.append("<div><b>Format:</b> " + ((limited == "true") ? "Limited" : "Constructed") + " " + format + "</div>");
|
||||
previewDialog.append("<div><b>Collection:</b> " + collection + "</div>");
|
||||
|
||||
previewDialog.append("<div>Maximum ranked matches in serie: " + maxMatches + "</div>");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var previewError = function (xhr) {
|
||||
previewDialog.dialog("close");
|
||||
alert("Invalid parameters specified - error code: " + xhr.status);
|
||||
};
|
||||
|
||||
$("#previewSealed").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewSealedLeague", $("#addSealedForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#previewSoloDraft").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewSoloDraftLeague", $("#addSoloDraftForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#previewConstructed").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewConstructedLeague", $("#addConstructedForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#addConstructedSerie").click(
|
||||
function () {
|
||||
$(".serieData").last().clone().appendTo(".series");
|
||||
});
|
||||
var input = $(this);
|
||||
var name = null;
|
||||
var value = null;
|
||||
if (input.prop("tagName") == "INPUT") {
|
||||
name = input.attr("name");
|
||||
value = input.val();
|
||||
} else if (input.prop("tagName") == "OPTION") {
|
||||
name = input.parents("select").attr("name");
|
||||
value = input.attr("value");
|
||||
}
|
||||
if (name != null && value != null) {
|
||||
if (data[name] == null)
|
||||
data[name] = new Array();
|
||||
data[name].push(value);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>League</h1>
|
||||
|
||||
<h2>Add sealed league</h2>
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:serverDomain+url,
|
||||
cache:false,
|
||||
data:data,
|
||||
traditional:true,
|
||||
success:success,
|
||||
error:error,
|
||||
dataType:"xml"
|
||||
});
|
||||
}
|
||||
|
||||
<form id="addSealedForm" method="POST" action="/gemp-lotr-server/admin/addSealedLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="fotr_block">Fellowship block</option>
|
||||
<option value="ttt_block">Towers block</option>
|
||||
<option value="movie">King (Movie) block</option>
|
||||
<option value="war_block">War of the Ring block</option>
|
||||
<option value="hunters_block">Hunters block</option>
|
||||
<option value="movie_special">Movie Special block</option>
|
||||
<option value="ts_special">TS Special block</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
<input id="previewSealed" type="button" value="Preview sealed league">
|
||||
<input type="submit" value="Add sealed league">
|
||||
</form>
|
||||
$(document).ready(
|
||||
function () {
|
||||
var previewDialog = $("<div></div>")
|
||||
.dialog({
|
||||
autoOpen:false,
|
||||
closeOnEscape:true,
|
||||
resizable:true,
|
||||
modal:true,
|
||||
title:"Preview window"
|
||||
});
|
||||
|
||||
<h2>Add solo-draft league</h2>
|
||||
var displayPreview = function (xml) {
|
||||
var root = xml.documentElement;
|
||||
if (root.tagName == 'league') {
|
||||
var league = root;
|
||||
|
||||
<form id="addSoloDraftForm" method="POST" action="/gemp-lotr-server/admin/addSoloDraftLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="test_draft">Test Draft</option>
|
||||
<option value="fotr_draft">Fellowship Draft</option>
|
||||
<option value="ttt_draft">Two Towers Draft</option>
|
||||
<option value="hobbit_random_draft">Hobbit Random Draft</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
<input id="previewSoloDraft" type="button" value="Preview solo draft league">
|
||||
<input type="submit" value="Add solo draft league">
|
||||
</form>
|
||||
var leagueName = league.getAttribute("name");
|
||||
var cost = parseInt(league.getAttribute("cost"));
|
||||
|
||||
<h2>Add constructed league</h2>
|
||||
previewDialog.append("<div class='leagueName'>" + leagueName + "</div>");
|
||||
|
||||
<form id="addConstructedForm" method="POST" action="/gemp-lotr-server/admin/addConstructedLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Prize multiplier (e.g. 0.7): <input type="text" name="prizeMultiplier"><br/>
|
||||
Collection:
|
||||
<select name="collectionType">
|
||||
<option value="default">All cards</option>
|
||||
<option value="permanent+trophy">My cards</option>
|
||||
</select><br/>
|
||||
var costStr = formatPrice(cost);
|
||||
previewDialog.append("<div class='leagueCost'><b>Cost:</b> " + costStr + "</div>");
|
||||
|
||||
<div class="series">
|
||||
<div class="serieData">
|
||||
<b>Series definition:</b><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="fotr_block">Fellowship block</option>
|
||||
<option value="pc_fotr_block">Fellowship block (PC)</option>
|
||||
<option value="fotr1_block">Fellowship block - Set 1</option>
|
||||
<option value="fotr2_block">Fellowship block - Sets 1&2</option>
|
||||
<option value="fotr_poorman">Fellowship block - Poorman</option>
|
||||
<option value="fotr_highlander">Fellowship block - Highlander</option>
|
||||
<option value="ttt_block">Towers block</option>
|
||||
<option value="ttt1_block">Towers block - Set 4</option>
|
||||
<option value="ttt2_block">Towers block - Sets 4&5</option>
|
||||
<option value="towers_standard">Towers standard</option>
|
||||
<option value="ttt_standard">Towers standard - Sets 1-4</option>
|
||||
<option value="bohd_standard">Towers standard - Sets 1-5</option>
|
||||
<option value="ts_no_fotr">Towers standard - Sets 2-6</option>
|
||||
<option value="ts_reflections">Towers standard - Sets 1-6,9,14&16</option>
|
||||
<option value="king_block">King block</option>
|
||||
<option value="king1_block">King block - Set 7</option>
|
||||
<option value="king2_block">King block - Sets 7-8</option>
|
||||
<option value="movie">Movie block</option>
|
||||
<option value="pc_movie">Movie block (PC)</option>
|
||||
<option value="movie_exp">Movie block, no GLR (10R11)</option>
|
||||
<option value="movie7">Movie block - Sets 1-7</option>
|
||||
<option value="movie8">Movie block - Sets 1-8</option>
|
||||
<option value="movie9">Movie block - Sets 1-9</option>
|
||||
<option value="movie_sans9">Movie block - Sets 1-8,10</option>
|
||||
<option value="movie_highlander">Movie block - Highlander</option>
|
||||
<option value="war_block">War of the Ring block</option>
|
||||
<option value="war_block11">War of the Ring block - Set 11</option>
|
||||
<option value="war_block12">War of the Ring block - Sets 11-12</option>
|
||||
<option value="war_block14">War of the Ring block - Sets 10-14</option>
|
||||
<option value="hunter_block">Hunters block</option>
|
||||
<option value="war_standard">War of the Ring standard</option>
|
||||
<option value="standard">Standard</option>
|
||||
<option value="open">Open</option>
|
||||
<option value="open_legacy">Open - Sets 1-4</option>
|
||||
<option value="expanded">Expanded</option>
|
||||
<option value="pc_expanded">Expanded (PC)</option>
|
||||
<option value="test_pc_fotr_block">PLAYTEST FOTR (PC)</option>
|
||||
<option value="test_pc_movie">PLAYTEST Movie (PC)</option>
|
||||
<option value="test_pc_expanded">PLAYTEST Expanded (PC)</option>
|
||||
<option value="french">French</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
var series = league.getElementsByTagName("serie");
|
||||
for (var j = 0; j < series.length; j++) {
|
||||
|
||||
var serie = series[j];
|
||||
var serieName = serie.getAttribute("type");
|
||||
var serieStart = serie.getAttribute("start");
|
||||
var serieEnd = serie.getAttribute("end");
|
||||
var maxMatches = serie.getAttribute("maxMatches");
|
||||
var format = serie.getAttribute("format");
|
||||
var collection = serie.getAttribute("collection");
|
||||
var limited = serie.getAttribute("limited");
|
||||
|
||||
var serieText = serieName + " - " + getDateString(serieStart) + " to " + getDateString(serieEnd);
|
||||
previewDialog.append("<div class='serieName'>" + serieText + "</div>");
|
||||
|
||||
previewDialog.append("<div><b>Format:</b> " + ((limited == "true") ? "Limited" : "Constructed") + " " + format + "</div>");
|
||||
previewDialog.append("<div><b>Collection:</b> " + collection + "</div>");
|
||||
|
||||
previewDialog.append("<div>Maximum ranked matches in serie: " + maxMatches + "</div>");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var previewError = function (xhr) {
|
||||
previewDialog.dialog("close");
|
||||
alert("Invalid parameters specified - error code: " + xhr.status);
|
||||
};
|
||||
|
||||
$("#previewSealed").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewSealedLeague", $("#addSealedForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#previewSoloDraft").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewSoloDraftLeague", $("#addSoloDraftForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#previewConstructed").click(
|
||||
function () {
|
||||
submitFormToAddress("/gemp-lotr-server/admin/previewConstructedLeague", $("#addConstructedForm").eq(0), displayPreview, previewError);
|
||||
previewDialog.html("");
|
||||
previewDialog.dialog("open");
|
||||
});
|
||||
|
||||
$("#addConstructedSerie").click(
|
||||
function () {
|
||||
$(".serieData").last().clone().appendTo(".series");
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<div class="article">
|
||||
<h1>League</h1>
|
||||
|
||||
<h2>Add sealed league</h2>
|
||||
|
||||
<form id="addSealedForm" method="POST" action="/gemp-lotr-server/admin/addSealedLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="fotr_block">Fellowship block</option>
|
||||
<option value="ttt_block">Towers block</option>
|
||||
<option value="movie">King (Movie) block</option>
|
||||
<option value="war_block">War of the Ring block</option>
|
||||
<option value="hunters_block">Hunters block</option>
|
||||
<option value="movie_special">Movie Special block</option>
|
||||
<option value="ts_special">TS Special block</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
<input id="previewSealed" type="button" value="Preview sealed league">
|
||||
<input type="submit" value="Add sealed league">
|
||||
</form>
|
||||
|
||||
<h2>Add solo-draft league</h2>
|
||||
|
||||
<form id="addSoloDraftForm" method="POST" action="/gemp-lotr-server/admin/addSoloDraftLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="test_draft">Test Draft</option>
|
||||
<option value="fotr_draft">Fellowship Draft</option>
|
||||
<option value="ttt_draft">Two Towers Draft</option>
|
||||
<option value="hobbit_random_draft">Hobbit Random Draft</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
<input id="previewSoloDraft" type="button" value="Preview solo draft league">
|
||||
<input type="submit" value="Add solo draft league">
|
||||
</form>
|
||||
|
||||
<h2>Add constructed league</h2>
|
||||
|
||||
<form id="addConstructedForm" method="POST" action="/gemp-lotr-server/admin/addConstructedLeague">
|
||||
Name: <input type="text" name="name"><br/>
|
||||
Cost (in silver): <input type="text" name="cost"><br/>
|
||||
Start (YYYYMMDD): <input type="text" name="start"><br/>
|
||||
Prize multiplier (e.g. 0.7): <input type="text" name="prizeMultiplier"><br/>
|
||||
Collection:
|
||||
<select name="collectionType">
|
||||
<option value="default">All cards</option>
|
||||
<option value="permanent+trophy">My cards</option>
|
||||
</select><br/>
|
||||
|
||||
<div class="series">
|
||||
<div class="serieData">
|
||||
<b>Series definition:</b><br/>
|
||||
Format:
|
||||
<select name="format">
|
||||
<option value="fotr_block">Fellowship block</option>
|
||||
<option value="pc_fotr_block">Fellowship block (PC)</option>
|
||||
<option value="fotr1_block">Fellowship block - Set 1</option>
|
||||
<option value="fotr2_block">Fellowship block - Sets 1&2</option>
|
||||
<option value="fotr_poorman">Fellowship block - Poorman</option>
|
||||
<option value="fotr_highlander">Fellowship block - Highlander</option>
|
||||
<option value="ttt_block">Towers block</option>
|
||||
<option value="ttt1_block">Towers block - Set 4</option>
|
||||
<option value="ttt2_block">Towers block - Sets 4&5</option>
|
||||
<option value="towers_standard">Towers standard</option>
|
||||
<option value="ttt_standard">Towers standard - Sets 1-4</option>
|
||||
<option value="bohd_standard">Towers standard - Sets 1-5</option>
|
||||
<option value="ts_no_fotr">Towers standard - Sets 2-6</option>
|
||||
<option value="ts_reflections">Towers standard - Sets 1-6,9,14&16</option>
|
||||
<option value="king_block">King block</option>
|
||||
<option value="king1_block">King block - Set 7</option>
|
||||
<option value="king2_block">King block - Sets 7-8</option>
|
||||
<option value="movie">Movie block</option>
|
||||
<option value="pc_movie">Movie block (PC)</option>
|
||||
<option value="movie_exp">Movie block, no GLR (10R11)</option>
|
||||
<option value="movie7">Movie block - Sets 1-7</option>
|
||||
<option value="movie8">Movie block - Sets 1-8</option>
|
||||
<option value="movie9">Movie block - Sets 1-9</option>
|
||||
<option value="movie_sans9">Movie block - Sets 1-8,10</option>
|
||||
<option value="movie_highlander">Movie block - Highlander</option>
|
||||
<option value="war_block">War of the Ring block</option>
|
||||
<option value="war_block11">War of the Ring block - Set 11</option>
|
||||
<option value="war_block12">War of the Ring block - Sets 11-12</option>
|
||||
<option value="war_block14">War of the Ring block - Sets 10-14</option>
|
||||
<option value="hunter_block">Hunters block</option>
|
||||
<option value="war_standard">War of the Ring standard</option>
|
||||
<option value="standard">Standard</option>
|
||||
<option value="open">Open</option>
|
||||
<option value="open_legacy">Open - Sets 1-4</option>
|
||||
<option value="expanded">Expanded</option>
|
||||
<option value="pc_expanded">Expanded (PC)</option>
|
||||
<option value="test_pc_fotr_block">PLAYTEST FOTR (PC)</option>
|
||||
<option value="test_pc_movie">PLAYTEST Movie (PC)</option>
|
||||
<option value="test_pc_expanded">PLAYTEST Expanded (PC)</option>
|
||||
<option value="french">French</option>
|
||||
</select><br/>
|
||||
Series duration in days: <input type="text" name="serieDuration"><br/>
|
||||
Maximum matches in series: <input type="text" name="maxMatches"><br/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<input id="addConstructedSerie" type="button" value="Add another series">
|
||||
<input id="previewConstructed" type="button" value="Preview constructed league">
|
||||
<input type="submit" value="Add constructed league">
|
||||
</form>
|
||||
<input id="addConstructedSerie" type="button" value="Add another series">
|
||||
<input id="previewConstructed" type="button" value="Preview constructed league">
|
||||
<input type="submit" value="Add constructed league">
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -723,6 +723,71 @@ var GempLotrCommunication = Class.extend({
|
||||
});
|
||||
},
|
||||
|
||||
setShutdownMode:function (shutdown, callback, errorMap) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:this.url + "/admin/shutdown",
|
||||
cache:false,
|
||||
data:{
|
||||
shutdown:shutdown
|
||||
},
|
||||
success:this.deliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"html"
|
||||
});
|
||||
},
|
||||
|
||||
clearServerCache:function (callback, errorMap) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:this.url + "/admin/clearCache",
|
||||
cache:false,
|
||||
data:{},
|
||||
success:this.deliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"html"
|
||||
});
|
||||
},
|
||||
|
||||
reloadCardDefinitions:function (callback, errorMap) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:this.url + "/admin/reloadCards",
|
||||
cache:false,
|
||||
data:{},
|
||||
success:this.deliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"html"
|
||||
});
|
||||
},
|
||||
|
||||
getMOTD:function (callback, errorMap) {
|
||||
$.ajax({
|
||||
type:"GET",
|
||||
url:this.url + "/admin/getMOTD",
|
||||
cache:false,
|
||||
success:this.deliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"json"
|
||||
});
|
||||
},
|
||||
|
||||
setMOTD:function (motd, callback, errorMap) {
|
||||
$.ajax({
|
||||
type:"POST",
|
||||
url:this.url + "/admin/setMOTD",
|
||||
cache:false,
|
||||
data:{
|
||||
motd:motd
|
||||
},
|
||||
success:this.deliveryCheck(callback),
|
||||
error:this.errorCheck(errorMap),
|
||||
dataType:"html"
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
|
||||
//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
|
||||
|
||||
@@ -21,7 +21,12 @@ public class CachedIpBanDAO implements IpBanDAO, Cached {
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return 2;
|
||||
int total = 0;
|
||||
if(_bannedIps != null)
|
||||
total += _bannedIps.size();
|
||||
if(_bannedIpPrefixes != null)
|
||||
total += _bannedIpPrefixes.size();
|
||||
return total;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -283,18 +283,31 @@ public class HallServer extends AbstractServer {
|
||||
public void setShutdown(boolean shutdown) {
|
||||
_hallDataAccessLock.writeLock().lock();
|
||||
try {
|
||||
boolean cancelMessage = _shutdown && !shutdown;
|
||||
_shutdown = shutdown;
|
||||
if (shutdown) {
|
||||
cancelWaitingTables();
|
||||
cancelTournamentQueues();
|
||||
_chatServer.sendSystemMessageToAllChatRooms("System is entering shutdown mode and will be restarted when all games are finished");
|
||||
_chatServer.sendSystemMessageToAllChatRooms("@everyone System is entering shutdown mode and will be restarted when all games are finished.");
|
||||
hallChanged();
|
||||
}
|
||||
else if(cancelMessage){
|
||||
_chatServer.sendSystemMessageToAllChatRooms("@everyone Shutdown mode canceled; games may now resume.");
|
||||
}
|
||||
} finally {
|
||||
_hallDataAccessLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public String getMOTD() {
|
||||
_hallDataAccessLock.readLock().lock();
|
||||
try {
|
||||
return _motd;
|
||||
} finally {
|
||||
_hallDataAccessLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void setMOTD(String motd) {
|
||||
_hallDataAccessLock.writeLock().lock();
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user