aboutsummaryrefslogtreecommitdiffstats
path: root/root/html/includes/mirrorslist.tt
blob: 9088a49405ed34c7dfe6318bc4852557cd1ae107 (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
<form action="[% c.uri_for() %]">
<select name="country">
<option value="">--</option>
[% FOREACH country = c.model('Mirrors').country_list %]
<option value="[% country.code %]" [% "selected=select" IF country.code == c.req.param('country') %]>[% country.name | html %]</option>
[% END %]
</select>
<select name="protocol">
<option value="">--</option>
[% FOREACH p = c.model('Mirrors').protocol_list %]
<option value="[% p %]" [% "selected=select" IF p == c.req.param('protocol') %]>[% p %]</option>
[% END %]
</select>

<input type="submit">
</form>

[% db = c.model('Mirrors') %]
[% mirrorslist = db.find_mirrors({
    'protocol' => c.req.param('protocol'),
    'country'  => c.req.param('country'),
}) %]
[% FOREACH item = mirrorslist %]
[% IF loop.first %]
<table border=1>
<tr>
    <th>Server name</th>
    <th>Location</th>
    <th>Bandwidth</th>
    <th>Source</th>
    <th>Urls</th>
<tr>
[% END %]
<tr>
[% urls = db.find_urls({ "hostname" => item.hostname }) %]
<td>
<a href="[% c.uri_for('/mirrors', item.hostname) %]">[% item.hostname | html %]</a>
</td>
<td>
[% IF item.name %]
[% item.continent | html %], [% item.name | html %]
[% END %]
</td>
<td>
[% c.model('Mirrors').bandwidth_name(item.bandwidth) | html %]
</td>
<td>
[% item.syncfrom | html %]
</td>
<td>
[% IF item.public %]
[% FOREACH u = urls %]
[% IF u.valid %]
<a href="[% u.url %]">[% u.protocol %]</a>
[% ELSE %]
<span style="color: red">[% u.protocol %]</span>
[% END %]
[% END %]
[% ELSE %]
Private access
[% END %]
</td>
</tr>
[% IF loop.last %]
</table>
[% END %]
[% END %]