--- loncom/interface/lonsupportreq.pm 2007/05/07 14:02:45 1.43
+++ loncom/interface/lonsupportreq.pm 2011/03/03 17:29:29 1.66
@@ -1,5 +1,5 @@
#
-# $Id: lonsupportreq.pm,v 1.43 2007/05/07 14:02:45 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.66 2011/03/03 17:29:29 bisitz 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,10 +57,10 @@ sub handler {
&Apache::lonacc::get_posted_cgi($r);
}
my $function = $env{'form.function'};
- my $origurl = &unescape($env{'form.origurl'});
- my $action = $env{'form.action'};
+ my $origurl = $env{'form.origurl'};
+ my $command = $env{'form.command'};
- if ($action eq 'process') {
+ if ($command eq 'process') {
&print_request_receipt($r,$origurl,$function);
} else {
&print_request_form($r,$origurl,$function);
@@ -70,18 +70,21 @@ sub handler {
sub print_request_form {
my ($r,$origurl,$function) = @_;
- my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,$formname);
- my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
- if (($tablecolor eq '') || ($tablecolor eq '#FFFFFF')) {
- $tablecolor = '#EEEE99';
- }
+ my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid,
+ $cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,
+ $formname,$public);
+ $function = &Apache::loncommon::get_users_function() if (!$function);
$ccode = '';
$os = $env{'browser.os'};
$browser = $env{'browser.type'};
$bversion = $env{'browser.version'};
$uhost = $env{'request.host'};
- $uname = $env{'user.name'};
- $udom = $env{'user.domain'};
+ if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) {
+ $public = 1;
+ } else {
+ $uname = $env{'user.name'};
+ $udom = $env{'user.domain'};
+ }
$uhome = $env{'user.home'};
$urole = $env{'request.role'};
$usec = $env{'request.course.sec'};
@@ -93,6 +96,8 @@ sub print_request_form {
} else {
$server = $machine.$origurl;
}
+ my $showserver = $server;
+ $showserver =~ s/\?.*$//;
my %lt = &Apache::lonlocal::texthash (
email => 'The e-mail address you entered',
notv => 'is not a valid e-mail address',
@@ -100,10 +105,13 @@ sub print_request_form {
rdes => 'You must include a description',
name => 'Name',
subm => 'Submit Request',
- emad => 'E-mail address',
+ emad => 'Your e-mail address',
+ emac => 'Cc',
unme => 'username',
doma => 'domain',
- entr => 'Enter the username you use to log-in to your LON-CAPA system, and choose your domain.',
+ entu => 'Enter the username you use to log-in to LON-CAPA',
+ chdo => 'Choose your LON-CAPA domain',
+ entr => 'Enter the username you use to log-in to LON-CAPA, and your domain.',
urlp => 'URL of page',
phon => 'Phone',
crsd => 'Course Details',
@@ -117,7 +125,7 @@ sub print_request_form {
subj => 'Subject',
detd => 'Detailed Description',
opfi => 'Optional file upload',
- uplf => 'Upload a file (e.g., a screenshot) relevant to your support request (128 KB max. size)',
+ uplf => 'Upload a file (e.g., a screenshot) relevant to your help request (128 KB max.)',
fini => 'Finish',
clfm => 'Clear Form',
);
@@ -140,8 +148,9 @@ function validate() {
END
$scripttag .= &Apache::lonhtmlcommon::javascript_valid_email();
- if ($cid =~ m/_/) {
- ($cdom,$cnum) = split(/_/,$cid);
+ if ($cid) {
+ $cdom = $env{'course.'.$cid.'.domain'};
+ $cnum = $env{'course.'.$cid.'.num'};
}
if ($cdom && $cnum) {
my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum);
@@ -149,10 +158,12 @@ END
$ccode = $csettings{'internal.coursecode'};
$sectionlist = $csettings{'internal.sectionnums'};
}
- if ($env{'environment.critnotification'}) {
+
+ if ($env{'environment.permanentemail'}) {
+ $email = $env{'environment.permanentemail'};
+ } elsif ($env{'environment.critnotification'}) {
$email = $env{'environment.critnotification'};
- }
- if (!$email && $env{'environment.notification'}) {
+ } elsif ($env{'environment.notification'}) {
$email = $env{'environment.notification'};
}
if ($env{'environment.lastname'}) {
@@ -167,11 +178,21 @@ END
my ($sec,$grp) = split(/:/,$section);
$groupid{$sec} = $grp;
}
- my $codedom = $Apache::lonnet::perlvar{'lonDefDomain'};
- &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']);
- if (exists($env{'form.codedom'})) {
- $codedom = $env{'form.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) {
$details_title = '
('.$codedom.')';
@@ -193,9 +214,6 @@ function initialize_codes() {
return;
}
|;
- if ($cdom) {
- $codedom = $cdom;
- }
if ($cnum) {
$coursecodes{$cnum} = $ccode;
if ($ccode eq '') {
@@ -225,228 +243,128 @@ function initialize_codes() {
}
}
- my $js = '';
+ my $js = '';
my %add_entries = (topmargin => "0",
marginheight => "0",
onLoad =>"initialize_codes()",);
- my $start_page =
- &Apache::loncommon::start_page('Support Request',$js,
+
+ $r->print(&Apache::loncommon::start_page('Support Request',$js,
{ 'function' => $function,
'add_entries' => \%add_entries,
- 'only_body' => 1,});
- $r->print($start_page);
-
+ 'only_body' => 1,}));
if ($r->uri eq '/adm/helpdesk') {
&print_header($r,$origurl);
}
- $r->print(<<"END");
-