From 6ba68835e0fbf4bac91fa144f43a0da91ae1045b Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 17 May 2006 23:25:49 +0000 Subject: [PATCH] fix [ 1488556 ] blank page after setup --- docs/changelog/6.x.x.txt | 2 ++ lib/WebGUI.pm | 3 +-- lib/WebGUI/Operation/WebGUI.pm | 11 ++++++----- lib/WebGUI/Session/Form.pm | 6 +++--- lib/WebGUI/Session/Http.pm | 16 +++++++++------- 5 files changed, 21 insertions(+), 17 deletions(-) diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 60332eeac..4af1abe91 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -28,6 +28,8 @@ - fix [ 1488850 ] Collaboration front page slow to load - The CS main listing is now 863% faster. - Fixed a problem where last reply column wasn't being updated in the thread. + - fix [ 1488556 ] blank page after setup + 6.99.0 - Added an Events Management System asset that can help people run diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index ff601e320..c7511a490 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -255,8 +255,7 @@ The current WebGUI::Session object. sub setup { my $session = shift; require WebGUI::Operation::WebGUI; - $session->http->sendHeader; - $session->output->print(WebGUI::Operation::WebGUI::www_setup($session)); + WebGUI::Operation::WebGUI::www_setup($session); } diff --git a/lib/WebGUI/Operation/WebGUI.pm b/lib/WebGUI/Operation/WebGUI.pm index 102f59eb6..8d81ac23a 100644 --- a/lib/WebGUI/Operation/WebGUI.pm +++ b/lib/WebGUI/Operation/WebGUI.pm @@ -41,6 +41,7 @@ sub www_genesis { return $output; } +#------------------------------------------------------------------- =head2 www_setup ( ) Initial setup for a brand new WebGUI install. Sets the administrator name, @@ -49,11 +50,8 @@ password and email address, as well as some other WebGUI settings. =cut -#------------------------------------------------------------------- sub www_setup { my $session = shift; - $session->http->setCacheControl("none"); - $session->http->setMimeType("text/html"); return "" unless ($session->setting->get("specialState") eq "init"); my $i18n = WebGUI::International->new($session, "WebGUI"); my $output = 'setting->set('companyEmail',$session->form->email("companyEmail")); $session->http->setRedirect($session->url->gateway()); $session->http->sendHeader; - return ""; + return undef; } else { $output .= 'Admin Account'; my $u = WebGUI::User->new($session,'3'); @@ -148,7 +146,10 @@ sub www_setup { '; - return $output; + $session->http->setCacheControl("none"); + $session->http->setMimeType("text/html"); + $session->http->sendHeader; + $session->output->print($output); } diff --git a/lib/WebGUI/Session/Form.pm b/lib/WebGUI/Session/Form.pm index fcd7c5da7..4c28bd710 100644 --- a/lib/WebGUI/Session/Form.pm +++ b/lib/WebGUI/Session/Form.pm @@ -119,13 +119,13 @@ sub new { #------------------------------------------------------------------- -=head2 param ( field ) +=head2 param ( [ field ] ) -Retrieves a form field post from the HTTP request. +Returns all the fields from a form post as an array. =head3 field -The name of the field to retrieve. +The name of the field to retrieve if you want to retrieve just one specific field. =cut diff --git a/lib/WebGUI/Session/Http.pm b/lib/WebGUI/Session/Http.pm index a0c71be8e..e51ebd0f4 100644 --- a/lib/WebGUI/Session/Http.pm +++ b/lib/WebGUI/Session/Http.pm @@ -184,17 +184,18 @@ sub sendHeader { } else { $request->content_type($self->{_http}{mimetype} || "text/html"); my $date = $self->session->datetime->epochToHuman(($self->{_http}{lastModified} || time()), "%W, %d %C %y %j:%m:%s %t"); + my $cc = $self->{_http}{cacheControl}; $request->headers_out->set('Last-Modified' => $date); - if ($self->{_http}{cacheControl} eq "none" || $self->session->setting->get("preventProxyCache") || ($self->{_http}{cacheControl} eq "" && $self->session->var->get("userId") ne "1")) { + if ($cc eq "none" || $self->session->setting->get("preventProxyCache") || ($cc eq "" && $self->session->var->get("userId") ne "1")) { $request->headers_out->set("Cache-Control" => "private"); $request->no_cache(1); - } elsif ($self->{_http}{cacheControl} ne "" && $request->protocol =~ /(\d\.\d)/ && $1 >= 1.1){ + } elsif ($cc ne "" && $request->protocol =~ /(\d\.\d)/ && $1 >= 1.1){ my $extras = ""; $extras .= ", private" unless ($self->session->var->get("userId") eq "1"); - $request->headers_out->set('Cache-Control' => "max-age=" . $self->{_http}{cacheControl}.$extras); - } elsif ($self->{_http}{cacheControl} ne "") { + $request->headers_out->set('Cache-Control' => "max-age=" . $cc.$extras); + } elsif ($cc ne "") { $request->headers_out->set("Cache-Control" => "private") unless ($self->session->var->get("userId") eq "1"); - my $date = $self->session->datetime->epochToHuman(time() + $self->{_http}{cacheControl}, "%W, %d %C %y %j:%m:%s %t"); + my $date = $self->session->datetime->epochToHuman(time() + $cc, "%W, %d %C %y %j:%m:%s %t"); $request->headers_out->set('Expires' => $date); } if ($self->{_http}{filename}) { @@ -234,7 +235,7 @@ Either the number of seconds until the cache expires, or the word "none" to disa sub setCacheControl { my $self = shift; my $timeout = shift; - $self->{_http}{cacheControl}; + $self->{_http}{cacheControl} = $timeout; } #------------------------------------------------------------------- @@ -364,7 +365,8 @@ The URL to redirect to. sub setRedirect { my $self = shift; my $url = shift; - return undef if ($url eq $self->session->url->page()); # prevent redirecting to self + my @params = $self->session->form->param; + return undef if ($url eq $self->session->url->page() && scalar(@params) < 1); # prevent redirecting to self $self->{_http}{location} = $url; $self->setStatus("302", "Redirect"); $self->session->style->setMeta({"http-equiv"=>"refresh",content=>"0; URL=".$url});