From c899e929e8c4f48e1772e9e29e7de5d71ba5c84a Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Wed, 15 Nov 2006 17:58:35 +0000 Subject: [PATCH] Remove extraneous @addafter from hosturl entry. Skip "new" and "copy" parameters when assembling %data. "The record has need created" (not "updated") for new records. Correct element of dropdowns is selected based on current value. Undefined "id" is not submitted; instead "new=1". --- web/htdocs/details/form.mc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/web/htdocs/details/form.mc b/web/htdocs/details/form.mc index 12ffe1b..2812aec 100644 --- a/web/htdocs/details/form.mc +++ b/web/htdocs/details/form.mc @@ -1,4 +1,4 @@ -%# $Id: form.mc,v 1.6 2006-11-15 13:20:32 mike Exp $ +%# $Id: form.mc,v 1.7 2006-11-15 17:58:35 mike Exp $ <%args> $id => undef $conn @@ -27,8 +27,7 @@ my @fields = qw(e:title) ], [ author => 0, "Author", "e:databaseInfo/e:author", qw(e:title e:description) ], - [ hosturl => 0, "URL to Hosting Organisation", "i:status/i:hostURL", - qw(e:title e:description) ], + [ hosturl => 0, "URL to Hosting Organisation", "i:status/i:hostURL" ], [ contact => 0, "Contact", "e:databaseInfo/e:contact", qw(e:title e:description) ], [ extent => 3, "Extent", "e:databaseInfo/e:extent", @@ -50,7 +49,7 @@ if (defined $update) { my %fieldsByKey = map { ( $_->[0], $_) } @fields; my %data; foreach my $key ($r->param()) { - next if grep { $key eq $_ } qw(id update); + next if grep { $key eq $_ } qw(id update new copy); $data{$key} = $r->param($key); } @@ -64,7 +63,7 @@ if (defined $update) {

<% xml_encode($xc->find("e:databaseInfo/e:title"), "[Untitled]") %>

% if ($nchanges) {

- The record has been updated.
+ The record has been <% $r->param("new") ? "created" : "updated" %>.
Changed <% $nchanges %> field<% $nchanges == 1 ? "" : "s" %>.

% } @@ -77,11 +76,14 @@ foreach my $ref (@fields) { <% $caption %> -% my $data = xml_encode($xc->find($xpath), ""); +% my $rawdata = $xc->findvalue($xpath); +% my $data = xml_encode($rawdata, ""); % if (ref $nlines) { % } elsif ($nlines) { @@ -95,7 +97,11 @@ foreach my $ref (@fields) { +% if (defined $id) { +% } else { + +% } -- 1.7.10.4