freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt
changeset 100 8b899ed24f9f
parent 99 fed05535725f
child 105 6e55d5c85d3c
     1.1 --- a/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt	Sat Sep 19 12:51:50 2009 +0200
     1.2 +++ b/freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/game.fmt	Sat Sep 19 14:38:29 2009 +0200
     1.3 @@ -29,12 +29,24 @@
     1.4  
     1.5  
     1.6        <p>
     1.7 +          <b>${bundle.MOVENUMBER}: </b> ${(doc.game.@currentMove?number / 2 + 1)?string("0")}<br>
     1.8            <b>${bundle.WHITE}:</b> <@status doc.game.id.@white/> ${bundle("FENCES_LEFT", board.players[0].fences)}<br>
     1.9            <b>${bundle.BLACK}:</b> <@status doc.game.id.@black/> ${bundle("FENCES_LEFT", board.players[1].fences)}<br>
    1.10        </p>
    1.11  
    1.12        <p>
    1.13        <a href="/">${bundle.ROOT}</a>
    1.14 +      <#if (doc.game.@currentMove?number > 0)>
    1.15 +        <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number - 1}">${bundle.PREVIOUS}</a>
    1.16 +      <#else>
    1.17 +        ${bundle.PREVIOUS}
    1.18 +      </#if>
    1.19 +      <a href="/games/${doc.game.id.@id}"">${bundle.LATEST}</a>
    1.20 +      <#if (doc.game.@currentMove?number < doc.game.moves.*?size)>
    1.21 +        <a href="/games/${doc.game.id.@id}?move=${doc.game.@currentMove?number + 1}">${bundle.NEXT}</a>
    1.22 +      <#else>
    1.23 +        ${bundle.NEXT}
    1.24 +      </#if>
    1.25        </p>
    1.26        
    1.27        <#if message?? >
    1.28 @@ -99,20 +111,38 @@
    1.29                <input type="submit" value="${bundle.RESIGN}" />
    1.30            </form>
    1.31        </#if>
    1.32 -
    1.33 +      <p>
    1.34 +      ${bundle.BOARD_VIEW}
    1.35        <#if format?? && format = "text">
    1.36          <pre>${doc.game.board}</pre>
    1.37 +        <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
    1.38          <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
    1.39 +        ${bundle.BOARD_TEXT}
    1.40 +      <#elseif format?? && format = "small">
    1.41 +        <p>
    1.42 +            <img src="/api/games/${doc.game.id.@id}?fieldSize=20<#if doc.game.@currentMove??>&move=${doc.game.@currentMove}</#if>" alt="${bundle.BOARD_TEXT}">
    1.43 +        </p>
    1.44 +        ${bundle.BOARD_SMALL}
    1.45 +        <a href="/games/${doc.game.id.@id}?format=image">${bundle.BOARD_IMAGE}</a>
    1.46 +        <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
    1.47        <#else>
    1.48          <p>
    1.49 -        <img src="/api/games/${doc.game.id.@id}" alt="text">
    1.50 +            <img src="/api/games/${doc.game.id.@id}<#if doc.game.@currentMove??>?move=${doc.game.@currentMove}</#if>" alt="${bundle.BOARD_TEXT}">
    1.51          </p>
    1.52 +        <a href="/games/${doc.game.id.@id}?format=small">${bundle.BOARD_SMALL}</a>
    1.53 +        ${bundle.BOARD_IMAGE}
    1.54          <a href="/games/${doc.game.id.@id}?format=text">${bundle.BOARD_TEXT}</a>
    1.55 -
    1.56        </#if>
    1.57  
    1.58 +      <#macro printMove item>
    1.59 +        <#if item.@index = doc.game.@currentMove>
    1.60 +            <b>${item.@move}</b>
    1.61 +        <#else>
    1.62 +            <a href="/games/${doc.game.id.@id}?move=${item.@index}">${item.@move}</a>
    1.63 +        </#if>
    1.64 +      </#macro>
    1.65  
    1.66 -      <h3>${bundle.MOVES}</h3>
    1.67 +      <h3><a href="/games/${doc.game.id.@id}?move=0">${bundle.MOVES}</a></h3>
    1.68  
    1.69        <table border="0">
    1.70            <thead>
    1.71 @@ -125,11 +155,12 @@
    1.72            <tbody>
    1.73                <#assign index = 0>
    1.74                <#list doc.game.moves.* as item>
    1.75 +                
    1.76                  <#if item.@index?number % 2 = 1>
    1.77                      <#assign index = index + 1>
    1.78 -                    <tr><td>${index}</td><td>${item.@move}</td>
    1.79 +                    <tr><td>${index}</td><td><@printMove item/></td>
    1.80                  <#else>
    1.81 -                    <td>${item.@move}</td></tr>
    1.82 +                    <td><@printMove item/></td></tr>
    1.83                  </#if>
    1.84                </#list>
    1.85            </tbody>