From: Wolfram Schneider
Date: Tue, 27 Apr 2010 15:44:59 +0000 (+0000)
Subject: Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/irspy
X-Git-Tag: CPAN-v1.02~78
X-Git-Url: http://git.indexdata.com/?p=irspy-moved-to-github.git;a=commitdiff_plain;h=b583ad097a83649f459fecc09869817bdc8f127a;hp=058b3e0d9003ae8a44fe920ae9ccf7efd6554877
Merge branch 'master' of ssh://git.indexdata.com/home/git/pub/irspy
---
diff --git a/lib/ZOOM/IRSpy/Utils.pm b/lib/ZOOM/IRSpy/Utils.pm
index 1dc25e1..233222e 100644
--- a/lib/ZOOM/IRSpy/Utils.pm
+++ b/lib/ZOOM/IRSpy/Utils.pm
@@ -10,6 +10,7 @@ use Scalar::Util;
use Exporter 'import';
our @EXPORT_OK = qw(utf8param
trimField
+ utf8paramTrim
isodate
xml_encode
cql_quote
@@ -83,7 +84,6 @@ sub utf8param {
return $cooked;
}
-
# Utility functions follow, exported for use of web UI
sub utf8param_apache1 {
my($r, $key, $value) = @_;
@@ -115,6 +115,17 @@ sub trimField {
return $field;
}
+# utf8param() with trim
+sub utf8paramTrim {
+ my $result = utf8param(@_);
+
+ if (defined $result) {
+ $result = trimField($result);
+ }
+
+ return $result;
+}
+
# I can't -- just can't, can't, can't -- believe that this function
# isn't provided by one of the core XML modules. But the evidence all
# says that it's not: among other things, XML::Generator and
diff --git a/web/htdocs/chrome/layout.mc b/web/htdocs/chrome/layout.mc
index 69c0ac6..4de8b67 100644
--- a/web/htdocs/chrome/layout.mc
+++ b/web/htdocs/chrome/layout.mc
@@ -7,7 +7,7 @@ $component
use URI::Escape qw(uri_escape uri_escape_utf8);
use ZOOM;
use ZOOM::IRSpy::Web;
-use ZOOM::IRSpy::Utils qw(utf8param trimField isodate xml_encode cql_target cql_quote
+use ZOOM::IRSpy::Utils qw(utf8param trimField utf8paramTrim isodate xml_encode cql_target cql_quote
irspy_xpath_context irspy_make_identifier
irspy_record2identifier
irspy_identifier2target modify_xml_document
diff --git a/web/htdocs/details/edit.mc b/web/htdocs/details/edit.mc
index bfe3836..881b5ce 100644
--- a/web/htdocs/details/edit.mc
+++ b/web/htdocs/details/edit.mc
@@ -36,10 +36,11 @@ my $conn = new ZOOM::Connection($db, 0,
user => "admin", password => "fruitbat",
elementSetName => "zeerex");
-my $protocol = utf8param($r, "protocol");
-my $host = utf8param($r, "host");
-my $port = utf8param($r, "port");
-my $dbname = utf8param($r, "dbname");
+my $protocol = utf8paramTrim($r, "protocol");
+my $host = utf8paramTrim($r, "host");
+my $port = utf8paramTrim($r, "port");
+my $dbname = utf8paramTrim($r, "dbname");
+my $title = utf8paramTrim($r, "title");
if ((!defined $port || $port eq "") &&
(defined $protocol && $protocol ne "")) {
@@ -53,6 +54,7 @@ my $newid;
if (defined $protocol && $protocol ne "" &&
defined $host && $host ne "" &&
defined $port && $port ne "" &&
+ defined $title && $title ne "" &&
defined $dbname && $dbname ne "") {
$newid = irspy_make_identifier($protocol, $host, $port, $dbname);
}
@@ -66,7 +68,7 @@ if (!defined $id) {
} elsif (!defined $newid) {
# Tried to create new record but data is insufficient
print qq[
- Please specify protocol, host, port and database name.
\n];
+ Please specify title, protocol, host, port and database name.
\n];
undef $update;
} elsif ($host !~ /^\w+\.[\w.]*\w$/i) {
print qq[