1 %# $Id: full.mc,v 1.15 2006-11-15 13:23:05 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 [ "Type of Library" => "i:status/i:libraryType" ],
29 [ Country => "i:status/i:country" ],
30 [ "Username (if needed)" =>
31 "e:serverInfo/e:authentication/e:user" ],
32 [ "Password (if needed)" =>
33 "e:serverInfo/e:authentication/e:password" ],
34 [ Title => "e:databaseInfo/e:title",
35 lang => "en", primary => "true" ],
36 [ Description => "e:databaseInfo/e:description",
37 lang => "en", primary => "true" ],
38 [ Author => "e:databaseInfo/e:author" ],
39 [ Contact => "e:databaseInfo/e:contact" ],
40 [ "URL to Hosting Organisation" => "i:status/i:hostURL" ],
41 [ Extent => "e:databaseInfo/e:extent" ],
42 [ History => "e:databaseInfo/e:history" ],
43 [ "Language of Records" => "e:databaseInfo/e:langUsage" ],
44 [ Restrictions => "e:databaseInfo/e:restrictions" ],
45 [ Subjects => "e:databaseInfo/e:subjects" ],
46 [ "Implementation ID" => "i:status/i:implementationId" ],
47 [ "Implementation Name" => "i:status/i:implementationName" ],
48 [ "Implementation Version" => "i:status/i:implementationVersion" ],
49 [ "Reliability" => \&calc_reliability, $xc ],
50 [ "Services" => sub { "
51 ### IRSpy does not yet check for search, present, delSet,
52 concurrentOperations, namedResultSets, etc. and store the information
53 is a usable form. This information should probably be harvested from
56 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
57 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
58 [ "Operators" => \&calc_boolean, $xc ],
59 [ "Named Result Sets" => \&calc_nrs, $xc ],
60 [ "Record syntaxes" => \&calc_recsyn, $xc ],
61 [ "Explain" => \&calc_explain, $xc ],
64 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "") %></h2>
65 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
67 foreach my $ref (@fields) {
68 my($caption, $xpath, @args) = @$ref;
70 if (ref $xpath && ref($xpath) eq "CODE") {
71 $data = &$xpath(@args);
73 $data = $xc->find($xpath);
78 <th><% xml_encode($caption) %></th>
79 <td><% xml_encode($data) %></td>
87 sub calc_reliability {
90 my @allpings = $xc->findnodes("i:status/i:probe");
92 return "[untested]" if $nall == 0;
93 my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
95 return "$nok/$nall = " . int(100*$nok/$nall) . "%";
101 my $expr = 'e:indexInfo/e:index/e:map/e:attr[
102 @set = "'.$set.'" and @type = "1"]';
103 my @bib1nodes = $xc->findnodes($expr);
104 my $nbib1 = @bib1nodes;
105 return "[none]" if $nbib1 == 0;
109 @bib1nodes = sort { $a->findvalue(".") <=> $b->findvalue(".") } @bib1nodes;
110 foreach my $node (@bib1nodes) {
111 my $ap .= $node->findvalue(".");
112 if (!defined $first) {
114 } elsif (!defined $last || $last == $ap-1) {
117 # Got a complete range
118 $res .= ", " if $res ne "";
120 $res .= "-$last" if defined $last;
127 if (defined $first) {
128 $res .= ", " if $res ne "";
130 $res .= "-$last" if defined $last;
133 return "$nbib1 access points: $res";
139 ### Note that we are currently interrogating an IRSpy extension.
140 # The standard ZeeRex record should be extended with a
141 # "supports" type for this.
142 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
143 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
144 $res = "[none]" if $res eq "";
151 my @nodes = $xc->findnodes('i:status/i:named_resultset[@ok = "1"]');
152 return @nodes ? "Yes" : "No";
158 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
159 my $res = join(", ", map { $_->findvalue('@name') } @nodes);
160 $res = "[none]" if $res eq "";
167 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
168 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
169 $res = "[none]" if $res eq "";