version 1.86, 2017/01/18 21:24:40
|
version 1.106, 2024/07/15 17:12:40
|
Line 67 sub handler {
|
Line 67 sub handler {
|
} |
} |
} |
} |
my $origurl = $env{'form.origurl'}; |
my $origurl = $env{'form.origurl'}; |
$origurl =~ s{^https?://}{}; |
if ($origurl =~ m{^https?://[^/]+(.*)$}) { |
|
$origurl = $1; |
|
} |
$origurl =~ s/(`)//g; |
$origurl =~ s/(`)//g; |
$origurl =~ s/\$/\(\$\)/g; |
$origurl =~ s/\$/\(\$\)/g; |
my $command = $env{'form.command'}; |
my $command = $env{'form.command'}; |
Line 79 sub handler {
|
Line 81 sub handler {
|
} |
} |
return OK; |
return OK; |
} |
} |
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$origurl,$function) = @_; |
my ($r,$origurl,$function) = @_; |
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
Line 105 sub print_request_form {
|
Line 107 sub print_request_form {
|
} |
} |
} |
} |
} |
} |
if (($env{'user.name'} =~ /^$match_username$/) && |
if (($env{'user.name'} =~ /^$match_username$/) && |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$knownuser = 1; |
$knownuser = 1; |
} else { |
} else { |
Line 149 sub print_request_form {
|
Line 151 sub print_request_form {
|
} |
} |
} |
} |
|
|
my %coursecodes; |
|
my %codes; |
my %codes; |
my @codetitles; |
my @codetitles; |
my %cat_titles; |
my %cat_titles; |
Line 157 sub print_request_form {
|
Line 158 sub print_request_form {
|
my %idlist; |
my %idlist; |
my %idnums; |
my %idnums; |
my %idlist_titles; |
my %idlist_titles; |
my $caller = 'global'; |
|
my $totcodes = 0; |
my $totcodes = 0; |
my $format_reply; |
|
my $jscript = ''; |
my $jscript = ''; |
my $loaditems = qq| |
my $loaditems = qq| |
function initialize_codes() { |
function initialize_codes() { |
Line 167 function initialize_codes() {
|
Line 166 function initialize_codes() {
|
} |
} |
|; |
|; |
unless ($helpform{'course'} eq 'no') { |
unless ($helpform{'course'} eq 'no') { |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom); |
my $instcats = &Apache::lonnet::get_dom_instcats($codedom); |
if ($totcodes > 0) { |
if (ref($instcats) eq 'HASH') { |
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') && |
if ($format_reply eq 'ok') { |
(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; |
my $numtypes = @codetitles; |
&Apache::courseclassifier::build_code_selections(\%codes,\@codetitles,\%cat_titles,\%cat_order,\%idlist,\%idnums,\%idlist_titles); |
&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); |
my ($scripttext,$longtitles) = &Apache::courseclassifier::javascript_definitions(\@codetitles,\%idlist,\%idlist_titles,\%idnums,\%cat_titles); |
Line 246 END
|
Line 252 END
|
subj => 'Subject', |
subj => 'Subject', |
detd => 'Detailed Description', |
detd => 'Detailed Description', |
opfi => 'Optional file upload', |
opfi => 'Optional file upload', |
uplf => 'Upload a file (e.g., a screenshot) relevant to your help request (1 MB max.)', |
uplf => 'Upload a file (e.g., a screenshot) relevant to your help request', |
fini => 'Finish', |
fini => 'Finish', |
clfm => 'Clear Form', |
clfm => 'Clear Form', |
); |
); |
Line 313 $jscript
|
Line 319 $jscript
|
$loaditems |
$loaditems |
// ]]> |
// ]]> |
</script> |
</script> |
<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script> |
|
ENDJS |
ENDJS |
if ($recaptcha_version >=2) { |
if ($knownuser) { |
|
$js .="\n".'<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script>'; |
|
} elsif ($recaptcha_version >=2) { |
$js.= "\n".'<script src="https://www.google.com/recaptcha/api.js"></script>'."\n"; |
$js.= "\n".'<script src="https://www.google.com/recaptcha/api.js"></script>'."\n"; |
} |
} |
my %add_entries = ( |
my %add_entries = ( |
Line 350 ENDJS
|
Line 357 ENDJS
|
unless ($helpform{'username'} eq 'no') { |
unless ($helpform{'username'} eq 'no') { |
my ($reqd,$namefield,$fullname); |
my ($reqd,$namefield,$fullname); |
if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) { |
if ((defined($lastname) && $lastname ne '') && (defined($firstname) && $firstname ne '')) { |
$fullname = "$firstname $lastname"; |
$fullname = "$firstname $lastname"; |
$namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
$namefield = $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
} else { |
} else { |
if (defined($firstname) && $firstname ne '') { |
if (defined($firstname) && $firstname ne '') { |
Line 378 ENDJS
|
Line 385 ENDJS
|
&HTML::Entities::encode($email,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($email,'"<>&').'" />'."\n"; |
unless ($shownsubmit) { |
unless ($shownsubmit) { |
$output .= $topsubmit; |
$output .= $topsubmit; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if ($knownuser) { |
if ($knownuser) { |
if ($homeserver) { |
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]). |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]). |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
Line 393 ENDJS
|
Line 404 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]); |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'unme'}/$html_lt{'doma'}",undef,$css[$i]); |
my $udom_input = '<input type="hidden" name="udom" value="'. |
my $udom_input = '<input type="hidden" name="udom" value="'. |
&HTML::Entities::encode($udom,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($udom,'"<>&').'" />'."\n"; |
Line 430 ENDJS
|
Line 441 ENDJS
|
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
|
$i = $num%2; |
|
} |
|
unless ($env{'request.lti.login'}) { |
|
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]). |
|
$server."\n".'<input type="hidden" name="sourceurl" value="'. |
|
&HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n". |
|
&Apache::lonhtmlcommon::row_closure(); |
} |
} |
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]). |
|
$server."\n".'<input type="hidden" name="sourceurl" value="'. |
|
&HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n". |
|
&Apache::lonhtmlcommon::row_closure(); |
|
unless ($helpform{'phone'} eq 'no') { |
unless ($helpform{'phone'} eq 'no') { |
my $reqd; |
my $reqd; |
if ($helpform{'phone'} eq 'req') { |
if ($helpform{'phone'} eq 'req') { |
Line 447 ENDJS
|
Line 460 ENDJS
|
$num ++; |
$num ++; |
$i = $num%2; |
$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]); |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]); |
if ($totcodes > 0) { |
if ($totcodes > 0) { |
my $numtitles = @codetitles; |
my $numtitles = @codetitles; |
if ($numtitles == 0) { |
if ($numtitles == 0) { |
$output .= $html_lt{'enin'}.': |
$output .= $html_lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
<input type="text" name="coursecode" size="15" value="'.&HTML::Entities::encode($ccode,'\'"&<>').'" />'."\n"; |
} else { |
} else { |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my $lasttitle = $numtitles; |
my $lasttitle = $numtitles; |
Line 522 ENDJS
|
Line 535 ENDJS
|
$num ++; |
$num ++; |
$i = $num%2; |
$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]); |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]); |
if ($sectionlist) { |
if ($sectionlist) { |
$output .= "<div id=\"LC_helpdesk_sectionlist\"><select name=\"sectionsel\">\n". |
$output .= "<div id=\"LC_helpdesk_sectionlist\"><select name=\"sectionsel\">\n". |
Line 541 ENDJS
|
Line 554 ENDJS
|
$output .= '</select></div>'."\n". |
$output .= '</select></div>'."\n". |
'<div id="LC_helpdesk_section" style="display:none">'. |
'<div id="LC_helpdesk_section" style="display:none">'. |
'<input type="text" name="sectiontxt" size="10" /></div>'."\n"; |
'<input type="text" name="sectiontxt" size="10" /></div>'."\n"; |
} else { |
} else { |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
Line 567 ENDJS
|
Line 580 ENDJS
|
if ($homeserver) { |
if ($homeserver) { |
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
my $max = 1048576; |
my $max = 1048576; |
|
my $showmax = 1.00; |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
$max *= $helpform{'maxsize'}; |
$max *= $helpform{'maxsize'}; |
|
$showmax = $helpform{'maxsize'}; |
} |
} |
|
$showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')'; |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) |
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
.' <input type="file" name="screenshot" class="LC_flUpload" size="20" />' |
.'<input type="hidden" id="free_space" value="'.$max.'" />' |
.'<input type="hidden" id="LC_free_space" value="'.$max.'" />' |
.'<br />'."\n".$html_lt{'uplf'}."\n" |
.'<br />'."\n".$html_lt{'uplf'}.$showmax."\n" |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
Line 624 sub print_request_receipt {
|
Line 640 sub print_request_receipt {
|
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
$public = 1; |
$public = 1; |
} |
} |
my $lonhost = $r->dir_config('lonHostID'); |
my $lonhost = $r->dir_config('lonHostID'); |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
my ($captcha_chk,$captcha_error) = |
my ($captcha_chk,$captcha_error) = |
&Apache::loncommon::captcha_response('login',$lonhost); |
&Apache::loncommon::captcha_response('login',$lonhost); |
Line 651 sub print_request_receipt {
|
Line 667 sub print_request_receipt {
|
return; |
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 @envvars = ('browser.os','browser.type','browser.version','user.home','request.role'); |
my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id'); |
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 $admin = $Apache::lonnet::perlvar{'lonAdminMail'}; |
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'}; |
my $defdom = &get_domain(); |
my $defdom = &get_domain(); |
my ($to,$bcc,$addtext) = |
|
&Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
|
$defdom,$origmail); |
|
my $from = $admin; |
my $from = $admin; |
my %helpform; |
my %helpform; |
my %domconfig = |
my %domconfig = |
Line 688 sub print_request_receipt {
|
Line 710 sub print_request_receipt {
|
unless ($helpform{'phone'} eq 'no') { |
unless ($helpform{'phone'} eq 'no') { |
$formvars{'phone'} = 1; |
$formvars{'phone'} = 1; |
} |
} |
unless ($helpform{'section'} eq 'no') { |
unless (($helpform{'section'} eq 'no') || ($env{'request.lti.login'})) { |
$formvars{'section'} = 1; |
$formvars{'section'} = 1; |
} |
} |
unless ($helpform{'course'} eq 'no') { |
unless (($helpform{'course'} eq 'no') || ($env{'request.lti.login'})) { |
$formvars{'course'} = 1; |
$formvars{'course'} = 1; |
} |
} |
unless ($helpform{'cc'} eq 'no') { |
unless (($helpform{'cc'} eq 'no') || ($by_ip)) { |
$formvars{'cc'} = 1; |
$formvars{'cc'} = 1; |
} |
} |
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
$formvars{'screenshot'} = 1; |
$formvars{'screenshot'} = 1; |
} |
} |
my $coursecode; |
my ($coursecode,$sourceurl); |
if ($formvars{'course'}) { |
if ($formvars{'course'}) { |
$coursecode = $env{'form.coursecode'}; |
$coursecode = $env{'form.coursecode'}; |
if ($coursecode eq '') { |
if ($coursecode eq '') { |
my $totcodes = 0; |
my $totcodes = 0; |
my %coursecodes; |
my $instcats = &Apache::lonnet::get_dom_instcats($defdom); |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom); |
if (ref($instcats) eq 'HASH') { |
|
if (ref($instcats->{'codes'}) eq 'HASH') { |
|
$totcodes = scalar(keys(%{$instcats->{'codes'}})); |
|
} |
|
} |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
if ($totcodes > 0) { |
if ($totcodes > 0) { |
my $noregexps = 1; |
my $noregexps = 1; |
Line 736 sub print_request_receipt {
|
Line 762 sub print_request_receipt {
|
secn => 'Section', |
secn => 'Section', |
warn => 'Warning: Problem with support e-mail address', |
warn => 'Warning: Problem with support e-mail address', |
your => 'Your support request contained the following information', |
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', |
sect => 'section', |
info => 'Information supplied', |
info => 'Information supplied', |
adin => 'Additional information recorded', |
adin => 'Additional information recorded', |
Line 794 sub print_request_receipt {
|
Line 822 sub print_request_receipt {
|
$badccmsg .= '<br />'.&mt('The following Cc e-mail addresses are invalid: '). &Apache::loncommon::cleanup_html(join(', ',@bad_ccs)); |
$badccmsg .= '<br />'.&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'}) { |
if ($formvars{'course'}) { |
$env{'form.crsi'} = $env{'form.title'}; |
$env{'form.crsi'} = $env{'form.title'}; |
if ($coursecode ne '') { |
if ($coursecode ne '') { |
Line 830 sub print_request_receipt {
|
Line 866 sub print_request_receipt {
|
} |
} |
if ($formvars{'course'}) { |
if ($formvars{'course'}) { |
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n"; |
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n"; |
} |
} |
$supportmsg .= "$lt{'subject'}: $env{'form.subject'} |
$supportmsg .= "$lt{'subject'}: $env{'form.subject'} |
$lt{'description'}: $env{'form.description'} |
$lt{'description'}: $env{'form.description'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
$lt{'sourceurl'}: $sourceurl |
$lt{'date'}: $reporttime |
$lt{'date'}: $reporttime |
"; |
"; |
|
|
Line 867 $lt{'date'}: $reporttime
|
Line 903 $lt{'date'}: $reporttime
|
next if ($helpform{$item} eq 'no'); |
next if ($helpform{$item} eq 'no'); |
} |
} |
next if (($item eq 'crsi') && ($helpform{'course'} 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}; |
my $showitem = $env{'form.'.$item}; |
$showitem = &Apache::loncommon::cleanup_html($showitem); |
$showitem = &Apache::loncommon::cleanup_html($showitem); |
$displaymsg .= |
$displaymsg .= |
Line 875 $lt{'date'}: $reporttime
|
Line 912 $lt{'date'}: $reporttime
|
} |
} |
} |
} |
} |
} |
|
|
|
my ($requname,$requdom,$reqemail); |
|
foreach my $field ('uname','udom','email') { |
|
$env{'form.'.$field} =~ s/^\s+//; |
|
$env{'form.'.$field} =~ s/\s+$//; |
|
} |
|
if ($env{'form.uname'} =~ /^$match_username$/) { |
|
$requname = $env{'form.uname'}; |
|
} |
|
if ($env{'form.udom'} =~ /^$match_domain$/) { |
|
$requdom = $env{'form.udom'}; |
|
} |
|
if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) { |
|
$reqemail = $env{'form.email'}; |
|
} |
|
|
|
my $dom_in_effect; |
|
unless ($env{'user.domain'} eq 'public') { |
|
$dom_in_effect = $env{'user.domain'}; |
|
} |
|
if ($dom_in_effect eq '') { |
|
$dom_in_effect = $requdom; |
|
} |
|
if ($dom_in_effect eq '') { |
|
$dom_in_effect = $defdom; |
|
} |
|
|
$displaymsg .= '<span class="LC_helpform_receipt_cat">'. |
$displaymsg .= '<span class="LC_helpform_receipt_cat">'. |
$lt{'date'}.'</span>: '.$reporttime.'<br />'."\n"; |
$lt{'date'}.'</span>: '.$reporttime.'<br />'."\n"; |
|
|
Line 897 END
|
Line 961 END
|
&print_header($r,$url,'process'); |
&print_header($r,$url,'process'); |
} |
} |
my $bad_email = 0; |
my $bad_email = 0; |
|
my ($to,$bcc,$addtext) = |
|
&Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
|
$dom_in_effect,$origmail, |
|
$requname,$requdom, |
|
$reqemail); |
if ($to =~ /,/) { |
if ($to =~ /,/) { |
my @ok_email; |
my @ok_email; |
foreach my $email (split(/,/,$to)) { |
foreach my $email (split(/,/,$to)) { |
Line 923 END
|
Line 992 END
|
|
|
my $message; |
my $message; |
if (!$bad_email) { |
if (!$bad_email) { |
$message = &Apache::lonhtmlcommon::confirm_success( |
$message = &mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>'); |
&mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>')); |
|
} else { |
} else { |
$message = &Apache::lonhtmlcommon::confirm_success( |
$message = $lt{'warn'}.'<br />'; |
$lt{'warn'}.'<br />' |
if ($to eq '') { |
.&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.','<tt>'.$to.'</tt>','<b>','</b>') |
$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.','<b>','</b>'); |
.' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1); |
} else { |
$to = 'helpdesk@lon-capa.org'; |
$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.','<tt>'.$to.'</tt>','<b>','</b>'); |
} |
|
$r->print(&Apache::loncommon::confirmwrapper($message)); |
|
|
|
if (defined($env{'form.email'})) { |
|
$env{'form.email'} =~ s/^\s+//; |
|
$env{'form.email'} =~ s/\s+$//; |
|
if ($env{'form.email'} =~ m/^[^\@]+\@[^\@]+$/) { |
|
$from = $env{'form.email'}; |
|
} |
} |
} |
} |
|
$r->print(&Apache::loncommon::confirmwrapper(&Apache::lonhtmlcommon::confirm_success($message,$bad_email))); |
|
|
|
if ($reqemail ne '') { |
|
$from = $reqemail; |
|
} |
|
|
if (defined($env{'form.cc'})) { |
if (defined($env{'form.cc'})) { |
if ($badccmsg) { |
if ($badccmsg) { |
Line 958 END
|
Line 1023 END
|
my $fname; |
my $fname; |
|
|
my $attachmentpath = ''; |
my $attachmentpath = ''; |
my $attachmentsize = ''; |
my $showsize = ''; |
|
|
if ((defined($env{'user.name'})) && (!$public)) { |
if ((defined($env{'user.name'})) && (!$public)) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
unless ($helpform{'screenshot'} eq 'no') { |
unless ($helpform{'screenshot'} eq 'no') { |
$attachmentsize = length($env{'form.screenshot'}); |
my $attachmentsize = length($env{'form.screenshot'}); |
my $max = 1048576; |
my $max = 1048576; |
|
my $showmax = 1.00; |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
$max *= $helpform{'maxsize'}; |
$max *= $helpform{'maxsize'}; |
|
$showmax = $helpform{'maxsize'}; |
} |
} |
|
$showmax = '('.sprintf("%.2f",$showmax).' MB)'; |
|
$showsize = $attachmentsize/1048576; |
|
$showsize = '('.sprintf("%.2f",$showsize).' MB)'; |
if ($attachmentsize > $max) { |
if ($attachmentsize > $max) { |
$displaymsg .= '<br /><span class="LC_warning">'. |
$displaymsg .= '<br /><span class="LC_warning">'. |
&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 1 MB, and has therefore been discarded.',$attachmentsize).'</span>'; |
&mt('The uploaded screenshot file [_1] included with your request exceeded the maximum allowed size [_2], and has therefore been discarded.',$showsize,$showmax).'</span>'; |
} else { |
} else { |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
} |
} |
Line 982 END
|
Line 1053 END
|
if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) { |
if ($$cookie{'lonID'} =~ /lonID=($LONCAPA::handle_re);/) { |
$cookies{'lonID'} = $1; |
$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-/([^/]+)$-) { |
if ($attachmentpath =~ m-/([^/]+)$-) { |
$fname = $1; |
$fname = $1; |
$displaymsg .= '<br />' |
$displaymsg .= '<br />' |
.&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].' |
.&mt('An uploaded screenshot file [_1] was included in the request sent by [_2].' |
,'<span class="LC_filename">'.$fname.'</span>' |
,'<span class="LC_filename">'.$fname.'</span> '.$showsize, |
,$attachmentsize |
|
,$env{'user.name'}.':'.$env{'user.domain'} |
,$env{'user.name'}.':'.$env{'user.domain'} |
); |
); |
$supportmsg .= "\n"; |
$supportmsg .= "\n"; |
Line 998 END
|
Line 1082 END
|
foreach my $var(@ENVvars) { |
foreach my $var(@ENVvars) { |
$supportmsg .= "$var: $ENV{$var}\n"; |
$supportmsg .= "$var: $ENV{$var}\n"; |
} |
} |
|
$supportmsg .= "REMOTE_ADDR: $ip\n"; |
foreach my $var (@envvars) { |
foreach my $var (@envvars) { |
$supportmsg .= "$var: $env{$var}\n"; |
$supportmsg .= "$var: $env{$var}\n"; |
} |
} |
|
if ($lti_info) { |
|
$supportmsg .= $lti_info; |
|
} |
} |
} |
|
|
my $cc_string; |
my $cc_string; |
if ($homeserver) { |
if ($homeserver) { |
if (@ok_ccs > 0) { |
if (@ok_ccs > 0) { |
Line 1010 END
|
Line 1098 END
|
} |
} |
} |
} |
|
|
my $attachment_text; |
my $attachment_text = ''; |
unless ($homeserver && $attachmentpath) { |
unless ($homeserver && $attachmentpath) { |
my $envdata = ''; |
|
foreach my $var (@cookievars) { |
foreach my $var (@cookievars) { |
$envdata .= "$var: $cookies{$var}\n"; |
$attachment_text .= "$var: $cookies{$var}\n"; |
} |
} |
foreach my $var (@ENVvars) { |
foreach my $var (@ENVvars) { |
$envdata .= "$var: $ENV{$var}\n"; |
$attachment_text .= "$var: $ENV{$var}\n"; |
} |
} |
|
$attachment_text .= "REMOTE_ADDR: $ip\n"; |
foreach my $var (@envvars) { |
foreach my $var (@envvars) { |
$envdata .= "$var: $env{$var}\n"; |
$attachment_text .= "$var: $env{$var}\n"; |
} |
} |
foreach my $var (@loncvars) { |
foreach my $var (@loncvars) { |
$envdata .= "$var: $env{$var}\n"; |
$attachment_text .= "$var: $env{$var}\n"; |
|
} |
|
if ($lti_info) { |
|
$attachment_text .= $lti_info; |
} |
} |
$attachment_text = $envdata; |
|
} |
} |
|
|
if ($addtext) { |
if ($addtext) { |
Line 1038 END
|
Line 1128 END
|
} |
} |
} |
} |
|
|
# Compose and send a MIME email |
if ($bad_email) { |
&Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc, |
$r->print('<b>'.$lt{'belo'}.'</b><br />'. |
$attachmentpath, $fname, $attachment_text); |
$lt{'ifyk'}.'<br /><br />'."\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('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n"); |
|
} |
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
unlink($attachmentpath); |
unlink($attachmentpath); |
} |
} |
$r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n"); |
|
$r->print('<div style="width:620px;">'. |
$r->print('<div style="width:620px;">'. |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n". |
&Apache::lonhtmlcommon::row_title($lt{'info'},undef,'LC_oddrow_value')."\n".$displaymsg."\n". |
Line 1064 END
|
Line 1158 END
|
$var.'</span>: '.$ENV{$var}.', '; |
$var.'</span>: '.$ENV{$var}.', '; |
} |
} |
} |
} |
|
if ($ip ne '') { |
|
$envmsg .= '<span class="LC_helpform_receipt_cat">'. |
|
'REMOTE_ADDR</span>: '.$ip.', '; |
|
} |
foreach my $var (@envvars) { |
foreach my $var (@envvars) { |
if ($env{$var} ne '') { |
if ($env{$var} ne '') { |
$envmsg .= '<span class="LC_helpform_receipt_cat">'. |
$envmsg .= '<span class="LC_helpform_receipt_cat">'. |