freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/openings.fmt
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Thu, 07 Jan 2010 22:34:17 +0100
branchstatistics-and-elo
changeset 178 4b78d4f028b3
child 193 9b414aae2aa9
permissions -rw-r--r--
Initial version of statistics and ELO rating. Donated by Martin Rexa
     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
     2 <html>
     3   <head>
     4     <title>${bundle.OPENINGS}</title>
     5     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     6   </head>
     7   <body bgcolor="white">
     8       <h3><a href="/">${bundle.TITLE_PLAIN}</a></h3>
     9       <h4><a href="/openings">${bundle.OPENINGS}</a></h4>
    10       <p>
    11           <b>${bundle.WHITE}:</b> ${bundle("FENCES_LEFT", whitefences?number)}<br>
    12           <b>${bundle.BLACK}:</b> ${bundle("FENCES_LEFT", blackfences?number)}<br>
    13       </p>
    14       <div style="position: relative; height:180px;">
    15            <img style="position: absolute; left: 0; right: 0;"
    16                 width="180" height="180 "
    17                 src="/openings/${doc.openingNodeView.@code}.png?fieldSize=20"
    18                 alt="${bundle.BOARD_TEXT}"
    19            >
    20            <div id="fence" style="position: absolute; left: 0; right: 0;"></div>
    21            <div id="player" style="position: absolute; left: 0; right: 0;"></div>
    22       </div>
    23 
    24       <#macro move item>
    25           <a href="/openings/${item.code}/">${item.move}</a>
    26       </#macro>
    27       <#macro games cnt gId status code>
    28           <#if (cnt?number = 0)>
    29               ${cnt?number}
    30           </#if>
    31           <#if (cnt?number = 1)>
    32               <a href="/games/${gId.@id}/">${cnt?number}</a>
    33           </#if>
    34           <#if (cnt?number > 1)>
    35               <a href="/openings/${code}/${status}">${cnt?number}</a>
    36           </#if>
    37       </#macro>
    38       <#if (doc.openingNodeView.children.*?size > 0)>
    39       <table border="1">
    40           <thead>
    41               <tr>
    42                   <th>${bundle.MOVENUMBER}</th>
    43                   <th>${bundle.WHITE_WON}</th>
    44                   <th>${bundle.BLACK_WON}</th>
    45               </tr>
    46           </thead>
    47           <tbody>
    48               <#list doc.openingNodeView.children.* as item>
    49                 <tr>
    50                 <td><@move item/></td>
    51                 <td><@games item.whiteWon item.whiteGame 'white' item.code/></td>
    52                 <td><@games item.blackWon item.blackGame 'black' item.code/></td>
    53                 </tr>
    54               </#list>
    55           </tbody>
    56       </table>
    57       </#if>
    58 
    59       <#macro before t>
    60         <#assign seconds = (t / 1000)?long/>
    61         <#assign minutes= (seconds / 60)?long/>
    62         <#assign hours= (minutes / 60)?long/>
    63         <#assign days= (hours / 24)?long/>
    64         <!--millis: ${t}, seconds: ${seconds}, minutes: ${minutes} hours: ${hours}, days: ${days} -->
    65         ${bundle("LastMove", t?int, seconds?int, minutes?int, hours?int, days?int)}
    66       </#macro>
    67       <#macro game game>
    68           ${bundle("gameWhiteBlack", game.@white?string, game.@black?string)}
    69           <a href="/games/${game.@id}/"><@before (now - game.@modified?number)?long/></a>
    70           <#if game.@status = "whiteWon">
    71             ${bundle.WHITE_WON}
    72           </#if>
    73           <#if game.@status = "blackWon">
    74             ${bundle.BLACK_WON}
    75           </#if>
    76           <#if game.@comments?number != 0>
    77             ${bundle("comments", game.@comments?number)}
    78           </#if>
    79       </#macro>
    80 
    81       <#if (doc.openingNodeView.@whiteCount?number + doc.openingNodeView.@blackCount?number > 0)>
    82           <h3>${bundle.GAMES}</h3>
    83           <ol>
    84           <#list doc.openingNodeView.whiteGames.* as g>
    85                 <li>
    86                     <@game g/>
    87                 </li>
    88           </#list>
    89           <#list doc.openingNodeView.blackGames.* as g>
    90                 <li>
    91                     <@game g/>
    92                 </li>
    93           </#list>
    94           </ol>
    95       </#if>
    96   </body>
    97 </html>