1 %# $Id: form.mc,v 1.6 2006-11-15 13:20:32 mike Exp $
8 my $xc = irspy_xpath_context($rec);
11 [ protocol => [ qw(Z39.50 SRW SRU SRW/U) ],
12 "Protocol", "e:serverInfo/\@protocol" ],
13 [ host => 0, "Host", "e:serverInfo/e:host" ],
14 [ port => 0, "Port", "e:serverInfo/e:port" ],
15 [ dbname => 0, "Database Name", "e:serverInfo/e:database",
17 [ type => [ qw(Academic Public Corporate Special National Education Other) ],
18 "Type of Library", "i:status/i:libraryType" ],
19 [ country => 0, "Country", "i:status/i:country" ],
20 [ username => 0, "Username (if needed)", "e:serverInfo/e:authentication/e:user",
22 [ password => 0, "Password (if needed)", "e:serverInfo/e:authentication/e:password",
24 [ title => 0, "Title", "e:databaseInfo/e:title",
26 [ description => 5, "Description", "e:databaseInfo/e:description",
28 [ author => 0, "Author", "e:databaseInfo/e:author",
29 qw(e:title e:description) ],
30 [ hosturl => 0, "URL to Hosting Organisation", "i:status/i:hostURL",
31 qw(e:title e:description) ],
32 [ contact => 0, "Contact", "e:databaseInfo/e:contact",
33 qw(e:title e:description) ],
34 [ extent => 3, "Extent", "e:databaseInfo/e:extent",
35 qw(e:title e:description) ],
36 [ history => 5, "History", "e:databaseInfo/e:history",
37 qw(e:title e:description) ],
38 [ language => 0, "Language of Records", "e:databaseInfo/e:langUsage",
39 qw(e:title e:description) ],
40 [ restrictions => 2, "Restrictions", "e:databaseInfo/e:restrictions",
41 qw(e:title e:description) ],
42 [ subjects => 2, "Subjects", "e:databaseInfo/e:subjects",
43 qw(e:title e:description) ],
47 my $update = $r->param("update");
48 if (defined $update) {
49 # Update record with submitted data
50 my %fieldsByKey = map { ( $_->[0], $_) } @fields;
52 foreach my $key ($r->param()) {
53 next if grep { $key eq $_ } qw(id update);
54 $data{$key} = $r->param($key);
57 $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
59 ### Set e:metaInfo/e:dateModified
61 ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
64 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "[Untitled]") %></h2>
66 <p style="font-weight: bold">
67 The record has been updated.<br/>
68 Changed <% $nchanges %> field<% $nchanges == 1 ? "" : "s" %>.
71 <form method="get" action="">
72 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
74 foreach my $ref (@fields) {
75 my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
78 <th><% $caption %></th>
80 % my $data = xml_encode($xc->find($xpath), "");
82 <select name="<% $name %>" size="1">
83 % foreach my $val (@$nlines) {
84 <option value="<% $val %>"><% $val %></option>
88 <textarea name="<% $name %>" rows="<% $nlines %>" cols="61"><% $data %></textarea>
90 <input name="<% $name %>" type="text" size="60" value="<% $data %>">
96 <td align="right" colspan="2">
97 <input type="submit" name="update" value="Update"/>
98 <input type="hidden" name="id" value="<% xml_encode($id) %>"/>
104 if ($nchanges && 0) {
105 my $x = $xc->getContextNode()->toString();
107 #$x =~ s/$/<br\/>/gm;
108 print "<pre>$x</pre>\n";