version 1.48, 2008/03/24 01:11:36
|
version 1.67, 2012/04/18 17:30:24
|
Line 37 use Apache::lonnet;
|
Line 37 use Apache::lonnet;
|
use Apache::lonlocal; |
use Apache::lonlocal; |
use Apache::lonacc(); |
use Apache::lonacc(); |
use Apache::courseclassifier; |
use Apache::courseclassifier; |
use LONCAPA; |
use LONCAPA qw(:DEFAULT :match); |
|
|
|
|
sub handler { |
sub handler { |
Line 57 sub handler {
|
Line 57 sub handler {
|
&Apache::lonacc::get_posted_cgi($r); |
&Apache::lonacc::get_posted_cgi($r); |
} |
} |
my $function = $env{'form.function'}; |
my $function = $env{'form.function'}; |
my $origurl = &unescape($env{'form.origurl'}); |
my $origurl = $env{'form.origurl'}; |
my $command = $env{'form.command'}; |
my $command = $env{'form.command'}; |
|
|
if ($command eq 'process') { |
if ($command eq 'process') { |
Line 70 sub handler {
|
Line 70 sub handler {
|
|
|
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,$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server,$formname); |
my ($os,$browser,$bversion,$uhost,$uname,$udom,$uhome,$urole,$usec,$email,$cid, |
|
$cdom,$cnum,$ctitle,$ccode,$sectionlist,$lastname,$firstname,$server, |
|
$formname,$public,$homeserver); |
$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'}; |
$uhost = $env{'request.host'}; |
$uname = $env{'user.name'}; |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
$udom = $env{'user.domain'}; |
$public = 1; |
$uhome = $env{'user.home'}; |
} else { |
$urole = $env{'request.role'}; |
if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) { |
$usec = $env{'request.course.sec'}; |
$homeserver = &Apache::lonnet::homeserver($env{'user.name'}, |
$cid = $env{'request.course.id'}; |
$env{'user.domain'}); |
|
if ($homeserver eq 'no_host') { |
|
undef($homeserver); |
|
} else { |
|
$uname = $env{'user.name'}; |
|
$udom = $env{'user.domain'}; |
|
} |
|
} |
|
} |
|
if ($homeserver) { |
|
$uhome = $env{'user.home'}; |
|
$urole = $env{'request.role'}; |
|
$usec = $env{'request.course.sec'}; |
|
$cid = $env{'request.course.id'}; |
|
} |
$formname = 'logproblem'; |
$formname = 'logproblem'; |
my $machine = &Apache::lonnet::absolute_url(); |
my $machine = &Apache::lonnet::absolute_url(); |
if ($origurl =~ m-^https?://-) { |
if ($origurl =~ m-^https?://-) { |
Line 153 END
|
Line 169 END
|
$sectionlist = $csettings{'internal.sectionnums'}; |
$sectionlist = $csettings{'internal.sectionnums'}; |
} |
} |
|
|
if ($env{'environment.permanentemail'}) { |
if ($homeserver) { |
$email = $env{'environment.permanentemail'}; |
if ($env{'environment.permanentemail'}) { |
} elsif ($env{'environment.critnotification'}) { |
$email = $env{'environment.permanentemail'}; |
$email = $env{'environment.critnotification'}; |
} elsif ($env{'environment.critnotification'}) { |
} elsif ($env{'environment.notification'}) { |
$email = $env{'environment.critnotification'}; |
$email = $env{'environment.notification'}; |
} elsif ($env{'environment.notification'}) { |
} |
$email = $env{'environment.notification'}; |
if ($env{'environment.lastname'}) { |
} |
$lastname = $env{'environment.lastname'}; |
if ($env{'environment.lastname'}) { |
} |
$lastname = $env{'environment.lastname'}; |
if ($env{'environment.firstname'}) { |
} |
$firstname = $env{'environment.firstname'}; |
if ($env{'environment.firstname'}) { |
|
$firstname = $env{'environment.firstname'}; |
|
} |
} |
} |
my @sections = split(/,/,$sectionlist); |
my @sections = split(/,/,$sectionlist); |
my %groupid; |
my %groupid; |
Line 172 END
|
Line 190 END
|
my ($sec,$grp) = split(/:/,$section); |
my ($sec,$grp) = split(/:/,$section); |
$groupid{$sec} = $grp; |
$groupid{$sec} = $grp; |
} |
} |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['codedom', |
|
'useremail','useraccount']); |
|
if ($env{'form.origurl'} eq '/adm/createaccount') { |
|
if ($email eq '') { |
|
if ($env{'form.useremail'} =~ /^[^\@]+\@[^\@]+$/) { |
|
$email = &HTML::Entities::encode($env{'form.useremail'},'"<>&'); |
|
} |
|
} |
|
if ($uname eq '') { |
|
if ($env{'form.useraccount'} =~ /^$match_username$/) { |
|
$uname = &HTML::Entities::encode($env{'form.useraccount'},'"<>&'); |
|
} |
|
} |
|
} |
my $codedom = &get_domain(); |
my $codedom = &get_domain(); |
my $details_title; |
my $details_title; |
if ($codedom) { |
if ($codedom) { |
Line 224 function initialize_codes() {
|
Line 255 function initialize_codes() {
|
} |
} |
} |
} |
|
|
my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n". |
my $js = <<"ENDJS"; |
'</script>'; |
<script type="text/javascript"> |
my %add_entries = (topmargin => "0", |
// <![CDATA[ |
marginheight => "0", |
$scripttag |
onLoad =>"initialize_codes()",); |
$jscript |
|
$loaditems |
|
// ]]> |
|
</script> |
|
ENDJS |
|
my %add_entries = ( |
|
style => "margin-top:0px;margin-bottom:0px;", |
|
onload => "initialize_codes();", |
|
); |
|
|
|
|
$r->print(&Apache::loncommon::start_page('Support Request',$js, |
$r->print(&Apache::loncommon::start_page('Support Request',$js, |
Line 238 function initialize_codes() {
|
Line 277 function initialize_codes() {
|
if ($r->uri eq '/adm/helpdesk') { |
if ($r->uri eq '/adm/helpdesk') { |
&print_header($r,$origurl); |
&print_header($r,$origurl); |
} |
} |
$r->print('<form method="post" name="logproblem" enctype="multipart/form-data">'."\n"); |
my @css = ('LC_evenrow_value','LC_oddrow_value'); |
|
my $num = 1; |
|
my $i = $num%2; |
|
my $formtype; |
|
if ($homeserver) { |
|
$formtype = ' enctype="multipart/form-data"'; |
|
} |
|
$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_title($lt{'name'},undef,'LC_oddrow_value')."\n"; |
&Apache::lonhtmlcommon::row_title($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"; |
$output .= $fullname.'<input type="hidden" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'; |
$output .= $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"; |
} |
} |
$output .= '<input type="text" size="20" name="username" value="'.&HTML::Entities::encode($fullname,'"<>&').'" />'; |
$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="'.$lt{'subm'}.'" onclick="validate()" /> '. |
&Apache::lonhtmlcommon::row_closure()."\n". |
&Apache::lonhtmlcommon::row_closure()."\n"; |
&Apache::lonhtmlcommon::row_title($lt{'emad'},undef,'LC_evenrow_value'). |
$num ++; |
'<input type="text" size="20" name="email" value="'. |
$i = $num%2; |
&HTML::Entities::encode($email,'"<>&').'" /><br />'."\n". |
$output .= &Apache::lonhtmlcommon::row_title($lt{'emad'},undef,$css[$i]). |
&Apache::lonhtmlcommon::row_closure(). |
'<input type="text" size="20" name="email" value="'. |
&Apache::lonhtmlcommon::row_title($lt{'emac'},undef,'LC_oddrow_value'). |
&HTML::Entities::encode($email,'"<>&').'" /><br />'."\n". |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(). |
$num ++; |
&Apache::lonhtmlcommon::row_title("$lt{'unme'}/$lt{'doma'}",undef,'LC_evenrow_value'); |
$i = $num%2; |
|
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
|
if ($homeserver) { |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]). |
|
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
|
&Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
|
} |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_title("$lt{'unme'}/$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,'"<>&').'" />'; |
&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,'"<>&').'" />'; |
&HTML::Entities::encode($uname,'"<>&').'" />'."\n"; |
if (defined($uname) && defined($udom)) { |
if (($env{'user.name'} =~ /^$match_username$/) && |
|
($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= '<i>'.$lt{'unme'}.'</i>: '.$uname.' <i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
$output .= '<i>'.$lt{'unme'}.'</i>: '.$uname.' <i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input.$uname_input; |
} else { |
} else { |
my $udomform = ''; |
my $udomform = ''; |
my $unameform = ''; |
my $unameform = ''; |
if (defined($udom)) { |
if (($env{'user.domain'} =~ /^$match_domain$/) && (!$public)) { |
$output .= $lt{'entu'}; |
$output .= $lt{'entu'}; |
} elsif (defined($uname)) { |
} elsif (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= $lt{'chdo'}; |
$output .= $lt{'chdo'}; |
} else { |
} else { |
$output .= $lt{'entr'}; |
$output .= $lt{'entr'}; |
} |
} |
$output .= '<br />'; |
$output .= '<br />'."\n"; |
if (defined($udom)) { |
if (!$public) { |
$udomform = '<i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input; |
if ($env{'user.domain'} =~ /^$match_domain$/) { |
} elsif (defined($uname)) { |
$udomform = '<i>'.$lt{'doma'}.'</i>: '.$udom.$udom_input; |
$unameform = '<i>'.$lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
} elsif ($env{'user.name'} =~ /^$match_username$/) { |
|
$unameform = '<i>'.$lt{'unme'}.'</i>: '.$uname.' '.$uname_input; |
|
} |
} |
} |
if ($udomform eq '') { |
if ($udomform eq '') { |
$udomform = '<i>'.$lt{'doma'}.'</i>: '; |
$udomform = '<i>'.$lt{'doma'}.'</i>: '; |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom'); |
$udomform .= &Apache::loncommon::select_dom_form($codedom,'udom')."\n"; |
} |
} |
if ($unameform eq '') { |
if ($unameform eq '') { |
$unameform= '<i>'.$lt{'unme'}.'</i>: <input type="text" size="12" name="uname" value="'.$uname.'" /> '; |
$unameform= '<i>'.$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(); |
&Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,'LC_oddrow_value'). |
$num ++; |
$showserver.'<input type="hidden" name="sourceurl" value="'. |
$i = $num%2; |
&HTML::Entities::encode($server,'"<>&').'" />'. |
$output .= &Apache::lonhtmlcommon::row_title("$lt{'urlp'}",undef,$css[$i]). |
|
$showserver."\n".'<input type="hidden" name="sourceurl" value="'. |
|
&HTML::Entities::encode($server,'"<>&').'" />'."\n". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). |
&Apache::lonhtmlcommon::row_title("$lt{'phon'}",undef,'LC_evenrow_value'). |
'<input type="text" size="15" name="phone" /><br />'. |
'<input type="text" size="15" name="phone" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_title("$lt{'crsd'}$details_title",undef,'LC_oddrow_value'); |
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title("$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) { |
$output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; '; |
$output .= '<i>'.$item.'</i>: '.$codes{$cnum}{$item}.'; '; |
} |
} |
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'; |
$output .= ' <input type="hidden" name="coursecode" value="'.&HTML::Entities::encode($coursecodes{$cnum},'"<>&').'" />'."\n"; |
} else { |
} else { |
$output .= $lt{'enin'}.': |
$output .= $lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'; |
<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 .= $lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'; |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
} else { |
} else { |
|
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
my $lasttitle = $numtitles; |
my $lasttitle = $numtitles; |
if ($numtitles > 4) { |
if ($numtitles > 4) { |
$lasttitle = 4; |
$lasttitle = 4; |
} |
} |
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
$output .= '<table><tr><td>'.$codetitles[0].'<br />'."\n". |
'<select name="'.$codetitles[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
'<select name="'.$standardnames[0].'" onchange="courseSet('."'$codetitles[0]'".')">'."\n". |
' <option value="-1" />'.$lt{'sele'}."\n"; |
' <option value="-1">'.$lt{'sele'}."</option>\n"; |
my @items = (); |
my @items = (); |
my @longitems = (); |
my @longitems = (); |
if ($idlist{$codetitles[0]} =~ /","/) { |
if ($idlist{$codetitles[0]} =~ /","/) { |
Line 354 function initialize_codes() {
|
Line 418 function initialize_codes() {
|
$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="'.$codetitles[$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"><-'.$lt{'pick'}.' '.$codetitles[$i-1].'</option>'."\n". |
'</select>'."\n". |
'</select>'."\n". |
'</td>'."\n"; |
'</td>'."\n"; |
Line 362 function initialize_codes() {
|
Line 426 function initialize_codes() {
|
$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="'.$codetitles[$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"><-'.$lt{'pick'}.' '.$codetitles[$numtitles-1].'</option>'."\n". |
'</select>'."\n"; |
'</select>'."\n"; |
} |
} |
} |
} |
} else { |
} else { |
$output .= $lt{'enin'}.': |
$output .= $lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'; |
<input type="text" name="coursecode" size="15" value="" />'."\n"; |
} |
} |
} |
} |
if ($ctitle) { |
if ($ctitle) { |
Line 380 function initialize_codes() {
|
Line 444 function initialize_codes() {
|
$output .= '<br />'.$lt{'enct'}.': |
$output .= '<br />'.$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(); |
&Apache::lonhtmlcommon::row_title($lt{'secn'},undef,'LC_evenrow_value'); |
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title($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\">$lt{'sele'}</option>\n"; |
Line 398 function initialize_codes() {
|
Line 464 function initialize_codes() {
|
} |
} |
$output .= "</select>"; |
$output .= "</select>"; |
} else { |
} else { |
$output .= '<input type="text" name="section" size="10" />'; |
$output .= '<input type="text" name="section" size="10" />'."\n"; |
} |
} |
$output .= &Apache::lonhtmlcommon::row_closure(). |
$output .= &Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value'). |
$num ++; |
|
$i = $num%2; |
|
$output .= &Apache::lonhtmlcommon::row_title($lt{'subj'},undef,'LC_oddrow_value'). |
' <input type="text" size="40" name="subject" />'."\n". |
' <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($lt{'detd'},undef,'LC_evenrow_value'). |
' <textarea rows="10" cols="45" name="description" wrap="virtual"></textarea>'. |
' <textarea rows="10" cols="45" name="description" style="word-wrap:normal;">'. |
|
'</textarea>'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
my $lastrow = 'LC_evenrow_value'; |
$num ++; |
if (defined($env{'user.name'})) { |
$i = $num%2; |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,'LC_oddrow_value'). |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n". |
if ($homeserver) { |
&Apache::lonhtmlcommon::row_closure(); |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
$lastrow = 'LC_oddrow_value'; |
' <input type="file" name="screenshot" size="20" /><br />'. |
|
"\n".$lt{'uplf'}."\n". |
|
&Apache::lonhtmlcommon::row_closure(); |
|
$num ++; |
|
$i = $num%2; |
|
} |
} |
} |
$output .= &Apache::lonhtmlcommon::row_title($lt{'fini'},undef,$lastrow); |
$output .= &Apache::lonhtmlcommon::row_title($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> |
Line 453 sub print_request_receipt {
|
Line 527 sub print_request_receipt {
|
my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
my $to = &Apache::loncommon::build_recipient_list(undef,'helpdeskmail', |
$defdom,$origmail); |
$defdom,$origmail); |
my $from = $admin; |
my $from = $admin; |
|
my $bcc; |
|
my %domconfig = |
|
&Apache::lonnet::get_dom('configuration',['contacts'],$defdom); |
|
if (ref($domconfig{'contacts'}) eq 'HASH') { |
|
if (exists($domconfig{'contacts'}{'helpdeskmail'})) { |
|
if (ref($domconfig{'contacts'}{'helpdeskmail'}) eq 'HASH') { |
|
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 = ('username','email','uname','udom','sourceurl','phone','section','coursecode','title','subject','description','screenshot'); |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},\@formvars); |
my $coursecode = $env{'form.coursecode'}; |
my $coursecode = $env{'form.coursecode'}; |
if ($coursecode eq '') { |
if ($coursecode eq '') { |
if (defined($env{'form.Year'})) { |
my $totcodes = 0; |
$coursecode .= $env{'form.Year'}; |
my %coursecodes; |
} |
$totcodes = &Apache::courseclassifier::retrieve_instcodes(\%coursecodes,$defdom,$totcodes); |
if (defined($env{'form.Semester'})) { |
my @standardnames = &Apache::loncommon::get_standard_codeitems(); |
$coursecode .= $env{'form.Semester'}; |
if ($totcodes > 0) { |
} |
my $noregexps = 1; |
if (defined($env{'form.Department'})) { |
$coursecode = |
$coursecode .= $env{'form.Department'}; |
&Apache::courseclassifier::instcode_from_selectors($defdom,$noregexps); |
} |
} |
if (defined($env{'form.Number'})) { |
if ($coursecode eq '') { |
$coursecode .= $env{'form.Number'}; |
foreach my $item (@standardnames) { |
|
if ((defined($env{'form.'.$item})) && ($env{'form.'.$item} ne '-1')) { |
|
$coursecode .= $env{'form.'.$item}; |
|
} |
|
} |
} |
} |
} |
} |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
username => 'Name', |
username => 'Name', |
email => 'Email', |
email => 'E-mail', |
cc => 'Cc', |
cc => 'Cc', |
user => 'Username/domain', |
user => 'Username/domain', |
phone => 'Phone', |
phone => 'Phone', |
Line 484 sub print_request_receipt {
|
Line 588 sub print_request_receipt {
|
sourceurl => 'URL', |
sourceurl => 'URL', |
date => 'Date/Time', |
date => 'Date/Time', |
secn => 'Section', |
secn => 'Section', |
asup => 'A support request has been sent to', |
|
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', |
sect => 'section', |
sect => 'section', |
Line 492 sub print_request_receipt {
|
Line 595 sub print_request_receipt {
|
adin => 'Additional information recorded', |
adin => 'Additional information recorded', |
); |
); |
|
|
my (@ok_ccs,@bad_ccs,$badccmsg,$okcclist); |
my (@ok_ccs,@bad_ccs,$badccmsg,$okcclist,$public,$homeserver); |
if (defined($env{'form.cc'})) { |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
|
$public = 1; |
|
} else { |
|
if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) { |
|
$homeserver = &Apache::lonnet::homeserver($env{'user.name'}, |
|
$env{'user.domain'}); |
|
} |
|
} |
|
|
|
if (($homeserver) && (defined($env{'form.cc'}))) { |
my @ccs; |
my @ccs; |
if ($env{'form.cc'} =~ /,/) { |
if ($env{'form.cc'} =~ /,/) { |
@ccs = split(/,/,$env{'form.cc'}); |
@ccs = split(/,/,$env{'form.cc'}); |
Line 509 sub print_request_receipt {
|
Line 621 sub print_request_receipt {
|
if (!(grep(/^\Q$cc\E$/,@ok_ccs))) { |
if (!(grep(/^\Q$cc\E$/,@ok_ccs))) { |
push(@ok_ccs,$cc); |
push(@ok_ccs,$cc); |
} |
} |
} else { |
} elsif ($cc ne '') { |
if (!(grep(/^\Q$cc\E$/,@bad_ccs))) { |
if (!(grep(/^\Q$cc\E$/,@bad_ccs))) { |
push(@bad_ccs,$cc); |
push(@bad_ccs,$cc); |
} |
} |
Line 526 sub print_request_receipt {
|
Line 638 sub print_request_receipt {
|
} |
} |
} |
} |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; |
$env{'form.csri'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'}; |
$env{'form.crsi'} = $env{'form.title'}.' - '.$coursecode.' - '.$lt{'sect'}.': '.$env{'form.section'}; |
my $supportmsg = <<END; |
my $supportmsg = <<END; |
$lt{'username'}: $env{'form.username'} |
$lt{'username'}: $env{'form.username'} |
$lt{'email'}: $env{'form.email'} |
$lt{'email'}: $env{'form.email'} |
$lt{'cc'}: $okcclist |
$lt{'cc'}: $okcclist |
$lt{'user'}: $env{'form.user'} |
$lt{'user'}: $env{'form.user'} |
$lt{'phone'}: $env{'form.phone'} |
$lt{'phone'}: $env{'form.phone'} |
$lt{'crsi'}: $env{'form.csri'} |
$lt{'crsi'}: $env{'form.crsi'} |
$lt{'subject'}: $env{'form.subject'} |
$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'} |
Line 545 END
|
Line 657 END
|
if ($env{'form.'.$item} ne '') { |
if ($env{'form.'.$item} ne '') { |
if ($item eq 'description') { |
if ($item eq 'description') { |
my $descrip = $env{'form.description'}; |
my $descrip = $env{'form.description'}; |
$descrip =~ s|\n|<br />|g; |
$descrip = &cleanup_html($descrip); |
|
$descrip =~ s|[\n\r\f]|<br />|g; |
$displaymsg .= |
$displaymsg .= |
'<span class="LC_helpform_receipt_cat">'. |
'<span class="LC_helpform_receipt_cat">'. |
"$lt{$item}</span>: $descrip<br />\n"; |
"$lt{$item}</span>: $descrip<br />\n"; |
} elsif ($item eq 'sourceurl') { |
} elsif ($item eq 'sourceurl') { |
my $showurl = $env{'form.sourceurl'}; |
my $showurl = $env{'form.sourceurl'}; |
$showurl =~ s/\?.*$//; |
$showurl =~ s/\?.*$//; |
|
$showurl = &cleanup_html($showurl); |
$displaymsg .= |
$displaymsg .= |
'<span class="LC_helpform_receipt_cat">'. |
'<span class="LC_helpform_receipt_cat">'. |
"$lt{$item}</span>: $showurl<br />\n"; |
"$lt{$item}</span>: $showurl<br />\n"; |
Line 560 END
|
Line 674 END
|
'<span class="LC_helpform_receipt_cat">'. |
'<span class="LC_helpform_receipt_cat">'. |
"$lt{$item}</span>: $okcclist<br />\n"; |
"$lt{$item}</span>: $okcclist<br />\n"; |
} else { |
} else { |
|
my $showitem = $env{'form.'.$item}; |
|
$showitem = &cleanup_html($showitem); |
$displaymsg .= |
$displaymsg .= |
'<span class="LC_helpform_receipt_cat">'. |
'<span class="LC_helpform_receipt_cat">'. |
"$lt{$item}</span>: $env{'form.'.$item}<br />\n"; |
"$lt{$item}</span>: $showitem<br />\n"; |
} |
} |
} |
} |
} |
} |
Line 611 END
|
Line 727 END
|
$bad_email = 1; |
$bad_email = 1; |
} |
} |
} |
} |
if ($bad_email) { |
|
$r->print(' |
my $message; |
<h3>'.$lt{'warn'}.'</h3>'. |
if (!$bad_email) { |
&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 <b>not</b> been sent to the LON-CAPA support staff or administrator at your institution.',$to).' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.')); |
$message = &Apache::lonhtmlcommon::confirm_success( |
$to = 'helpdesk@lon-capa.org'; |
&mt('A support request has been sent to [_1]','<tt>'.$to.'</tt>')); |
} else { |
} else { |
$r->print('<h3>'.$lt{'asup'}.' '.$to.'</h3>'); |
$message = &Apache::lonhtmlcommon::confirm_success( |
|
$lt{'warn'}.'<br />' |
|
.&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>') |
|
.' '.&mt('Instead a copy has been sent to the LON-CAPA support team at Michigan State University.'),1); |
|
$to = 'helpdesk@lon-capa.org'; |
} |
} |
|
$r->print(&Apache::loncommon::confirmwrapper($message)); |
|
|
if (defined($env{'form.email'})) { |
if (defined($env{'form.email'})) { |
$env{'form.email'} =~ s/^\s+//; |
$env{'form.email'} =~ s/^\s+//; |
$env{'form.email'} =~ s/\s+$//; |
$env{'form.email'} =~ s/\s+$//; |
Line 644 END
|
Line 766 END
|
|
|
my $attachmentpath = ''; |
my $attachmentpath = ''; |
my $attachmentsize = ''; |
my $attachmentsize = ''; |
if (defined($env{'user.name'})) { |
if ((defined($env{'user.name'})) && ($env{'user.name'} ne 'public') |
if ($env{'form.screenshot.filename'}) { |
&& ($env{'user.domain'} ne 'public')) { |
|
if ($homeserver && $env{'form.screenshot.filename'}) { |
$attachmentsize = length($env{'form.screenshot'}); |
$attachmentsize = length($env{'form.screenshot'}); |
if ($attachmentsize > 131072) { |
if ($attachmentsize > 131072) { |
$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 />'.&mt('The uploaded screenshot file ([_1] bytes) included with your request exceeded the maximum allowed size - 128 KB, and has therefore been discarded.',$attachmentsize); |
Line 663 END
|
Line 786 END
|
|
|
if ($attachmentpath =~ m-/([^/]+)$-) { |
if ($attachmentpath =~ m-/([^/]+)$-) { |
$fname = $1; |
$fname = $1; |
$displaymsg .= '<br />'.&mt('An uploaded screenshot file \'[_1]\' ([_2] bytes) was included in the request sent by [_3].',$fname,$attachmentsize,$env{'user.name'}.': '.$env{'user.domain'}); |
$displaymsg .= '<br />' |
|
.&mt('An uploaded screenshot file [_1] ([_2] bytes) was included in the request sent by [_3].' |
|
,'<span class="LC_filename">'.$fname.'</span>' |
|
,$attachmentsize |
|
,$env{'user.name'}.':'.$env{'user.domain'} |
|
); |
$supportmsg .= "\n"; |
$supportmsg .= "\n"; |
foreach my $var (@cookievars) { |
foreach my $var (@cookievars) { |
$supportmsg .= "$var: $cookies{$var}\n"; |
$supportmsg .= "$var: $cookies{$var}\n"; |
Line 683 END
|
Line 811 END
|
Type =>'TEXT', |
Type =>'TEXT', |
Data => $supportmsg, |
Data => $supportmsg, |
); |
); |
if (@ok_ccs > 0) { |
if ($homeserver) { |
my $cc_string = join(', ',@ok_ccs); |
if (@ok_ccs > 0) { |
$msg->add("Cc" => $cc_string); |
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 ($attachmentpath) { |
if ($homeserver && $attachmentpath) { |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |
$msg->attach(Type => $type, |
$msg->attach(Type => $type, |
Path => $attachmentpath, |
Path => $attachmentpath, |
Line 720 END
|
Line 855 END
|
unlink($attachmentpath); |
unlink($attachmentpath); |
} |
} |
$r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n"); |
$r->print('<b>'.$lt{'your'}.'</b>:<br /><br />'."\n"); |
$r->print(&Apache::lonhtmlcommon::start_pick_box('LC_helpform_receipt'). |
$r->print('<div style="width:620px;">'. |
|
&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". |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_title($lt{'adin'},undef,'LC_evenrow_value')); |
&Apache::lonhtmlcommon::row_title($lt{'adin'},undef,'LC_evenrow_value')); |
Line 746 END
|
Line 882 END
|
$envmsg =~ s/, $//; |
$envmsg =~ s/, $//; |
$r->print($envmsg."\n". |
$r->print($envmsg."\n". |
&Apache::lonhtmlcommon::row_closure(1)."\n". |
&Apache::lonhtmlcommon::row_closure(1)."\n". |
&Apache::lonhtmlcommon::end_pick_box()."\n". |
&Apache::lonhtmlcommon::end_pick_box(). |
|
"</div>\n". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
} |
} |
|
|
Line 759 sub print_header {
|
Line 896 sub print_header {
|
$helpdesk_link = '<a href="/adm/helpdesk">'; |
$helpdesk_link = '<a href="/adm/helpdesk">'; |
} |
} |
my %lt = &Apache::lonlocal::texthash ( |
my %lt = &Apache::lonlocal::texthash ( |
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', |
|
ifyo => 'If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk.', |
|
cont => 'Contact your instructor instead.', |
); |
); |
my ($getstartlink,$reviewtext); |
my ($getstartlink,$reviewtext); |
if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') { |
if (-e $Apache::lonnet::perlvar{'lonDocRoot'}.'/adm/gettingstarted.html') { |
Line 772 sub print_header {
|
Line 912 sub print_header {
|
} else { |
} else { |
$reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.'); |
$reviewtext = &mt('Please review the information in "Log-in help" if you are unable to log-in.'); |
} |
} |
$r->print(<<END); |
if ($origurl eq '') { |
<table width="620" border="0" cellspacing="0" cellpadding="0" height="55"> <tr height="50"> <td width='5'> </td> |
$origurl = 'javascript:history.go(-1)'; |
<td> |
} |
<fieldset><legend><img src="$location/lonIcons/minilogo.gif" height='20' width='29' valign='bottom' /> <b><font size="+1">LON-CAPA $lt{'headline'}</font></b></legend> |
$r->print(<<"END"); |
|
<table width="620" border="0" cellspacing="0" cellpadding="0" style="height: 55px;"> |
|
<tr> |
|
<td width="5" height="50"> </td> |
|
<td height="50"> |
|
<fieldset> |
|
<legend> |
|
<img src="$location/lonIcons/minilogo.gif" height="20" width="29" alt="logo" style="vertical-align:bottom" /> |
|
LON-CAPA $lt{'headline'} |
|
</legend> |
<table id="LC_helpmenu_links"> |
<table id="LC_helpmenu_links"> |
<tr> |
<tr> |
<td align="center"><span class="LC_nobreak"><img src="/res/adm/pages/help.png" border="0" alt="($lt{'login'})" valign="middle" /> <b><a href="/adm/loginproblems.html">$lt{'login'}</a></b> </span></td> |
<td align="center"><span class="LC_nobreak"><img src="$location/help/help.png" border="0" alt="($lt{'login'})" style="vertical-align:middle" /> <b><a href="/adm/loginproblems.html">$lt{'login'}</a></b> </span></td> |
<td align="center"><span class="LC_nobreak"> <b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" valign="middle" /> $lt{'ask'}</a></b> </span></td>$getstartlink |
<td align="center"><span class="LC_nobreak"> <b>$helpdesk_link<img src="$location/lonIcons/helpdesk.gif" border="0" alt="($lt{'ask'})" style="vertical-align:middle" /> $lt{'ask'}</a></b> </span></td>$getstartlink |
<td align="center"><span class="LC_nobreak"> <b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" valign="middle" /> $lt{'back'}</a></b> </span></td> |
<td align="center"><span class="LC_nobreak"> <b><a href="$origurl" target="_top"><img src="$location/lonIcons/move_up.gif" border="0" alt="($lt{'back'})" style="vertical-align:middle" /> $lt{'back'}</a></b> </span></td> |
</tr> |
</tr> |
</table> |
</table> |
</fieldset> |
</fieldset> |
</td> |
</td> |
<td width='5'> </td> |
<td width="5"> </td> |
</tr> |
</tr> |
<tr height='5'> |
<tr> |
<td colspan='3' height='5'> </td> |
<td colspan="3" height="5"> </td> |
</tr> |
</tr> |
END |
END |
if ($command ne 'process') { |
if ($command ne 'process') { |
$r->print(' |
my $stuwarn = &mt('Do [_1]not[_2] use this form to ask about course content.', |
|
'<b>','</b>'); |
|
$r->print(<<"END"); |
<tr> |
<tr> |
<td colspan="3">'.$reviewtext.' ' |
<td colspan="3">$reviewtext |
.&mt('If your problem is still unresolved, the form below can be used to send a question to the LON-CAPA helpdesk.').'<br />' |
$lt{'ifyo'}<br /> |
.'<font size="-1"><b>'.&mt('Students').'</b>: '.&mt('Do <b>not</b> use this form to ask questions about course content.').' ' |
<span style="font-size:90%;"><b>$lt{'stud'}</b>: |
.&mt('Contact your instructor instead.') |
$stuwarn $lt{'cont'}</span> |
.'</font><br /><br /> |
<br /><br /> |
</td> |
</td> |
</tr>'); |
</tr> |
|
END |
} |
} |
$r->print(' |
$r->print(' |
</table>'); |
</table>'); |
Line 816 sub get_domain {
|
Line 968 sub get_domain {
|
} elsif ($env{'request.role.domain'}) { |
} elsif ($env{'request.role.domain'}) { |
$codedom = $env{'request.role.domain'}; |
$codedom = $env{'request.role.domain'}; |
} else { |
} else { |
$codedom = $Apache::lonnet::perlvar{'lonDefDomain'}; |
$codedom = &Apache::lonnet::default_login_domain(); |
} |
} |
return $codedom; |
return $codedom; |
} |
} |
|
|
|
sub cleanup_html { |
|
my ($incoming) = @_; |
|
my $outgoing; |
|
if ($incoming ne '') { |
|
$outgoing = $incoming; |
|
$outgoing =~ s/\#/#/g; |
|
$outgoing =~ s/\&/&/g; |
|
$outgoing =~ s/</</g; |
|
$outgoing =~ s/>/>/g; |
|
$outgoing =~ s/\(/(/g; |
|
$outgoing =~ s/\)/)/g; |
|
$outgoing =~ s/"/"/g; |
|
$outgoing =~ s/'/'/g; |
|
$outgoing =~ s/\$/$/g; |
|
} |
|
return $outgoing; |
|
} |
|
|
1; |
1; |