--- loncom/interface/lonsupportreq.pm 2010/04/14 07:31:21 1.55.4.3
+++ loncom/interface/lonsupportreq.pm 2010/12/02 22:05:17 1.60
@@ -1,5 +1,5 @@
#
-# $Id: lonsupportreq.pm,v 1.55.4.3 2010/04/14 07:31:21 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.60 2010/12/02 22:05:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,7 +37,7 @@ use Apache::lonnet;
use Apache::lonlocal;
use Apache::lonacc();
use Apache::courseclassifier;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub handler {
@@ -57,7 +57,7 @@ sub handler {
&Apache::lonacc::get_posted_cgi($r);
}
my $function = $env{'form.function'};
- my $origurl = &unescape($env{'form.origurl'});
+ my $origurl = $env{'form.origurl'};
my $command = $env{'form.command'};
if ($command eq 'process') {
@@ -77,8 +77,10 @@ sub print_request_form {
$browser = $env{'browser.type'};
$bversion = $env{'browser.version'};
$uhost = $env{'request.host'};
- my ($uname,$udom);
- if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) {
+ my ($uname,$udom,$public);
+ if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) {
+ $public = 1;
+ } else {
$uname = $env{'user.name'};
$udom = $env{'user.domain'};
}
@@ -175,7 +177,20 @@ END
my ($sec,$grp) = split(/:/,$section);
$groupid{$sec} = $grp;
}
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']);
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom',
+ 'useremail','useraccount']);
+ if ($env{'form.origurl'} eq '/adm/createaccount') {
+ if ($email eq '') {
+ if ($env{'form.useremail'} =~ /^[^\@]+\@[^\@]+$/) {
+ $email = &HTML::Entities::encode($env{'form.useremail'},'"<>&');
+ }
+ }
+ if ($uname eq '') {
+ if ($env{'form.useraccount'} =~ /^$match_username$/) {
+ $uname = &HTML::Entities::encode($env{'form.useraccount'},'"<>&');
+ }
+ }
+ }
my $codedom = &get_domain();
my $details_title;
if ($codedom) {
@@ -269,7 +284,7 @@ function initialize_codes() {
&Apache::lonhtmlcommon::row_closure();
$num ++;
$i = $num%2;
- if (defined($uname)) {
+ if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
$output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]).
'
'."\n".
&Apache::lonhtmlcommon::row_closure();
@@ -281,30 +296,33 @@ function initialize_codes() {
&HTML::Entities::encode($udom,'"<>&').'" />';
my $uname_input = '&').'" />';
- if (defined($uname) && defined($udom)) {
+ if (($env{'user.name'} =~ /^$match_username$/) &&
+ ($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
$output .= ''.$lt{'unme'}.': '.$uname.' '.$lt{'doma'}.': '.$udom.$udom_input.$uname_input;
} else {
my $udomform = '';
my $unameform = '';
- if (defined($udom)) {
+ if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) {
$output .= $lt{'entu'};
- } elsif (defined($uname)) {
+ } elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) {
$output .= $lt{'chdo'};
} else {
$output .= $lt{'entr'};
}
$output .= '
';
- if (defined($udom)) {
- $udomform = ''.$lt{'doma'}.': '.$udom.$udom_input;
- } elsif (defined($uname)) {
- $unameform = ''.$lt{'unme'}.': '.$uname.' '.$uname_input;
+ if (!$public) {
+ if ($env{'user.domain'} =~ /^$match_domain$/) {
+ $udomform = ''.$lt{'doma'}.': '.$udom.$udom_input;
+ } elsif ($env{'user.name'} =~ /^$match_username$/) {
+ $unameform = ''.$lt{'unme'}.': '.$uname.' '.$uname_input;
+ }
}
if ($udomform eq '') {
$udomform = ''.$lt{'doma'}.': ';
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom');
}
if ($unameform eq '') {
- $unameform= ''.$lt{'unme'}.': ';
+ $unameform= ''.$lt{'unme'}.': ';
}
$output .= $unameform.$udomform;
}
@@ -338,12 +356,13 @@ function initialize_codes() {
$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";
@@ -380,7 +399,7 @@ function initialize_codes() {
$output .= '