--- loncom/interface/lonsupportreq.pm 2010/12/02 23:18:37 1.55.6.3
+++ loncom/interface/lonsupportreq.pm 2011/03/03 00:33:38 1.65
@@ -1,5 +1,5 @@
#
-# $Id: lonsupportreq.pm,v 1.55.6.3 2010/12/02 23:18:37 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.65 2011/03/03 00:33:38 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,7 +37,8 @@ use Apache::lonnet;
use Apache::lonlocal;
use Apache::lonacc();
use Apache::courseclassifier;
-use LONCAPA qw(:DEFAULT :match);
+use LONCAPA qw(:DEFAULT :match);
+
sub handler {
my ($r) = @_;
@@ -243,7 +244,7 @@ function initialize_codes() {
}
my $js = '';
+ $loaditems.'';
my %add_entries = (topmargin => "0",
marginheight => "0",
onLoad =>"initialize_codes()",);
@@ -296,7 +297,7 @@ function initialize_codes() {
&HTML::Entities::encode($udom,'"<>&').'" />';
my $uname_input = '&').'" />';
- if (($env{'user.name'} =~ /^$match_username$/) &&
+ if (($env{'user.name'} =~ /^$match_username$/) &&
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
$output .= ''.$lt{'unme'}.': '.$uname.' '.$lt{'doma'}.': '.$udom.$udom_input.$uname_input;
} else {
@@ -304,7 +305,7 @@ function initialize_codes() {
my $unameform = '';
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
$output .= $lt{'entu'};
- } elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
+ } elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
$output .= $lt{'chdo'};
} else {
$output .= $lt{'entr'};
@@ -332,119 +333,116 @@ function initialize_codes() {
$output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]).
$showserver.'&').'" />'.
+ &Apache::lonhtmlcommon::row_closure().
+ &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value').
+ '
'.
&Apache::lonhtmlcommon::row_closure();
- if (&Apache::loncommon::check_for_gci_dc()) {
- $output .= &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,
- 'LC_evenrow_value').
- '
'.
- &Apache::lonhtmlcommon::row_closure();
- $num ++;
- $i = $num%2;
- $output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]);
- if ($cnum) {
- if ($coursecodes{$cnum}) {
- foreach my $item (@codetitles) {
- $output .= ''.$item.': '.$codes{$cnum}{$item}.'; ';
- }
- $output .= ' &').'" />';
- } else {
- $output .= $lt{'enin'}.':
- ';
+ $num ++;
+ $i = $num%2;
+ $output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]);
+ if ($cnum) {
+ if ($coursecodes{$cnum}) {
+ foreach my $item (@codetitles) {
+ $output .= ''.$item.': '.$codes{$cnum}{$item}.'; ';
}
+ $output .= ' &').'" />';
} else {
- if ($totcodes > 0) {
- my $numtitles = @codetitles;
- if ($numtitles == 0) {
- $output .= $lt{'enin'}.':
- ';
+ $output .= $lt{'enin'}.':
+ ';
+ }
+ } else {
+ if ($totcodes > 0) {
+ my $numtitles = @codetitles;
+ if ($numtitles == 0) {
+ $output .= $lt{'enin'}.':
+ ';
+ } else {
+ my @standardnames = &Apache::loncommon::get_standard_codeitems();
+ my $lasttitle = $numtitles;
+ if ($numtitles > 4) {
+ $lasttitle = 4;
+ }
+ $output .= '
'.$codetitles[0].' '."\n".
+ ' | ';
+ for (my $i=1; $i<$numtitles; $i++) {
+ $output .= ''.$codetitles[$i].' '."\n".
+ ''."\n".
+ ''."\n".
+ ''."\n".
+ ' | '."\n";
+ }
+ $output .= '
';
+ if ($numtitles > 4) {
+ $output .= '
'.$codetitles[$numtitles].'
'."\n".
+ ''."\n".
+ ''."\n".
+ ''."\n";
}
}
- $output .= "";
} else {
- $output .= '';
+ $output .= $lt{'enin'}.':
+ ';
}
- $output .= &Apache::lonhtmlcommon::row_closure();
}
+ if ($ctitle) {
+ $output .= '
'.$lt{'titl'}.': '.$ctitle.
+ '&').'" />'."\n";
+ } else {
+ $output .= '
'.$lt{'enct'}.':
+ '."\n";
+ }
+ $output .= &Apache::lonhtmlcommon::row_closure();
$num ++;
$i = $num%2;
+ $output .= &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,$css[$i]);
+ if ($sectionlist) {
+ $output .= "".
+ " \n";
+ foreach my $id (sort(keys(%groupid))) {
+ if ($id eq $groupid{$id} || $groupid{$id} eq '') {
+ $output .= " \n";
+ } else {
+ $output .= " \n";
+ }
+ }
+ $output .= "";
+ } else {
+ $output .= '';
+ }
+ $output .= &Apache::lonhtmlcommon::row_closure();
+ $num ++;
+ $i = $num%2;
$output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value').
' '."\n".
&Apache::lonhtmlcommon::row_closure().
@@ -453,7 +451,7 @@ function initialize_codes() {
&Apache::lonhtmlcommon::row_closure();
$num ++;
$i = $num%2;
- if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
+ if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]).
'
'.$lt{'uplf'}."\n".
&Apache::lonhtmlcommon::row_closure();
@@ -499,27 +497,52 @@ sub print_request_receipt {
my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail',
$defdom,$origmail);
my $from = $admin;
- my $reporttime = &Apache::lonlocal::locallocaltime(time);
- my @formvars = ('username','email','uname','udom','sourceurl');
- if (&Apache::loncommon::check_for_gci_dc()) {
- push(@formvars,('phone','section','coursecode','title'));
+ 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);
+ }
+ }
+ }
+ }
}
- push(@formvars,('subject','description','screenshot'));
+ my $reporttime = &Apache::lonlocal::locallocaltime(time);
+ my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
+
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
my $coursecode = $env{'form.coursecode'};
- if (&Apache::loncommon::check_for_gci_dc()) {
+ if ($coursecode eq '') {
+ my $totcodes = 0;
+ my %coursecodes;
+ $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes);
+ my @standardnames = &Apache::loncommon::get_standard_codeitems();
+ if ($totcodes > 0) {
+ my $noregexps = 1;
+ $coursecode =
+ &Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps);
+ }
if ($coursecode eq '') {
- if (defined($env{'form.Year'})) {
- $coursecode .= $env{'form.Year'};
- }
- if (defined($env{'form.Semester'})) {
- $coursecode .= $env{'form.Semester'};
- }
- if (defined($env{'form.Department'})) {
- $coursecode .= $env{'form.Department'};
- }
- if (defined($env{'form.Number'})) {
- $coursecode .= $env{'form.Number'};
+ foreach my $item (@standardnames) {
+ if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) {
+ $coursecode .= $env{'form.'.$item};
+ }
}
}
}
@@ -560,7 +583,7 @@ sub print_request_receipt {
if (!(grep(/^\Q$cc\E$/,@ok_ccs))) {
push(@ok_ccs,$cc);
}
- } else {
+ } elsif ($cc ne '') {
if (!(grep(/^\Q$cc\E$/,@bad_ccs))) {
push(@bad_ccs,$cc);
}
@@ -577,22 +600,14 @@ sub print_request_receipt {
}
}
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'";
- if (&Apache::loncommon::check_for_gci_dc()) {
- $env{'form.csri'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'};
- }
+ $env{'form.crsi'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'};
my $supportmsg = < 131072) {
@@ -760,6 +771,11 @@ END
my $cc_string = join(', ',@ok_ccs);
$msg->add("Cc" => $cc_string);
}
+ if ($bcc ne '') {
+ $msg->add("Bcc" => $bcc);
+ }
+ $msg->attr("content-type" => "text/plain");
+ $msg->attr("content-type.charset" => "UTF-8");
if ($attachmentpath) {
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath);