1 %# $Id: full.mc,v 1.16 2006-11-16 11:48:49 mike Exp $
6 my $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1");
7 $conn->option(elementSetName => "zeerex");
10 my $query = qq[rec.id="$qid"];
11 my $rs = $conn->search(new ZOOM::Query::CQL($query));
14 $m->comp("/details/error.mc",
15 title => "Error", message => "No such ID '$id'");
17 my $rec = $rs->record(0);
18 my $xc = irspy_xpath_context($rec);
20 [ "Last Checked" => "i:status/i:probe[last()]" ],
21 [ Protocol => "e:serverInfo/\@protocol" ],
22 [ Host => "e:serverInfo/e:host" ],
23 [ Port => "e:serverInfo/e:port" ],
24 [ "Database Name" => "e:serverInfo/e:database" ],
25 [ "Type of Library" => "i:status/i:libraryType" ],
26 [ Country => "i:status/i:country" ],
27 [ "Username (if needed)" =>
28 "e:serverInfo/e:authentication/e:user" ],
29 [ "Password (if needed)" =>
30 "e:serverInfo/e:authentication/e:password" ],
31 [ Title => "e:databaseInfo/e:title",
32 lang => "en", primary => "true" ],
33 [ Description => "e:databaseInfo/e:description",
34 lang => "en", primary => "true" ],
35 [ Author => "e:databaseInfo/e:author" ],
36 [ Contact => "e:databaseInfo/e:contact" ],
37 [ "URL to Hosting Organisation" => "i:status/i:hostURL" ],
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 { "
48 ### IRSpy does not yet check for search, present, delSet,
49 concurrentOperations, namedResultSets, etc. and store the information
50 is a usable form. This information should probably be harvested from
53 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
54 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
55 [ "Operators" => \&calc_boolean, $xc ],
56 [ "Named Result Sets" => \&calc_nrs, $xc ],
57 [ "Record syntaxes" => \&calc_recsyn, $xc ],
58 [ "Explain" => \&calc_explain, $xc ],
61 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "") %></h2>
62 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
64 foreach my $ref (@fields) {
65 my($caption, $xpath, @args) = @$ref;
67 if (ref $xpath && ref($xpath) eq "CODE") {
68 $data = &$xpath(@args);
70 $data = $xc->find($xpath);
75 <th><% xml_encode($caption) %></th>
76 <td><% xml_encode($data) %></td>
84 sub calc_reliability {
87 my @allpings = $xc->findnodes("i:status/i:probe");
89 return "[untested]" if $nall == 0;
90 my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
92 return "$nok/$nall = " . int(100*$nok/$nall) . "%";
98 my $expr = 'e:indexInfo/e:index/e:map/e:attr[
99 @set = "'.$set.'" and @type = "1"]';
100 my @bib1nodes = $xc->findnodes($expr);
101 my $nbib1 = @bib1nodes;
102 return "[none]" if $nbib1 == 0;
106 @bib1nodes = sort { $a->findvalue(".") <=> $b->findvalue(".") } @bib1nodes;
107 foreach my $node (@bib1nodes) {
108 my $ap .= $node->findvalue(".");
109 if (!defined $first) {
111 } elsif (!defined $last || $last == $ap-1) {
114 # Got a complete range
115 $res .= ", " if $res ne "";
117 $res .= "-$last" if defined $last;
124 if (defined $first) {
125 $res .= ", " if $res ne "";
127 $res .= "-$last" if defined $last;
130 return "$nbib1 access points: $res";
136 ### Note that we are currently interrogating an IRSpy extension.
137 # The standard ZeeRex record should be extended with a
138 # "supports" type for this.
139 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
140 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
141 $res = "[none]" if $res eq "";
148 my @nodes = $xc->findnodes('i:status/i:named_resultset[@ok = "1"]');
149 return @nodes ? "Yes" : "No";
155 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
156 my $res = join(", ", map { $_->findvalue('@name') } @nodes);
157 $res = "[none]" if $res eq "";
164 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
165 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
166 $res = "[none]" if $res eq "";