--- loncom/interface/lonsupportreq.pm 2012/08/27 06:28:06 1.69 +++ loncom/interface/lonsupportreq.pm 2013/01/04 16:57:38 1.70 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.69 2012/08/27 06:28:06 raeburn Exp $ +# $Id: lonsupportreq.pm,v 1.70 2013/01/04 16:57:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,7 +39,7 @@ use Apache::lonacc(); use Apache::lonauth(); use Apache::courseclassifier; use LONCAPA qw(:DEFAULT :match); - +use HTML::Entities; sub handler { my ($r) = @_; @@ -57,8 +57,19 @@ sub handler { if ($r->uri eq '/adm/helpdesk') { &Apache::lonacc::get_posted_cgi($r); } - my $function = $env{'form.function'}; + my $function; + if ($env{'form.function'}) { + if (($env{'form.function'} eq 'norole') || + ($env{'form.function'} eq 'student') || + ($env{'form.function'} eq 'admin') || + ($env{'form.function'} eq 'author')) { + $function = $env{'form.function'}; + } + } my $origurl = $env{'form.origurl'}; + $origurl =~ s{^https?://}{}; + $origurl =~ s/(`)//g; + $origurl =~ s/\$/\(\$\)/g; my $command = $env{'form.command'}; if ($command eq 'process') { @@ -102,13 +113,9 @@ sub print_request_form { } $formname = 'logproblem'; my $machine = &Apache::lonnet::absolute_url(); - if ($origurl =~ m-^https?://-) { - $server = $origurl; - } else { - $server = $machine.$origurl; - } - my $showserver = $server; - $showserver =~ s/\?.*$//; + my $sourceurl = $machine.$origurl; + $server = $machine.&cleanup_html($origurl); + $server =~ s/\?.*$//; my %lt = &Apache::lonlocal::texthash ( email => 'The e-mail address you entered', notv => 'is not a valid e-mail address', @@ -358,8 +365,8 @@ ENDJS $num ++; $i = $num%2; $output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]). - $showserver."\n".'&').'" />'."\n". + $server."\n".'&').'" />'."\n". &Apache::lonhtmlcommon::row_closure(). &Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). '
'."\n". @@ -951,8 +958,11 @@ sub print_header { } else { $reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.'); } + my $linkback; if ($origurl eq '') { - $origurl = 'javascript:history.go(-1)'; + $linkback = 'javascript:history.go(-1)'; + } else { + $linkback = &HTML::Entities::encode($origurl,'"<>&'); } my $loginhelp = &Apache::lonauth::loginhelpdisplay(); if ($loginhelp eq '') { @@ -972,7 +982,7 @@ sub print_header { ($lt{'login'}) $lt{'login'}   $helpdesk_link($lt{'ask'}) $lt{'ask'} $getstartlink -  ($lt{'back'}) $lt{'back'}  +  ($lt{'back'}) $lt{'back'}  @@ -1005,8 +1015,11 @@ END sub get_domain { my $codedom; if (exists($env{'form.codedom'})) { - $codedom = $env{'form.codedom'}; - } elsif ($env{'request.course.id'}) { + if (&Apache::lonnet::domain($env{'form.codedom'}) ne '') { + return $env{'form.codedom'}; + } + } + if ($env{'request.course.id'}) { $codedom = $env{'course.'.$env{'request.course.id'}.'.domain'}; } elsif ($env{'request.role.domain'}) { $codedom = $env{'request.role.domain'}; @@ -1021,6 +1034,7 @@ sub cleanup_html { my $outgoing; if ($incoming ne '') { $outgoing = $incoming; + $outgoing =~ s/;/;/g; $outgoing =~ s/\#/#/g; $outgoing =~ s/\&/&/g; $outgoing =~ s/