blob: a76ebcd9b18dc976671f83c2fd1c1f9f666f43aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# -*- coding: utf-8 -*-
from jfr_playoff.i18n import PlayoffI18N
class PlayoffTemplateStrings(object):
MATCH_TABLE = '''
<table border="0" cellspacing="0">
<tr>
<td class="s12" width="%d"> </td>
<td class="bdcc2" width="%d"> {{SCORE}} </td>
</tr>
%s
</table>
'''
MATCH_LINK = '''
<a href="%s" target="_top">
%s
</a>
'''
MATCH_SCORE = '''
%.1f
'''
MATCH_TEAM_LABEL = '<span class="team-label">%s</span>'
MATCH_PREDICTED_TEAM_LABEL = '<span class="team-predicted-label">%s</span>'
MATCH_TEAM_LIST_HEADER = '{{DETERMINED_TEAMS}}'
MATCH_POSSIBLE_TEAM_LIST_HEADER = '{{POSSIBLE_TEAMS}}'
MATCH_TEAM_LINK = '''
<a href="%s" onmouseover="Tip('%s')" onmouseout="UnTip()">%s</a>
'''
MATCH_TEAM_NON_LINK = '''
<a onmouseover="Tip('%s')" onmouseout="UnTip()">%s</a>
'''
MATCH_TEAM_ROW = '''
<tr class="%s">
<td class="bd1"> %s </td>
<td class="bdc">
%s
</td>
</tr>
'''
MATCH_RUNNING = '''
<img src="images/A.gif" />
<span style="font-size: 10pt">%d</span>
<img src="images/A.gif" />
'''
MATCH_GRID = '''
<div style="position: relative; width: %dpx; height: %dpx; margin: 10px">
<canvas width="%d" height="%d" id="playoff_canvas" %s></canvas>
%s
%s
%s
<script src="sklady/playoff.js" type="text/javascript"></script>
</div>
'''
MATCH_GRID_PHASE_LINK = '''
<a href="%s" target="_top" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx">
%s
</a>
'''
MATCH_GRID_PHASE_NON_LINK = '''
<span class="phase_header" style="display: inline-block; width: %dpx; text-align: center; position: absolute; top: 0; left: %dpx">
<p style="margin: 0">%s</p>
</span>
'''
MATCH_GRID_PHASE = '''
<font size="4">%s</font>
'''
MATCH_GRID_PHASE_RUNNING = '''
<img src="images/A.gif" />
<font size="4">%s</font>
<img src="images/A.gif" />
'''
STARTING_POSITION_BOX = '''
<div style="position: absolute; left: %dpx; top: %dpx" class="playoff_matchbox" data-id="place-%d">
%s
</div>
'''
FINISHING_POSITION_BOX = '''
<div style="position: absolute; right: 0px; top: %dpx" class="playoff_matchbox %s" data-id="finish-%d" data-finish-winner="%s" data-finish-loser="%s">
%s
</div>
'''
POSITION_BOX = '''
<table border="0" cellspacing="0">
<tr>
<td class="bdc12" width="20">%d</td>
</tr>
</table>
'''
CAPTIONED_POSITION_BOX = '''
<table border="0" cellspacing="0">
<tr>
<td class="bdc12" width="20">
<a onmouseover="Tip('%s')" onmouseout="UnTip()" style="width: 100%%; display: inline-block; cursor: pointer">%d</a>
</td>
</tr>
</table>
'''
MATCH_BOX = '''
<div style="text-align: center; position: absolute; left: %dpx; top: %dpx" data-id="%d" data-winner="%s" data-loser="%s" data-place-winner="%s" data-place-loser="%s" class="playoff_matchbox">
%s
</div>
'''
LEADERBOARD = '''
<table class="leaderboard" border="0" cellspacing="0">
<tr>
<td class="bdnl12" colspan="2" align="center" style="text-transform: uppercase"><b> {{FINAL_STANDINGS}} </b></td>
</tr>
<tr>
<td class="e" colspan="2"> </td>
</tr>
<tr>
<td class="bdcc12"> {{STANDINGS_PLACE}} </td>
<td class="bdcc2"> {{STANDINGS_TEAM}} </td>
</tr>
%s
</table>
'''
LEADERBOARD_ROW = '''
<tr class="%s">
<td class="bdc1">%d</td>
<td class="bd">
%s %s
</td>
</tr>
'''
LEADERBOARD_ROW_FLAG = '''
<img class="fl" src="images/%s" />
'''
LEADERBOARD_CAPTION_TABLE = '''
<table class="caption_table" border="0" cellspacing="0">
<tr><td class="e"> </td></tr>
<tr><td class="bdnl12" align="center" style="text-transform: uppercase"><b> {{STANDINGS_CAPTIONS}} </b></td></tr>
%s
</table>
'''
LEADERBOARD_CAPTION_TABLE_ROW = '''
<tr class="%s">
<td class="bd1">
%s
</td>
</tr>
'''
PAGE_HEAD = '''
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta name="robots" content="noarchive" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="Generator" content="PlayOff" />
%s
<title>%s</title>
<link rel="stylesheet" type="text/css" href="css/kolorki.css" />
<link rel="stylesheet" type="text/css" href="css/playoff.css" />
<script type="text/javascript" src="sklady/myAjax.js"></script>
'''
PAGE_HEAD_REFRESH = '''
<meta http-equiv="Refresh" content="%d" />
'''
PAGE_BODY = '''
<script type="text/javascript" src="sklady/wz_tooltip.js"></script>
%s
%s
<p class="swiss_links">
%s
</p>
%s
%s
%s
'''
PAGE_BODY_FOOTER = '''
<p class="f"> Admin ©Jan Romański'2005, PlayOff ©Michał Klichowicz'2017-2018, {{FOOTER_GENERATED}} %s</p>
'''
PAGE = '''
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
%s
</head>
<body class="all">
%s
</body>
</html>
'''
SWISS_LINK = '''
[<a href="%s" class="zb" target="_top"> %s </a>]<br /><br />
'''
SWISS_RUNNING_LINK = '''
[<a href="%s" class="zb" target="_top"> <img src="images/A.gif" /> %s <img src="images/A.gif" /> </a>]<br /><br />
'''
SWISS_DEFAULT_LABEL = '{{SWISS_DEFAULT_LABEL}}'
class PlayoffTemplate(object):
def __init__(self, settings):
self.i18n = PlayoffI18N(settings)
def get(self, string, *params):
return self.i18n.localize(
getattr(PlayoffTemplateStrings, string).decode('utf8')) % params
|