From adea84787597afc06def0a2e7c21b9ae7a1ea872 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 7 Apr 2006 19:35:31 +0000 Subject: [PATCH] fixed some xhhtml stuff increased performance on burst protection --- lib/WebGUI.pm | 4 +++- lib/WebGUI/Asset/Post/Thread.pm | 4 ++-- lib/WebGUI/Asset/Wobject.pm | 4 ++-- lib/WebGUI/Asset/Wobject/Layout.pm | 13 +++++++++---- lib/WebGUI/Asset/Wobject/Matrix.pm | 2 +- lib/WebGUI/Form/Textarea.pm | 10 +--------- lib/WebGUI/Session/ErrorHandler.pm | 18 +++++++++--------- lib/WebGUI/Session/Output.pm | 9 +++++++-- 8 files changed, 34 insertions(+), 30 deletions(-) diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index 82bcc14ec..f15235e19 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -107,7 +107,9 @@ sub contentHandler { $session->http->getHeader(); unless ($session->http->isRedirect()) { $session->output->print($output); - $session->output->goodNightAndGoodLuck(); + if ($session->errorHandler->canShowDebug()) { + $session->output->print($session->errorHandler->showDebug(),1); + } } WebGUI::Affiliate::grabReferral($session); # process affilliate tracking request } diff --git a/lib/WebGUI/Asset/Post/Thread.pm b/lib/WebGUI/Asset/Post/Thread.pm index b3c8046f3..8f386d162 100644 --- a/lib/WebGUI/Asset/Post/Thread.pm +++ b/lib/WebGUI/Asset/Post/Thread.pm @@ -1039,9 +1039,9 @@ sub www_view { $self->prepareView; my $style = $self->getParent->processStyle("~~~"); my ($head, $foot) = split("~~~",$style); - $self->session->output->print($head); + $self->session->output->print($head,1); $self->session->output->print($self->view); - $self->session->output->print($foot); + $self->session->output->print($foot,1); return "chunked"; } diff --git a/lib/WebGUI/Asset/Wobject.pm b/lib/WebGUI/Asset/Wobject.pm index 4d4f0838a..6841a8c9b 100644 --- a/lib/WebGUI/Asset/Wobject.pm +++ b/lib/WebGUI/Asset/Wobject.pm @@ -558,9 +558,9 @@ sub www_view { $self->prepareView; my $style = $self->processStyle("~~~"); my ($head, $foot) = split("~~~",$style); - $self->session->output->print($head); + $self->session->output->print($head, 1); $self->session->output->print($self->view); - $self->session->output->print($foot); + $self->session->output->print($foot, 1); return "chunked"; } diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 16bcd1c2c..e355d2858 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -15,6 +15,7 @@ package WebGUI::Asset::Wobject::Layout; =cut use strict; +use WebGUI::AdSpace; use WebGUI::Asset::Wobject; use WebGUI::Utility; use WebGUI::Cache; @@ -278,12 +279,16 @@ sub www_view { $cache->set($out, 60); $self->session->stow->delete("cacheFixOverride"); } + # keep those ads rotating while ($out =~ /(\[AD\:(\w+)\])/gs) { - my $ad = $1; - my $macro = "^AdSpace(".$2.");"; - $out =~ s/\Q$ad/$macro/ges; + my $code = $1; + my $adSpace = WebGUI::AdSpace->newByName($self->session, $2); + my $ad = $adSpace->displayImpression if (defined $adSpace); + $out =~ s/\Q$code/$ad/ges; } - return $out; + $self->session->http->getHeader; + $self->session->output->print($out, 1); + return "chunked"; } $self->{_viewPrintOverride} = 1; # we do this to make it output each easset as it goes, rather than waiting until the end return $self->SUPER::www_view; diff --git a/lib/WebGUI/Asset/Wobject/Matrix.pm b/lib/WebGUI/Asset/Wobject/Matrix.pm index acd907ae5..9b7f6706c 100644 --- a/lib/WebGUI/Asset/Wobject/Matrix.pm +++ b/lib/WebGUI/Asset/Wobject/Matrix.pm @@ -1184,7 +1184,7 @@ sub www_viewDetail { $f->submit( -extras=>'class="ratingForm"', -value=>"Rate", - -label=>''.$i18n->get('show ratings').'' + -label=>''.$i18n->get('show ratings').'' ); if ($hasRated) { $var{'ratings'} = $ratingsTable; diff --git a/lib/WebGUI/Form/Textarea.pm b/lib/WebGUI/Form/Textarea.pm index fec8cdc97..7b197e543 100644 --- a/lib/WebGUI/Form/Textarea.pm +++ b/lib/WebGUI/Form/Textarea.pm @@ -54,10 +54,6 @@ The number of rows (in characters) tall the box should be. Defaults to the setti The number of columns (in characters) wide the box should be. Defaults to the setting textAreaCols or 50 if that's not specified. -=head4 wrap - -The style of wrapping this form should use. Defaults to "virtual". Other possible values are "off" and "physical". - =head4 profileEnabled Flag that tells the User Profile system that this is a valid form element in a User Profile @@ -79,9 +75,6 @@ sub definition { columns=>{ defaultValue=> $session->setting->get("textAreaCols") || 50 }, - wrap=>{ - defaultValue=>"virtual" - }, profileEnabled=>{ defaultValue=>1 }, @@ -100,8 +93,7 @@ Renders an input tag of type text. sub toHtml { my $self = shift; my $value = $self->fixMacros($self->fixTags($self->fixSpecialCharacters($self->get("value")))); - return ''; + return ''; } diff --git a/lib/WebGUI/Session/ErrorHandler.pm b/lib/WebGUI/Session/ErrorHandler.pm index 1e773ad15..7c111d95c 100644 --- a/lib/WebGUI/Session/ErrorHandler.pm +++ b/lib/WebGUI/Session/ErrorHandler.pm @@ -170,7 +170,7 @@ sub error { my $self = shift; my $message = shift; $self->getLogger->error($message); - $self->session->output->print("\n\n".$message.":\n".$self->getStackTrace()); + $self->session->output->print("\n\n".$message.":\n".$self->getStackTrace(), 1); $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"); } @@ -191,19 +191,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()); - $self->session->output->print($self->session->http->getHeader) if ($self->session->request); + $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. $self->session->output->print("

Problem With Request

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."); - $self->session->output->print('
'.$self->session->setting("companyName")); - $self->session->output->print('
'.$self->session->setting("companyEmail")); - $self->session->output->print('
'.$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.",1); + $self->session->output->print('
'.$self->session->setting("companyName"),1); + $self->session->output->print('
'.$self->session->setting("companyEmail"),1); + $self->session->output->print('
'.$self->session->setting("companyURL"),1); } else { - $self->session->output->print("

WebGUI Fatal Error

Something unexpected happened that caused this system to fault.

\n"); - $self->session->output->print("

".$message."

\n"); - $self->session->output->print($self->showDebug()); + $self->session->output->print("

WebGUI Fatal Error

Something unexpected happened that caused this system to fault.

\n",1); + $self->session->output->print("

".$message."

\n",1); + $self->session->output->print($self->showDebug(),1); } $self->session->close(); die $message; diff --git a/lib/WebGUI/Session/Output.pm b/lib/WebGUI/Session/Output.pm index 2e67ce3c3..f082b3194 100644 --- a/lib/WebGUI/Session/Output.pm +++ b/lib/WebGUI/Session/Output.pm @@ -85,7 +85,7 @@ sub new { #------------------------------------------------------------------- -=head2 print ( content ) +=head2 print ( content, skipMacros ) Outputs content to either the web server or standard out, depending on which is available. @@ -93,12 +93,17 @@ Outputs content to either the web server or standard out, depending on which is The content to output. +=head3 skipMacros + +A boolean indicating whether to skip macro processing on this content. + =cut sub print { my $self = shift; my $content = shift; - WebGUI::Macro::process($self->session, \$content); + my $skipMacros = shift; + WebGUI::Macro::process($self->session, \$content) unless $skipMacros; print $content; }