Removed onCriticalError setting because the showDebug setting made it unnecessary.

This commit is contained in:
JT Smith 2002-08-10 05:27:26 +00:00
parent 6ab673f5ba
commit 079109dc52
3 changed files with 64 additions and 21 deletions

View file

@ -29,7 +29,19 @@ insert into international values (78,'EventsCalendar',1,'Don\'t delete anything,
update wobject set editTimeout=editTimeout*3600; update wobject set editTimeout=editTimeout*3600;
insert into international values (707,"WebGUI",1,"Show debugging?"); insert into international values (707,"WebGUI",1,"Show debugging?");
insert into settings values ('showDebug',0); insert into settings values ('showDebug',0);
update settings set name='imageManagersGroup' where name='groupToManageImages';
insert into settings values ('packageManagersGroup',6);
insert into settings values ('styleManagersGroup',5);
insert into settings values ('templateManagersGroup',8);
delete from international where internationalId=414 and namespace='WebGUI';
delete from international where internationalId=415 and namespace='WebGUI';
delete from international where internationalId=413 and namespace='WebGUI';
insert into international values (710,'WebGUI',1,'Edit Privilege Settings');
insert into international values (711,'WebGUI',1,'Image Managers Group');
insert into international values (712,'WebGUI',1,'Package Managers Group');
insert into international values (713,'WebGUI',1,'Style Managers Group');
insert into international values (714,'WebGUI',1,'Template Managers Group');
delete from settings where name='onCriticalError';

View file

@ -15,10 +15,9 @@ use WebGUI::Session;
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub fatalError { sub fatalError {
my ($key, $log, $cgi, $logfile, $config, $friendly); my ($key, $log, $cgi, $logfile, $config);
if (exists $session{cgi}) { if (exists $session{cgi}) {
$cgi = $session{cgi}; $cgi = $session{cgi};
$friendly = 1 if ($session{setting}{onCriticalError} eq "friendly");
print WebGUI::Session::httpHeader(); print WebGUI::Session::httpHeader();
} else { } else {
use CGI; use CGI;
@ -32,38 +31,38 @@ sub fatalError {
$config = new Data::Config '../etc/WebGUI.conf'; $config = new Data::Config '../etc/WebGUI.conf';
$logfile = $config->param('logfile'); $logfile = $config->param('logfile');
} }
print "<h1>WebGUI Fatal Error</h1>Something unexpected happened that caused this system to fault.<p>" unless ($friendly); print "<h1>WebGUI Fatal Error</h1>Something unexpected happened that caused this system to fault.<p>" if ($session{setting}{showDebug});
$log = FileHandle->new(">>$logfile") or print "Can't open log file: ".$logfile $log = FileHandle->new(">>$logfile") or print "Can't open log file: ".$logfile
."\n<p>Check your WebGUI configuration file to set the path of the log file, ."\n<p>Check your WebGUI configuration file to set the path of the log file,
and check to be sure the web server has the privileges to write to the log file."; and check to be sure the web server has the privileges to write to the log file.";
print $0." at ".localtime(time)." reported:<br>" unless ($friendly); print $0." at ".localtime(time)." reported:<br>" if ($session{setting}{showDebug});
print $log localtime(time)." ".$0." FATAL: ".$_[0]."\n"; print $log localtime(time)." ".$0." FATAL: ".$_[0]."\n";
print $_[0] unless ($friendly); print $_[0] if ($session{setting}{showDebug});
print "<p><h3>Caller</h3><table border=1><tr><td valign=top>" unless ($friendly); print "<p><h3>Caller</h3><table border=1><tr><td valign=top>" if ($session{setting}{showDebug});
print "<b>Level 1</b><br>".join("<br>",caller(1)) unless ($friendly); print "<b>Level 1</b><br>".join("<br>",caller(1)) if ($session{setting}{showDebug});
print $log "\t".join(",",caller(1))."\n"; print $log "\t".join(",",caller(1))."\n";
print "</td><td valign=top>"."<b>Level 2</b><br>".join("<br>",caller(2)) unless ($friendly); print "</td><td valign=top>"."<b>Level 2</b><br>".join("<br>",caller(2)) if ($session{setting}{showDebug});
print $log "\t".join(",",caller(2))."\n"; print $log "\t".join(",",caller(2))."\n";
print "</td><td valign=top>"."<b>Level 3</b><br>".join("<br>",caller(3)) unless ($friendly); print "</td><td valign=top>"."<b>Level 3</b><br>".join("<br>",caller(3)) if ($session{setting}{showDebug});
print $log "\t".join(",",caller(3))."\n"; print $log "\t".join(",",caller(3))."\n";
print "</td><td valign=top>"."<b>Level 4</b><br>".join("<br>",caller(4)) unless ($friendly); print "</td><td valign=top>"."<b>Level 4</b><br>".join("<br>",caller(4)) if ($session{setting}{showDebug});
print $log "\t".join(",",caller(4))."\n"; print $log "\t".join(",",caller(4))."\n";
print "</td></tr></table>" unless ($friendly); print "</td></tr></table>" if ($session{setting}{showDebug});
print "<h3>Form Variables</h3>" unless ($friendly); print "<h3>Form Variables</h3>" if ($session{setting}{showDebug});
print $log "\t"; print $log "\t";
if (exists $session{form}) { if (exists $session{form}) {
foreach $key (keys %{$session{form}}) { foreach $key (keys %{$session{form}}) {
print $key." = ".$session{form}{$key}."<br>" unless ($friendly); print $key." = ".$session{form}{$key}."<br>" if ($session{setting}{showDebug});
print $log $key."=".$session{form}{$key}." "; print $log $key."=".$session{form}{$key}." ";
} }
print $log "\n"; print $log "\n";
} else { } else {
print "Cannot retrieve session information." unless ($friendly); print "Cannot retrieve session information." if ($session{setting}{showDebug});
print $log "Session not accessible for form variable dump.\n"; print $log "Session not accessible for form variable dump.\n";
} }
print $log "\n"; print $log "\n";
$log->close; $log->close;
if ($friendly) { unless ($session{setting}{showDebug}) {
print WebGUI::International::get(416).'<br>'; print WebGUI::International::get(416).'<br>';
print '<br>'.$session{setting}{companyName}; print '<br>'.$session{setting}{companyName};
print '<br>'.$session{setting}{companyEmail}; print '<br>'.$session{setting}{companyEmail};

View file

@ -22,7 +22,8 @@ use WebGUI::SQL;
use WebGUI::URL; use WebGUI::URL;
our @ISA = qw(Exporter); our @ISA = qw(Exporter);
our @EXPORT = qw(&www_editUserSettings &www_editUserSettingsSave &www_editCompanyInformation &www_editCompanyInformationSave our @EXPORT = qw(&www_editUserSettings &www_editUserSettingsSave &www_editCompanyInformation
&www_editCompanyInformationSave &www_editPrivilegeSettings &www_editPrivilegeSettingsSave
&www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings &www_editMailSettings &www_editMailSettingsSave &www_editMiscSettings
&www_editContentSettings &www_editContentSettingsSave &www_editMiscSettingsSave &www_manageSettings); &www_editContentSettings &www_editContentSettingsSave &www_editMiscSettingsSave &www_manageSettings);
@ -202,8 +203,7 @@ sub www_editMailSettingsSave {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editMiscSettings { sub www_editMiscSettings {
my ($output, %criticalError, $f); my ($output, $f);
%criticalError = ('debug'=>WebGUI::International::get(414), 'friendly'=>WebGUI::International::get(415));
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
$output .= helpIcon(24); $output .= helpIcon(24);
$output .= '<h1>'.WebGUI::International::get(140).'</h1>'; $output .= '<h1>'.WebGUI::International::get(140).'</h1>';
@ -211,7 +211,6 @@ sub www_editMiscSettings {
$f->hidden("op","editMiscSettingsSave"); $f->hidden("op","editMiscSettingsSave");
$f->yesNo("preventProxyCache",WebGUI::International::get(400),$session{setting}{preventProxyCache}); $f->yesNo("preventProxyCache",WebGUI::International::get(400),$session{setting}{preventProxyCache});
$f->yesNo("showDebug",WebGUI::International::get(707),$session{setting}{showDebug}); $f->yesNo("showDebug",WebGUI::International::get(707),$session{setting}{showDebug});
$f->select("onCriticalError",\%criticalError,WebGUI::International::get(413),[$session{setting}{onCriticalError}]);
$f->submit; $f->submit;
$output .= $f->print; $output .= $f->print;
} else { } else {
@ -225,13 +224,45 @@ sub www_editMiscSettingsSave {
if (WebGUI::Privilege::isInGroup(3)) { if (WebGUI::Privilege::isInGroup(3)) {
_saveSetting("preventProxyCache"); _saveSetting("preventProxyCache");
_saveSetting("showDebug"); _saveSetting("showDebug");
_saveSetting("onCriticalError");
return www_manageSettings(); return www_manageSettings();
} else { } else {
return WebGUI::Privilege::adminOnly(); return WebGUI::Privilege::adminOnly();
} }
} }
#-------------------------------------------------------------------
sub www_editPrivilegeSettings {
my ($output, $f);
if (WebGUI::Privilege::isInGroup(3)) {
$output .= helpIcon(48);
$output .= '<h1>'.WebGUI::International::get(710).'</h1>';
$f = WebGUI::HTMLForm->new;
$f->hidden("op","editPrivilegeSettingsSave");
$f->group("imageManagersGroup",WebGUI::International::get(711),[$session{setting}{imageManagersGroup}]);
$f->group("packageManagersGroup",WebGUI::International::get(712),[$session{setting}{packageManagersGroup}]);
$f->group("styleManagersGroup",WebGUI::International::get(713),[$session{setting}{styleManagersGroup}]);
$f->group("templateManagersGroup",WebGUI::International::get(714),[$session{setting}{templateManagersGroup}]);
$f->submit;
$output .= $f->print;
} else {
$output = WebGUI::Privilege::adminOnly();
}
return $output;
}
#-------------------------------------------------------------------
sub www_editPrivilegeSettingsSave {
if (WebGUI::Privilege::isInGroup(3)) {
_saveSetting("imageManagersGroup");
_saveSetting("packageManagersGroup");
_saveSetting("styleManagersGroup");
_saveSetting("templateManagersGroup");
return www_manageSettings();
} else {
return WebGUI::Privilege::adminOnly();
}
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_manageSettings { sub www_manageSettings {
my ($output); my ($output);
@ -243,6 +274,7 @@ sub www_manageSettings {
$output .= '<li><a href="'.WebGUI::URL::page('op=editContentSettings').'">'.WebGUI::International::get(525).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editContentSettings').'">'.WebGUI::International::get(525).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editMailSettings').'">'.WebGUI::International::get(133).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editMailSettings').'">'.WebGUI::International::get(133).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editMiscSettings').'">'.WebGUI::International::get(140).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editMiscSettings').'">'.WebGUI::International::get(140).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editPrivilegeSettings').'">'.WebGUI::International::get(710).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.WebGUI::International::get(308).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editProfileSettings').'">'.WebGUI::International::get(308).'</a>';
$output .= '<li><a href="'.WebGUI::URL::page('op=editUserSettings').'">'.WebGUI::International::get(117).'</a>'; $output .= '<li><a href="'.WebGUI::URL::page('op=editUserSettings').'">'.WebGUI::International::get(117).'</a>';
$output .= '</ul>'; $output .= '</ul>';