Added MOTD
This commit is contained in:
@@ -31,6 +31,8 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
private Map<Player, Long> _lastVisitedPlayers = Collections.synchronizedMap(new LinkedHashMap<Player, Long>());
|
||||
|
||||
private String _motd;
|
||||
|
||||
public HallServer(LotroServer lotroServer, ChatServer chatServer, LeagueService leagueService, LotroCardBlueprintLibrary library, boolean test) {
|
||||
_lotroServer = lotroServer;
|
||||
_chatServer = chatServer;
|
||||
@@ -51,6 +53,14 @@ public class HallServer extends AbstractServer {
|
||||
addFormat("whatever", "Format for testing", "default", new FreeFormat(library));
|
||||
}
|
||||
|
||||
public String getMOTD() {
|
||||
return _motd;
|
||||
}
|
||||
|
||||
public void setMOTD(String motd) {
|
||||
_motd = motd;
|
||||
}
|
||||
|
||||
private void addFormat(String formatCode, String formatName, String formatCollectionId, LotroFormat format) {
|
||||
_supportedFormatNames.put(formatCode, formatName);
|
||||
_formatCollectionIds.put(formatCode, formatCollectionId);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.gempukku.lotro.db.LeagueDAO;
|
||||
import com.gempukku.lotro.db.vo.Player;
|
||||
import com.gempukku.lotro.game.DefaultCardCollection;
|
||||
import com.gempukku.lotro.game.LotroCardBlueprintLibrary;
|
||||
import com.gempukku.lotro.hall.HallServer;
|
||||
import com.sun.jersey.spi.resource.Singleton;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
@@ -27,6 +28,8 @@ public class AdminResource extends AbstractResource {
|
||||
private LeagueDAO _leagueDao;
|
||||
@Context
|
||||
private LotroCardBlueprintLibrary _library;
|
||||
@Context
|
||||
private HallServer _hallServer;
|
||||
|
||||
@Path("/clearCache")
|
||||
@GET
|
||||
@@ -41,6 +44,18 @@ public class AdminResource extends AbstractResource {
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@Path("/setMotd")
|
||||
@POST
|
||||
public String setMotd(
|
||||
@FormParam("motd") String motd,
|
||||
@Context HttpServletRequest request) throws Exception {
|
||||
validateAdmin(request);
|
||||
|
||||
_hallServer.setMOTD(motd);
|
||||
|
||||
return "OK";
|
||||
}
|
||||
|
||||
@Path("/addLeague")
|
||||
@POST
|
||||
public String addLeague(
|
||||
|
||||
@@ -38,6 +38,9 @@ public class HallResource extends AbstractResource {
|
||||
Document doc = documentBuilder.newDocument();
|
||||
|
||||
Element hall = doc.createElement("hall");
|
||||
String motd = _hallServer.getMOTD();
|
||||
if (motd != null)
|
||||
hall.setAttribute("motd", motd);
|
||||
|
||||
_hallServer.processTables(resourceOwner, new SerializeHallInfoVisitor(doc, hall));
|
||||
for (Map.Entry<String, String> format : _hallServer.getSupportedFormatNames().entrySet()) {
|
||||
|
||||
@@ -3,6 +3,13 @@
|
||||
<h1>Cache</h1>
|
||||
<a href="server/admin/clearCache">Clear cache</a>
|
||||
|
||||
<h1>Message of the Day</h1>
|
||||
|
||||
<form method="POST" action="server/admin/setMotd">
|
||||
MotD: <input type="text" name="motd"><br/>
|
||||
<input type="submit" value="Set MotD">
|
||||
</form>
|
||||
|
||||
<h1>League</h1>
|
||||
|
||||
<h2>Add league</h2>
|
||||
@@ -12,7 +19,7 @@
|
||||
Type: <input type="text" name="type"><br/>
|
||||
Start: <input type="text" name="start"><br/>
|
||||
End: <input type="text" name="end"><br/>
|
||||
Packs: <textarea rows="5" cols="20" name="packCollection"></textarea>
|
||||
Packs: <textarea rows="5" cols="20" name="packCollection"></textarea><br/>
|
||||
<input type="submit" value="Create">
|
||||
</form>
|
||||
</body>
|
||||
|
||||
@@ -73,6 +73,11 @@
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
#motd {
|
||||
color: #ffffff;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
.ui-tabs-nav li {
|
||||
font-size: 70%;
|
||||
}
|
||||
@@ -122,8 +127,6 @@
|
||||
$("#latestNews").append("<b>Sets 01-10 are available to play.</b> "
|
||||
+ "If you find any problems with specific card or rules in general, please report it <a href='http://lotrtcgdb.com/forums/index.php/topic,7592.0.html'>at the TLHH forums</a>.");
|
||||
|
||||
$("#latestNews").append("<br><font color='red'>The service is running on a hosted server, all looks great so far. Did a few changes in the chat code, so it should be more forgiving for people with a bad connection.</font>");
|
||||
|
||||
var chat = new ChatBoxUI("Game Hall", $("#chat"), "/gemp-lotr/server", true);
|
||||
chat.setBounds(2, 2, 780 - 4, 200 - 4);
|
||||
chat.showTimestamps = true;
|
||||
@@ -149,7 +152,8 @@
|
||||
</script>
|
||||
</ul>
|
||||
<div id="gameHall">
|
||||
<div id="latestNews" style="width:780px;height:60px;"></div>
|
||||
<div id="latestNews" style="width:780px;height:30px;"></div>
|
||||
<div id="motd" style="width:780px;height:30px;"></div>
|
||||
<div id="hall" class="ui-widget-content"
|
||||
style="width:780px;height:260px;"></div>
|
||||
<div id="chat" class="ui-widget-content"
|
||||
|
||||
@@ -139,6 +139,10 @@ var GempLotrHallUI = Class.extend({
|
||||
if (root.tagName == "hall") {
|
||||
this.tablesDiv.html("");
|
||||
|
||||
var motd = root.getAttribute("motd");
|
||||
if (motd != null)
|
||||
$("#motd").html(motd);
|
||||
|
||||
var waiting = root.getAttribute("waiting") == "true";
|
||||
|
||||
var tables = root.getElementsByTagName("table");
|
||||
|
||||
Reference in New Issue
Block a user