--- loncom/interface/lonsupportreq.pm 2009/01/27 15:59:30 1.52
+++ loncom/interface/lonsupportreq.pm 2010/04/14 03:09:35 1.56
@@ -1,5 +1,5 @@
#
-# $Id: lonsupportreq.pm,v 1.52 2009/01/27 15:59:30 schafran Exp $
+# $Id: lonsupportreq.pm,v 1.56 2010/04/14 03:09:35 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');
@@ -566,13 +595,15 @@ END
if ($env{'form.'.$item} ne '') {
if ($item eq 'description') {
my $descrip = $env{'form.description'};
- $descrip =~ s|\n|
|g;
+ $descrip = &cleanup_html($descrip);
+ $descrip =~ s|[\n\r\f]|
|g;
$displaymsg .=
''.
"$lt{$item}: $descrip
\n";
} elsif ($item eq 'sourceurl') {
my $showurl = $env{'form.sourceurl'};
$showurl =~ s/\?.*$//;
+ $showurl = &cleanup_html($showurl);
$displaymsg .=
''.
"$lt{$item}: $showurl
\n";
@@ -581,9 +612,11 @@ END
''.
"$lt{$item}: $okcclist
\n";
} else {
+ my $showitem = $env{'form.'.$item};
+ $showitem = &cleanup_html($showitem);
$displaymsg .=
''.
- "$lt{$item}: $env{'form.'.$item}
\n";
+ "$lt{$item}: $showitem
\n";
}
}
}
@@ -665,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) {
@@ -713,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);
@@ -746,7 +783,8 @@ END
unlink($attachmentpath);
}
$r->print(''.$lt{'your'}.':
'."\n");
- $r->print(&Apache::lonhtmlcommon::start_pick_box('LC_helpform_receipt').
+ $r->print('