[LON-CAPA-cvs] cvs: loncom /interface lonsupportreq.pm
raeburn
raeburn@source.lon-capa.org
Wed, 14 Apr 2010 03:09:35 -0000
raeburn Wed Apr 14 03:09:35 2010 EDT
Modified files:
/loncom/interface lonsupportreq.pm
Log:
- User: public:public does not count as a logged in user.
- Domain Configuration can include one or Bcc recipients of helpdesk email.
Index: loncom/interface/lonsupportreq.pm
diff -u loncom/interface/lonsupportreq.pm:1.55 loncom/interface/lonsupportreq.pm:1.56
--- loncom/interface/lonsupportreq.pm:1.55 Thu Oct 22 13:41:41 2009
+++ loncom/interface/lonsupportreq.pm Wed Apr 14 03:09:35 2010
@@ -1,5 +1,5 @@
#
-# $Id: lonsupportreq.pm,v 1.55 2009/10/22 13:41:41 bisitz 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 @@
$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 @@
&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]).
'<input type="text" size="50" name="cc" value="" /><br />'."\n".
&Apache::lonhtmlcommon::row_closure();
@@ -428,7 +431,7 @@
&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]).
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n".
&Apache::lonhtmlcommon::row_closure();
@@ -474,6 +477,32 @@
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 @@
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 @@
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);