d706a6272136b6ddf52ed853d3018804e1d36899
[irspy-moved-to-github.git] / web / htdocs / details / full.mc
1 %# $Id: full.mc,v 1.2 2006-10-26 17:23:13 mike Exp $
2 <%args>
3 $id
4 </%args>
5 <%once>
6 use ZOOM;
7 </%once>
8 <%perl>
9 my $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1");
10 $conn->option(elementSetName => "zeerex");
11 my $qid = $id;
12 $qid =~ s/"/\\"/g;
13 my $query = qq[rec.id="$qid"];
14 my $rs = $conn->search(new ZOOM::Query::CQL($query));
15 my $n = $rs->size();
16 if ($n == 0) {
17     $m->comp("/details/error.mc",
18              title => "Error", message => "No such ID '$id'");
19 } else {
20     my $rec = $rs->record(0);
21     my $xc = irspy_xpath_context($rec);
22     my @fields = (
23                   [ Protocol => "e:serverInfo/\@protocol" ],
24                   [ Host => "e:serverInfo/e:host" ],
25                   [ Port => "e:serverInfo/e:port" ],
26                   [ "Database Name" => "e:serverInfo/e:database" ],
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                   [ 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                   [ "Server ID" => sub { "CNIDR zserver v2.07g" } ],
43                   [ "Reliability" => sub { "97%" } ],
44                   [ "Services" => sub { "search, present, delSet, concurrentOperations, namedResultSets" } ],
45                   [ "Bib-1 Use attributes" => sub { "4-5, 7-8, 12, 21, 31, 54, 58, 63, 1003-1005, 1009, 1011-1012, 1016, 1031" } ],
46                   [ "Operators" => sub { "and, or, not" } ],
47                   [ "Record syntaxes" => sub { "SUTRS, USmarc, Danmarc" } ],
48                   [ "Explain" => sub { "CategoryList, TargetInfo, DatabaseInfo, RecordSyntaxInfo, AttributeSetInfo, AttributeDetails" } ],
49                   );
50 </%perl>
51      <h2><% xml_encode($id) %></h2>
52      <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
53 <%perl>
54     foreach my $ref (@fields) {
55         my($caption, $xpath, %attrs) = @$ref;
56         my $data;
57         if (ref $xpath && ref($xpath) eq "CODE") {
58             $data = &$xpath();
59         } else {
60             $data = $xc->find($xpath);
61         }
62         if ($data) {
63 </%perl>
64       <tr>
65        <th><% xml_encode($caption) %></th>
66        <td><% xml_encode($data) %></td>
67       </tr>
68 %       }
69 %   }
70      </table>
71      <p>
72       <a href="<% xml_encode("/raw.html?id=" . uri_escape($id))
73                 %>">Raw XML record</a>
74      </p>
75 % }