5 my $db = ZOOM::IRSpy::connect_to_registry();
6 my $conn = new ZOOM::Connection($db);
7 $conn->option(elementSetName => "zeerex");
8 my $query = cql_target($id);
9 my $rs = $conn->search(new ZOOM::Query::CQL($query));
12 $m->comp("/details/error.mc",
13 title => "Error", message => "No such ID '$id'");
15 my $xc = irspy_xpath_context($rs->record(0));
17 [ Name => "e:databaseInfo/e:title",
18 lang => "en", primary => "true" ],
19 [ Country => "i:status/i:country" ],
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 [ "Access Name (Unique DB)" => "e:databaseInfo/i:udb" ],
26 [ "Type of Library" => "i:status/i:libraryType" ],
27 # [ "Username (if needed)" => "e:serverInfo/e:authentication/e:user" ],
28 # [ "Password (if needed)" => "e:serverInfo/e:authentication/e:password" ],
29 [ "Proxy (if needed)" => "e:serverInfo/e:authentication/e:proxy" ],
30 [ "Server ID" => 'i:status/i:serverImplementationId/@value' ],
31 [ "Server Name" => 'i:status/i:serverImplementationName/@value' ],
32 [ "Server Version" => 'i:status/i:serverImplementationVersion/@value' ],
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/reliability" => \&calc_reliability_wrapper, $xc ],
47 [ "Services" => \&calc_init_options, $xc ],
48 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
49 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
50 [ "Bath Profile searches" => \&calc_bath, $xc ],
51 [ "Operators" => \&calc_boolean, $xc ],
52 [ "Named Result Sets" => \&calc_nrs, $xc ],
53 [ "Record syntaxes" => \&calc_recsyn, $xc ],
54 [ "Explain" => \&calc_explain, $xc ],
55 [ "Multiple OPAC records" => \&calc_mor, $xc ],
56 [ "Piggyback searching" => \&calc_piggyback, $xc ],
58 my $title = $xc->find("e:databaseInfo/e:title");
60 <h2><% xml_encode($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, $linkURL) = &$xpath($id, @args);
69 $data = $xc->find($xpath);
73 $caption =~ s/\/(.*)//;
75 my($linkstart, $linkend) = ("", "");
76 if (defined $linkURL) {
77 $linkstart = '<a href="' . xml_encode($linkURL) . '">';
81 <th><% xml_encode($caption) %><%
82 !defined $help ? "" : $m->comp("/help/link.mc", help =>"info/$help")
84 <td><% $linkstart . xml_encode($data) . $linkend %></td>
90 % my $target = irspy_identifier2target($id);
91 % $target =~ s/^tcp://; # Apparently ZAP can't handle the leading "tcp:"
92 <a href="<% xml_encode("http://targettest.indexdata.com/targettest/search/index.zap?" .
94 "target=" . uri_escape_utf8($target),
95 "name=" . uri_escape_utf8($title),
96 "attr=" . join(" ", _list_ap($xc, "bib-1")),
97 "formats=" . calc_recsyn($id, $xc, " ")))
98 %>">Search this target.</a>
103 sub calc_reliability_wrapper {
105 return calc_reliability_string($xc);
108 sub calc_init_options {
112 my @nodes = $xc->findnodes('e:configInfo/e:supports/@type');
113 foreach my $node (@nodes) {
114 my $type = $node->value();
115 if ($type =~ s/^z3950_//) {
120 return join(", ", @ops);
124 my($id, $xc, $set) = @_;
126 my @aps = _list_ap($xc, $set);
128 return "[none]" if $n == 0;
132 foreach my $ap (@aps) {
133 if (!defined $first) {
134 $first = $last = $ap;
135 } elsif ($ap == $last+1) {
138 # Got a complete range
139 $res .= ", " if $res ne "";
141 $res .= "-$last" if $last > $first;
142 $first = $last = $ap;
147 if (defined $first) {
148 $res .= ", " if $res ne "";
150 $res .= "-$last" if $last > $first;
153 return ("$n access points: $res",
154 "/ap.html?id=$id&set=$set");
160 my $expr = 'e:indexInfo/e:index[@search = "true"]/e:map/e:attr[
161 @set = "'.$set.'" and @type = "1"]';
162 my @nodes = $xc->findnodes($expr);
163 return sort { $a <=> $b } map { $_->findvalue(".") } @nodes;
169 my @nodes = $xc->findnodes('i:status/i:search_bath[@ok = "1"]');
170 my $res = join(", ", map { $_->findvalue('@name') } @nodes);
171 $res = "[none]" if $res eq "";
178 ### Note that we are currently interrogating an IRSpy extension.
179 # The standard ZeeRex record should be extended with a
180 # "supports" type for this.
181 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
182 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
183 $res = "[none]" if $res eq "";
187 sub calc_nrs { _calc_boolean(@_, 'i:status/i:named_resultset[@ok = "1"]') }
188 sub calc_mor { _calc_boolean(@_, 'i:status/i:multiple_opac[@ok = "1"]') }
189 sub calc_piggyback { _calc_boolean(@_, 'i:status/i:piggyback[@ok = "1"]') }
192 my($id, $xc, $xpath) = @_;
194 my @nodes = $xc->findnodes($xpath);
195 return @nodes ? "Yes" : "No";
199 my($id, $xc, $sep) = @_;
200 $sep = ", " if !defined $sep;
202 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
203 my $res = join($sep, map { $_->findvalue('@name') } @nodes);
204 $res = "[none]" if $res eq "";
211 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
212 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
213 $res = "[none]" if $res eq "";