getting closer to bucket output
This commit is contained in:
parent
deb6b353d6
commit
268947c1d5
8 changed files with 192 additions and 42 deletions
|
|
@ -172,7 +172,7 @@ sub error {
|
|||
my $self = shift;
|
||||
my $message = shift;
|
||||
$self->getLogger->error($message);
|
||||
print("\n\n".$message.":\n".$self->getStackTrace());
|
||||
$self->session->output->print("\n\n".$message.":\n".$self->getStackTrace());
|
||||
$self->getLogger->debug("Stack trace for ERROR ".$message."\n".$self->getStackTrace());
|
||||
$self->session->stow->set("debug_error", $self->session->stow->get("debug_error").$message."\n");
|
||||
}
|
||||
|
|
@ -193,19 +193,19 @@ sub fatal {
|
|||
Apache2::RequestUtil->request->content_type('text/html') if ($self->session->request);
|
||||
$self->getLogger->fatal($message);
|
||||
$self->getLogger->debug("Stack trace for FATAL ".$message."\n".$self->getStackTrace());
|
||||
print $self->session->http->getHeader if ($self->session->request);
|
||||
$self->session->output->print($self->session->http->getHeader) if ($self->session->request);
|
||||
unless ($self->canShowDebug()) {
|
||||
#NOTE: You can't internationalize this because with some types of errors that would cause an infinite loop.
|
||||
print "<h1>Problem With Request</h1>
|
||||
$self->session->output->print("<h1>Problem With Request</h1>
|
||||
We have encountered a problem with your request. Please use your back button and try again.
|
||||
If this problem persists, please contact us with what you were trying to do and the time and date of the problem.";
|
||||
print '<br />'.$self->session->setting("companyName");
|
||||
print '<br />'.$self->session->setting("companyEmail");
|
||||
print '<br />'.$self->session->setting("companyURL");
|
||||
If this problem persists, please contact us with what you were trying to do and the time and date of the problem.");
|
||||
$self->session->output->print('<br />'.$self->session->setting("companyName"));
|
||||
$self->session->output->print('<br />'.$self->session->setting("companyEmail"));
|
||||
$self->session->output->print('<br />'.$self->session->setting("companyURL"));
|
||||
} else {
|
||||
print "<h1>WebGUI Fatal Error</h1><p>Something unexpected happened that caused this system to fault.</p>\n";
|
||||
print "<p>".$message."</p>\n";
|
||||
print $self->showDebug();
|
||||
$self->session->output->print("<h1>WebGUI Fatal Error</h1><p>Something unexpected happened that caused this system to fault.</p>\n");
|
||||
$self->session->output->print("<p>".$message."</p>\n");
|
||||
$self->session->output->print($self->showDebug());
|
||||
}
|
||||
$self->session->close();
|
||||
die $message;
|
||||
|
|
|
|||
106
lib/WebGUI/Session/Output.pm
Normal file
106
lib/WebGUI/Session/Output.pm
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
package WebGUI::Session::Output;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2006 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use WebGUI::Macro;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Session::Output
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
This class provides a handler for returning output. Through this we can apply filters (like macros), and simple page caching mechanisms.
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
$session->output->print($content);
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
These methods are available from this package:
|
||||
|
||||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head DESTROY ( )
|
||||
|
||||
Deconstructor.
|
||||
|
||||
=cut
|
||||
|
||||
sub DESTROY {
|
||||
my $self = shift;
|
||||
undef $self;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 new ( session )
|
||||
|
||||
Constructor.
|
||||
|
||||
=head3 session
|
||||
|
||||
A reference to the current session.
|
||||
|
||||
=cut
|
||||
|
||||
sub new {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
bless {_session=>$session}, $class;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 print ( content )
|
||||
|
||||
Outputs content to either the web server or standard out, depending on which is available.
|
||||
|
||||
=head3 content
|
||||
|
||||
The content to output.
|
||||
|
||||
=cut
|
||||
|
||||
sub print {
|
||||
my $self = shift;
|
||||
my $content = shift;
|
||||
WebGUI::Macro::process($self->session, \$content);
|
||||
print $content;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 session ( )
|
||||
|
||||
Returns a reference to the current session.
|
||||
|
||||
=cut
|
||||
|
||||
sub session {
|
||||
my $self = shift;
|
||||
return $self->{_session};
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
|
@ -195,6 +195,7 @@ props["pageURL"] = "'.$self->session->url->page(undef, undef, 1).'";
|
|||
return props[propName];
|
||||
}
|
||||
</script>
|
||||
<!--morehead-->
|
||||
';
|
||||
if ($self->session->user->isInGroup(2)) {
|
||||
# This "triple incantation" panders to the delicate tastes of various browsers for reliable cache suppression.
|
||||
|
|
@ -204,7 +205,6 @@ if ($self->session->user->isInGroup(2)) {
|
|||
<meta http-equiv="Expires" content="0" />
|
||||
';
|
||||
}
|
||||
$var{'head.tags'} .= "\n<!-- macro head tags -->\n";
|
||||
my $style = WebGUI::Asset::Template->new($self->session,$templateId);
|
||||
my $output;
|
||||
if (defined $style) {
|
||||
|
|
@ -212,10 +212,9 @@ if ($self->session->user->isInGroup(2)) {
|
|||
} else {
|
||||
$output = "WebGUI was unable to instantiate your style template.".$var{'body.content'};
|
||||
}
|
||||
WebGUI::Macro::process($self->session,\$output);
|
||||
my $macroHeadTags = $self->generateAdditionalHeadTags();
|
||||
WebGUI::Macro::process($self->session,\$macroHeadTags);
|
||||
$output =~ s/\<\!-- macro head tags --\>/$macroHeadTags/;
|
||||
WebGUI::Macro::process(\$output);
|
||||
my $macroHeadTags = $self->generateAdditionalHeadTags();
|
||||
$output =~ s/\<\!--morehead--\>/$macroHeadTags/;
|
||||
if ($self->session->errorHandler->canShowDebug()) {
|
||||
$output .= $self->session->errorHandler->showDebug();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue