- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 12 Sep 2007 06:12:45 +0000
- To: www-validator-cvs@w3.org
Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv4469
Modified Files:
check
Log Message:
* Cleanup of the template variables used to determine whether upload or direct input has been used.
This complicates the template structure a little, since HTML::Template does not have <TMPL_ELSIF>, but in the long run it is cleaner than using is_upload
for direct input AND upload
* using a filtering routine to work around a HTML::Template bug with utf-8 encoded template files, see
http://lists.w3.org/Archives/Public/public-qa-dev/2007Sep/0006.html
Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.567
retrieving revision 1.568
diff -u -d -r1.567 -r1.568
--- check 11 Sep 2007 06:52:21 -0000 1.567
+++ check 12 Sep 2007 06:12:43 -0000 1.568
@@ -317,6 +317,10 @@
filename => File::Spec->catfile($CFG->{Paths}->{Templates},
$lang, 'result.tmpl'),
loop_context_vars => TRUE,
+ filter => sub {
+ my $ref = shift;
+ ${$ref} = Encode::decode_utf8(${$ref});
+ }
);
$File->{Templates}->{Error} = HTML::Template->new(
%template_defaults,
@@ -998,6 +1002,10 @@
$T->param(is_upload => $File->{'Is Upload'});
#
+ # Direct Input?
+ $T->param(is_direct_input => $File->{'Direct Input'});
+
+ #
# The URI...
$T->param(file_uri => $File->{URI});
$T->param(file_uri_param => uri_escape($File->{URI}));
@@ -1389,7 +1397,7 @@
$File->{Size} = '';
$File->{ContentType} = ''; # @@TODO?
$File->{URI} = 'upload://Form Submission';
- $File->{'Is Upload'} = TRUE;
+ $File->{'Is Upload'} = FALSE;
$File->{'Direct Input'} = TRUE;
$File->{Charset}->{HTTP} = "utf-8"; # by default, the form accepts utf-8 chars
@@ -1662,7 +1670,7 @@
# }
my $_msg = $RSRC->{msg}->{nomsg}->{verbose};
$_msg =~ s/<!--MID-->/$num/g;
- if ($File->{'Is Upload'})
+ if (($File->{'Is Upload'}) or ($File->{'Direct Input'}))
{
$_msg =~ s/<!--URI-->//g
}
@@ -1993,12 +2001,12 @@
# Supersede URL with an uploaded fragment.
if ($q->param('fragment')) {
$q->param('uri', 'upload://Form Submission');
- $File->{'Is Upload'} = TRUE; # Tag it for later use.
+ $File->{'Direct Input'} = TRUE; # Tag it for later use.
}
# Redirect to a GETable URL if method is POST without a file upload.
if (defined $q->request_method and $q->request_method eq 'POST'
- and not $File->{'Is Upload'}) {
+ and not ($File->{'Is Upload'} or $File->{'Direct Input'})) {
my $thispage = &self_url_q($q, $File);
print redirect $thispage;
exit;
Received on Wednesday, 12 September 2007 06:12:47 UTC