X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;ds=sidebyside;f=web%2Fhtdocs%2Fdetails%2Fedit.mc;h=92b5fa2c607b02d7879e65c4504771f51890cf70;hb=f710bbf2da2d0478be71ca49425aa70be89c26d2;hp=96a2948ff80f149d89d0a9a5e7decd7d3390f471;hpb=ffff14134a767a31948cb44d8c7695ab8e947aad;p=irspy-moved-to-github.git
diff --git a/web/htdocs/details/edit.mc b/web/htdocs/details/edit.mc
index 96a2948..92b5fa2 100644
--- a/web/htdocs/details/edit.mc
+++ b/web/htdocs/details/edit.mc
@@ -1,22 +1,44 @@
-%# $Id: edit.mc,v 1.13 2006-11-16 11:53:33 mike Exp $
+%# $Id: edit.mc,v 1.19 2006-11-16 17:52:06 mike Exp $
<%args>
$id => undef
%args>
<%perl>
my $conn = new ZOOM::Connection("localhost:3313/IR-Explain---1", 0,
- user => "admin", password => "fruitbat");
+ user => "admin", password => "fruitbat",
+ elementSetName => "zeerex");
my $rec = '
+You must specify host, port and database name.
\n]; + $r->param(update => 0); } else { - $rec = $rs->record(0); + my $query = cql_target($host, $port, $dbname); + my $rs = $conn->search(new ZOOM::Query::CQL($query)); + if ($rs->size() > 0) { + my $fakeid = xml_encode(uri_escape("$host:$port/$dbname")); + print qq[+There is already +a record +for this host, port and database name. +
\n]; + } } } @@ -59,7 +81,7 @@ my @fields = my $nchanges = 0; my $update = $r->param("update"); -if (defined $update) { + # Update record with submitted data my %fieldsByKey = map { ( $_->[0], $_) } @fields; my %data; @@ -67,8 +89,10 @@ if (defined $update) { next if grep { $key eq $_ } qw(id update new copy); $data{$key} = $r->param($key); } + my $mynchanges = modify_xml_document($xc, \%fieldsByKey, \%data); - $nchanges = modify_xml_document($xc, \%fieldsByKey, \%data); +if ($update) { + $nchanges = $mynchanges; if ($nchanges) { ### Set e:metaInfo/e:dateModified } @@ -102,9 +126,9 @@ foreach my $ref (@fields) { % } % } elsif ($nlines) { - + % } else { - + % }