Merge: Don't display comments when there are none, test to find who wins, talk header without any link
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
5 <#if user = doc.game.@currentPlayer>
8 ${bundle("Waiting", doc.game.@currentPlayer?string)}
11 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
12 <#if user != doc.game.@currentPlayer >
13 <meta http-equiv="REFRESH" content="60;URL=/games/${doc.game.id.@id}">
15 <script type="text/javascript">
16 function paintFence() {
17 var fifth = fieldSize / 10;
18 var x = (document.getElementById("column").value.charCodeAt(0) - 64) * fieldSize;
19 var y = fieldSize * 9 - (document.getElementById("row").value) * fieldSize;
22 if (document.getElementById("direction").value.charAt(0) == 'H') {
23 dx = fieldSize - 2 * fifth;
27 dy = fieldSize - 2 * fifth;
29 var fenceDiv = document.getElementById("fence");
30 fenceDiv.style.position="absolute";
31 fenceDiv.style.left = (x - dx) +"px";
32 fenceDiv.style.top = (y - dy) +"px";
33 fenceDiv.style.width = (dx * 2) +"px";
34 fenceDiv.style.height = (dy * 2) +"px";
35 fenceDiv.style.backgroundColor = 'black';
36 fenceDiv.style.visibility = 'visible';
38 function deltas(dir) {
42 if (dir == 'N') r.y = 1;
43 if (dir == 'S') r.y = -1;
44 if (dir == 'E') r.x = 1;
45 if (dir == 'W') r.x = -1;
48 function paintPlayer() {
49 var fifth = fieldSize / 5;
50 var m1 = deltas(document.getElementById("pdir1").value.charAt(0));
51 var m2 = deltas(document.getElementById("pdir2").value.charAt(0));
54 x : m1.x + m2.x + playerPos.x,
55 y : m1.y + m2.y + playerPos.y
57 var fenceDiv = document.getElementById("player");
58 fenceDiv.style.position="absolute";
59 fenceDiv.style.left = (pos.x * fieldSize + fifth) +"px";
60 fenceDiv.style.top = ((8 - pos.y) * fieldSize + fifth) +"px";
61 fenceDiv.style.width = (fieldSize - fifth * 2) +"px";
62 fenceDiv.style.height = (fieldSize - fifth * 2) +"px";
63 fenceDiv.style.backgroundColor = 'black';
64 fenceDiv.style.visibility = 'visible';
66 var fieldSize=<#if format?? && format="small">20<#else>50</#if>;
68 x: ${board.currentPlayer.column},
69 y: ${board.currentPlayer.row}
74 <h3><a href="/">${bundle.TITLE_PLAIN}</a></h3>
78 <#if who = doc.game.@currentPlayer>
79 <#if doc.game.id.@status = "whiteWon" || doc.game.id.@status = "blackWon" >
89 <b>${bundle.MOVENUMBER}: </b> ${(doc.game.@currentMove?number / 2 + 1)?string("0")}<br>
90 <b>${bundle.WHITE}:</b> <@status doc.game.id.@white/> ${bundle("FENCES_LEFT", board.players[0].fences)}<br>
91 <b>${bundle.BLACK}:</b> <@status doc.game.id.@black/> ${bundle("FENCES_LEFT", board.players[1].fences)}<br>
95 <#if (doc.game.@currentMove?number > 0)>
96 <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number - 1}">${bundle.PREVIOUS}</a>
100 <a href="/games/${doc.game.id.@id}"">${bundle.LATEST}</a>
101 <#if (doc.game.@currentMove?number < doc.game.moves.*?size)>
102 <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number + 1}">${bundle.NEXT}</a>
110 <span style="color: red">${message}</span>
114 <#assign play = false>
116 <#if doc.game.id.@status = "whiteMove" || doc.game.id.@status = "blackMove" >
117 <#assign play = user = doc.game.@currentPlayer>
120 <form action="/games/${doc.game.id.@id}/move">
121 <input type="hidden" name="type" value="fence" readonly="readonly"/>
122 <select name="column" id="column" onchange="paintFence()">
132 <select name="row" id="row" onchange="paintFence()">
142 <select name="direction" id="direction" onchange="paintFence()">
143 <option value="H">${bundle.H}</option>
144 <option value="V">${bundle.V}</option>
146 <input type="submit" value="${bundle.PLACE}" />
148 <form action="/games/${doc.game.id.@id}/move">
149 <input type="hidden" name="type" value="move" readonly="readonly"/>
150 <select id="pdir1" name="direction" onchange="paintPlayer()">
151 <option value="E">${bundle.E}</option>
152 <option value="W">${bundle.W}</option>
153 <option value ="N" <#if doc.game.id.@status = "whiteMove">selected="true"</#if>>${bundle.N}</option>
154 <option value ="S" <#if doc.game.id.@status = "blackMove">selected="true"</#if>>${bundle.S}</option>
156 <select id="pdir2" name="direction-next" onchange="paintPlayer()">
158 <option value="E">${bundle.E}</option>
159 <option value="W">${bundle.W}</option>
160 <option value="N">${bundle.N}</option>
161 <option value="S">${bundle.S}</option>
163 <input type="submit" value="${bundle.MOVE}" />
165 <form action="/games/${doc.game.id.@id}/move">
166 <input type="hidden" name="type" value="resign" readonly="readonly"/>
167 <input type="submit" value="${bundle.RESIGN}" />
171 <#if format?? && format = "text">
172 <pre>${doc.game.board}</pre>
174 <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
175 <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
177 <#elseif format?? && format = "small">
179 <div style="position: relative; height:180px;">
180 <img style="position: absolute; left: 0; right: 0;"
181 width="180" height="180 "
182 src="/games/${doc.game.id.@id}.png?fieldSize=20<#if doc.game.@currentMove??>&move=${doc.game.@currentMove}</#if>"
183 alt="${bundle.BOARD_TEXT}"
185 <div id="fence" style="position: absolute; left: 0; right: 0;"></div>
186 <div id="player" style="position: absolute; left: 0; right: 0;"></div>
189 ${bundle.BOARD_SMALL}
190 <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
191 <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
193 <div style="position: relative; height:450px;">
194 <img style="position: absolute; left: 0; right: 0;"
195 width="450" height="450"
196 src="/games/${doc.game.id.@id}.png<#if doc.game.@currentMove??>?move=${doc.game.@currentMove}</#if>"
197 alt="${bundle.BOARD_TEXT}"
199 <div id="fence" style="position: absolute; left: 0; right: 0;"></div>
200 <div id="player" style="position: absolute; left: 0; right: 0;"></div>
203 <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
204 ${bundle.BOARD_IMAGE}
205 <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
208 <#macro printMove item>
209 <#if item.@index = doc.game.@currentMove>
212 <a href="/games/${doc.game.id.@id}?move=${item.@index}">${item.@move}</a>
216 <h3><a href="/games/${doc.game.id.@id}?move=0">${bundle.MOVES}</a></h3>
221 <th>${bundle.MOVENUMBER}</th>
222 <th>${doc.game.id.@white}</th>
223 <th>${doc.game.id.@black}</th>
228 <#list doc.game.moves.* as item>
230 <#if item.@index?number % 2 = 1>
231 <#assign index = index + 1>
232 <tr><td>${index}</td><td><@printMove item/></td>
234 <td><@printMove item/></td></tr>
240 <h3>${bundle.TALK}</h3>
243 <#list doc.game.moves.item.comment as item>
244 <li><b>${item.@who}</b>: ${item}</li>
248 <form action="/games/${doc.game.id.@id}/comment">
249 <textarea rows="2" cols="80" name="comment"></textarea>
250 <input type="submit"/>
254 ${bundle("copyright", version)}