1 %# $Id: found.mc,v 1.1 2006-09-15 16:51:51 mike Exp $
4 use XML::LibXML::XPathContext;
8 foreach my $key ($r->param()) {
10 my $val = $r->param($key);
12 $query .= " and " if $query ne "";
13 $query .= "$key = ($val)";
16 ### We can think about keeping the Connection object open to re-use
17 # for multiple requests, but that may not get us much. Same applies
19 my $conn = new ZOOM::Connection("localhost:1313/IR-Explain---1");
20 $conn->option(elementSetName => "zeerex");
21 my $parser = new XML::LibXML();
23 my $rs = $conn->search(new ZOOM::Query::CQL($query));
26 my $skip = $r->param("_skip") || 0;
27 my $count = $r->param("_count") || 10;
30 my $last = $first+$count-1;
31 $last = $n if $last > $n;
38 % } elsif ($first > $n) {
39 Past end of <% $n %> records
41 Records <% $first %> to <% $last %> of <% $n %>
44 % if ($n > 0 && $first <= $n) {
52 % foreach my $i ($first .. $last) {
54 my $rec = $rs->record($i-1);
55 my $xml = $rec->render();
56 my $doc = $parser->parse_string($xml);
57 my $root = $doc->getDocumentElement();
58 my $xc = XML::LibXML::XPathContext->new($root);
59 $xc->registerNs(e => 'http://explain.z3950.org/dtd/2.0/');
60 my $host = $xc->find("e:serverInfo/e:host");
61 my $port = $xc->find("e:serverInfo/e:port");
62 my $db = $xc->find("e:serverInfo/e:database");
64 <tr style="background: <% ($i % 2) ? '#ffffc0' : 'white' %>">