freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt
author Jaroslav Tulach <jtulach@netbeans.org>
Wed, 16 Sep 2009 22:28:11 +0200
branchdisplay-image
changeset 91 786df32c496b
parent 88 a3be2be0112f
permissions -rw-r--r--
First attempt to show the board as image
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     2 <html>
     3   <head>
     4     <title></title>
     5     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     6     <#if user != doc.game.@currentPlayer >
     7         <meta http-equiv="REFRESH" content="60;URL=/games/${doc.game.id.@id}">
     8     </#if>
     9   </head>
    10   <body>
    11       <h1>${bundle.GAME}</h1>
    12       <h3>${bundle("players", doc.game.id.@white?string, doc.game.id.@black?string)}</h3>
    13 
    14       <p>
    15       <a href="/games/${doc.game.id.@id}">${bundle.RELOAD}</a>
    16       <a href="/">${bundle.ROOT}</a>
    17       </p>
    18       
    19       <#if message?? >
    20         <p>
    21             <span style="color: red">${message}</span>
    22         </p>
    23       </#if>
    24 
    25       <#assign play = false>
    26 
    27       <#if doc.game.id.@status = "whiteMove" || doc.game.id.@status = "blackMove" >
    28           ${bundle("MOVE_WHO", doc.game.@currentPlayer?string)}
    29           <#assign play = user = doc.game.@currentPlayer>
    30       <#else>
    31         <#if doc.game.id.@status = "whiteWon">
    32           ${bundle("WON", doc.game.id.@white?string)}
    33         <#else>
    34           ${bundle("WON", doc.game.id.@black?string)}
    35         </#if>
    36       </#if>
    37       <#if  play>
    38           <form action="/games/${doc.game.id.@id}/move">
    39               <input type="hidden" name="type" value="fence" readonly="readonly"/>
    40               <select name="column">
    41                   <option>A</option>
    42                   <option>B</option>
    43                   <option>C</option>
    44                   <option>D</option>
    45                   <option>E</option>
    46                   <option>F</option>
    47                   <option>G</option>
    48                   <option>H</option>
    49               </select>
    50               <select name="row">
    51                   <option>1</option>
    52                   <option>2</option>
    53                   <option>3</option>
    54                   <option>4</option>
    55                   <option>5</option>
    56                   <option>6</option>
    57                   <option>7</option>
    58                   <option>8</option>
    59               </select>
    60               <select name="direction">
    61                   <option>${bundle.H}</option>
    62                   <option>${bundle.V}</option>
    63               </select>
    64               <input type="submit" value="${bundle.PLACE}" />
    65           </form>
    66           <form action="/games/${doc.game.id.@id}/move">
    67               <input type="hidden" name="type" value="move" readonly="readonly"/>
    68               <select name="direction">
    69                   <option>E</option>
    70                   <option>W</option>
    71                   <option>N</option>
    72                   <option>S</option>
    73               </select>
    74               <select name="direction-next">
    75                   <option></option>
    76                   <option>E</option>
    77                   <option>W</option>
    78                   <option>N</option>
    79                   <option>S</option>
    80               </select>
    81               <input type="submit" value="${bundle.MOVE}" />
    82           </form>
    83           <form action="/games/${doc.game.id.@id}/move">
    84               <input type="hidden" name="type" value="resign" readonly="readonly"/>
    85               <input type="submit" value="${bundle.RESIGN}" />
    86           </form>
    87       </#if>
    88       <img src="/api/games/${doc.game.id.@id}" alt="board"/>
    89       <pre>${doc.game.board}</pre>
    90 
    91       <h3>${bundle.MOVES}</h3>
    92 
    93       <table border="0">
    94           <thead>
    95               <tr>
    96                   <th>${bundle.MOVENUMBER}</th>
    97                   <th>${doc.game.id.@white}</th>
    98                   <th>${doc.game.id.@black}</th>
    99               </tr>
   100           </thead>
   101           <tbody>
   102               <#assign index = 0>
   103               <#list doc.game.moves.* as item>
   104                 <#if item.@index?number % 2 = 1>
   105                     <#assign index = index + 1>
   106                     <tr><td>${index}</td><td>${item.@move}</td>
   107                 <#else>
   108                     <td>${item.@move}</td></tr>
   109                 </#if>
   110               </#list>
   111           </tbody>
   112       </table>
   113       <hr/>
   114       ${bundle("copyright", version)}
   115   </body>
   116 </html>