version 1.79.2.7, 2019/08/28 02:17:10
|
version 1.94, 2019/06/16 05:33:45
|
Line 29
|
Line 29
|
package Apache::lonsupportreq; |
package Apache::lonsupportreq; |
|
|
use strict; |
use strict; |
use MIME::Types; |
|
use MIME::Lite; |
|
use CGI::Cookie(); |
use CGI::Cookie(); |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
use Apache::loncommon(); |
use Apache::loncommon(); |
Line 153 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 160 sub print_request_form {
|
Line 159 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 168 function initialize_codes() {
|
Line 169 function initialize_codes() {
|
} |
} |
|; |
|; |
unless ($helpform{'course'} eq 'no') { |
unless ($helpform{'course'} eq 'no') { |
my $instcats = &Apache::lonnet::get_dom_instcats($codedom); |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom); |
if (ref($instcats) eq 'HASH') { |
if ($totcodes > 0) { |
if ((ref($instcats->{'codetitles'}) eq 'ARRAY') && (ref($instcats->{'codes'}) eq 'HASH') && |
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
(ref($instcats->{'cat_titles'}) eq 'HASH') && (ref($instcats->{'cat_order'}) eq 'HASH')) { |
if ($format_reply eq 'ok') { |
%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 321 $jscript
|
Line 315 $jscript
|
$loaditems |
$loaditems |
// ]]> |
// ]]> |
</script> |
</script> |
|
<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script> |
ENDJS |
ENDJS |
if ($knownuser) { |
if ($recaptcha_version >=2) { |
$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 583 ENDJS
|
Line 576 ENDJS
|
} |
} |
$showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')'; |
$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="LC_flUpload" size="20" />' |
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
.'<input type="hidden" id="LC_free_space" value="'.$max.'" />' |
.'<input type="hidden" id="free_space" value="'.$max.'" />' |
.'<br />'."\n".$html_lt{'uplf'}.$showmax."\n" |
.'<br />'."\n".$html_lt{'uplf'}.$showmax."\n" |
.&Apache::lonhtmlcommon::row_closure(); |
.&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
Line 719 sub print_request_receipt {
|
Line 712 sub print_request_receipt {
|
$coursecode = $env{'form.coursecode'}; |
$coursecode = $env{'form.coursecode'}; |
if ($coursecode eq '') { |
if ($coursecode eq '') { |
my $totcodes = 0; |
my $totcodes = 0; |
my $instcats = &Apache::lonnet::get_dom_instcats($defdom); |
my %coursecodes; |
if (ref($instcats) eq 'HASH') { |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom); |
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 1089 END
|
Line 1078 END
|
} |
} |
} |
} |
|
|
my $msg = MIME::Lite->new( |
# Compose and send a MIME email |
From => $from, |
&Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc, |
To => $to, |
$attachmentpath, $fname, $attachment_text); |
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); |
|
} |
|
|
|
### Send it: |
|
$msg->send('sendmail'); |
|
|
|
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
unlink($attachmentpath); |
unlink($attachmentpath); |