freemarkerdor/src/main/resources/cz/xelfi/quoridor/freemarkerdor/UI/index.fmt
author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
Sun, 20 Sep 2009 10:50:35 +0200
changeset 103 9a1eda26132d
parent 90 63ec24914da9
child 104 e37b229e238b
permissions -rw-r--r--
Cleanup of the index page. Giving it reasonable title.
jtulach@41
     1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
jtulach@41
     2
<html>
jaroslav@103
     3
  <#assign toMove = 0/>
jaroslav@103
     4
  <#assign toWait = 0/>
jaroslav@103
     5
  <#assign toWon = 0/>
jaroslav@103
     6
  <#assign toLost = 0/>
jaroslav@103
     7
  <#list doc.gameIds.* as g>
jaroslav@103
     8
    <#if (g.@white = user && g.@status = "whiteMove") ||
jaroslav@103
     9
         (g.@black = user && g.@status = "blackMove")
jaroslav@103
    10
    >
jaroslav@103
    11
        <#assign toMove = toMove + 1/>
jaroslav@103
    12
    </#if>
jaroslav@103
    13
    <#if (g.@white = user && g.@status = "blackMove") ||
jaroslav@103
    14
         (g.@black = user && g.@status = "whiteMove")
jaroslav@103
    15
    >
jaroslav@103
    16
        <#assign toWait = toWait + 1/>
jaroslav@103
    17
    </#if>
jaroslav@103
    18
    <#if
jaroslav@103
    19
        (g.@white = user && g.@status = "whiteWon") ||
jaroslav@103
    20
        (g.@black = user && g.@status = "blackWon")
jaroslav@103
    21
    >
jaroslav@103
    22
        <#assign toWon = toWon + 1/>
jaroslav@103
    23
    </#if>
jaroslav@103
    24
    <#if
jaroslav@103
    25
        (g.@white = user && g.@status = "blackWon") ||
jaroslav@103
    26
        (g.@black = user && g.@status = "whiteWon")
jaroslav@103
    27
    >
jaroslav@103
    28
        <#assign toLost = toLost + 1/>
jaroslav@103
    29
    </#if>
jaroslav@103
    30
  </#list>
jtulach@41
    31
  <head>
jaroslav@103
    32
    <title>
jaroslav@103
    33
        <#if (toMove > 0)>${bundle.YourTurn} - </#if>
jaroslav@103
    34
        ${bundle.TITLE}
jaroslav@103
    35
    </title>
jtulach@41
    36
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
jtulach@90
    37
    <meta http-equiv="REFRESH" content="60;URL=/">
jtulach@41
    38
  </head>
jtulach@41
    39
  <body>
jaroslav@59
    40
      <h1>${bundle.TITLE}</h1>
jaroslav@56
    41
jtulach@80
    42
      <#macro before t>
jtulach@80
    43
        <#assign seconds = (t / 1000)?int/>
jtulach@80
    44
        <#assign minutes= (seconds / 60)?int/>
jtulach@80
    45
        <#assign hours= (minutes / 60)?int/>
jtulach@80
    46
        <#assign days= (hours / 24)?int/>
jtulach@80
    47
        <!--millis: ${t}, seconds: ${seconds}, minutes: ${minutes} hours: ${hours}, days: ${days} -->
jtulach@80
    48
        ${bundle("LastMove", t?int, seconds?int, minutes?int, hours?int, days?int)}
jtulach@78
    49
      </#macro>
jtulach@78
    50
jaroslav@58
    51
      <#macro game game>
jtulach@78
    52
          ${bundle("gameWhiteBlack", game.@white?string, game.@black?string)} 
jtulach@80
    53
          <a href="/games/${game.@id}/"><@before (now - game.@modified?number)?int/></a>
jaroslav@58
    54
      </#macro>
jaroslav@58
    55
jaroslav@57
    56
      <#if message?? >
jaroslav@57
    57
        <p>
jaroslav@57
    58
            <span style="color: red">${message}</span>
jaroslav@57
    59
        </p>
jaroslav@57
    60
      </#if>
jaroslav@57
    61
jaroslav@103
    62
      <#if (toMove > 0)>
jaroslav@59
    63
      <h5>${bundle.GAME_MOVE}</h5>
jaroslav@56
    64
jaroslav@56
    65
      <ol>
jaroslav@56
    66
      <#list doc.gameIds.* as g>
jtulach@77
    67
        <#if (g.@white = user && g.@status = "whiteMove") ||
jtulach@77
    68
             (g.@black = user && g.@status = "blackMove")
jtulach@77
    69
        >
jtulach@77
    70
            <li>
jtulach@77
    71
                <@game g/>
jtulach@77
    72
            </li>
jtulach@77
    73
        </#if>
jtulach@77
    74
      </#list>
jtulach@77
    75
      </ol>
jaroslav@103
    76
      </#if>
jtulach@77
    77
jaroslav@103
    78
      <#if (toWait > 0)>
jtulach@77
    79
      <h5>${bundle.GAME_WAIT}</h5>
jtulach@77
    80
      <ol>
jtulach@77
    81
      <#list doc.gameIds.* as g>
jtulach@77
    82
        <#if (g.@white = user && g.@status = "blackMove") ||
jtulach@77
    83
             (g.@black = user && g.@status = "whiteMove")
jtulach@77
    84
        >
jaroslav@56
    85
            <li>
jaroslav@58
    86
                <@game g/>
jaroslav@56
    87
            </li>
jaroslav@56
    88
        </#if>
jaroslav@56
    89
      </#list>
jaroslav@56
    90
      </ol>
jaroslav@103
    91
      </#if>
jaroslav@56
    92
jaroslav@103
    93
      <#if (toWon > 0)><!-- ${toWon} -->
jaroslav@59
    94
      <h5>${bundle.GAME_WON}</h5>
jaroslav@57
    95
jaroslav@57
    96
      <ol>
jaroslav@57
    97
      <#list doc.gameIds.* as g>
jaroslav@57
    98
        <#if 
jtulach@77
    99
            (g.@white = user && g.@status = "whiteWon") ||
jtulach@77
   100
            (g.@black = user && g.@status = "blackWon")
jaroslav@57
   101
        >
jaroslav@57
   102
            <li>
jaroslav@58
   103
                <@game g/>
jaroslav@57
   104
            </li>
jaroslav@57
   105
        </#if>
jaroslav@57
   106
      </#list>
jaroslav@57
   107
      </ol>
jaroslav@103
   108
      </#if>
jaroslav@57
   109
jaroslav@103
   110
      <#if (toLost > 0)>
jaroslav@59
   111
      <h5>${bundle.GAME_LOST}</h5>
jaroslav@57
   112
jaroslav@57
   113
      <ol>
jaroslav@57
   114
      <#list doc.gameIds.* as g>
jaroslav@57
   115
        <#if
jtulach@77
   116
            (g.@white = user && g.@status = "blackWon") ||
jtulach@77
   117
            (g.@black = user && g.@status = "whiteWon")
jaroslav@57
   118
        >
jaroslav@57
   119
            <li>
jaroslav@58
   120
                <@game g/>
jaroslav@57
   121
            </li>
jaroslav@57
   122
        </#if>
jaroslav@57
   123
      </#list>
jaroslav@57
   124
      </ol>
jaroslav@103
   125
      </#if>
jaroslav@57
   126
jtulach@74
   127
      <form action="/games/create">
jaroslav@59
   128
            ${bundle.WHITE}: <input type="text" name="white" value="" />
jaroslav@59
   129
            ${bundle.BLACK}: <input type="text" name="black" value="" />
jaroslav@71
   130
            <input type="submit" value="${bundle.CREATE}" />
jaroslav@57
   131
      </form>
jaroslav@57
   132
jaroslav@59
   133
      <h5>${bundle.GAME_ALL}</h5>
jaroslav@56
   134
jtulach@41
   135
      <ol>
jtulach@54
   136
      <#list doc.gameIds.* as g>
jtulach@54
   137
        <li>
jaroslav@58
   138
            <@game g/>
jtulach@54
   139
        </li>
jtulach@41
   140
      </#list>
jtulach@41
   141
      </ol>
jaroslav@88
   142
      <hr/>
jaroslav@88
   143
      ${bundle("copyright", version)}
jtulach@41
   144
  </body>
jtulach@41
   145
</html>