@@ -575,8 +638,10 @@ END
sub print_request_receipt {
my ($r,$url,$function) = @_;
- my @envvars = ('lonID','HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME','browser.os','browser.type','browser.version','user.home','request.role');
+ my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME');
+ my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role');
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id');
+ my @cookievars = ('lonID');
my $bodytag = &Apache::loncommon::bodytag('',$function,'topmargin="0" marginheight="0"',1);
my $admin = $Apache::lonnet::perlvar{'lonAdminMail'};
@@ -587,41 +652,57 @@ sub print_request_receipt {
my $vlinkcolor = &Apache::loncommon::designparm($function.'.vlink');
my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot');
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars);
+ my $coursecode = $env{'form.coursecode'};
+ 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'};
+ }
+ }
my $supportmsg = qq|
-Name: $ENV{'form.username'}
-Email: $ENV{'form.email'}
-Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'}
-Tel: $ENV{'form.phone'}
-Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}
-Subject: $ENV{'form.subject'}
-Description: $ENV{'form.description'}
-URL: $ENV{'form.sourceurl'}
+Name: $env{'form.username'}
+Email: $env{'form.email'}
+Username/domain: $env{'form.uname'} - $env{'form.udom'}
+Tel: $env{'form.phone'}
+Course Information: $env{'form.title'} - $coursecode - section: $env{'form.section'}
+Subject: $env{'form.subject'}
+Description: $env{'form.description'}
+URL: $env{'form.sourceurl'}
Date/Time: $reporttime
|;
- my $descrip = $ENV{'form.description'};
+ my $descrip = $env{'form.description'};
$descrip =~ s#\n# #g;
my $displaymsg = qq|
-Name: $ENV{'form.username'}
-Email: $ENV{'form.email'}
-Username/domain: $ENV{'form.uname'} - $ENV{'form.udom'}
-Tel: $ENV{'form.phone'}
-Course Information: $ENV{'form.title'} - $ENV{'form.coursecode'} - section: $ENV{'form.section'}
-Subject: $ENV{'form.subject'}
+Name: $env{'form.username'}
+Email: $env{'form.email'}
+Username/domain: $env{'form.uname'} - $env{'form.udom'}
+Tel: $env{'form.phone'}
+Course Information: $env{'form.title'} - $coursecode - section: $env{'form.section'}
+Subject: $env{'form.subject'}
Description: $descrip
-URL: $ENV{'form.sourceurl'}
+URL: $env{'form.sourceurl'}
Date/Time: $reporttime
|;
+ my $html=&Apache::lonxml::xmlbegin();
$r->print(<<"END");
-
+$html
LON-CAPA support request recorded
$bodytag
END
if ($r->uri eq '/adm/helpdesk') {
@@ -642,13 +723,13 @@ END
$to = 'helpdesk@lon-capa.org';
}
}
- if (defined($ENV{'form.email'})) {
- if ($ENV{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
- $from = $ENV{'form.email'};
+ if (defined($env{'form.email'})) {
+ if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) {
+ $from = $env{'form.email'};
}
}
- my $subject = $ENV{'form.subject'};
+ my $subject = $env{'form.subject'};
$subject =~ s#(`)#'#g;
$subject =~ s#\$#\(\$\)#g;
$supportmsg =~ s#(`)#'#g;
@@ -659,9 +740,9 @@ END
my $attachmentpath = '';
my $attachmentsize = '';
- if (defined($ENV{'user.name'})) {
- if ($ENV{'form.screenshot.filename'}) {
- $attachmentsize = length($ENV{'form.screenshot'});
+ if (defined($env{'user.name'})) {
+ if ($env{'form.screenshot.filename'}) {
+ $attachmentsize = length($env{'form.screenshot'});
if ($attachmentsize > 131072) {
$displaymsg .= " The uploaded screenshot file ($attachmentsize bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.";
} else {
@@ -670,13 +751,25 @@ END
}
}
+ my %cookies = ();
+ my $cookie=CGI::Cookie->parse($r->header_in('Cookie'));
+ if ($$cookie{'lonID'} =~ /lonID=(\w+);/) {
+ $cookies{'lonID'} = $1;
+ }
+
if ($attachmentpath =~ m-/([^/]+)$-) {
$fname = $1;
- $displaymsg .= " An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $ENV{'user.name'} from LON-CAPA domain: $ENV{'user.domain'}";
+ $displaymsg .= " An uploaded screenshot file - $fname ($attachmentsize bytes) was included in the request sent by $env{'user.name'} from LON-CAPA domain: $env{'user.domain'}";
$supportmsg .= "\n";
- foreach (@envvars) {
+ foreach (@cookievars) {
+ $supportmsg .= "$_: $cookies{$_}\n";
+ }
+ foreach (@ENVvars) {
$supportmsg .= "$_: $ENV{$_}\n";
}
+ foreach (@envvars) {
+ $supportmsg .= "$_: $env{$_}\n";
+ }
}
my $msg = MIME::Lite->new(
@@ -696,24 +789,24 @@ END
} else {
my $envdata = '';
- foreach (@envvars) {
+ foreach (@cookievars) {
+ $envdata .= "$_: $cookies{$_}\n";
+ }
+ foreach (@ENVvars) {
$envdata .= "$_: $ENV{$_}\n";
}
+ foreach (@envvars) {
+ $envdata .= "$_: $env{$_}\n";
+ }
foreach (@loncvars) {
- $envdata .= "$_: $ENV{$_}\n";
+ $envdata .= "$_: $env{$_}\n";
}
$msg->attach(Type => 'TEXT',
Data => $envdata);
}
### Send it:
- # ->send can cause an sh launch which can pass all of %ENV along
- # which can be to large for /bin/sh's little mind
- my %oldENV=%ENV;
- undef(%ENV);
$msg->send('sendmail');
- %ENV=%oldENV;
- undef(%oldENV);
if ($attachmentpath =~ m#$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+#) {
unlink($attachmentpath);
@@ -766,11 +859,21 @@ END
|
|);
- foreach (@envvars) {
- unless($ENV{$_} eq '') {
+ foreach (@cookievars) {
+ unless($cookies{$_} eq '') {
+ $r->print("$_: $cookies{$_}, ");
+ }
+ }
+ foreach (@ENVvars) {
+ unless($ENV{$_} eq '') {
$r->print("$_: $ENV{$_}, ");
}
}
+ foreach (@envvars) {
+ unless($env{$_} eq '') {
+ $r->print("$_: $env{$_}, ");
+ }
+ }
$r->print("
|
@@ -806,7 +909,12 @@ sub print_header {
ask => 'Ask helpdesk',
getst => 'Getting started guide',
back => 'Back to last location'
- );
+ );
+ my ($getstartlink,$getstarttext);
+ if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') {
+ $getstartlink = qq| $lt{'getst'} | |;
+ $getstarttext = ' '.&mt('and the "Getting started" guide').' ';
+ }
$r->print(< |
@@ -823,8 +931,7 @@ sub print_header {
@@ -849,7 +956,7 @@ END
$r->print('
|
'.&mt('
-Please read the "Log-in help" and "Getting started guide" if you can not log-in').'. '.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk').'. '.&mt('Note').': '.&mt('Student questions about course content should be directed to the course instructor').'.
+Please review the information in "Log-in help"').$getstarttext.' '.&mt('if you are unable to log-in').'. '.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk').'. '.&mt('Note').': '.&mt('Student questions about course content should be directed to the course instructor').'.
|
');
}
@@ -922,9 +1029,9 @@ sub build_code_selections {
my @sorted_b = ();
my @sorted_b_titles = ();
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[2]}{$key_a}{$key_b}},\@sorted_b);
- if (defined($$cat_titles{$$codetitles[1]})) {
+ if (defined($$cat_titles{$$codetitles[2]})) {
foreach (@sorted_b) {
- push @sorted_b_titles, $$cat_titles{$$codetitles[1]}{$_};
+ push @sorted_b_titles, $$cat_titles{$$codetitles[2]}{$_};
}
}
$$idlist{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_b);
@@ -942,9 +1049,18 @@ sub build_code_selections {
%{$$idlist{$$codetitles[3]}{$key_a}{$key_b}} = ();
foreach my $key_c (keys %{$idarrays{$$codetitles[3]}{$key_a}{$key_b}}) {
my @sorted_c = ();
+ my @sorted_c_titles = ();
&sort_cats($num,$cat_order,$codetitles,\@{$idarrays{$$codetitles[3]}{$key_a}{$key_b}{$key_c}},\@sorted_c);
+ if (defined($$cat_titles{$$codetitles[3]})) {
+ foreach (@sorted_c) {
+ push @sorted_c_titles, $$cat_titles{$$codetitles[3]}{$_};
+ }
+ }
$$idlist{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = join('","',@sorted_c);
$$idnums{$$codetitles[3]}{$key_a}{$key_b}{$key_c} = scalar(@sorted_c);
+ if (defined($$cat_titles{$$codetitles[3]})) {
+ $$idlist_titles{$$codetitles[2]}{$key_a}{$key_b} = join('","',@sorted_c_titles);
+ }
}
}
}
@@ -958,7 +1074,13 @@ sub build_code_selections {
%{$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}} = ();
foreach my $key_d (keys %{$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}}) {
my @sorted_d = ();
+ my @sorted_d_titles = ();
&sort_cats($num,$cat_order,$codetitles,$idarrays{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d},\@sorted_d);
+ if (defined($$cat_titles{$$codetitles[4]})) {
+ foreach (@sorted_d) {
+ push @sorted_d_titles, $$cat_titles{$$codetitles[4]}{$_};
+ }
+ }
$$idlist{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = join('","',@sorted_d);
$$idnums{$$codetitles[4]}{$key_a}{$key_b}{$key_c}{$key_d} = scalar(@sorted_d);
}
@@ -1064,94 +1186,182 @@ sub recurse_list {
}
sub javascript_code_selections {
- my ($numcats,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_;
+ my ($numcats,$cat_titles,$script_tag,$idlist,$idnums,$idlist_titles,$codetitles) = @_;
my $numtitles = @{$codetitles};
- my @seltitles = ();
+ my @seltitles = ();
for (my $j=0; $j<$numtitles; $j++) {
$seltitles[$j] = 'id'.$$codetitles[$j];
}
my $seltitle_str = join('","',@seltitles);
+ my @longtitles = ();
+ for (my $i=0; $i<$numtitles; $i++) {
+ if (defined($$cat_titles{$$codetitles[$i]})) {
+ $longtitles[$i] = 1;
+ } else {
+ $longtitles[$i] = 0;
+ }
+ }
+ my $longtitles_str = join('","',@longtitles);
$$script_tag .= <