diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index 9eaf0d111..dd27dda4e 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -19,9 +19,11 @@ use WebGUI::Affiliate; use WebGUI::Asset; use WebGUI::Cache; use WebGUI::Config; +use WebGUI::HTMLForm; use WebGUI::International; use WebGUI::Operation; use WebGUI::Session; +use WebGUI::User; use WebGUI::Utility; use WebGUI::PassiveProfiling; use Apache2::Request; @@ -90,11 +92,14 @@ sub contentHandler { $session->http->sendHeader; } elsif ($session->setting->get("specialState") eq "upgrading") { upgrading($session); - } elsif ($session->setting->get("specialState") eq "init") { - setup($session); } else { - my $output = ""; - if ($session->errorHandler->canShowPerformanceIndicators) { + my $output = processOperations($session); + if ($output ne "") { + # do nothing because we have operation output to display + $output = undef if ($output eq "chunked"); + } elsif ($session->setting->get("specialState") eq "init") { + $output = setup($session); + } elsif ($session->errorHandler->canShowPerformanceIndicators) { my $t = [Time::HiRes::gettimeofday()]; $output = page($session); $t = Time::HiRes::tv_interval($t) ; @@ -175,24 +180,22 @@ Optionally pass in a URL to be loaded. sub page { my $session = shift; my $assetUrl = shift || $session->url->getRequestedUrl; - my $output = processOperations($session); - if ($output eq "") { - my $asset = eval{WebGUI::Asset->newByUrl($session,$assetUrl,$session->form->process("revision"))}; - if ($@) { - $session->errorHandler->warn("Couldn't instantiate asset for url: ".$assetUrl." Root cause: ".$@); - } - if (defined $asset) { - my $method = "view"; - if ($session->form->process("func")) { - $method = $session->form->process("func"); - unless ($method =~ /^[A-Za-z]+$/) { - $session->errorHandler->security("to call a non-existent method $method on $assetUrl"); - $method = "view"; - } + my $asset = eval{WebGUI::Asset->newByUrl($session,$assetUrl,$session->form->process("revision"))}; + if ($@) { + $session->errorHandler->warn("Couldn't instantiate asset for url: ".$assetUrl." Root cause: ".$@); + } + my $output = undef; + if (defined $asset) { + my $method = "view"; + if ($session->form->process("func")) { + $method = $session->form->process("func"); + unless ($method =~ /^[A-Za-z]+$/) { + $session->errorHandler->security("to call a non-existent method $method on $assetUrl"); + $method = "view"; } - $output = tryAssetMethod($session,$asset,$method); - $output = tryAssetMethod($session,$asset,"view") unless ($output || ($method eq "view")); } + $output = tryAssetMethod($session,$asset,$method); + $output = tryAssetMethod($session,$asset,"view") unless ($output || ($method eq "view")); } if (defined($output) and $output eq "") { if ($session->var->isAdminOn) { # they're expecting it to be there, so let's help them add it @@ -254,8 +257,93 @@ The current WebGUI::Session object. sub setup { my $session = shift; - require WebGUI::Operation::WebGUI; - WebGUI::Operation::WebGUI::www_setup($session); + my $i18n = WebGUI::International->new($session, "WebGUI"); + my $output = ' + +
+
+
+';
+ $session->http->setCacheControl("none");
+ $session->http->setMimeType("text/html");
+ return $output;
}
diff --git a/lib/WebGUI/Operation.pm b/lib/WebGUI/Operation.pm
index a8d72f9d9..f6d60c02c 100644
--- a/lib/WebGUI/Operation.pm
+++ b/lib/WebGUI/Operation.pm
@@ -268,7 +268,6 @@ sub getOperations {
'setWorkingVersionTag' => 'WebGUI::Operation::VersionTag',
'genesis' => 'WebGUI::Operation::WebGUI',
- 'setup' => 'WebGUI::Operation::WebGUI',
'theWg' => 'WebGUI::Operation::WebGUI',
'addWorkflow' => 'WebGUI::Operation::Workflow',
diff --git a/lib/WebGUI/Operation/WebGUI.pm b/lib/WebGUI/Operation/WebGUI.pm
index c6b4102c7..f61372053 100644
--- a/lib/WebGUI/Operation/WebGUI.pm
+++ b/lib/WebGUI/Operation/WebGUI.pm
@@ -10,10 +10,7 @@ package WebGUI::Operation::WebGUI;
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
-use Digest::MD5;
use strict;
-use WebGUI::HTMLForm;
-use WebGUI::User;
#-------------------------------------------------------------------
@@ -43,117 +40,6 @@ sub www_genesis {
#-------------------------------------------------------------------
-=head2 www_setup ( )
-
-Initial setup for a brand new WebGUI install. Sets the administrator name,
-password and email address, as well as some other WebGUI settings.
-
-=cut
-
-
-sub www_setup {
- my $session = shift;
- return "" unless ($session->setting->get("specialState") eq "init");
- my $i18n = WebGUI::International->new($session, "WebGUI");
- my $output = '
-
-
-
-
-';
- $session->http->setCacheControl("none");
- $session->http->setMimeType("text/html");
- $session->http->sendHeader;
- $session->output->print($output);
-}
-
-
=head2 theWg ( )
The core WebGUI function. All WebGUI Assets, Operations and functions require this
@@ -162,7 +48,6 @@ to work, even superseding the session variable.
=cut
-#-------------------------------------------------------------------
sub www_theWg {
my $session = shift;
$session->style->useEmptyStyle("1");