version 1.79.2.1, 2016/08/12 18:23:32
|
version 1.87, 2017/01/23 17:23:03
|
Line 1
|
Line 1
|
|
# The LearningOnline Network with CAPA |
|
# Helpdesk request form |
# |
# |
# $Id$ |
# $Id$ |
# |
# |
Line 27
|
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 79 sub handler {
|
Line 79 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,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
my ($os,$browser,$bversion,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server, |
$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server, |
$formname,$public,$homeserver,$knownuser,$captcha_form,$captcha_error, |
$formname,$public,$homeserver,$knownuser,$captcha_form,$captcha_error, |
$captcha,$recaptcha_version); |
$captcha,$recaptcha_version,$extra_validations,%groupid); |
$function = &Apache::loncommon::get_users_function() if (!$function); |
$function = &Apache::loncommon::get_users_function() if (!$function); |
$ccode = ''; |
$ccode = ''; |
$os = $env{'browser.os'}; |
$os = $env{'browser.os'}; |
$browser = $env{'browser.type'}; |
$browser = $env{'browser.type'}; |
$bversion = $env{'browser.version'}; |
$bversion = $env{'browser.version'}; |
$uhost = $env{'request.host'}; |
|
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; |
} else { |
} else { |
Line 106 sub print_request_form {
|
Line 105 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 114 sub print_request_form {
|
Line 113 sub print_request_form {
|
($captcha_form,$captcha_error,$captcha,$recaptcha_version) = |
($captcha_form,$captcha_error,$captcha,$recaptcha_version) = |
&Apache::loncommon::captcha_display('login',$lonhost); |
&Apache::loncommon::captcha_display('login',$lonhost); |
} |
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom', |
|
'useremail','useraccount']); |
|
|
if ($homeserver) { |
if ($homeserver) { |
$uhome = $env{'user.home'}; |
$uhome = $env{'user.home'}; |
$urole = $env{'request.role'}; |
$urole = $env{'request.role'}; |
$usec = $env{'request.course.sec'}; |
$usec = $env{'request.course.sec'}; |
$cid = $env{'request.course.id'}; |
$cid = $env{'request.course.id'}; |
} |
} |
|
if ($cid) { |
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
if ($cdom && $cnum) { |
|
my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum); |
|
$ctitle = $csettings{'description'}; |
|
$ccode = $csettings{'internal.coursecode'}; |
|
$sectionlist = $csettings{'internal.sectionnums'}; |
|
my @sections = split(/,/,$sectionlist); |
|
foreach my $section (@sections) { |
|
my ($sec,$grp) = split(/:/,$section); |
|
$groupid{$sec} = $grp; |
|
} |
|
} |
|
|
$formname = 'logproblem'; |
$formname = 'logproblem'; |
|
my $codedom = &get_domain(); |
|
my %helpform; |
|
my %domconfig = |
|
&Apache::lonnet::get_dom('configuration',['contacts'],$codedom); |
|
if (ref($domconfig{'contacts'}) eq 'HASH') { |
|
if (ref($domconfig{'contacts'}{'helpform'}) eq 'HASH') { |
|
%helpform = %{$domconfig{'contacts'}{'helpform'}}; |
|
} |
|
} |
|
|
|
my %coursecodes; |
|
my %codes; |
|
my @codetitles; |
|
my %cat_titles; |
|
my %cat_order; |
|
my %idlist; |
|
my %idnums; |
|
my %idlist_titles; |
|
my $caller = 'global'; |
|
my $totcodes = 0; |
|
my $format_reply; |
|
my $jscript = ''; |
|
my $loaditems = qq| |
|
function initialize_codes() { |
|
return; |
|
} |
|
|; |
|
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 $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); |
|
my $longtitles_str = join('","',@{$longtitles}); |
|
my $allidlist = $idlist{$codetitles[0]}; |
|
my $knowncodes; |
|
if (($ccode ne '') && ($cnum ne '')) { |
|
my (%singlecodes,@singlecodetitles,%singlecat_titles,%singlecat_order); |
|
my $crscode_reply = &Apache::lonnet::auto_instcode_format($cnum,$codedom,{ $cnum => $ccode },\%singlecodes, |
|
\@singlecodetitles,\%singlecat_titles,\%singlecat_order); |
|
if (ref($singlecodes{$cnum}) eq 'HASH') { |
|
$knowncodes = $singlecodes{$cnum}; |
|
} |
|
} |
|
$jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist); |
|
$jscript .= $scripttext; |
|
$jscript .= &Apache::courseclassifier::javascript_code_selections($formname,\@codetitles,$knowncodes,$sectionlist); |
|
$loaditems = ''; |
|
} |
|
} |
|
} |
|
my %missing = &Apache::lonlocal::texthash( |
|
username => 'You must include a name.', |
|
phone => 'You must include a phone.', |
|
); |
|
&js_escape(\%missing); |
|
if (keys(%helpform)) { |
|
foreach my $key (keys(%helpform)) { |
|
if (($helpform{$key} eq 'req') && ($missing{$key} ne '')) { |
|
next if (($key eq 'username') && (($knownuser) || |
|
(($env{'user.name'} =~ /^$match_username$/) && (!$public)))); |
|
$extra_validations .= <<"END"; |
|
|
|
if (document.$formname.$key.value == '') { |
|
alert("$missing{$key}"); |
|
return; |
|
} |
|
|
|
END |
|
} |
|
} |
|
} |
my $machine = &Apache::lonnet::absolute_url(); |
my $machine = &Apache::lonnet::absolute_url(); |
my $sourceurl = $machine.$origurl; |
my $sourceurl = $machine.$origurl; |
$server = $machine.&Apache::loncommon::cleanup_html($origurl); |
$server = $machine.&Apache::loncommon::cleanup_html($origurl); |
Line 135 sub print_request_form {
|
Line 227 sub print_request_form {
|
name => 'Name', |
name => 'Name', |
subm => 'Submit Request', |
subm => 'Submit Request', |
emad => 'Your e-mail address', |
emad => 'Your e-mail address', |
emac => 'Cc', |
emac => 'Cc', |
unme => 'username', |
unme => 'username', |
doma => 'domain', |
doma => 'domain', |
entu => 'Enter the username you use to log-in to LON-CAPA', |
entu => 'Enter the username you use to log-in to LON-CAPA', |
Line 154 sub print_request_form {
|
Line 246 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', |
fini => 'Finish', |
fini => 'Finish', |
clfm => 'Clear Form', |
clfm => 'Clear Form', |
); |
); |
Line 174 function validate() {
|
Line 266 function validate() {
|
alert("$js_lt{'rdes'}."); |
alert("$js_lt{'rdes'}."); |
return; |
return; |
} |
} |
|
$extra_validations |
document.logproblem.submit(); |
document.logproblem.submit(); |
} |
} |
|
|
END |
END |
$scripttag .= &Apache::lonhtmlcommon::javascript_valid_email(); |
$scripttag .= &Apache::lonhtmlcommon::javascript_valid_email(); |
if ($cid) { |
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
if ($cdom && $cnum) { |
|
my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum); |
|
$ctitle = $csettings{'description'}; |
|
$ccode = $csettings{'internal.coursecode'}; |
|
$sectionlist = $csettings{'internal.sectionnums'}; |
|
} |
|
|
|
if ($homeserver) { |
if ($homeserver) { |
if ($env{'environment.permanentemail'}) { |
if ($env{'environment.permanentemail'}) { |
Line 205 END
|
Line 288 END
|
$firstname = $env{'environment.firstname'}; |
$firstname = $env{'environment.firstname'}; |
} |
} |
} |
} |
my @sections = split(/,/,$sectionlist); |
|
my %groupid; |
|
foreach my $section (@sections) { |
|
my ($sec,$grp) = split(/:/,$section); |
|
$groupid{$sec} = $grp; |
|
} |
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom', |
|
'useremail','useraccount']); |
|
if ($env{'form.origurl'} eq '/adm/createaccount') { |
if ($env{'form.origurl'} eq '/adm/createaccount') { |
if ($email eq '') { |
if ($email eq '') { |
if ($env{'form.useremail'} =~ /^[^\@]+\@[^\@]+$/) { |
if ($env{'form.useremail'} =~ /^[^\@]+\@[^\@]+$/) { |
Line 225 END
|
Line 300 END
|
} |
} |
} |
} |
} |
} |
my $codedom = &get_domain(); |
|
my $details_title; |
my $details_title; |
if ($codedom) { |
if ($codedom) { |
$details_title = '<br />('.$codedom.')'; |
$details_title = '<br />('.$codedom.')'; |
} |
} |
my %coursecodes; |
|
my %codes; |
|
my @codetitles; |
|
my %cat_titles; |
|
my %cat_order; |
|
my %idlist; |
|
my %idnums; |
|
my %idlist_titles; |
|
my $caller = 'global'; |
|
my $totcodes = 0; |
|
my $format_reply; |
|
my $jscript = ''; |
|
my $loaditems = qq| |
|
function initialize_codes() { |
|
return; |
|
} |
|
|; |
|
if ($cnum) { |
|
$coursecodes{$cnum} = $ccode; |
|
if ($ccode eq '') { |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
|
} else { |
|
$coursecodes{$cnum} = $ccode; |
|
$caller = $cnum; |
|
$totcodes ++; |
|
} |
|
} else { |
|
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$codedom,$totcodes); |
|
} |
|
if ($totcodes > 0) { |
|
if ($ccode eq '') { |
|
$format_reply = &Apache::lonnet::auto_instcode_format($caller,$codedom,\%coursecodes,\%codes,\@codetitles,\%cat_titles,\%cat_order); |
|
if ($format_reply eq 'ok') { |
|
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); |
|
my $longtitles_str = join('","',@{$longtitles}); |
|
my $allidlist = $idlist{$codetitles[0]}; |
|
$jscript .= &Apache::courseclassifier::courseset_js_start($formname,$longtitles_str,$allidlist); |
|
$jscript .= $scripttext; |
|
$jscript .= &Apache::courseclassifier::javascript_code_selections($formname,@codetitles); |
|
$loaditems = ''; |
|
} |
|
} |
|
} |
|
|
|
my $js = <<"ENDJS"; |
my $js = <<"ENDJS"; |
<script type="text/javascript"> |
<script type="text/javascript"> |
// <![CDATA[ |
// <![CDATA[ |
Line 284 $jscript
|
Line 313 $jscript
|
$loaditems |
$loaditems |
// ]]> |
// ]]> |
</script> |
</script> |
|
<script type="text/javascript" src="/res/adm/includes/file_upload.js"></script> |
ENDJS |
ENDJS |
if ($recaptcha_version >=2) { |
if ($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"; |
Line 308 ENDJS
|
Line 338 ENDJS
|
if ($homeserver) { |
if ($homeserver) { |
$formtype = ' enctype="multipart/form-data"'; |
$formtype = ' enctype="multipart/form-data"'; |
} |
} |
|
my $topsubmit = ' <input type="button" value="'.$html_lt{'subm'}.'" onclick="validate()" /> '; |
|
my $shownsubmit; |
$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($html_lt{'name'},undef,$css[$num])."\n"; |
unless ($helpform{'username'} eq 'no') { |
my $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"; |
$output .= $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 '') { |
$fullname = $firstname; |
$fullname = $firstname; |
} elsif (defined($lastname) && $lastname ne '') { |
} elsif (defined($lastname) && $lastname ne '') { |
$fullname = " $lastname"; |
$fullname = " $lastname"; |
|
} |
|
$namefield = '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
|
if ($helpform{'username'} eq 'req') { |
|
$reqd = '<span class="LC_info">*</span>'; |
|
} |
} |
} |
$output .= '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'."\n"; |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'name'}.$reqd,undef,$css[$num])."\n".$namefield. |
|
$topsubmit. |
|
&Apache::lonhtmlcommon::row_closure()."\n"; |
|
$shownsubmit = 1; |
|
$num ++; |
|
$i = $num%2; |
} |
} |
$output .= ' <input type="button" value="'.$html_lt{'subm'}.'" onclick="validate()" /> '. |
|
&Apache::lonhtmlcommon::row_closure()."\n"; |
|
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title( |
$output .= &Apache::lonhtmlcommon::row_title( |
'<span title="'.&mt('required').'">'. |
'<span title="'.&mt('required').'">'. |
$html_lt{'emad'}.' <span class="LC_info">*</span></span>' |
$html_lt{'emad'}.' <span class="LC_info">*</span></span>' |
,undef,$css[$i]). |
,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,'"<>&').'" />'."\n"; |
&Apache::lonhtmlcommon::row_closure(); |
unless ($shownsubmit) { |
|
$output .= $topsubmit; |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if ($knownuser) { |
if ($knownuser) { |
if ($homeserver) { |
if ($homeserver) { |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]). |
unless ($helpform{'cc'} eq 'no') { |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'emac'},undef,$css[$i]). |
&Apache::lonhtmlcommon::row_closure(); |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
$num ++; |
&Apache::lonhtmlcommon::row_closure(); |
$i = $num%2; |
$num ++; |
|
$i = $num%2; |
|
} |
} |
} |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'unme'}/$html_lt{'doma'}",undef,$css[$i]); |
unless ($helpform{'user'} eq 'no') { |
my $udom_input = '<input type="hidden" name="udom" value="'. |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'unme'}/$html_lt{'doma'}",undef,$css[$i]); |
&HTML::Entities::encode($udom,'"<>&').'" />'."\n"; |
my $udom_input = '<input type="hidden" name="udom" value="'. |
my $uname_input = '<input type="hidden" name="uname" value="'. |
&HTML::Entities::encode($udom,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($uname,'"<>&').'" />'."\n"; |
my $uname_input = '<input type="hidden" name="uname" value="'. |
if ($knownuser) { |
&HTML::Entities::encode($uname,'"<>&').'" />'."\n"; |
$output .= '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' <i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
if ($knownuser) { |
} else { |
$output .= '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' <i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
my $udomform = ''; |
|
my $unameform = ''; |
|
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
|
$output .= $html_lt{'entu'}; |
|
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
|
$output .= $html_lt{'chdo'}; |
|
} else { |
} else { |
$output .= $html_lt{'entr'}; |
my $udomform = ''; |
} |
my $unameform = ''; |
$output .= '<br />'."\n"; |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
if (!$public) { |
$output .= $html_lt{'entu'}; |
if ($env{'user.domain'} =~ /^$match_domain$/) { |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input; |
$output .= $html_lt{'chdo'}; |
} elsif ($env{'user.name'} =~ /^$match_username$/) { |
} else { |
$unameform = '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
$output .= $html_lt{'entr'}; |
} |
} |
|
$output .= '<br />'."\n"; |
|
if (!$public) { |
|
if ($env{'user.domain'} =~ /^$match_domain$/) { |
|
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '.$udom.$udom_input; |
|
} elsif ($env{'user.name'} =~ /^$match_username$/) { |
|
$unameform = '<i>'.$html_lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
|
} |
|
} |
|
if ($udomform eq '') { |
|
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '; |
|
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; |
|
} |
|
if ($unameform eq '') { |
|
$unameform= '<i>'.$html_lt{'unme'}.'</i>: <input type="text" size="20" name="uname" value="'.$uname.'" /> '; |
|
} |
|
$output .= $unameform.$udomform; |
} |
} |
if ($udomform eq '') { |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$udomform = '<i>'.$html_lt{'doma'}.'</i>: '; |
$num ++; |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; |
|
} |
|
if ($unameform eq '') { |
|
$unameform= '<i>'.$html_lt{'unme'}.'</i>: <input type="text" size="20" name="uname" value="'.$uname.'" /> '; |
|
} |
|
$output .= $unameform.$udomform; |
|
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title("$html_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_title("$html_lt{'phon'}",undef,'LC_evenrow_value'). |
|
'<input type="text" size="15" name="phone" /><br />'."\n". |
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
unless ($helpform{'phone'} eq 'no') { |
$i = $num%2; |
my $reqd; |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]); |
if ($helpform{'phone'} eq 'req') { |
if ($cnum) { |
$reqd = '<span class="LC_info">*</span>'; |
if ($coursecodes{$cnum}) { |
} |
foreach my $item (@codetitles) { |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'phon'}.$reqd,undef,'LC_evenrow_value'). |
$output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; '; |
'<input type="text" size="15" name="phone" /><br />'."\n". |
} |
&Apache::lonhtmlcommon::row_closure(); |
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'."\n"; |
$num ++; |
} else { |
$i = $num%2; |
$output .= $html_lt{'enin'}.': |
} |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
unless ($helpform{'course'} eq 'no') { |
} |
$output .= &Apache::lonhtmlcommon::row_title("$html_lt{'crsd'}$details_title",undef,$css[$i]); |
} else { |
|
if ($totcodes > 0) { |
if ($totcodes > 0) { |
my $numtitles = @codetitles; |
my $numtitles = @codetitles; |
if ($numtitles == 0) { |
if ($numtitles == 0) { |
Line 418 ENDJS
|
Line 459 ENDJS
|
my $lasttitle = $numtitles; |
my $lasttitle = $numtitles; |
if ($numtitles > 4) { |
if ($numtitles > 4) { |
$lasttitle = 4; |
$lasttitle = 4; |
} |
} |
|
my $onchange; |
|
if ($sectionlist) { |
|
$onchange = 'toggleSecVis()'; |
|
} |
$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]'".');'.$onchange.'">'."\n". |
' <option value="-1">'.$html_lt{'sele'}."</option>\n"; |
' <option value="-1">'.$html_lt{'sele'}."</option>\n"; |
my @items = (); |
my @items = (); |
my @longitems = (); |
my @longitems = (); |
Line 449 ENDJS
|
Line 494 ENDJS
|
$output .= '</select></td>'; |
$output .= '</select></td>'; |
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]'".');'.$onchange.'">'."\n". |
'<option value="-1"><-'.$html_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 457 ENDJS
|
Line 502 ENDJS
|
$output .= '</tr></table>'; |
$output .= '</tr></table>'; |
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]'".');'.$onchange.'">'."\n". |
'<option value="-1"><-'.$html_lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
'<option value="-1"><-'.$html_lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
'</select>'."\n"; |
'</select>'."\n"; |
} |
} |
Line 466 ENDJS
|
Line 511 ENDJS
|
$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="" />'."\n"; |
} |
} |
} |
my $reqd; |
if ($ctitle) { |
if ($helpform{'course'} eq 'req') { |
$output .= '<br /><i>'.$html_lt{'titl'}.'</i>: '.$ctitle. |
$reqd = '<span class="LC_info">*</span>'; |
'<input type="hidden" name="title" value="'. |
} |
|
$output .= '<br />'.$html_lt{'enct'}.$reqd.': |
|
<input type="text" name="title" size="25" value="'. |
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
&HTML::Entities::encode($ctitle,'"<>&').'" />'."\n"; |
} else { |
$output .= &Apache::lonhtmlcommon::row_closure(); |
$output .= '<br />'.$html_lt{'enct'}.': |
$num ++; |
<input type="text" name="title" size="25" value="" />'."\n"; |
$i = $num%2; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
unless ($helpform{'section'} eq 'no') { |
$num ++; |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]); |
$i = $num%2; |
if ($sectionlist) { |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'secn'},undef,$css[$i]); |
$output .= "<div id=\"LC_helpdesk_sectionlist\"><select name=\"sectionsel\">\n". |
if ($sectionlist) { |
" <option value=\"\" selected=\"selected\">$html_lt{'sele'}</option>\n"; |
$output .= "<select name=\"section\"\n>". |
foreach my $id (sort(keys(%groupid))) { |
" <option value=\"\" selected=\"selected\">$html_lt{'sele'}</option>\n"; |
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
foreach my $id (sort(keys(%groupid))) { |
$output .= " <option value=". |
if ($id eq $groupid{$id} || $groupid{$id} eq '') { |
&HTML::Entities::encode($id,'"<>&'). |
$output .= " <option value=". |
" >$id</option>\n"; |
&HTML::Entities::encode($id,'"<>&'). |
} else { |
" >$id</option>\n"; |
$output .= " <option value=". |
} else { |
&HTML::Entities::encode($id,'"<>&'). |
$output .= " <option value=". |
" >$id - ($html_lt{'lsec'}: $groupid{$id})</option>\n"; |
&HTML::Entities::encode($id,'"<>&'). |
} |
" >$id - ($html_lt{'lsec'}: $groupid{$id})</option>\n"; |
|
} |
} |
} |
$output .= '</select></div>'."\n". |
$output .= "</select>"; |
'<div id="LC_helpdesk_section" style="display:none">'. |
} else { |
'<input type="text" name="sectiontxt" size="10" /></div>'."\n"; |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
} else { |
|
$output .= '<input type="text" name="section" size="10" />'."\n"; |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title( |
$output .= &Apache::lonhtmlcommon::row_title( |
'<span title="'.&mt('required').'">'. |
'<span title="'.&mt('required').'">'. |
$html_lt{'subj'}.' <span class="LC_info">*</span></span>' |
$html_lt{'subj'}.' <span class="LC_info">*</span></span>' |
Line 517 ENDJS
|
Line 565 ENDJS
|
$i = $num%2; |
$i = $num%2; |
if ($knownuser) { |
if ($knownuser) { |
if ($homeserver) { |
if ($homeserver) { |
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]). |
unless ($helpform{'screenshot'} eq 'no') { |
' <input type="file" name="screenshot" size="20" /><br />'. |
my $max = 1048576; |
"\n".$html_lt{'uplf'}."\n". |
my $showmax = 1.00; |
&Apache::lonhtmlcommon::row_closure(); |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
$num ++; |
$max *= $helpform{'maxsize'}; |
$i = $num%2; |
$showmax = $helpform{'maxsize'}; |
|
} |
|
$showmax = ' ('.sprintf("%.2f",$showmax).' '.&mt('MB max.').')'; |
|
$output .= &Apache::lonhtmlcommon::row_title($html_lt{'opfi'},undef,$css[$i]) |
|
.' <input type="file" name="screenshot" class="flUpload" size="20" />' |
|
.'<input type="hidden" id="free_space" value="'.$max.'" />' |
|
.'<br />'."\n".$html_lt{'uplf'}.$showmax."\n" |
|
.&Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
|
} |
} |
} |
} else { |
} else { |
if ($captcha_form) { |
if ($captcha_form) { |
Line 569 sub print_request_receipt {
|
Line 627 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'); |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
unless (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
my $lonhost = $r->dir_config('lonHostID'); |
|
my ($captcha_chk,$captcha_error) = |
my ($captcha_chk,$captcha_error) = |
&Apache::loncommon::captcha_response('login',$lonhost); |
&Apache::loncommon::captcha_response('login',$lonhost); |
if ($captcha_chk != 1) { |
if ($captcha_chk != 1) { |
Line 604 sub print_request_receipt {
|
Line 662 sub print_request_receipt {
|
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 = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
my ($to,$bcc,$addtext) = |
$defdom,$origmail); |
&Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
|
$defdom,$origmail); |
my $from = $admin; |
my $from = $admin; |
my $bcc; |
my %helpform; |
my %domconfig = |
my %domconfig = |
&Apache::lonnet::get_dom('configuration',['contacts'],$defdom); |
&Apache::lonnet::get_dom('configuration',['contacts'],$defdom); |
if (ref($domconfig{'contacts'}) eq 'HASH') { |
if (ref($domconfig{'contacts'}) eq 'HASH') { |
if (exists($domconfig{'contacts'}{'helpdeskmail'})) { |
if (ref($domconfig{'contacts'}{'helpform'}) eq 'HASH') { |
if (ref($domconfig{'contacts'}{'helpdeskmail'}) eq 'HASH') { |
%helpform = %{$domconfig{'contacts'}{'helpform'}}; |
my $bccmail = $domconfig{'contacts'}{'helpdeskmail'}{'bcc'}; |
|
if ($bccmail ne '') { |
|
my @bccs = split(/,/,$bccmail); |
|
my @ok_bccs; |
|
foreach my $bcc (@bccs) { |
|
$bcc =~ s/^\s+//g; |
|
$bcc =~ s/\s+$//g; |
|
if ($bcc =~ m/^[^\@]+\@[^\@]+$/) { |
|
if (!(grep(/^\Q$bcc\E$/,@ok_bccs))) { |
|
push(@ok_bccs,$bcc); |
|
} |
|
} |
|
} |
|
if (@ok_bccs > 0) { |
|
$bcc = join(', ',@ok_bccs); |
|
} |
|
} |
|
} |
|
} |
} |
} |
} |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
my $reporttime = &Apache::lonlocal::locallocaltime(time); |
my @formvars = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); |
my %formvars = ( |
|
email => 1, |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
sourceurl => 1, |
my $coursecode = $env{'form.coursecode'}; |
subject => 1, |
if ($coursecode eq '') { |
description => 1, |
my $totcodes = 0; |
); |
my %coursecodes; |
unless ($helpform{'username'} eq 'no') { |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes); |
$formvars{'username'} = 1; |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
} |
if ($totcodes > 0) { |
unless ($helpform{'user'} eq 'no') { |
my $noregexps = 1; |
$formvars{'uname'} = 1; |
$coursecode = |
$formvars{'udom'} = 1; |
&Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps); |
} |
} |
unless ($helpform{'phone'} eq 'no') { |
|
$formvars{'phone'} = 1; |
|
} |
|
unless ($helpform{'section'} eq 'no') { |
|
$formvars{'section'} = 1; |
|
} |
|
unless ($helpform{'course'} eq 'no') { |
|
$formvars{'course'} = 1; |
|
} |
|
unless ($helpform{'cc'} eq 'no') { |
|
$formvars{'cc'} = 1; |
|
} |
|
unless ($helpform{'screenshot'} eq 'no') { |
|
$formvars{'screenshot'} = 1; |
|
} |
|
my $coursecode; |
|
if ($formvars{'course'}) { |
|
$coursecode = $env{'form.coursecode'}; |
if ($coursecode eq '') { |
if ($coursecode eq '') { |
foreach my $item (@standardnames) { |
my $totcodes = 0; |
if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) { |
my %coursecodes; |
$coursecode .= $env{'form.'.$item}; |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom); |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
|
if ($totcodes > 0) { |
|
my $noregexps = 1; |
|
$coursecode = |
|
&Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps); |
|
} |
|
if ($coursecode eq '') { |
|
foreach my $item (@standardnames) { |
|
if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) { |
|
$coursecode .= $env{'form.'.$item}; |
|
} |
} |
} |
} |
} |
} |
} |
Line 682 sub print_request_receipt {
|
Line 751 sub print_request_receipt {
|
$env{'user.domain'}); |
$env{'user.domain'}); |
} |
} |
} |
} |
|
my ($cid,$cdom,$cnum,$sectionlist,$ccode); |
if (($homeserver) && (defined($env{'form.cc'}))) { |
if ($homeserver) { |
|
$cid = $env{'request.course.id'}; |
|
} |
|
if ($cid) { |
|
$cdom = $env{'course.'.$cid.'.domain'}; |
|
$cnum = $env{'course.'.$cid.'.num'}; |
|
} |
|
if ($cdom && $cnum) { |
|
my %csettings = &Apache::lonnet::get('environment',['description','internal.coursecode','internal.sectionnums'],$cdom,$cnum); |
|
$ccode = $csettings{'internal.coursecode'}; |
|
$sectionlist = $csettings{'internal.sectionnums'}; |
|
} |
|
if (($homeserver) && (defined($env{'form.cc'})) && ($formvars{'cc'})) { |
my @ccs; |
my @ccs; |
if ($env{'form.cc'} =~ /,/) { |
if ($env{'form.cc'} =~ /,/) { |
@ccs = split(/,/,$env{'form.cc'}); |
@ccs = split(/,/,$env{'form.cc'}); |
Line 717 sub print_request_receipt {
|
Line 798 sub print_request_receipt {
|
} |
} |
} |
} |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.crsi'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'}; |
if ($formvars{'course'}) { |
my $supportmsg = <<END; |
$env{'form.crsi'} = $env{'form.title'}; |
$lt{'username'}: $env{'form.username'} |
if ($coursecode ne '') { |
$lt{'email'}: $env{'form.email'} |
$env{'form.crsi'} .= ' - '.$coursecode; |
$lt{'cc'}: $okcclist |
} |
$lt{'user'}: $env{'form.user'} |
} |
$lt{'phone'}: $env{'form.phone'} |
if ($formvars{'section'}) { |
$lt{'crsi'}: $env{'form.crsi'} |
my $section; |
$lt{'subject'}: $env{'form.subject'} |
if ($sectionlist) { |
|
if ($coursecode eq $ccode) { |
|
$section = $env{'form.sectionsel'} |
|
} else { |
|
$section = $env{'form.sectiontxt'}; |
|
} |
|
} else { |
|
$section = $env{'form.section'}; |
|
} |
|
$env{'form.crsi'} .= ' - '.$lt{'sect'}.': '.$section; |
|
} |
|
my $supportmsg; |
|
if ($formvars{'username'}) { |
|
$supportmsg .= "$lt{'username'}: $env{'form.username'}\n"; |
|
} |
|
$supportmsg .= "$lt{'email'}: $env{'form.email'}\n"; |
|
if (($homeserver) && (defined($env{'form.cc'})) && ($formvars{'cc'})) { |
|
$supportmsg .= "$lt{'cc'}: $okcclist\n"; |
|
} |
|
if ($formvars{'user'}) { |
|
$supportmsg .= "$lt{'user'}: $env{'form.user'}\n"; |
|
} |
|
if ($formvars{'phone'}) { |
|
$supportmsg .= "$lt{'phone'}: $env{'form.phone'}\n"; |
|
} |
|
if ($formvars{'course'}) { |
|
$supportmsg .= "$lt{'crsi'}: $env{'form.crsi'}\n"; |
|
} |
|
$supportmsg .= "$lt{'subject'}: $env{'form.subject'} |
$lt{'description'}: $env{'form.description'} |
$lt{'description'}: $env{'form.description'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
$lt{'sourceurl'}: $env{'form.sourceurl'} |
$lt{'date'}: $reporttime |
$lt{'date'}: $reporttime |
|
"; |
|
|
END |
|
my $displaymsg; |
my $displaymsg; |
foreach my $item ('username','email','cc','user','phone','crsi','subject','description','sourceurl') { |
foreach my $item ('username','email','cc','user','phone','crsi','subject','description','sourceurl') { |
if ($env{'form.'.$item} ne '') { |
if ($env{'form.'.$item} ne '') { |
Line 749 END
|
Line 858 END
|
'<span class="LC_helpform_receipt_cat">'. |
'<span class="LC_helpform_receipt_cat">'. |
"$lt{$item}</span>: $showurl<br />\n"; |
"$lt{$item}</span>: $showurl<br />\n"; |
} elsif ($item eq 'cc') { |
} elsif ($item eq 'cc') { |
|
next if ($helpform{'cc'} eq 'no'); |
if ($okcclist) { |
if ($okcclist) { |
my $showcclist = &Apache::loncommon::cleanup_html($okcclist); |
my $showcclist = &Apache::loncommon::cleanup_html($okcclist); |
$displaymsg .= |
$displaymsg .= |
Line 756 END
|
Line 866 END
|
"$lt{$item}</span>: $showcclist<br />\n"; |
"$lt{$item}</span>: $showcclist<br />\n"; |
} |
} |
} else { |
} else { |
|
if (($item eq 'username') || ($item eq 'user') || ($item eq 'phone')) { |
|
next if ($helpform{$item} eq 'no'); |
|
} |
|
next if (($item eq 'crsi') && ($helpform{'course'} eq 'no')); |
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 850 END
|
Line 964 END
|
my $attachmentsize = ''; |
my $attachmentsize = ''; |
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'}); |
unless ($helpform{'screenshot'} eq 'no') { |
if ($attachmentsize > 131072) { |
$attachmentsize = length($env{'form.screenshot'}); |
$displaymsg .= '<br /><span class="LC_warning">'. |
my $max = 1048576; |
&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.',$attachmentsize).'</span>'; |
my $showmax = 1.00; |
} else { |
if ($helpform{'maxsize'} =~ /^\d+\.\d*$/) { |
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
$max *= $helpform{'maxsize'}; |
|
$showmax = $helpform{'maxsize'}; |
|
} |
|
$showmax = '('.sprintf("%.2f",$showmax).' MB)'; |
|
if ($attachmentsize > $max) { |
|
my $showsize = $attachmentsize/1048576; |
|
$showsize = '('.sprintf("%.2f",$showsize).' MB)'; |
|
$displaymsg .= '<br /><span class="LC_warning">'. |
|
&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 { |
|
$attachmentpath=&Apache::lonnet::userfileupload('screenshot',undef,'helprequests'); |
|
} |
} |
} |
} |
} |
} |
} |
Line 886 END
|
Line 1011 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 926 END
|
Line 1033 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); |
} |
|
|
|
if ($addtext) { |
|
my ($addloc,$addstr) = split(/:/,$addtext,2); |
|
$addstr = &unescape($addstr); |
|
if ($addloc eq 's') { |
|
$subject = $addstr.' '.$subject; |
|
} elsif ($addloc eq 'b') { |
|
$supportmsg = $addstr."\n".$supportmsg; |
|
} |
} |
} |
|
|
### 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); |
Line 981 sub print_header {
|
Line 1098 sub print_header {
|
login => 'Log-in help', |
login => 'Log-in help', |
ask => 'Ask helpdesk', |
ask => 'Ask helpdesk', |
getst => 'Getting started guide', |
getst => 'Getting started guide', |
back => 'Back to last location', |
back => 'Back to last location', |
headline => 'help/support', |
headline => 'help/support', |
stud => 'Students', |
stud => 'Students', |
ifyo => 'If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk.', |
ifyo => 'If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk.', |