1.1 --- a/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sat Sep 19 08:54:30 2009 +0200
1.2 +++ b/freemarkerdor/src/main/java/cz/xelfi/quoridor/freemarkerdor/UI.java Sat Sep 19 12:51:50 2009 +0200
1.3 @@ -34,6 +34,8 @@
1.4 import com.sun.jersey.api.core.ResourceConfig;
1.5 import com.sun.jersey.api.view.Viewable;
1.6 import com.sun.net.httpserver.HttpServer;
1.7 +import cz.xelfi.quoridor.Board;
1.8 +import cz.xelfi.quoridor.IllegalPositionException;
1.9 import java.io.File;
1.10 import java.io.IOException;
1.11 import java.io.InputStream;
1.12 @@ -58,6 +60,7 @@
1.13 import javax.ws.rs.core.MediaType;
1.14 import javax.ws.rs.core.NewCookie;
1.15 import javax.ws.rs.core.Response;
1.16 +import org.openide.util.Exceptions;
1.17 import org.w3c.dom.Document;
1.18
1.19 /**
1.20 @@ -151,7 +154,14 @@
1.21 return v;
1.22 }
1.23 Document doc = base.path("games").path(id).accept(MediaType.TEXT_XML).get(Document.class);
1.24 - return viewable("game.fmt", doc, "message", msg, "format", format);
1.25 + Board b;
1.26 + try {
1.27 + b = Board.valueOf(doc.getElementsByTagName("board").item(0).getTextContent());
1.28 + } catch (IllegalPositionException ex) {
1.29 + Exceptions.printStackTrace(ex);
1.30 + b = Board.empty();
1.31 + }
1.32 + return viewable("game.fmt", doc, "message", msg, "format", format, "board", b);
1.33 }
1.34
1.35 @GET
2.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties Sat Sep 19 08:54:30 2009 +0200
2.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle.properties Sat Sep 19 12:51:50 2009 +0200
2.3 @@ -32,10 +32,15 @@
2.4 MOVE=Move!
2.5 TO_MOVE=to move
2.6 HAS_WON=won
2.7 +FENCES_LEFT=({0,choice,\
2.8 + 0#no fences|\
2.9 + 1#last fence|\
2.10 + 2#two fences|\
2.11 + 3#{0} fences\
2.12 +} left)
2.13 RESIGN=Resign!
2.14 H=Horizontal
2.15 V=Vertical
2.16 -RELOAD=Reload
2.17 GAME=Game
2.18 MOVENUMBER=#
2.19 MOVES=Moves
3.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties Sat Sep 19 08:54:30 2009 +0200
3.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/Bundle_cs.properties Sat Sep 19 12:51:50 2009 +0200
3.3 @@ -41,7 +41,6 @@
3.4 RESIGN=Vzd\u00E1t
3.5 H=Horizont\u00E1ln\u011B
3.6 V=Vertik\u00E1ln\u011B
3.7 -RELOAD=Obnovit
3.8 GAME=Hra
3.9 MOVENUMBER=Tah
3.10 MOVES=Z\u00E1pis
3.11 @@ -49,6 +48,15 @@
3.12 MOVE=T\u00E1hnout
3.13 TO_MOVE=na tahu
3.14 HAS_WON=vyhr\u00E1no
3.15 +FENCES_LEFT=({0,choice,\
3.16 + 0#nezb\u00FDv\u00E1 \u017E\u00E1dn\u00FD pl\u016Ftek|\
3.17 + 1#zb\u00FDv\u00E1 posledn\u00ED pl\u016Ftek|\
3.18 + 2#zb\u00FDvaj\u00ED dva pl\u016Ftky|\
3.19 + 3#zb\u00FDvaj\u00ED t\u0159i pl\u016Ftky|\
3.20 + 4#zb\u00FDvaj\u00ED \u010Dty\u0159i pl\u016Ftky|\
3.21 + 5#zb\u00FDv\u00E1 {0} pl\u016Ftk\u016F\
3.22 +})
3.23 +
3.24 TITLE=Komunitn\u00ED server Quoridor
3.25 NAME=Jm\u00E9no
3.26 PASSWORD=Heslo
4.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Sat Sep 19 08:54:30 2009 +0200
4.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt Sat Sep 19 12:51:50 2009 +0200
4.3 @@ -14,7 +14,7 @@
4.4 </#if>
4.5 </head>
4.6 <body>
4.7 - <h1>${bundle.GAME}</h1>
4.8 + <h1><a href="/games/${doc.game.id.@id}">${bundle.GAME}</a></h1>
4.9
4.10 <#macro status who>
4.11 ${who?string}
4.12 @@ -29,12 +29,11 @@
4.13
4.14
4.15 <p>
4.16 - <b>${bundle.WHITE}:</b> <@status doc.game.id.@white/><br>
4.17 - <b>${bundle.BLACK}:</b> <@status doc.game.id.@black/><br>
4.18 + <b>${bundle.WHITE}:</b> <@status doc.game.id.@white/> ${bundle("FENCES_LEFT", board.players[0].fences)}<br>
4.19 + <b>${bundle.BLACK}:</b> <@status doc.game.id.@black/> ${bundle("FENCES_LEFT", board.players[1].fences)}<br>
4.20 </p>
4.21
4.22 <p>
4.23 - <a href="/games/${doc.game.id.@id}">${bundle.RELOAD}</a>
4.24 <a href="/">${bundle.ROOT}</a>
4.25 </p>
4.26