--- loncom/interface/lonsupportreq.pm 2017/01/23 19:57:30 1.79.2.3 +++ loncom/interface/lonsupportreq.pm 2019/08/12 18:11:42 1.79.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Helpdesk request form # -# $Id: lonsupportreq.pm,v 1.79.2.3 2017/01/23 19:57:30 raeburn Exp $ +# $Id: lonsupportreq.pm,v 1.79.2.6 2019/08/12 18:11:42 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -69,7 +69,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 +153,6 @@ sub print_request_form { } } - my %coursecodes; my %codes; my @codetitles; my %cat_titles; @@ -159,9 +160,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 +168,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 +322,9 @@ $loaditems // ]]> ENDJS - if ($recaptcha_version >=2) { + if ($knownuser) { + $js .="\n".''; + } elsif ($recaptcha_version >=2) { $js.= "\n".''."\n"; } my %add_entries = ( @@ -574,10 +582,11 @@ ENDJS $showmax = $helpform{'maxsize'}; } $showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')'; - $output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]). - '
'. - "\n".$html_lt{'uplf'}.$showmax."\n". - &Apache::lonhtmlcommon::row_closure(); + $output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) + .' ' + .'' + .'
'."\n".$html_lt{'uplf'}.$showmax."\n" + .&Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; } @@ -657,7 +666,12 @@ sub print_request_receipt { 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 @cookievars; + if ($ENV{'SERVER_PORT'} == 443) { + @cookievars = ('lonLinkID'); + } else { + @cookievars = ('lonID'); + } my $admin = $Apache::lonnet::perlvar{'lonAdminMail'}; my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'}; @@ -708,8 +722,12 @@ sub print_request_receipt { $coursecode = $env{'form.coursecode'}; if ($coursecode eq '') { my $totcodes = 0; - my %coursecodes; - $totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom); + my $instcats = &Apache::lonnet::get_dom_instcats($defdom); + if (ref($instcats) eq 'HASH') { + if (ref($instcats->{'codes'}) eq 'HASH') { + $totcodes = scalar(keys(%{$instcats->{'codes'}})); + } + } my @standardnames = &Apache::loncommon::get_standard_codeitems(); if ($totcodes > 0) { my $noregexps = 1; @@ -991,7 +1009,9 @@ END if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) { $cookies{'lonID'} = $1; } - + if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) { + $cookies{'lonLinkID'} = $1; + } if ($attachmentpath =~ m-/([^/]+)$-) { $fname = $1; $displaymsg .= '
'