version 1.77, 2014/01/17 17:17:42
|
version 1.81, 2015/06/23 02:42:34
|
Line 27
|
Line 27
|
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 116 sub print_request_form {
|
Line 114 sub print_request_form {
|
my $sourceurl = $machine.$origurl; |
my $sourceurl = $machine.$origurl; |
$server = $machine.&Apache::loncommon::cleanup_html($origurl); |
$server = $machine.&Apache::loncommon::cleanup_html($origurl); |
$server =~ s/\?.*$//; |
$server =~ s/\?.*$//; |
my %lt = &Apache::lonlocal::texthash ( |
my %js_lt = &Apache::lonlocal::texthash ( |
email => 'The e-mail address you entered', |
email => 'The e-mail address you entered', |
notv => 'is not a valid e-mail address', |
notv => 'is not a valid e-mail address', |
rsub => 'You must include a subject', |
rsub => 'You must include a subject', |
rdes => 'You must include a description', |
rdes => 'You must include a description', |
|
); |
|
my %html_lt = &Apache::lonlocal::texthash ( |
name => 'Name', |
name => 'Name', |
subm => 'Submit Request', |
subm => 'Submit Request', |
emad => 'Your e-mail address', |
emad => 'Your e-mail address', |
Line 143 sub print_request_form {
|
Line 143 sub print_request_form {
|
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 (128 KB max.)', |
uplf => 'Upload a file (e.g., a screenshot) relevant to your help request (1 MB max.)', |
fini => 'Finish', |
fini => 'Finish', |
clfm => 'Clear Form', |
clfm => 'Clear Form', |
); |
); |
|
&js_escape(\%js_lt); |
|
&html_escape(\%html_lt); |
my $scripttag = (<<"END"); |
my $scripttag = (<<"END"); |
function validate() { |
function validate() { |
if (validmail(document.logproblem.email) == false) { |
if (validmail(document.logproblem.email) == false) { |
alert("$lt{'email'}: "+document.logproblem.email.value+" $lt{'notv'}."); |
alert("$js_lt{'email'}: "+document.logproblem.email.value+" $js_lt{'notv'}."); |
return; |
return; |
} |
} |
if (document.logproblem.subject.value == '') { |
if (document.logproblem.subject.value == '') { |
alert("$lt{'rsub'}."); |
alert("$js_lt{'rsub'}."); |
return; |
return; |
} |
} |
if (document.logproblem.description.value == '') { |
if (document.logproblem.description.value == '') { |
alert("$lt{'rdes'}."); |
alert("$js_lt{'rdes'}."); |
return; |
return; |
} |
} |
document.logproblem.submit(); |
document.logproblem.submit(); |
Line 271 $jscript
|
Line 273 $jscript
|
$loaditems |
$loaditems |
// ]]> |
// ]]> |
</script> |
</script> |
|
<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script> |
ENDJS |
ENDJS |
my %add_entries = ( |
my %add_entries = ( |
style => "margin-top:0px;margin-bottom:0px;", |
style => "margin-top:0px;margin-bottom:0px;", |
Line 294 ENDJS
|
Line 297 ENDJS
|
} |
} |
$r->print('<form method="post" action="" name="logproblem"'.$formtype.'>'."\n"); |
$r->print('<form method="post" action="" name="logproblem"'.$formtype.'>'."\n"); |
my $output = &Apache::lonhtmlcommon::start_pick_box(). |
my $output = &Apache::lonhtmlcommon::start_pick_box(). |
# &Apache::lonhtmlcommon::row_headline(). |
&Apache::lonhtmlcommon::row_headline(). |
# '<span class="LC_info">'. |
'<span class="LC_info">'. |
# &mt('(All fields marked with * are required.)'). |
&mt('(All fields marked with * are required.)'). |
# '</span>'. |
'</span>'. |
# &Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title($lt{'name'},undef,$css[$num])."\n"; |
&Apache::lonhtmlcommon::row_title($html_lt{'name'},undef,$css[$num])."\n"; |
my $fullname = ''; |
my $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"; |
Line 312 ENDJS
|
Line 315 ENDJS
|
} |
} |
$output .= '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
$output .= '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
} |
} |
$output .= ' <input type="button" value="'.$lt{'subm'}.'" onclick="validate()" /> '. |
$output .= ' <input type="button" value="'.$html_lt{'subm'}.'" onclick="validate()" /> '. |
&Apache::lonhtmlcommon::row_closure()."\n"; |
&Apache::lonhtmlcommon::row_closure()."\n"; |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title($lt{'emad'},undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title( |
|
'<span title="'.&mt('required').'">'. |
|
$html_lt{'emad'}.' <span class="LC_info">*</span></span>' |
|
,undef,$css[$i]). |
'<input type="text" size="20" name="email" value="'. |
'<input type="text" size="20" name="email" value="'. |
&HTML::Entities::encode($email,'"<>&').'" /><br />'."\n". |
&HTML::Entities::encode($email,'"<>&').'" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
Line 324 ENDJS
|
Line 330 ENDJS
|
$i = $num%2; |
$i = $num%2; |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
if ($homeserver) { |
if ($homeserver) { |
$output .= &Apache::lonhtmlcommon::row_title($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(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
} |
} |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'unme'}/$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"; |
my $uname_input = '<input type="hidden" name="uname" value="'. |
my $uname_input = '<input type="hidden" name="uname" value="'. |
&HTML::Entities::encode($uname,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($uname,'"<>&').'" />'."\n"; |
if (($env{'user.name'} =~ /^$match_username$/) && |
if (($env{'user.name'} =~ /^$match_username$/) && |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= '<i>'.$lt{'unme'}.'</i>: '.$uname.' <i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
$output .= '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' <i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
} else { |
} else { |
my $udomform = ''; |
my $udomform = ''; |
my $unameform = ''; |
my $unameform = ''; |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= $lt{'entu'}; |
$output .= $html_lt{'entu'}; |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= $lt{'chdo'}; |
$output .= $html_lt{'chdo'}; |
} else { |
} else { |
$output .= $lt{'entr'}; |
$output .= $html_lt{'entr'}; |
} |
} |
$output .= '<br />'."\n"; |
$output .= '<br />'."\n"; |
if (!$public) { |
if (!$public) { |
if ($env{'user.domain'} =~ /^$match_domain$/) { |
if ($env{'user.domain'} =~ /^$match_domain$/) { |
$udomform = '<i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input; |
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input; |
} elsif ($env{'user.name'} =~ /^$match_username$/) { |
} elsif ($env{'user.name'} =~ /^$match_username$/) { |
$unameform = '<i>'.$lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
$unameform = '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
} |
} |
} |
} |
if ($udomform eq '') { |
if ($udomform eq '') { |
$udomform = '<i>'.$lt{'doma'}.'</i>: '; |
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '; |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; |
} |
} |
if ($unameform eq '') { |
if ($unameform eq '') { |
$unameform= '<i>'.$lt{'unme'}.'</i>: <input type="text" size="20" name="uname" value="'.$uname.'" /> '; |
$unameform= '<i>'.$html_lt{'unme'}.'</i>: <input type="text" size="20" name="uname" value="'.$uname.'" /> '; |
} |
} |
$output .= $unameform.$udomform; |
$output .= $unameform.$udomform; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'urlp'}",undef,$css[$i]). |
$server."\n".'<input type="hidden" name="sourceurl" value="'. |
$server."\n".'<input type="hidden" name="sourceurl" value="'. |
&HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n". |
&HTML::Entities::encode($sourceurl,'"<>&').'" />'."\n". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). |
&Apache::lonhtmlcommon::row_title("$html_lt{'phon'}",undef,'LC_evenrow_value'). |
'<input type="text" size="15" name="phone" /><br />'."\n". |
'<input type="text" size="15" name="phone" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,$css[$i]); |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]); |
if ($cnum) { |
if ($cnum) { |
if ($coursecodes{$cnum}) { |
if ($coursecodes{$cnum}) { |
foreach my $item (@codetitles) { |
foreach my $item (@codetitles) { |
Line 386 ENDJS
|
Line 392 ENDJS
|
} |
} |
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'."\n"; |
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'."\n"; |
} else { |
} else { |
$output .= $lt{'enin'}.': |
$output .= $html_lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
} |
} |
} else { |
} else { |
if ($totcodes > 0) { |
if ($totcodes > 0) { |
my $numtitles = @codetitles; |
my $numtitles = @codetitles; |
if ($numtitles == 0) { |
if ($numtitles == 0) { |
$output .= $lt{'enin'}.': |
$output .= $html_lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
} else { |
} else { |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
Line 403 ENDJS
|
Line 409 ENDJS
|
} |
} |
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
'<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
'<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
' <option value="-1">'.$lt{'sele'}."</option>\n"; |
' <option value="-1">'.$html_lt{'sele'}."</option>\n"; |
my @items = (); |
my @items = (); |
my @longitems = (); |
my @longitems = (); |
if ($idlist{$codetitles[0]} =~ /","/) { |
if ($idlist{$codetitles[0]} =~ /","/) { |
Line 432 ENDJS
|
Line 438 ENDJS
|
for (my $i=1; $i<$numtitles; $i++) { |
for (my $i=1; $i<$numtitles; $i++) { |
$output .= '<td>'.$codetitles[$i].'<br />'."\n". |
$output .= '<td>'.$codetitles[$i].'<br />'."\n". |
'<select name="'.$standardnames[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n". |
'<select name="'.$standardnames[$i].'" onchange="courseSet('."'$codetitles[$i]'".')">'."\n". |
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n". |
'<option value="-1"><-'.$html_lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n". |
'</select>'."\n". |
'</select>'."\n". |
'</td>'."\n"; |
'</td>'."\n"; |
} |
} |
Line 440 ENDJS
|
Line 446 ENDJS
|
if ($numtitles > 4) { |
if ($numtitles > 4) { |
$output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n". |
$output .= '<br /><br />'.$codetitles[$numtitles].'<br />'."\n". |
'<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n". |
'<select name="'.$standardnames[$numtitles].'" onchange="courseSet('."'$codetitles[$numtitles]'".')">'."\n". |
'<option value="-1"><-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
'<option value="-1"><-'.$html_lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
'</select>'."\n"; |
'</select>'."\n"; |
} |
} |
} |
} |
} else { |
} else { |
$output .= $lt{'enin'}.': |
$output .= $html_lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
} |
} |
} |
} |
if ($ctitle) { |
if ($ctitle) { |
$output .= '<br /><i>'.$lt{'titl'}.'</i>: '.$ctitle. |
$output .= '<br /><i>'.$html_lt{'titl'}.'</i>: '.$ctitle. |
'<input type="hidden" name="title" value="'. |
'<input type="hidden" name="title" value="'. |
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
} else { |
} else { |
$output .= '<br />'.$lt{'enct'}.': |
$output .= '<br />'.$html_lt{'enct'}.': |
<input type="text" name="title" size="25" value="" />'."\n"; |
<input type="text" name="title" size="25" value="" />'."\n"; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title($lt{'secn'},undef,$css[$i]); |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]); |
if ($sectionlist) { |
if ($sectionlist) { |
$output .= "<select name=\"section\"\n>". |
$output .= "<select name=\"section\"\n>". |
" <option value=\"\" selected=\"selected\">$lt{'sele'}</option>\n"; |
" <option value=\"\" selected=\"selected\">$html_lt{'sele'}</option>\n"; |
foreach my $id (sort(keys(%groupid))) { |
foreach my $id (sort(keys(%groupid))) { |
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
$output .= " <option value=". |
$output .= " <option value=". |
Line 472 ENDJS
|
Line 478 ENDJS
|
} else { |
} else { |
$output .= " <option value=". |
$output .= " <option value=". |
&HTML::Entities::encode($id,'"<>&'). |
&HTML::Entities::encode($id,'"<>&'). |
" >$id - ($lt{'lsec'}: $groupid{$id})</option>\n"; |
" >$id - ($html_lt{'lsec'}: $groupid{$id})</option>\n"; |
} |
} |
} |
} |
$output .= "</select>"; |
$output .= "</select>"; |
Line 482 ENDJS
|
Line 488 ENDJS
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value'). |
$output .= &Apache::lonhtmlcommon::row_title( |
' <input type="text" size="40" name="subject" />'."\n". |
'<span title="'.&mt('required').'">'. |
|
$html_lt{'subj'}.' <span class="LC_info">*</span></span>' |
|
,undef,'LC_oddrow_value'). |
|
'<input type="text" size="40" name="subject" />'."\n". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title($lt{'detd'},undef,'LC_evenrow_value'). |
&Apache::lonhtmlcommon::row_title( |
' <textarea rows="10" cols="45" name="description" style="word-wrap:normal;">'. |
'<span title="'.&mt('required').'">'. |
|
$html_lt{'detd'}.' <span class="LC_info">*</span></span>' |
|
,undef,'LC_evenrow_value'). |
|
'<textarea rows="10" cols="45" name="description" style="word-wrap:normal;">'. |
'</textarea>'."\n". |
'</textarea>'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
if ($homeserver) { |
if ($homeserver) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) |
' <input type="file" name="screenshot" size="20" /><br />'. |
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
"\n".$lt{'uplf'}."\n". |
.'<input type="hidden" id="free_space" value="1048576" />' |
&Apache::lonhtmlcommon::row_closure(); |
.'<br />'."\n".$html_lt{'uplf'}."\n" |
|
.&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
} |
} |
Line 505 ENDJS
|
Line 518 ENDJS
|
my ($captchaform,$error) = |
my ($captchaform,$error) = |
&Apache::loncommon::captcha_display('login',$lonhost); |
&Apache::loncommon::captcha_display('login',$lonhost); |
if ($captchaform) { |
if ($captchaform) { |
$output .= &Apache::lonhtmlcommon::row_title(&mt('Validation'),undef, |
$output .= &Apache::lonhtmlcommon::row_title( |
$css[$i])."\n". |
'<span title="'.&mt('required').'">'. |
|
&mt('Validation'). |
|
' <span class="LC_info">*</span></span>' |
|
,undef,$css[$i]). |
$captchaform."\n". |
$captchaform."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
} |
} |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title($lt{'fini'},undef,$css[$i]); |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'fini'},undef,$css[$i]); |
$output .= <<END; |
$output .= <<END; |
<table border="0" cellpadding="8" cellspacing="0"> |
<table border="0" cellpadding="8" cellspacing="0"> |
<tr> |
<tr> |
<td> |
<td> |
<input type="hidden" name="command" value="process" /> |
<input type="hidden" name="command" value="process" /> |
<input type="button" value="$lt{'subm'}" onclick="validate()" /> |
<input type="button" value="$html_lt{'subm'}" onclick="validate()" /> |
</td> |
</td> |
<td> </td> |
<td> </td> |
<td> |
<td> |
<input type="reset" value="$lt{'clfm'}" /> |
<input type="reset" value="$html_lt{'clfm'}" /> |
</td> |
</td> |
</tr> |
</tr> |
</table> |
</table> |
Line 827 END
|
Line 843 END
|
if ((defined($env{'user.name'})) && (!$public)) { |
if ((defined($env{'user.name'})) && (!$public)) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
if ($homeserver && $env{'form.screenshot.filename'}) { |
$attachmentsize = length($env{'form.screenshot'}); |
$attachmentsize = length($env{'form.screenshot'}); |
if ($attachmentsize > 131072) { |
if ($attachmentsize > 1048576) { |
$displaymsg .= '<br />'.&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.',$attachmentsize); |
$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>'; |
} else { |
} else { |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
} |
} |
Line 861 END
|
Line 878 END
|
} |
} |
} |
} |
|
|
my $msg = MIME::Lite->new( |
my $cc_string; |
From => $from, |
|
To => $to, |
|
Subject => $subject, |
|
Type =>'TEXT', |
|
Data => $supportmsg, |
|
); |
|
if ($homeserver) { |
if ($homeserver) { |
if (@ok_ccs > 0) { |
if (@ok_ccs > 0) { |
my $cc_string = join(', ',@ok_ccs); |
$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 |
|
); |
|
|
|
} else { |
my $attachment_text; |
|
unless ($homeserver && $attachmentpath) { |
my $envdata = ''; |
my $envdata = ''; |
foreach my $var (@cookievars) { |
foreach my $var (@cookievars) { |
$envdata .= "$var: $cookies{$var}\n"; |
$envdata .= "$var: $cookies{$var}\n"; |
Line 901 END
|
Line 900 END
|
foreach my $var (@loncvars) { |
foreach my $var (@loncvars) { |
$envdata .= "$var: $env{$var}\n"; |
$envdata .= "$var: $env{$var}\n"; |
} |
} |
$msg->attach(Type => 'TEXT', |
$attachment_text = $envdata; |
Data => $envdata); |
|
} |
} |
|
|
### Send it: |
# Compose and send a MIME email |
$msg->send('sendmail'); |
&Apache::loncommon::mime_email($from, $to, $subject, $supportmsg, $cc_string, $bcc, |
|
$attachmentpath, $fname, $attachment_text); |
|
|
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
if ($attachmentpath =~ m|$Apache::lonnet::perlvar{'lonDaemons'}/tmp/helprequests/(\d+)/[^/]+|) { |
unlink($attachmentpath); |
unlink($attachmentpath); |