--- loncom/interface/lonerrorhandler.pm 2008/11/18 19:14:22 1.19 +++ loncom/interface/lonerrorhandler.pm 2013/08/12 16:51:58 1.24 @@ -1,7 +1,7 @@ # The LearningOnline Network # Internal Server Error Handler # -# $Id: lonerrorhandler.pm,v 1.19 2008/11/18 19:14:22 jms Exp $ +# $Id: lonerrorhandler.pm,v 1.24 2013/08/12 16:51:58 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -26,24 +26,7 @@ # http://www.lon-capa.org/ # -=pod - -=head1 NAME -Apache::lonerrorhandler.pm - -=head1 SYNOPSIS - -Handles errors. - -This is part of the LearningOnline Network with CAPA project -described at http://www.lon-capa.org. - -=head1 OVERVIEW - -None - -=cut package Apache::lonerrorhandler; @@ -100,8 +83,18 @@ $env{'form.guesses'} $lt{'env'}: $env{'form.environment'} ENDMESSAGE - my $sysmail = $r->dir_config('lonSysEMail'); my $defdom = $r->dir_config('lonDefDomain'); + my $sysmail; + my $notify = 1; + my %domconfig = &Apache::lonnet::get_dom('configuration',['contacts']); + if (ref($domconfig{'contacts'}) eq 'HASH') { + if ($domconfig{'contacts'}{'reporterrors'} == 0) { + $notify = 0; + } + } + if ($notify) { + $sysmail = 'errorrecord@loncapa.org'; + } my $origmail = $r->dir_config('lonAdmEMail'); my $recipients = &Apache::loncommon::build_recipient_list($sysmail, 'errormail',$defdom,$origmail); @@ -122,6 +115,18 @@ ENDMESSAGE my $env=''; my $syllabus=''; + foreach $envkey (keys(%env)) { + if ($envkey =~ /^form\.(.+)\.filename$/) { + my $item = $1; + if (exists($env{'form.'.$item.'.mimetype'})) { + if (exists($env{'form.'.$item})) { + my $size = (length($env{'form.'.$item}))/(1024.0 * 1024.0); + $env{'form.'.$item} = &mt('File (contents not shown) - size was [_1] MB.',sprintf("%.4f",$size)); + } + } + } + } + foreach $envkey (sort(keys(%env))) { $env.="$envkey: $env{$envkey}\n"; } @@ -143,7 +148,7 @@ ENDMESSAGE .'

'.&mt('Please help us to find out what.').'

' .'

'.&mt('Please take a moment to fill out the form below.').' ' .&mt('Your information, together with internal debugging information, ' - .'will be emailed to the system and server administrators.') + .'will be e-mailed to the system and server administrators.') .'

'.&mt('Please describe what you did just before this screen came up').'

@@ -161,7 +166,7 @@ ENDMESSAGE

- +

'.&mt('Thank you for your help!').'

@@ -182,3 +187,23 @@ $syllabus.' 1; __END__ + + +=pod + +=head1 NAME + +Apache::lonerrorhandler.pm + +=head1 SYNOPSIS + +Handles errors. + +This is part of the LearningOnline Network with CAPA project +described at http://www.lon-capa.org. + +=head1 OVERVIEW + +None + +=cut