switched around the setup system so that spectre can still do it's thing even if users haven't gone through setup. this should help eliminate some of the memory leak problems.

This commit is contained in:
JT Smith 2006-05-25 16:30:54 +00:00
parent 39bd3ccce9
commit 5be99ea5eb
3 changed files with 110 additions and 138 deletions

View file

@ -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',

View file

@ -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 = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WebGUI Initial Configuration</title>
<style type="text/css">
a { color: black; }
a:visited { color: black;}
</style>
</head>
<body><div style="font-family: georgia, helvetica, arial, sans-serif; color: white; z-index: 10; width: 550px; height: 400px; top: 20%; left: 20%; position: absolute;"><h1>WebGUI Initial Configuration</h1><fieldset>';
if ($session->form->process("step") eq "2") {
$output .= '<legend align="left">Company Information</legend>';
my $u = WebGUI::User->new($session,"3");
$u->username($session->form->process("username","text","Admin"));
$u->profileField("email",$session->form->email("email"));
$u->identifier(Digest::MD5::md5_base64($session->form->process("identifier","password","123qwe")));
my $f = WebGUI::HTMLForm->new($session,action=>$session->url->gateway());
$f->hidden(
-name=>"op",
-value=>"setup"
);
$f->hidden(
-name=>"step",
-value=>"3"
);
$f->text(
-name=>"companyName",
-value=>$session->setting->get("companyName"),
-label=>$i18n->get(125),
-hoverHelp=>$i18n->get('125 description'),
);
$f->email(
-name=>"companyEmail",
-value=>$session->setting->get("companyEmail"),
-label=>$i18n->get(126),
-hoverHelp=>$i18n->get('126 description'),
);
$f->url(
-name=>"companyURL",
-value=>$session->setting->get("companyURL"),
-label=>$i18n->get(127),
-hoverHelp=>$i18n->get('127 description'),
);
$f->submit;
$output .= $f->print;
} elsif ($session->form->process("step") eq "3") {
$session->setting->remove('specialState');
$session->setting->set('companyName',$session->form->text("companyName"));
$session->setting->set('companyURL',$session->form->url("companyURL"));
$session->setting->set('companyEmail',$session->form->email("companyEmail"));
$session->http->setRedirect($session->url->gateway());
$session->http->sendHeader;
return undef;
} else {
$output .= '<legend align="left">Admin Account</legend>';
my $u = WebGUI::User->new($session,'3');
my $f = WebGUI::HTMLForm->new($session,action=>$session->url->gateway());
$f->hidden(
-name=>"op",
-value=>"setup"
);
$f->hidden(
-name=>"step",
-value=>"2"
);
$f->text(
-name=>"username",
-value=>$u->username,
-label=>$i18n->get(50),
-hoverHelp=>$i18n->get('50 setup description'),
);
$f->text(
-name=>"identifier",
-value=>"123qwe",
-label=>$i18n->get(51),
-hoverHelp=>$i18n->get('51 description'),
-subtext=>'<div style=\"font-size: 10px;\">('.$i18n->get("password clear text").')</div>'
);
$f->email(
-name=>"email",
-value=>$u->profileField("email"),
-label=>$i18n->get(56),
-hoverHelp=>$i18n->get('56 description'),
);
$f->submit;
$output .= $f->print;
}
$output .= '</fieldset></div>
<img src="'.$session->url->extras('background.jpg').'" style="border-style:none;position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 5;" />
</body>
</html>';
$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");