--- loncom/interface/lonsupportreq.pm 2017/10/15 03:43:52 1.79.2.3.2.1
+++ loncom/interface/lonsupportreq.pm 2023/07/26 01:03:58 1.105
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Helpdesk request form
#
-# $Id: lonsupportreq.pm,v 1.79.2.3.2.1 2017/10/15 03:43:52 raeburn Exp $
+# $Id: lonsupportreq.pm,v 1.105 2023/07/26 01:03:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -29,8 +29,6 @@
package Apache::lonsupportreq;
use strict;
-use MIME::Types;
-use MIME::Lite;
use CGI::Cookie();
use Apache::Constants qw(:common);
use Apache::loncommon();
@@ -69,7 +67,9 @@ sub handler {
}
}
my $origurl = $env{'form.origurl'};
- $origurl =~ s{^https?://}{};
+ if ($origurl =~ m{^https?://[^/]+(.*)$}) {
+ $origurl = $1;
+ }
$origurl =~ s/(`)//g;
$origurl =~ s/\$/\(\$\)/g;
my $command = $env{'form.command'};
@@ -151,7 +151,6 @@ sub print_request_form {
}
}
- my %coursecodes;
my %codes;
my @codetitles;
my %cat_titles;
@@ -159,9 +158,7 @@ sub print_request_form {
my %idlist;
my %idnums;
my %idlist_titles;
- my $caller = 'global';
my $totcodes = 0;
- my $format_reply;
my $jscript = '';
my $loaditems = qq|
function initialize_codes() {
@@ -169,10 +166,17 @@ function initialize_codes() {
}
|;
unless ($helpform{'course'} eq 'no') {
- $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom);
- if ($totcodes > 0) {
- $format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order);
- if ($format_reply eq 'ok') {
+ my $instcats = &Apache::lonnet::get_dom_instcats($codedom);
+ if (ref($instcats) eq 'HASH') {
+ if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') &&
+ (ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) {
+ %codes = %{$instcats->{'codes'}};
+ @codetitles = @{$instcats->{'codetitles'}};
+ %cat_titles = %{$instcats->{'cat_titles'}};
+ %cat_order = %{$instcats->{'cat_order'}};
+ $totcodes = scalar(keys(%codes));
+ }
+ if ($totcodes > 0) {
my $numtypes = @codetitles;
&Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles);
my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles);
@@ -316,7 +320,9 @@ $loaditems
// ]]>
ENDJS
- if ($recaptcha_version >=2) {
+ if ($knownuser) {
+ $js .="\n".'';
+ } elsif ($recaptcha_version >=2) {
$js.= "\n".''."\n";
}
my %add_entries = (
@@ -385,7 +391,11 @@ ENDJS
$i = $num%2;
if ($knownuser) {
if ($homeserver) {
- unless ($helpform{'cc'} eq 'no') {
+ my $ip = &Apache::lonnet::get_requestor_ip($r);
+ my %setters;
+ my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) =
+ &Apache::loncommon::blockcheck(\%setters,'com',$ip);
+ unless (($helpform{'cc'} eq 'no') || ($by_ip)) {
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]).
'
'."\n".
&Apache::lonhtmlcommon::row_closure();
@@ -394,7 +404,7 @@ ENDJS
}
}
}
- unless ($helpform{'user'} eq 'no') {
+ unless (($helpform{'user'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'unme'}/$html_lt{'doma'}",undef,$css[$i]);
my $udom_input = '&').'" />'."\n";
@@ -431,12 +441,14 @@ ENDJS
}
$output .= &Apache::lonhtmlcommon::row_closure();
$num ++;
+ $i = $num%2;
+ }
+ unless ($env{'request.lti.login'}) {
+ $output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]).
+ $server."\n".'&').'" />'."\n".
+ &Apache::lonhtmlcommon::row_closure();
}
- $i = $num%2;
- $output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]).
- $server."\n".'&').'" />'."\n".
- &Apache::lonhtmlcommon::row_closure();
unless ($helpform{'phone'} eq 'no') {
my $reqd;
if ($helpform{'phone'} eq 'req') {
@@ -448,13 +460,13 @@ ENDJS
$num ++;
$i = $num%2;
}
- unless ($helpform{'course'} eq 'no') {
+ unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]);
if ($totcodes > 0) {
my $numtitles = @codetitles;
if ($numtitles == 0) {
$output .= $html_lt{'enin'}.':
- '."\n";
+ ').'" />'."\n";
} else {
my @standardnames = &Apache::loncommon::get_standard_codeitems();
my $lasttitle = $numtitles;
@@ -523,7 +535,7 @@ ENDJS
$num ++;
$i = $num%2;
}
- unless ($helpform{'section'} eq 'no') {
+ unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) {
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]);
if ($sectionlist) {
$output .= "