1 %# $Id: form.mc,v 1.7 2006-11-15 17:58:35 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 [ contact => 0, "Contact", "e:databaseInfo/e:contact",
32 qw(e:title e:description) ],
33 [ extent => 3, "Extent", "e:databaseInfo/e:extent",
34 qw(e:title e:description) ],
35 [ history => 5, "History", "e:databaseInfo/e:history",
36 qw(e:title e:description) ],
37 [ language => 0, "Language of Records", "e:databaseInfo/e:langUsage",
38 qw(e:title e:description) ],
39 [ restrictions => 2, "Restrictions", "e:databaseInfo/e:restrictions",
40 qw(e:title e:description) ],
41 [ subjects => 2, "Subjects", "e:databaseInfo/e:subjects",
42 qw(e:title e:description) ],
46 my $update = $r->param("update");
47 if (defined $update) {
48 # Update record with submitted data
49 my %fieldsByKey = map { ( $_->[0], $_) } @fields;
51 foreach my $key ($r->param()) {
52 next if grep { $key eq $_ } qw(id update new copy);
53 $data{$key} = $r->param($key);
56 $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
58 ### Set e:metaInfo/e:dateModified
60 ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
63 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "[Untitled]") %></h2>
65 <p style="font-weight: bold">
66 The record has been <% $r->param("new") ? "created" : "updated" %>.<br/>
67 Changed <% $nchanges %> field<% $nchanges == 1 ? "" : "s" %>.
70 <form method="get" action="">
71 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
73 foreach my $ref (@fields) {
74 my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
77 <th><% $caption %></th>
79 % my $rawdata = $xc->findvalue($xpath);
80 % my $data = xml_encode($rawdata, "");
82 <select name="<% $name %>" size="1">
83 % foreach my $val (@$nlines) {
84 <option value="<% $val %>"
85 % print ' selected="selected"' if $rawdata eq $val;
90 <textarea name="<% $name %>" rows="<% $nlines %>" cols="61"><% $data %></textarea>
92 <input name="<% $name %>" type="text" size="60" value="<% $data %>">
98 <td align="right" colspan="2">
99 <input type="submit" name="update" value="Update"/>
101 <input type="hidden" name="id" value="<% xml_encode($id) %>"/>
103 <input type="hidden" name="new" value="1"/>
110 if ($nchanges && 0) {
111 my $x = $xc->getContextNode()->toString();
113 #$x =~ s/$/<br\/>/gm;
114 print "<pre>$x</pre>\n";