1 %# $Id: form.mc,v 1.3 2006-11-14 16:09:14 mike Exp $
8 my $xc = irspy_xpath_context($rec);
11 [ protocol => 0, "Protocol", "e:serverInfo/\@protocol" ],
12 [ host => 0, "Host", "e:serverInfo/e:host" ],
13 [ port => 0, "Port", "e:serverInfo/e:port" ],
14 [ dbname => 0, "Database Name", "e:serverInfo/e:database",
16 [ username => 0, "Username (if needed)", "e:serverInfo/e:authentication/e:user",
18 [ password => 0, "Password (if needed)", "e:serverInfo/e:authentication/e:password",
20 [ title => 0, "title", "e:databaseInfo/e:title",
22 [ description => 5, "Description", "e:databaseInfo/e:description",
24 [ author => 0, "Author", "e:databaseInfo/e:author",
25 qw(e:title e:description) ],
26 [ contact => 0, "Contact", "e:databaseInfo/e:contact",
27 qw(e:title e:description) ],
28 [ extent => 3, "Extent", "e:databaseInfo/e:extent",
29 qw(e:title e:description) ],
30 [ history => 5, "History", "e:databaseInfo/e:history",
31 qw(e:title e:description) ],
32 [ language => 0, "Language of Records", "e:databaseInfo/e:langUsage",
33 qw(e:title e:description) ],
34 [ restrictions => 2, "Restrictions", "e:databaseInfo/e:restrictions",
35 qw(e:title e:description) ],
36 [ subjects => 2, "Subjects", "e:databaseInfo/e:subjects",
37 qw(e:title e:description) ],
41 my $update = $r->param("update");
42 if (defined $update) {
43 # Update record with submitted data
44 my %fieldsByKey = map { ( $_->[0], $_) } @fields;
46 foreach my $key ($r->param()) {
47 next if grep { $key eq $_ } qw(id update);
48 $data{$key} = $r->param($key);
51 $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data);
53 ### Set e:metaInfo/e:dateModified
55 ZOOM::IRSpy::_really_rewrite_record($conn, $xc->getContextNode());
58 <h2><% xml_encode($xc->find("e:databaseInfo/e:title"), "[Untitled]") %></h2>
60 <p style="font-weight: bold">
61 The record has been updated.<br/>
62 Changed <% $nchanges %> field<% $nchanges == 1 ? "" : "s" %>.
65 <form method="get" action="">
66 <table class="fullrecord" border="1" cellspacing="0" cellpadding="5" width="100%">
68 foreach my $ref (@fields) {
69 my($name, $nlines, $caption, $xpath, @addAfter) = @$ref;
72 <th><% $caption %></th>
74 % my $data = xml_encode($xc->find($xpath), "");
76 <textarea name="<% $name %>" rows="<% $nlines %>" cols="61"><% $data %></textarea>
78 <input name="<% $name %>" type="text" size="60" value="<% $data %>">
84 <td align="right" colspan="2">
85 <input type="submit" name="update" value="Update"/>
86 <input type="hidden" name="id" value="<% xml_encode($id) %>"/>
93 my $x = $xc->getContextNode()->toString();
96 print "<pre>$x</pre>\n";