--- loncom/interface/lonsupportreq.pm 2010/02/13 00:09:20 1.55.4.2 +++ loncom/interface/lonsupportreq.pm 2010/04/14 07:31:21 1.55.4.3 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.55.4.2 2010/02/13 00:09:20 raeburn Exp $ +# $Id: lonsupportreq.pm,v 1.55.4.3 2010/04/14 07:31:21 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -77,8 +77,11 @@ sub print_request_form { $browser = $env{'browser.type'}; $bversion = $env{'browser.version'}; $uhost = $env{'request.host'}; - $uname = $env{'user.name'}; - $udom = $env{'user.domain'}; + my ($uname,$udom); + if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) { + $uname = $env{'user.name'}; + $udom = $env{'user.domain'}; + } $uhome = $env{'user.home'}; $urole = $env{'request.role'}; $usec = $env{'request.course.sec'}; @@ -266,7 +269,7 @@ function initialize_codes() { &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; - if (defined($env{'user.name'})) { + if (defined($uname)) { $output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]). '
'."\n". &Apache::lonhtmlcommon::row_closure(); @@ -428,7 +431,7 @@ function initialize_codes() { &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; - if (defined($env{'user.name'})) { + if (defined($uname)) { $output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). '
'.$lt{'uplf'}."\n". &Apache::lonhtmlcommon::row_closure(); @@ -474,6 +477,32 @@ sub print_request_receipt { my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', $defdom,$origmail); my $from = $admin; + my $bcc; + my %domconfig = + &Apache::lonnet::get_dom('configuration',['contacts'],$defdom); + if (ref($domconfig{'contacts'}) eq 'HASH') { + if (exists($domconfig{'contacts'}{'helpdeskmail'})) { + if (ref($domconfig{'contacts'}{'helpdeskmail'}) eq 'HASH') { + my $bccmail = $domconfig{'contacts'}{'helpdeskmail'}{'bcc'}; + if ($bccmail ne '') { + my @bccs = split(/,/,$bccmail); + my @ok_bccs; + foreach my $bcc (@bccs) { + $bcc =~ s/^\s+//g; + $bcc =~ s/\s+$//g; + if ($bcc =~ m/^[^\@]+\@[^\@]+$/) { + if (!(grep(/^\Q$bcc\E$/,@ok_bccs))) { + push(@ok_bccs,$bcc); + } + } + } + if (@ok_bccs > 0) { + $bcc = join(', ',@ok_bccs); + } + } + } + } + } my $reporttime = &Apache::lonlocal::locallocaltime(time); my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); @@ -669,7 +698,8 @@ END my $attachmentpath = ''; my $attachmentsize = ''; - if (defined($env{'user.name'})) { + if ((defined($env{'user.name'})) && ($env{'user.name'} ne 'public') + && ($env{'user.domain'} ne 'public')) { if ($env{'form.screenshot.filename'}) { $attachmentsize = length($env{'form.screenshot'}); if ($attachmentsize > 131072) { @@ -717,6 +747,9 @@ END my $cc_string = join(', ',@ok_ccs); $msg->add("Cc" => $cc_string); } + if ($bcc ne '') { + $msg->add("Bcc" => $bcc); + } if ($attachmentpath) { my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);