Skip to content
Permalink
Browse files

Item12180: Template and expand diagnostics for feedback protocol erro…

…r messages.

git-svn-id: http://svn.foswiki.org/trunk@15915 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information...
TimotheLitt TimotheLitt
TimotheLitt authored and TimotheLitt committed Nov 5, 2012
1 parent 0a3d1ae commit 499ee901e026fbc6930cf6fffb613663fd6c0d00
@@ -236,8 +236,6 @@ $query->delete('action');
}
$action =~ tr/A-Za-z0-9_-//cd;

#$action = 'feedbackUI' if( $action =~ /^test$/i && $method eq 'POST' ); #PATH_INFO test

our $redirect;

my $usePinfo = 01; # Check for OS/browser issues before turning on?
@@ -489,22 +487,31 @@ sub _validatefeedbackUI {
if ( $query->request_method() ne 'POST' ) {
invalidRequest( "", 405, Allow => 'POST' );
}
my $version = $query->http('X-Foswiki-FeedbackRequest') || '';
unless ( $version =~ /^V(\d+)\.(\d+)(\.\d+)?$/ && $1 == 1 ) {
my $eicon = $Foswiki::resourceURI . "icon_error.png";
htmlResponse(
(
qq {<html><head></head><body><div class="configureFeedbackError">
<h1><img src="$eicon">Invalid feedback request</h1>
<p><p><p><strong>Feedback request was not accepted</strong><p>}
. (
$version
? "Invalid Feedback protocol: $version"
: "Unidentified protocol"
)
. qq{</div></body></html>}
),
my $version = $query->http('X-Foswiki-FeedbackRequest');
unless ( defined $version
&& ( my $fmtOK = ( $version =~ /^V(\d+)\.(\d+)(\.\d+)?$/ ) )
&& $1 == 1 )
{
# Note that this can ONLY happen if the javascript and
# this code get out of sync.

::_loadBasicModule('Foswiki::Configure::UI');

my $html =
Foswiki::Configure::UI::getTemplateParser()
->readTemplate('feedbackprotocol');
$html = Foswiki::Configure::UI::getTemplateParser()->parse(
$html,
{
RESOURCEURI => $resourceURI,
version => $version,
etype => ( defined $version ? ( $fmtOK ? 3 : 2 ) : 1 ),
}
);
Foswiki::Configure::UI::getTemplateParser()
->cleanupTemplateResidues($html);

htmlResponse( $html, 200 );
}

::_loadBasicModule('Foswiki::Configure::Feedback');
@@ -0,0 +1,40 @@
<html>
<head>
<!-- This error is sent to a modal window when a feedback request
violates the protocl. It is not a full HTML context; the
content inside the body tags will be inserted into a
configureFeedbackErrorWindow div. Everything else is used
to identify this as a protocol exception, but is not displayed. -->
</head>
<#assign noHeader>
The message received was missing a FeedbackRequest header.
<p>The feedback mechanism is not for direct interactive use.
</#assign>
<#assign noVersion>
The message received had a malformed FeedbackRequest header.
<p> Please clear your browser's cache and refresh your window.
If this does not resolve the problem, your Foswiki installation
is corrupted.
</#assign>
<#assign versionSkew>
The message received was the wrong version (${version}).
<p> Please clear your browser's cache and refresh your window.
If this does not resolve the problem, your Foswiki installation
is corrupted.
</#assign>
<body>
<div class="configureFeedbackError">
<h1><img src="%RESOURCEURI%icon_error.png">Invalid feedback request</h1>
<h2>Feedback request was not accepted</h2><p>
<#if etype == 1>
${noHeader}
</#if>
<#if etype == 2>
${noVersion}
</#if>
<#if etype == 3>
${versionSkew}
</#if>
</div>
</body>
</html>
@@ -691,6 +691,7 @@ lib/Foswiki/Configure/templates/authorize.tmpl 0444
lib/Foswiki/Configure/templates/confirm.tmpl 0444
lib/Foswiki/Configure/templates/extensions.tmpl 0444
lib/Foswiki/Configure/templates/feedback.tmpl 0444
lib/Foswiki/Configure/templates/feedbackprotocol.tmpl 044
lib/Foswiki/Configure/templates/findextensionsintro.tmpl 0444
lib/Foswiki/Configure/templates/installed.tmpl 0444
lib/Foswiki/Configure/templates/main.tmpl 0444

0 comments on commit 499ee90

Please sign in to comment.
You can’t perform that action at this time.