changes for new demo system

This commit is contained in:
JT Smith 2005-12-01 19:49:05 +00:00
parent 09bf2b263f
commit abe85d439e
2 changed files with 20 additions and 21 deletions

View file

@ -38,30 +38,29 @@ use Apache2::RequestIO ();
use Apache2::Const -compile => qw(OK DECLINED NOT_FOUND);
use Apache2::ServerUtil ();
#-------------------------------------------------------------------
sub handler {
my $r = shift;
$session{site} = shift || $r->dir_config('WebguiConfig');
my $s = Apache2::ServerUtil->server;
$session{wguri} = $r->uri;
$session{site} = $r->dir_config('WebguiConfig');
$session{config} = WebGUI::Config::getConfig($s->dir_config('WebguiRoot'),$session{site});
### Add Apache Request stuff to global session. Yes, I know the global hash will eventually be deprecated.
foreach my $url ($session{config}{extrasURL}, @{$session{config}{passthruUrls}}) {
return Apache2::Const::DECLINED if ($session{wguri} =~ m/^$url/);
}
my $uploads = $session{config}{uploadsURL};
if ($session{wguri} =~ m/^$uploads/) {
# foreach my $url ($session{config}{extrasURL}, @{$session{config}{passthruUrls}}) {
# return Apache2::Const::DECLINED if ($session{wguri} =~ m/^$url/);
# }
# my $uploads = $session{config}{uploadsURL};
# if ($session{wguri} =~ m/^$uploads/) {
# $r->handler('perl-script');
$r->set_handlers(PerlAccessHandler => \&uploadsHandler);
} else {
# $r->set_handlers(PerlAccessHandler => \&uploadsHandler);
# } else {
$session{requestedUrl} = $session{wguri};
my $gateway = $session{config}{gateway};
$session{requestedUrl} =~ s/^$gateway(.*)$/$1/;
# $r->handler('perl-script');
$r->set_handlers(PerlResponseHandler => \&contentHandler);
$r->set_handlers(PerlTransHandler => sub { return Apache2::Const::OK });
}
# }
return Apache2::Const::DECLINED;
}

View file

@ -18,6 +18,7 @@ use WebGUI::HTTP;
use WebGUI::Session;
use WebGUI::Setting;
use WebGUI::Style;
use WebGUI::URL;
use WebGUI::User;
#-------------------------------------------------------------------
@ -40,19 +41,17 @@ sub www_genesis {
#-------------------------------------------------------------------
sub www_setup {
return "" unless ($session{setting}{specialState} eq "init");
my $i18n = WebGUI::International->new("WebGUI");
unless ($session{setting}{specialState} eq "init") {
if (rand(10)>5) {
return www_genesis();
} else {
return www_theWg();
}
}
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}{step} eq "2") {
@ -61,7 +60,7 @@ sub www_setup {
$u->username(WebGUI::FormProcessor::process("username","text","Admin"));
$u->profileField("email",WebGUI::FormProcessor::email("email"));
$u->identifier(Digest::MD5::md5_base64(WebGUI::FormProcessor::process("identifier","password","123qwe")));
my $f = WebGUI::HTMLForm->new;
my $f = WebGUI::HTMLForm->new(action=>WebGUI::URL::gateway());
$f->hidden(
-name=>"op",
-value=>"setup"
@ -91,16 +90,17 @@ sub www_setup {
$f->submit;
$output .= $f->print;
} elsif ($session{form}{step} eq "3") {
WebGUI::Setting::remove('specialState');
WebGUI::Setting::set('companyName',WebGUI::FormProcessor::text("companyName"));
WebGUI::Setting::set('companyURL',WebGUI::FormProcessor::url("companyURL"));
WebGUI::Setting::set('companyEmail',WebGUI::FormProcessor::email("companyEmail"));
WebGUI::Setting::remove('specialState');
WebGUI::HTTP::setRedirect("/");
WebGUI::HTTP::setRedirect(WebGUI::URL::gateway());
return "";
#$output .= '<a href="'.WebGUI::URL::gateway().'">Configuration complete. Click here to go to your new site.</a>';
} else {
$output .= '<legend align="left">Admin Account</legend>';
my $u = WebGUI::User->new('3');
my $f = WebGUI::HTMLForm->new;
my $f = WebGUI::HTMLForm->new(action=>WebGUI::URL::gateway());
$f->hidden(
-name=>"op",
-value=>"setup"