version 1.56, 2010/04/14 03:09:35
|
version 1.64, 2011/03/03 00:06:38
|
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); |
$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'}; |
my ($uname,$udom); |
if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { |
if (($env{'user.name'} ne 'public') && ($env{'user.domain'} ne 'public')) { |
$public = 1; |
|
} else { |
$uname = $env{'user.name'}; |
$uname = $env{'user.name'}; |
$udom = $env{'user.domain'}; |
$udom = $env{'user.domain'}; |
} |
} |
Line 175 END
|
Line 178 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 228 function initialize_codes() {
|
Line 244 function initialize_codes() {
|
} |
} |
|
|
my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n". |
my $js = '<script type="text/javascript">'."\n$scripttag\n$jscript\n". |
'</script>'; |
$loaditems.'</script>'; |
my %add_entries = (topmargin => "0", |
my %add_entries = (topmargin => "0", |
marginheight => "0", |
marginheight => "0", |
onLoad =>"initialize_codes()",); |
onLoad =>"initialize_codes()",); |
Line 269 function initialize_codes() {
|
Line 285 function initialize_codes() {
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if (defined($uname)) { |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title($lt{'emac'},undef,$css[$i]). |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
'<input type="text" size="50" name="cc" value="" /><br />'."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
Line 281 function initialize_codes() {
|
Line 297 function initialize_codes() {
|
&HTML::Entities::encode($udom,'"<>&').'" />'; |
&HTML::Entities::encode($udom,'"<>&').'" />'; |
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,'"<>&').'" />'; |
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 />'; |
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'); |
} |
} |
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; |
} |
} |
Line 338 function initialize_codes() {
|
Line 357 function initialize_codes() {
|
$output .= $lt{'enin'}.': |
$output .= $lt{'enin'}.': |
<input type="text" name="coursecode" size="15" value="" />'; |
<input type="text" name="coursecode" size="15" value="" />'; |
} 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'}."\n"; |
my @items = (); |
my @items = (); |
my @longitems = (); |
my @longitems = (); |
Line 372 function initialize_codes() {
|
Line 392 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 380 function initialize_codes() {
|
Line 400 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"; |
} |
} |
Line 431 function initialize_codes() {
|
Line 451 function initialize_codes() {
|
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
$num ++; |
$num ++; |
$i = $num%2; |
$i = $num%2; |
if (defined($uname)) { |
if (($env{'user.name'} =~ /^$match_username$/) && (!$public)) { |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
$output .= &Apache::lonhtmlcommon::row_title($lt{'opfi'},undef,$css[$i]). |
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n". |
' <input type="file" name="screenshot" size="20" /><br />'.$lt{'uplf'}."\n". |
&Apache::lonhtmlcommon::row_closure(); |
&Apache::lonhtmlcommon::row_closure(); |
Line 509 sub print_request_receipt {
|
Line 529 sub print_request_receipt {
|
&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 ( |
Line 559 sub print_request_receipt {
|
Line 583 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 576 sub print_request_receipt {
|
Line 600 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 750 END
|
Line 774 END
|
if ($bcc ne '') { |
if ($bcc ne '') { |
$msg->add("Bcc" => $bcc); |
$msg->add("Bcc" => $bcc); |
} |
} |
|
$msg->add('Content-type','text/plain; charset=UTF-8'); |
|
|
if ($attachmentpath) { |
if ($attachmentpath) { |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |
my ($type, $encoding) = MIME::Types::by_suffix($attachmentpath); |
Line 837 sub print_header {
|
Line 862 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.'); |
} |
} |
|
if ($origurl eq '') { |
|
$origurl = 'javascript:history.go(-1)'; |
|
} |
$r->print(<<END); |
$r->print(<<END); |
<table width="620" border="0" cellspacing="0" cellpadding="0" height="55"> <tr height="50"> <td width='5'> </td> |
<table width="620" border="0" cellspacing="0" cellpadding="0" height="55"> <tr height="50"> <td width='5'> </td> |
<td> |
<td> |