1 %# $Id: full.mc,v 1.17 2006-11-16 17:12:30 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 $xc = irspy_xpath_context($rs->record(0));
19 [ "Last Checked" => "i:status/i:probe[last()]" ],
20 [ Protocol => "e:serverInfo/\@protocol" ],
21 [ Host => "e:serverInfo/e:host" ],
22 [ Port => "e:serverInfo/e:port" ],
23 [ "Database Name" => "e:serverInfo/e:database" ],
24 [ "Type of Library" => "i:status/i:libraryType" ],
25 [ Country => "i:status/i:country" ],
26 [ "Username (if needed)" =>
27 "e:serverInfo/e:authentication/e:user" ],
28 [ "Password (if needed)" =>
29 "e:serverInfo/e:authentication/e:password" ],
30 [ Title => "e:databaseInfo/e:title",
31 lang => "en", primary => "true" ],
32 [ Description => "e:databaseInfo/e:description",
33 lang => "en", primary => "true" ],
34 [ Author => "e:databaseInfo/e:author" ],
35 [ Contact => "e:databaseInfo/e:contact" ],
36 [ "URL to Hosting Organisation" => "i:status/i:hostURL" ],
37 [ Extent => "e:databaseInfo/e:extent" ],
38 [ History => "e:databaseInfo/e:history" ],
39 [ "Language of Records" => "e:databaseInfo/e:langUsage" ],
40 [ Restrictions => "e:databaseInfo/e:restrictions" ],
41 [ Subjects => "e:databaseInfo/e:subjects" ],
42 [ "Implementation ID" => "i:status/i:implementationId" ],
43 [ "Implementation Name" => "i:status/i:implementationName" ],
44 [ "Implementation Version" => "i:status/i:implementationVersion" ],
45 [ "Reliability" => \&calc_reliability, $xc ],
46 [ "Services" => sub { "
47 ### IRSpy does not yet check for search, present, delSet,
48 concurrentOperations, namedResultSets, etc. and store the information
49 is a usable form. This information should probably be harvested from
52 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
53 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
54 [ "Operators" => \&calc_boolean, $xc ],
55 [ "Named Result Sets" => \&calc_nrs, $xc ],
56 [ "Record syntaxes" => \&calc_recsyn, $xc ],
57 [ "Explain" => \&calc_explain, $xc ],
60 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "") %></h2>
61 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
63 foreach my $ref (@fields) {
64 my($caption, $xpath, @args) = @$ref;
66 if (ref $xpath && ref($xpath) eq "CODE") {
67 $data = &$xpath(@args);
69 $data = $xc->find($xpath);
74 <th><% xml_encode($caption) %></th>
75 <td><% xml_encode($data) %></td>
83 sub calc_reliability {
86 my @allpings = $xc->findnodes("i:status/i:probe");
88 return "[untested]" if $nall == 0;
89 my @okpings = $xc->findnodes('i:status/i:probe[@ok = "1"]');
91 return "$nok/$nall = " . int(100*$nok/$nall) . "%";
97 my $expr = 'e:indexInfo/e:index/e:map/e:attr[
98 @set = "'.$set.'" and @type = "1"]';
99 my @bib1nodes = $xc->findnodes($expr);
100 my $nbib1 = @bib1nodes;
101 return "[none]" if $nbib1 == 0;
105 @bib1nodes = sort { $a->findvalue(".") <=> $b->findvalue(".") } @bib1nodes;
106 foreach my $node (@bib1nodes) {
107 my $ap .= $node->findvalue(".");
108 if (!defined $first) {
110 } elsif (!defined $last || $last == $ap-1) {
113 # Got a complete range
114 $res .= ", " if $res ne "";
116 $res .= "-$last" if defined $last;
123 if (defined $first) {
124 $res .= ", " if $res ne "";
126 $res .= "-$last" if defined $last;
129 return "$nbib1 access points: $res";
135 ### Note that we are currently interrogating an IRSpy extension.
136 # The standard ZeeRex record should be extended with a
137 # "supports" type for this.
138 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
139 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
140 $res = "[none]" if $res eq "";
147 my @nodes = $xc->findnodes('i:status/i:named_resultset[@ok = "1"]');
148 return @nodes ? "Yes" : "No";
154 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
155 my $res = join(", ", map { $_->findvalue('@name') } @nodes);
156 $res = "[none]" if $res eq "";
163 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
164 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
165 $res = "[none]" if $res eq "";