1 %# $Id: full.mc,v 1.30 2007-07-03 13:10:50 mike Exp $
6 my $db = ZOOM::IRSpy::connect_to_registry();
7 my $conn = new ZOOM::Connection($db);
8 $conn->option(elementSetName => "zeerex");
9 my $query = cql_target($id);
10 my $rs = $conn->search(new ZOOM::Query::CQL($query));
13 $m->comp("/details/error.mc",
14 title => "Error", message => "No such ID '$id'");
16 my $xc = irspy_xpath_context($rs->record(0));
18 [ Name => "e:databaseInfo/e:title",
19 lang => "en", primary => "true" ],
20 [ Country => "i:status/i:country" ],
21 [ "Last Checked" => "i:status/i:probe[last()]" ],
22 [ Protocol => "e:serverInfo/\@protocol" ],
23 [ Host => "e:serverInfo/e:host" ],
24 [ Port => "e:serverInfo/e:port" ],
25 [ "Database Name" => "e:serverInfo/e:database" ],
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 [ "Operators" => \&calc_boolean, $xc ],
50 [ "Named Result Sets" => \&calc_nrs, $xc ],
51 [ "Record syntaxes" => \&calc_recsyn, $xc ],
52 [ "Explain" => \&calc_explain, $xc ],
54 my $title = $xc->find("e:databaseInfo/e:title");
56 <h2><% xml_encode($title, "") %></h2>
57 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
59 foreach my $ref (@fields) {
60 my($caption, $xpath, @args) = @$ref;
62 if (ref $xpath && ref($xpath) eq "CODE") {
63 ($data, $linkURL) = &$xpath($id, @args);
65 $data = $xc->find($xpath);
69 $caption =~ s/\/(.*)//;
71 my($linkstart, $linkend) = ("", "");
72 if (defined $linkURL) {
73 $linkstart = '<a href="' . xml_encode($linkURL) . '">';
77 <th><% xml_encode($caption) %><%
78 !defined $help ? "" : $m->comp("/help/link.mc", help =>"info/$help")
80 <td><% $linkstart . xml_encode($data) . $linkend %></td>
86 % my $target = irspy_identifier2target($id);
87 % $target =~ s/^tcp://; # Apparently ZAP can't handle the leading "tcp:"
88 <a href="<% xml_encode("http://targettest.indexdata.com/targettest/search/index.zap?" .
90 "target=" . uri_escape_utf8($target),
91 "name=" . uri_escape_utf8($title),
92 "attr=" . join(" ", _list_ap($xc, "bib-1")),
93 "formats=" . calc_recsyn($id, $xc, " ")))
94 %>">Search this target.</a>
99 sub calc_reliability_wrapper {
101 return calc_reliability_string($xc);
104 sub calc_init_options {
108 my @nodes = $xc->findnodes('e:configInfo/e:supports/@type');
109 foreach my $node (@nodes) {
110 my $type = $node->value();
111 if ($type =~ s/^z3950_//) {
116 return join(", ", @ops);
120 my($id, $xc, $set) = @_;
122 my @aps = _list_ap($xc, $set);
124 return "[none]" if $n == 0;
128 foreach my $ap (@aps) {
129 if (!defined $first) {
130 $first = $last = $ap;
131 } elsif ($ap == $last+1) {
134 # Got a complete range
135 $res .= ", " if $res ne "";
137 $res .= "-$last" if $last > $first;
138 $first = $last = $ap;
143 if (defined $first) {
144 $res .= ", " if $res ne "";
146 $res .= "-$last" if $last > $first;
149 return ("$n access points: $res",
150 "/ap.html?id=$id&set=$set");
156 my $expr = 'e:indexInfo/e:index[@search = "true"]/e:map/e:attr[
157 @set = "'.$set.'" and @type = "1"]';
158 my @nodes = $xc->findnodes($expr);
159 return sort { $a <=> $b } map { $_->findvalue(".") } @nodes;
165 ### Note that we are currently interrogating an IRSpy extension.
166 # The standard ZeeRex record should be extended with a
167 # "supports" type for this.
168 my @nodes = $xc->findnodes('i:status/i:boolean[@ok = "1"]');
169 my $res = join(", ", map { $_->findvalue('@operator') } @nodes);
170 $res = "[none]" if $res eq "";
177 my @nodes = $xc->findnodes('i:status/i:named_resultset[@ok = "1"]');
178 return @nodes ? "Yes" : "No";
182 my($id, $xc, $sep) = @_;
183 $sep = ", " if !defined $sep;
185 my @nodes = $xc->findnodes('e:recordInfo/e:recordSyntax');
186 my $res = join($sep, map { $_->findvalue('@name') } @nodes);
187 $res = "[none]" if $res eq "";
194 my @nodes = $xc->findnodes('i:status/i:explain[@ok = "1"]');
195 my $res = join(", ", map { $_->findvalue('@category') } @nodes);
196 $res = "[none]" if $res eq "";