3 my($params, $cond, $caption, $skip) = @_;
6 print(' <a href="', navlink($params, $caption, $skip),
7 '"', ">$caption</a>\n");
9 print qq[ <span class="disabled">$caption</span>\n];
14 my($params, $caption, $skip) = @_;
15 local $params->{_skip} = $skip;
16 my $url = "?" . join("&", map { "$_=" . $params->{$_} } sort keys %$params);
17 $url = xml_encode($url);
21 # Just make this once; forge the connection on first use
25 my %params = map { ( $_, utf8param($r, $_)) } grep { &utf8param($r, $_) } &utf8param($r);
27 if ($params{_query}) {
28 $query = $params{_query};
31 foreach my $key (keys %params) {
33 my $val = $params{$key};
35 $query .= " and " if $query ne "";
36 $query .= "$key = ($val)";
39 $query = 'cql.allRecords=1' if $query eq "";
41 my $sort = $params{"_sort"};
44 if ($sort =~ s/(\/.*)//) {
47 $query .= " or $sort=/sort";
48 $query .= "-desc" if $params{_desc};
53 my $tried_to_open = 0;
56 my $db = ZOOM::IRSpy::connect_to_registry();
57 $conn = new ZOOM::Connection($db);
58 $conn->option(elementSetName => "zeerex");
59 $conn->option(count => 20);
63 eval { $rs = $conn->search(new ZOOM::Query::CQL($query)) };
64 if ($@ && ref $@ && $@->isa('ZOOM::Exception') &&
65 $@->code() == ZOOM::Error::CONNECTION_LOST && !$tried_to_open) {
74 my $skip = $params{"_skip"} || 0;
75 my $count = $params{"_count"} || 10;
78 my $last = $first+$count-1;
79 $last = $n if $last > $n;
81 <form method="get" action=""><p>
82 <input type="text" name="_query" size="60" value="<% xml_encode($query) %>"/>
83 <input type="submit" name="_search" value="Search"/>
88 % } elsif ($first > $n) {
90 Past end of <% $n %> records
92 Records <% $first %> to <% $last %> of <% $n %><br/>
94 print_navlink(\%params, $skip > 0, "Prev", $count < $skip ? $skip-$count : 0);
95 print_navlink(\%params, $last < $n, "Next", $skip+$count);
99 % if ($n > 0 && $first <= $n) {
104 <th>Host Connection Reliability <& /help/link.mc, help => "info/reliability" &>
113 % $rs->records($first-1, $last-$first+1); ## Force pre-cache
114 % foreach my $i ($first .. $last) {
116 my $xc = irspy_xpath_context($rs->record($i-1));
117 my $title = $xc->find("e:databaseInfo/e:title") || "[UNTITLED]";
118 my $reliability = calc_reliability_string($xc);
119 my $host = $xc->find("e:serverInfo/e:host");
120 my $port = $xc->find("e:serverInfo/e:port");
121 my $db = $xc->find("e:serverInfo/e:database");
122 my $id = irspy_record2identifier($xc);
125 <tr style="background: <% ($i % 2) ? '#ffffc0' : 'white' %>">
127 <td><a href="<% xml_encode("/full.html?id=" . uri_escape_utf8($id))
128 %>"><% xml_encode($title) %></a></td>
129 <td><% xml_encode($reliability, "", { nbsp => 1 }) %></td>
130 <td><% xml_encode($host, "") %></td>
131 <td><% xml_encode($port, "") %></td>
132 <td><% xml_encode($db, "") %></td>
134 <a href="<% xml_encode("/admin/check.html?id=" . uri_escape_utf8($id))
135 %>" title="Test this target">Test</a
136 > <a href="<% xml_encode("/admin/edit.html?op=edit&id=" .
137 uri_escape_utf8($id))
138 %>" title="Edit this target's record">Edit</a
139 > <a href="<% xml_encode("/raw.html?id=" . uri_escape_utf8($id))
140 %>" title="Raw XML record">XML</a>
146 print_navlink(\%params, $skip > 0, "Prev", $count < $skip ? $skip-$count : 0);
147 print_navlink(\%params, $last < $n, "Next", $skip+$count);
150 <a href="<% "/admin/check.html?" .
151 xml_encode(join("&", map { "id=" . uri_escape_utf8($_) } @ids))
152 %>">[Test all targets on this list]</a>
155 <a href="<% "/stats.html?query=" . xml_encode(uri_escape_utf8($query))
156 %>">[Statistics for targets on this list]</a>