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 [ "Server ID" => 'i:status/i:serverImplementationId/@value' ],
30 [ "Server Name" => 'i:status/i:serverImplementationName/@value' ],
31 [ "Server Version" => 'i:status/i:serverImplementationVersion/@value' ],
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/reliability" => \&calc_reliability_wrapper, $xc ],
46 [ "Services" => \&calc_init_options, $xc ],
47 [ "Bib-1 Use attributes" => \&calc_ap, $xc, "bib-1" ],
48 [ "Dan-1 Use attributes" => \&calc_ap, $xc, "dan-1" ],
49 [ "Bath Profile searches" => \&calc_bath, $xc ],
50 [ "Operators" => \&calc_boolean, $xc ],
51 [ "Named Result Sets" => \&calc_nrs, $xc ],
52 [ "Record syntaxes" => \&calc_recsyn, $xc ],
53 [ "Explain" => \&calc_explain, $xc ],
54 [ "Multiple OPAC records" => \&calc_mor, $xc ],
55 [ "Piggyback searching" => \&calc_piggyback, $xc ],
57 my $title = $xc->find("e:databaseInfo/e:title");
59 <h2><% xml_encode($title, "") %></h2>
60 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
62 foreach my $ref (@fields) {
63 my($caption, $xpath, @args) = @$ref;
65 if (ref $xpath && ref($xpath) eq "CODE") {
66 ($data, $linkURL) = &$xpath($id, @args);
68 $data = $xc->find($xpath);
72 $caption =~ s/\/(.*)//;
74 my($linkstart, $linkend) = ("", "");
75 if (defined $linkURL) {
76 $linkstart = '<a href="' . xml_encode($linkURL) . '">';
80 <th><% xml_encode($caption) %><%
81 !defined $help ? "" : $m->comp("/help/link.mc", help =>"info/$help")
83 <td><% $linkstart . xml_encode($data) . $linkend %></td>
89 % my $target = irspy_identifier2target($id);
90 % $target =~ s/^tcp://; # Apparently ZAP can't handle the leading "tcp:"
91 <a href="<% xml_encode("http://targettest.indexdata.com/targettest/search/index.zap?" .
93 "target=" . uri_escape_utf8($target),
94 "name=" . uri_escape_utf8($title),
95 "attr=" . join(" ", _list_ap($xc, "bib-1")),
96 "formats=" . calc_recsyn($id, $xc, " ")))
97 %>">Search this target.</a>
102 sub calc_reliability_wrapper {
104 return calc_reliability_string($xc);
107 sub calc_init_options {
111 my @nodes = $xc->findnodes('e:configInfo/e:supports/@type');
112 foreach my $node (@nodes) {
113 my $type = $node->value();
114 if ($type =~ s/^z3950_//) {
119 return join(", ", @ops);
123 my($id, $xc, $set) = @_;
125 my @aps = _list_ap($xc, $set);
127 return "[none]" if $n == 0;
131 foreach my $ap (@aps) {
132 if (!defined $first) {
133 $first = $last = $ap;
134 } elsif ($ap == $last+1) {
137 # Got a complete range
138 $res .= ", " if $res ne "";
140 $res .= "-$last" if $last > $first;
141 $first = $last = $ap;
146 if (defined $first) {
147 $res .= ", " if $res ne "";
149 $res .= "-$last" if $last > $first;
152 return ("$n access points: $res",
153 "/ap.html?id=$id&set=$set");
159 my $expr = 'e:indexInfo/e:index[@search = "true"]/e:map/e:attr[
160 @set = "'.$set.'" and @type = "1"]';
161 my @nodes = $xc->findnodes($expr);
162 return sort { $a <=> $b } map { $_->findvalue(".") } @nodes;
168 my @nodes = $xc->findnodes('i:status/i:search_bath[@ok = "1"]');
169 my $res = join(", ", map { $_->findvalue('@name') } @nodes);
170 $res = "[none]" if $res eq "";
177 ### Note that we are currently interrogating an IRSpy extension.
178 # The standard ZeeRex record should be extended with a
179 # "supports" type for this.
180 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
181 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
182 $res = "[none]" if $res eq "";
186 sub calc_nrs { _calc_boolean(@_, 'i:status/i:named_resultset[@ok = "1"]') }
187 sub calc_mor { _calc_boolean(@_, 'i:status/i:multiple_opac[@ok = "1"]') }
188 sub calc_piggyback { _calc_boolean(@_, 'i:status/i:piggyback[@ok = "1"]') }
191 my($id, $xc, $xpath) = @_;
193 my @nodes = $xc->findnodes($xpath);
194 return @nodes ? "Yes" : "No";
198 my($id, $xc, $sep) = @_;
199 $sep = ", " if !defined $sep;
201 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
202 my $res = join($sep, map { $_->findvalue('@name') } @nodes);
203 $res = "[none]" if $res eq "";
210 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
211 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
212 $res = "[none]" if $res eq "";