1 %# $Id: full.mc,v 1.11 2006-11-06 17:34:58 mike Exp $
9 my $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1");
10 $conn->option(elementSetName => "zeerex");
13 my $query = qq[rec.id="$qid"];
14 my $rs = $conn->search(new ZOOM::Query::CQL($query));
17 $m->comp("/details/error.mc",
18 title => "Error", message => "No such ID '$id'");
20 my $rec = $rs->record(0);
21 my $xc = irspy_xpath_context($rec);
23 [ "Last Checked" => "i:status/i:probe[last()]" ],
24 [ Protocol => "e:serverInfo/\@protocol" ],
25 [ Host => "e:serverInfo/e:host" ],
26 [ Port => "e:serverInfo/e:port" ],
27 [ "Database Name" => "e:serverInfo/e:database" ],
28 [ "Username (if needed)" =>
29 "e:serverInfo/e:authentication/e:user" ],
30 [ "Password (if needed)" =>
31 "e:serverInfo/e:authentication/e:password" ],
32 [ Title => "e:databaseInfo/e:title",
33 lang => "en", primary => "true" ],
34 [ Description => "e:databaseInfo/e:description",
35 lang => "en", primary => "true" ],
36 [ Author => "e:databaseInfo/e:author" ],
37 [ Contact => "e:databaseInfo/e:contact" ],
38 [ Extent => "e:databaseInfo/e:extent" ],
39 [ History => "e:databaseInfo/e:history" ],
40 [ "Language of Records" => "e:databaseInfo/e:langUsage" ],
41 [ Restrictions => "e:databaseInfo/e:restrictions" ],
42 [ Subjects => "e:databaseInfo/e:subjects" ],
43 [ "Implementation ID" => "i:status/i:implementationId" ],
44 [ "Implementation Name" => "i:status/i:implementationName" ],
45 [ "Implementation Version" => "i:status/i:implementationVersion" ],
46 [ "Reliability" => \&calc_reliability, $xc ],
47 [ "Services" => sub { "### IRSpy does not yet check for search, present, delSet, concurrentOperations, namedResultSets, etc. and store the information is a usable form." } ],
48 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
49 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
50 [ "Operators" => \&calc_boolean, $xc ],
51 [ "Record syntaxes" => \&calc_recsyn, $xc ],
52 [ "Explain" => sub { "### CategoryList, TargetInfo, DatabaseInfo, RecordSyntaxInfo, AttributeSetInfo, AttributeDetails" } ],
55 <h2><% xml_encode($xc->find("e:databaseInfo/e:title")) %></h2>
56 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
58 foreach my $ref (@fields) {
59 my($caption, $xpath, @args) = @$ref;
61 if (ref $xpath && ref($xpath) eq "CODE") {
62 $data = &$xpath(@args);
64 $data = $xc->find($xpath);
69 <th><% xml_encode($caption) %></th>
70 <td><% xml_encode($data) %></td>
78 sub calc_reliability {
81 my @allpings = $xc->findnodes("i:status/i:probe");
83 return "[untested]" if $nall == 0;
84 my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
86 return "$nok/$nall = " . int(100*$nok/$nall) . "%";
92 my $expr = 'e:indexInfo/e:index/e:map/e:attr[
93 @set = "'.$set.'" and @type = "1"]';
94 my @bib1nodes = $xc->findnodes($expr);
95 my $nbib1 = @bib1nodes;
96 return "[none]" if $nbib1 == 0;
100 @bib1nodes = sort { $a->findvalue(".") <=> $b->findvalue(".") } @bib1nodes;
101 foreach my $node (@bib1nodes) {
102 my $ap .= $node->findvalue(".");
103 if (!defined $first) {
105 } elsif (!defined $last || $last == $ap-1) {
108 # Got a complete range
109 $res .= ", " if $res ne "";
111 $res .= "-$last" if defined $last;
118 if (defined $first) {
119 $res .= ", " if $res ne "";
121 $res .= "-$last" if defined $last;
124 return "$nbib1 access points: $res";
130 ### Note that we are currently interrogating an IRSpy extension.
131 # The standard ZeeRex record should be extended with a
132 # "supports" type for this.
133 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
134 return join(", ", map { $_->findvalue('@operator') } @nodes);
140 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
141 return join(", ", map { $_->findvalue('@name') } @nodes);