1 %# $Id: form.mc,v 1.4 2006-11-15 13:10:42 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 [ username => 0, "Username (if needed)", "e:serverInfo/e:authentication/e:user",
19 [ password => 0, "Password (if needed)", "e:serverInfo/e:authentication/e:password",
21 [ title => 0, "title", "e:databaseInfo/e:title",
23 [ description => 5, "Description", "e:databaseInfo/e:description",
25 [ author => 0, "Author", "e:databaseInfo/e:author",
26 qw(e:title e:description) ],
27 [ contact => 0, "Contact", "e:databaseInfo/e:contact",
28 qw(e:title e:description) ],
29 [ extent => 3, "Extent", "e:databaseInfo/e:extent",
30 qw(e:title e:description) ],
31 [ history => 5, "History", "e:databaseInfo/e:history",
32 qw(e:title e:description) ],
33 [ language => 0, "Language of Records", "e:databaseInfo/e:langUsage",
34 qw(e:title e:description) ],
35 [ restrictions => 2, "Restrictions", "e:databaseInfo/e:restrictions",
36 qw(e:title e:description) ],
37 [ subjects => 2, "Subjects", "e:databaseInfo/e:subjects",
38 qw(e:title e:description) ],
42 my $update = $r->param("update");
43 if (defined $update) {
44 # Update record with submitted data
45 my %fieldsByKey = map { ( $_->[0], $_) } @fields;
47 foreach my $key ($r->param()) {
48 next if grep { $key eq $_ } qw(id update);
49 $data{$key} = $r->param($key);
52 $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
54 ### Set e:metaInfo/e:dateModified
56 ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
59 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "[Untitled]") %></h2>
61 <p style="font-weight: bold">
62 The record has been updated.<br/>
63 Changed <% $nchanges %> field<% $nchanges == 1 ? "" : "s" %>.
66 <form method="get" action="">
67 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
69 foreach my $ref (@fields) {
70 my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
73 <th><% $caption %></th>
75 % my $data = xml_encode($xc->find($xpath), "");
77 <select name="<% $name %>" size="1">
78 % foreach my $val (@$nlines) {
79 <option value="<% $val %>"><% $val %></option>
83 <textarea name="<% $name %>" rows="<% $nlines %>" cols="61"><% $data %></textarea>
85 <input name="<% $name %>" type="text" size="60" value="<% $data %>">
91 <td align="right" colspan="2">
92 <input type="submit" name="update" value="Update"/>
93 <input type="hidden" name="id" value="<% xml_encode($id) %>"/>
100 my $x = $xc->getContextNode()->toString();
102 #$x =~ s/$/<br\/>/gm;
103 print "<pre>$x</pre>\n";