--- loncom/interface/lonsupportreq.pm 2017/10/15 03:43:52 1.79.2.3.2.1 +++ loncom/interface/lonsupportreq.pm 2025/02/25 05:35:26 1.108 @@ -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.108 2025/02/25 05:35:26 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 = ( @@ -324,11 +330,17 @@ ENDJS onload => "initialize_codes();", ); - - $r->print(&Apache::loncommon::start_page('Support Request',$js, - { 'function' => $function, - 'add_entries' => \%add_entries, - 'only_body' => 1,})); + my $args = { 'function' => $function, + 'add_entries' => \%add_entries, + 'only_body' => 1,}; + unless (($knownuser) || ($public)) { + (undef,undef,undef,my $clientmathml,my $clientunicode) = + &Apache::loncommon::decode_user_agent(); + if ($clientunicode && !$clientmathml) { + $args->{'browser.unicode'} = 1; + } + } + $r->print(&Apache::loncommon::start_page('Support Request',$js,$args)); if ($r->uri eq '/adm/helpdesk') { &print_header($r,$origurl); } @@ -341,30 +353,34 @@ ENDJS } my $topsubmit = '      '; my $shownsubmit; - $r->print('
'."\n"); + $r->print('
'."\n". + ''."\n"); my $output = &Apache::lonhtmlcommon::start_pick_box(). &Apache::lonhtmlcommon::row_headline(). ''. - &mt('(All fields marked with * are required.)'). + &mt('(All fields marked with [_1]*[_2] are required.)', + '',''). ''. &Apache::lonhtmlcommon::row_closure(); unless ($helpform{'username'} eq 'no') { - my ($reqd,$namefield,$fullname); + my ($reqd,$aria_reqd,$namefield,$fullname); if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) { $fullname = "$firstname $lastname"; - $namefield = $fullname.'&').'" />'."\n"; + $namefield = $fullname.'&').'" />'."\n"; } else { if (defined($firstname) && $firstname ne '') { $fullname = $firstname; } elsif (defined($lastname) && $lastname ne '') { $fullname = " $lastname"; } - $namefield = '&').'" />'."\n"; if ($helpform{'username'} eq 'req') { - $reqd = '*'; + $reqd = '*'; + $aria_reqd = 'aria-required="true" '; } + $namefield = '&').'" '.$aria_reqd.'/>'."\n"; } - $output .= &Apache::lonhtmlcommon::row_title($html_lt{'name'}.$reqd,undef,$css[$num])."\n".$namefield. + my $title = ''; + $output .= &Apache::lonhtmlcommon::row_title($title.$reqd,undef,$css[$num])."\n".$namefield. $topsubmit. &Apache::lonhtmlcommon::row_closure()."\n"; $shownsubmit = 1; @@ -373,10 +389,11 @@ ENDJS } $output .= &Apache::lonhtmlcommon::row_title( ''. - $html_lt{'emad'}.' *' + '*' ,undef,$css[$i]). - '&').'" />'."\n"; + '&').'" aria-required="true" />'."\n"; unless ($shownsubmit) { $output .= $topsubmit; } @@ -385,23 +402,30 @@ ENDJS $i = $num%2; if ($knownuser) { if ($homeserver) { - unless ($helpform{'cc'} eq 'no') { - $output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]). - '
'."\n". + 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('', + undef,$css[$i]). + '
'."\n". &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; } } } - 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"; my $uname_input = '&').'" />'."\n"; if ($knownuser) { - $output .= ''.$html_lt{'unme'}.': '.$uname.'  '.$html_lt{'doma'}.': '.$udom.$udom_input.$uname_input; + $output .= ''.$html_lt{'unme'} + .': '.$uname.'  ' + .$html_lt{'doma'}.': '.$udom.$udom_input.$uname_input.''; } else { my $udomform = ''; my $unameform = ''; @@ -415,46 +439,53 @@ ENDJS $output .= '
'."\n"; if (!$public) { if ($env{'user.domain'} =~ /^$match_domain$/) { - $udomform = ''.$html_lt{'doma'}.': '.$udom.$udom_input; + $udomform = ''.$html_lt{'doma'}.': '.$udom.$udom_input; } elsif ($env{'user.name'} =~ /^$match_username$/) { - $unameform = ''.$html_lt{'unme'}.': '.$uname.'  '.$uname_input; + $unameform = ''.$html_lt{'unme'}.': '.$uname.'  '.$uname_input; } } if ($udomform eq '') { - $udomform = ''.$html_lt{'doma'}.': '; - $udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; + $udomform = ': ' + .&Apache::loncommon::select_dom_form($codedom,'udom','','','','','','','udom')."\n"; } if ($unameform eq '') { - $unameform= ''.$html_lt{'unme'}.'  '; + $unameform= ': ' + .'' + .'  '; } $output .= $unameform.$udomform; } $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; + my ($reqd,$aria_reqd); if ($helpform{'phone'} eq 'req') { - $reqd = '*'; + $reqd = '*'; + $aria_reqd = 'aria-required="true" '; } - $output .= &Apache::lonhtmlcommon::row_title($html_lt{'phon'}.$reqd,undef,'LC_evenrow_value'). - '
'."\n". + $output .= &Apache::lonhtmlcommon::row_title(''.$reqd,undef,'LC_evenrow_value'). + '
'."\n". &Apache::lonhtmlcommon::row_closure(); $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"; + $output .= ''."\n"; } else { my @standardnames = &Apache::loncommon::get_standard_codeitems(); my $lasttitle = $numtitles; @@ -465,8 +496,13 @@ ENDJS if ($sectionlist) { $onchange = 'toggleSecVis()'; } - $output .= ' - - - - -
'.$codetitles[0].'
'."\n". - ''; + for (my $i=0; $i<$lasttitle; $i++) { + $output .= ''; + } + $output .= ''; + $output .= ''; - for (my $i=1; $i<$numtitles; $i++) { - $output .= ''."\n"; } $output .= '
'. + ''.$codetitles[$i].'
'."\n". - '
'."\n". + ''."\n". '
'; if ($numtitles > 4) { - $output .= '

'.$codetitles[$numtitles].'
'."\n". + $output .= '

'."\n"; } } } else { - $output .= $html_lt{'enin'}.':  - '."\n"; + $output .= ''."\n"; } - my $reqd; + my ($reqd,$aria_reqd); if ($helpform{'course'} eq 'req') { - $reqd = '*'; + $reqd = '*'; + $aria_reqd = 'aria-required="true" '; } - $output .= '
'.$html_lt{'enct'}.$reqd.':  + $output .= '
'."\n"; $output .= &Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; } - unless ($helpform{'section'} eq 'no') { - $output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]); + unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) { + $output .= &Apache::lonhtmlcommon::row_title('', + undef,$css[$i]); if ($sectionlist) { - $output .= "
\n". " \n"; foreach my $id (sort(keys(%groupid))) { if ($id eq $groupid{$id} || $groupid{$id} eq '') { @@ -541,9 +580,9 @@ ENDJS } $output .= '
'."\n". ''."\n"; + ''."\n"; } else { - $output .= ''."\n"; + $output .= ''."\n"; } $output .= &Apache::lonhtmlcommon::row_closure(); $num ++; @@ -551,15 +590,17 @@ ENDJS } $output .= &Apache::lonhtmlcommon::row_title( ''. - $html_lt{'subj'}.' *' + ''. + '*' ,undef,'LC_oddrow_value'). - ''."\n". + ''."\n". &Apache::lonhtmlcommon::row_closure(). &Apache::lonhtmlcommon::row_title( ''. - $html_lt{'detd'}.' *' + ''. + '*' ,undef,'LC_evenrow_value'). - ''."\n". &Apache::lonhtmlcommon::row_closure(); $num ++; @@ -574,10 +615,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".''.$showmax."\n" + .&Apache::lonhtmlcommon::row_closure(); $num ++; $i = $num%2; } @@ -587,7 +629,7 @@ ENDJS $output .= &Apache::lonhtmlcommon::row_title( ''. &mt('Validation'). - ' *' + '*' ,undef,$css[$i]). $captcha_form."\n". &Apache::lonhtmlcommon::row_closure(); @@ -597,18 +639,16 @@ ENDJS } $output .= &Apache::lonhtmlcommon::row_title($html_lt{'fini'},undef,$css[$i]); $output .= < -
+
+
  -
  + +
-
+
+ +
END $output .= &Apache::lonhtmlcommon::row_closure(1); $output .= &Apache::lonhtmlcommon::end_pick_box(); @@ -616,6 +656,7 @@ END $output

+ END $r->print(&Apache::loncommon::end_page()); return; @@ -624,6 +665,7 @@ END sub print_request_receipt { my ($r,$url,$function) = @_; my $public; + my $args; if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { $public = 1; } @@ -632,32 +674,49 @@ sub print_request_receipt { my ($captcha_chk,$captcha_error) = &Apache::loncommon::captcha_response('login',$lonhost); if ($captcha_chk != 1) { - $r->print(&Apache::loncommon::start_page('Support request failed',undef, - {'function' => $function, - 'add_entries' => { - topmargin => "0", - marginheight => "0", - }, - 'only_body' => 1,})); + $args = { + 'function' => $function, + 'add_entries' => { + topmargin => "0", + marginheight => "0", + }, + 'only_body' => 1,}; + (undef,undef,undef,my $clientmathml,my $clientunicode) = + &Apache::loncommon::decode_user_agent(); + if ($clientunicode && !$clientmathml) { + $args->{'browser.unicode' => 1}; + } + $r->print(&Apache::loncommon::start_page('Support request failed',undef,$args)); if ($r->uri eq '/adm/helpdesk') { &print_header($r,$url,'process'); } $r->print( - '

'.&mt('Support request failed').'

'. + '
'. + '

'.&mt('Support request failed').'

'. &Apache::lonhtmlcommon::confirm_success( &mt('Validation of the code you entered failed.'),1). '

'. &Apache::lonhtmlcommon::actionbox([ &mt('[_1]Go back[_2] and try again', '','')]). - &Apache::loncommon::end_page()); + '
'. + &Apache::loncommon::end_page()); return; } } - my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME'); + my $ip = &Apache::lonnet::get_requestor_ip($r); + my %setters; + my ($startblock,$endblock,$triggerblock,$by_ip,$blockdom) = + &Apache::loncommon::blockcheck(\%setters,'com',$ip); + my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','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'}; @@ -688,25 +747,29 @@ sub print_request_receipt { unless ($helpform{'phone'} eq 'no') { $formvars{'phone'} = 1; } - unless ($helpform{'section'} eq 'no') { + unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) { $formvars{'section'} = 1; } - unless ($helpform{'course'} eq 'no') { + unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) { $formvars{'course'} = 1; } - unless ($helpform{'cc'} eq 'no') { + unless (($helpform{'cc'} eq 'no') || ($by_ip)) { $formvars{'cc'} = 1; } unless ($helpform{'screenshot'} eq 'no') { $formvars{'screenshot'} = 1; } - my $coursecode; + my ($coursecode,$sourceurl); if ($formvars{'course'}) { $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; @@ -736,6 +799,8 @@ sub print_request_receipt { secn => 'Section', warn => 'Warning: Problem with support e-mail address', your => 'Your support request contained the following information', + belo => 'Below is your support request which could not be sent', + ifyk => 'If you know an IT support address for your institution, you could copy this information and send it to that email address.', sect => 'section', info => 'Information supplied', adin => 'Additional information recorded', @@ -794,7 +859,15 @@ sub print_request_receipt { $badccmsg .= '
'.&mt('The following Cc e-mail addresses are invalid: '). &Apache::loncommon::cleanup_html(join(', ',@bad_ccs)); } } - $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; + if ($env{'request.lti.login'}) { + if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) { + $env{'form.user'} = "'".$env{'user.name'}.':'.$env{'user.domain'}."'"; + } + $sourceurl = &Apache::lonnet::absolute_url().$url; + } else { + $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; + $sourceurl = $env{'form.sourceurl'}; + } if ($formvars{'course'}) { $env{'form.crsi'} = $env{'form.title'}; if ($coursecode ne '') { @@ -833,7 +906,7 @@ sub print_request_receipt { } $supportmsg .= "$lt{'subject'}: $env{'form.subject'} $lt{'description'}: $env{'form.description'} -$lt{'sourceurl'}: $env{'form.sourceurl'} +$lt{'sourceurl'}: $sourceurl $lt{'date'}: $reporttime "; @@ -867,6 +940,7 @@ $lt{'date'}: $reporttime next if ($helpform{$item} eq 'no'); } next if (($item eq 'crsi') && ($helpform{'course'} eq 'no')); + next if (($item eq 'user') && ($env{'request.lti.login'})); my $showitem = $env{'form.'.$item}; $showitem = &Apache::loncommon::cleanup_html($showitem); $displaymsg .= @@ -882,7 +956,7 @@ $lt{'date'}: $reporttime $env{'form.'.$field} =~ s/\s+$//; } if ($env{'form.uname'} =~ /^$match_username$/) { - $requdom = $env{'form.udom'}; + $requname = $env{'form.uname'}; } if ($env{'form.udom'} =~ /^$match_domain$/) { $requdom = $env{'form.udom'}; @@ -904,18 +978,19 @@ $lt{'date'}: $reporttime $displaymsg .= ''. $lt{'date'}.': '.$reporttime.'
'."\n"; - - my $start_page = - &Apache::loncommon::start_page('Support request recorded',undef, - {'function' => $function, - 'add_entries' => { - topmargin => "0", - marginheight => "0", - }, - 'only_body' => 1,}); - + my $args = {'function' => $function, + 'add_entries' => { + topmargin => "0", + marginheight => "0", + }, + 'only_body' => 1,}; + (undef,undef,undef,my $clientmathml,my $clientunicode) = + &Apache::loncommon::decode_user_agent(); + if ($clientunicode && !$clientmathml) { + $args->{'browser.unicode'} = 1; + } + $r->print(&Apache::loncommon::start_page('Support request recorded',undef,$args)); $r->print(<<"END"); -$start_page
@@ -955,17 +1030,19 @@ END my $message; if (!$bad_email) { - $message = &Apache::lonhtmlcommon::confirm_success( - &mt('A support request has been sent to [_1]',''.$to.'')); + $message = &mt('A support request has been sent to [_1]',''.$to.''); } else { - $message = &Apache::lonhtmlcommon::confirm_success( - $lt{'warn'}.'
' - .&mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.',''.$to.'','','') - .' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1); - $to = 'helpdesk@lon-capa.org'; + $message = $lt{'warn'}.'
'; + if ($to eq '') { + $message .= &mt('For this LON-CAPA server no e-mail address has been configured to receive support requests, so your support request has [_1]not[_2] been sent to the LON-CAPA support staff or administrator at your institution.','',''); + } else { + $message .= &mt('As the e-mail address provided for this LON-CAPA server ([_1]) does not appear to be a valid e-mail address, your support request has [_2]not[_3] been sent to the LON-CAPA support staff or administrator at your institution.',''.$to.'','',''); + } + } + $r->print('
'); + if ($bad_email) { + $r->print(&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message,$bad_email)).'
'); } - $r->print(&Apache::loncommon::confirmwrapper($message)); - if ($reqemail ne '') { $from = $reqemail; } @@ -1016,7 +1093,21 @@ END if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) { $cookies{'lonID'} = $1; } - + if ($$cookie{'lonLinkID'} =~ /lonLinkID=([a-f0-9]+_linked);/) { + $cookies{'lonLinkID'} = $1; + } + my $lti_info; + if (($env{'request.lti.login'}) && ($env{'request.course.id'})) { + my $ltidom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + if ($ltidom) { + my %lti = &Apache::lonnet::get_domain_lti($ltidom,'provider'); + if (ref($lti{$env{'request.lti.login'}}) eq 'HASH') { + if ($lti{$env{'request.lti.login'}}{'consumer'}) { + $lti_info = "LTI consumer: ".$lti{$env{'request.lti.login'}}{'consumer'}."\n"; + } + } + } + } if ($attachmentpath =~ m-/([^/]+)$-) { $fname = $1; $displaymsg .= '
' @@ -1031,9 +1122,13 @@ END foreach my $var(@ENVvars) { $supportmsg .= "$var: $ENV{$var}\n"; } + $supportmsg .= "REMOTE_ADDR: $ip\n"; foreach my $var (@envvars) { $supportmsg .= "$var: $env{$var}\n"; } + if ($lti_info) { + $supportmsg .= $lti_info; + } } my $cc_string; @@ -1051,12 +1146,16 @@ END foreach my $var (@ENVvars) { $attachment_text .= "$var: $ENV{$var}\n"; } + $attachment_text .= "REMOTE_ADDR: $ip\n"; foreach my $var (@envvars) { $attachment_text .= "$var: $env{$var}\n"; } foreach my $var (@loncvars) { $attachment_text .= "$var: $env{$var}\n"; } + if ($lti_info) { + $attachment_text .= $lti_info; + } } if ($addtext) { @@ -1069,44 +1168,18 @@ END } } - my $msg = MIME::Lite->new( - From => $from, - To => $to, - Subject => $subject, - Type =>'TEXT', - Data => $supportmsg, - ); - if ($homeserver) { - if (@ok_ccs > 0) { - my $cc_string = join(', ',@ok_ccs); - $msg->add("Cc" => $cc_string); - } - } - if ($bcc ne '') { - $msg->add("Bcc" => $bcc); - } - $msg->attr("content-type" => "text/plain"); - $msg->attr("content-type.charset" => "UTF-8"); - - if ($homeserver && $attachmentpath) { - my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); - $msg->attach(Type => $type, - Path => $attachmentpath, - Filename => $fname - ); - - } elsif ($attachment_text ne '') { - $msg->attach(Type => 'TEXT', - Data => $attachment_text); + if ($bad_email) { + $r->print(''.$lt{'belo'}.'
'. + $lt{'ifyk'}."\n"); + } else { + # Compose and send a MIME email + &Apache::loncommon::mime_email($from,'',$to,$subject,$supportmsg,$cc_string, + $bcc,$attachmentpath,$fname,$attachment_text); + $r->print(''.$lt{'your'}.':'."\n"); } - -### Send it: - $msg->send('sendmail'); - if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { unlink($attachmentpath); } - $r->print(''.$lt{'your'}.':

'."\n"); $r->print('
'. &Apache::lonhtmlcommon::start_pick_box(). &Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n". @@ -1125,6 +1198,10 @@ END $var.': '.$ENV{$var}.', '; } } + if ($ip ne '') { + $envmsg .= ''. + 'REMOTE_ADDR: '.$ip.', '; + } foreach my $var (@envvars) { if ($env{$var} ne '') { $envmsg .= ''. @@ -1135,7 +1212,11 @@ END $r->print($envmsg."\n". &Apache::lonhtmlcommon::row_closure(1)."\n". &Apache::lonhtmlcommon::end_pick_box(). - "
\n". + '
'); + unless ($bad_email) { + $r->print('


'.&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message)).'

'); + } + $r->print("\n". &Apache::loncommon::end_page()); } @@ -1143,7 +1224,11 @@ sub print_header { my ($r,$origurl,$command) = @_; my $location=&Apache::loncommon::lonhttpdurl("/adm"); my ($component_url); - my $helpdesk_link = ''; + my $helpicon_link = ''; + if ($command eq 'process') { + $helpicon_link = ''; + } + my $helpdesk_link = ''; if ($command eq 'process') { $helpdesk_link = ''; } @@ -1159,7 +1244,7 @@ sub print_header { ); my ($getstartlink,$reviewtext); if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') { - $getstartlink = qq| $lt{'getst'}|; + $getstartlink = qq||; $reviewtext = &mt('Please review the information in "Log-in help" and the "Getting started" guide if you are unable to log-in.'); } else { $reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.'); @@ -1175,47 +1260,34 @@ sub print_header { $loginhelp = '/adm/loginproblems.html'; } $r->print(<<"END"); - - - - - - - - - + END if ($command ne 'process') { my $stuwarn = &mt('Do [_1]not[_2] use this form to ask about course content.', '',''); $r->print(<<"END"); - - - +

+ $lt{'stud'}: + $stuwarn $lt{'cont'} +

+ END } - $r->print(' -
  -
- - logo - LON-CAPA $lt{'headline'} - - - - - $getstartlink - - - -
-
 
 
$reviewtext +
+ $reviewtext $lt{'ifyo'} -

-$lt{'stud'}: -$stuwarn $lt{'cont'} -


-
'); return; }