version 1.19, 2009/08/20 21:15:37
|
version 1.26, 2009/08/27 00:06:18
|
Line 116 use LONCAPA qw(:DEFAULT :match);
|
Line 116 use LONCAPA qw(:DEFAULT :match);
|
|
|
sub handler { |
sub handler { |
my ($r) = @_; |
my ($r) = @_; |
|
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
if ($r->header_only) { |
if ($r->header_only) { |
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
return OK; |
return OK; |
} |
} |
&Apache::loncommon::content_type($r,'text/html'); |
|
$r->send_http_header; |
|
|
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','showdom','cnum']); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
my $dom = &get_course_dom(); |
my $dom = &get_course_dom(); |
my $action = $env{'form.action'}; |
my $action = $env{'form.action'}; |
my $state = $env{'form.state'}; |
my $state = $env{'form.state'}; |
my %stored; |
my %stored; |
my $jscript; |
my $jscript; |
if ((defined($state)) && (defined($action))) { |
my ($uname,$udom,$result,$warning); |
|
if ($action eq 'display') { |
|
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
|
my $namespace = 'courserequestqueue'; |
|
if ($env{'form.cnum'} ne '') { |
|
my $cnum = $env{'form.cnum'}; |
|
my $reqkey = $cnum.'_approval'; |
|
my $namespace = 'courserequestqueue'; |
|
my $domconfig = &Apache::lonnet::get_domainconfiguser($dom); |
|
my %queued = |
|
&Apache::lonnet::get($namespace,[$reqkey],$dom,$domconfig); |
|
if (ref($queued{$reqkey}) eq 'HASH') { |
|
$uname = $queued{$reqkey}{'ownername'}; |
|
$udom = $queued{$reqkey}{'ownerdom'}; |
|
if (($udom =~ /^$match_domain$/) && ($uname =~ /^$match_username$/)) { |
|
$result = &retrieve_settings($dom,$cnum,$udom,$uname); |
|
} else { |
|
$warning = &mt('Invalid username or domain for course requestor'); |
|
} |
|
} else { |
|
$warning = &mt('No information was found for this course request.'); |
|
} |
|
} else { |
|
$warning = &mt('No course request ID provided.'); |
|
} |
|
} else { |
|
$warning = &mt('You do not have rights to view course request information.'); |
|
} |
|
} elsif ((defined($state)) && (defined($action))) { |
if (($action eq 'view') && ($state eq 'details')) { |
if (($action eq 'view') && ($state eq 'details')) { |
if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) { |
if ((defined($env{'form.showdom'})) && (defined($env{'form.cnum'}))) { |
my $result = &retrieve_settings($env{'form.showdom'},$env{'form.cnum'}); |
my $result = &retrieve_settings($env{'form.showdom'},$env{'form.cnum'}); |
Line 156 sub handler {
|
Line 183 sub handler {
|
my $loaditems = &onload_action($action,$state); |
my $loaditems = &onload_action($action,$state); |
|
|
my %states; |
my %states; |
|
$states{'display'} = ['details']; |
$states{'view'} = ['pick_request','details','cancel','removal']; |
$states{'view'} = ['pick_request','details','cancel','removal']; |
$states{'log'} = ['filter','display']; |
$states{'log'} = ['filter','display']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
|
|
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
unless ($env{'form.state'} eq 'crstype') { |
unless ($env{'form.state'} eq 'crstype') { |
unshift (@{$states{'new'}},'codepick'); |
unshift(@{$states{'new'}},'codepick'); |
} |
} |
} |
} |
|
|
Line 246 sub handler {
|
Line 275 sub handler {
|
} |
} |
} elsif ($action eq 'view') { |
} elsif ($action eq 'view') { |
if ($state eq 'crstype') { |
if ($state eq 'crstype') { |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,'',$crumb); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
$loaditems,$crumb); |
$loaditems,$crumb); |
|
} |
|
} elsif ($action eq 'display') { |
|
if ($warning ne '') { |
|
my $args = { only_body => 1 }; |
|
$r->print(&header('Course Requests','','',$args).$crumb. |
|
'<h3>'.&mt('Course Request Details').'</h3>'. |
|
'<div class="LC_warning">'.$warning.'</div>'. |
|
&close_popup_form()); |
|
} else { |
|
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
|
$loaditems,$crumb,$uname,$udom); |
} |
} |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
&print_request_logs($jscript,$loaditems,$crumb); |
&print_request_logs($jscript,$loaditems,$crumb); |
Line 260 sub handler {
|
Line 300 sub handler {
|
} |
} |
|
|
sub header { |
sub header { |
my ($bodytitle,$jscript,$loaditems,$jsextra) = @_; |
my ($bodytitle,$jscript,$loaditems,$jsextra,$args) = @_; |
if ($jscript) { |
if ($jscript) { |
$jscript = '<script type="text/javascript">'."\n". |
$jscript = '<script type="text/javascript">'."\n". |
'// <![CDATA['."\n". |
'// <![CDATA['."\n". |
$jscript."\n".'// ]]>'."\n".'</script>'."\n"; |
$jscript."\n".'// ]]>'."\n".'</script>'."\n"; |
} |
} |
if ($loaditems) { |
if ($loaditems) { |
$loaditems = {'add_entries' => $loaditems,}; |
if (ref($args) eq 'HASH') { |
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$loaditems); |
my %loadhash = ( |
} else { |
'add_entries' => $loaditems, |
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra); |
); |
|
my %arghash = (%loadhash,%{$args}); |
|
$args = \%arghash; |
|
} else { |
|
$args = {'add_entries' => $loaditems,}; |
|
} |
} |
} |
|
return &Apache::loncommon::start_page($bodytitle,$jscript.$jsextra,$args); |
} |
} |
|
|
sub form_elements { |
sub form_elements { |
Line 364 sub form_elements {
|
Line 410 sub form_elements {
|
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
for (my $i=0; $i<$env{'form.sectotal'}; $i++) { |
$extras{'sec_'.$i} = 'checkbox', |
$extras{'sec_'.$i} = 'checkbox', |
$extras{'secnum_'.$i} = 'text', |
$extras{'secnum_'.$i} = 'text', |
$extras{'loncapasec_'.$i} = 'checkbox', |
$extras{'loncapasec_'.$i} = 'text', |
} |
} |
} |
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
if ($env{'form.addcrosslist'}) { |
if ($env{'form.addcrosslist'}) { |
$crosslisttotal ++; |
$crosslisttotal ++; |
} |
} |
if (!defined($crosslisttotal)) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
if ($crosslisttotal > 0) { |
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
if ($numtitles) { |
if ($numtitles) { |
$extras{'crosslist_'.$i.'_'.$lastitem} = 'text'; |
$extras{'crosslist_'.$i.'_'.$lastitem} = 'text'; |
} |
} |
if (@codetitles > 0) { |
if (@codetitles > 0) { |
foreach my $item (@codetitles) { |
foreach my $item (@codetitles) { |
$extras{'crosslist_'.$i.'_'.$item} = 'selectbox'; |
$extras{'crosslist_'.$i.'_'.$item} = 'selectbox'; |
|
} |
|
} |
} |
$extras{'crosslist_'.$i} = 'checkbox'; |
|
$extras{'crosslist_'.$i.'_instsec'} = 'text', |
|
$extras{'crosslist_'.$i.'_lcsec'} = 'text', |
|
} |
} |
|
$extras{'crosslist_'.$i} = 'checkbox'; |
|
$extras{'crosslist_'.$i.'_instsec'} = 'text', |
|
$extras{'crosslist_'.$i.'_lcsec'} = 'text', |
} |
} |
my %mergedhash = (%{$elements{'new'}{'enrollment'}},%extras); |
my %mergedhash = (%{$elements{'new'}{'enrollment'}},%extras); |
%{$elements{'new'}{'enrollment'}} = %mergedhash; |
%{$elements{'new'}{'enrollment'}} = %mergedhash; |
Line 604 END
|
Line 648 END
|
} |
} |
|
|
sub request_administration { |
sub request_administration { |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb) = @_; |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb,$uname,$udom) = @_; |
my $js; |
my $js; |
if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) { |
if (($action eq 'new') || (($action eq 'view') && ($state eq 'pick_request'))) { |
$js = <<END; |
$js = <<END; |
Line 664 END
|
Line 708 END
|
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
$r->print('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n". |
$r->print('<h3>'.&mt('Course Request Details').'</h3><div>'."\n".$form."\n". |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
\@code_order)."\n". |
\@code_order)."\n". |
'<input name="origcnum" value="'.$origcnum.'" type="hidden" />'."\n"); |
'<input name="origcnum" value="'.$origcnum.'" type="hidden" />'."\n"); |
my @excluded = &get_excluded_elements($dom,$states,'new','review'); |
my @excluded = &get_excluded_elements($dom,$states,'new','review'); |
Line 737 END
|
Line 781 END
|
} |
} |
$r->print('</form>'); |
$r->print('</form>'); |
} |
} |
|
} elsif ($action eq 'display') { |
|
my $formname = 'requestcrs'; |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
|
if ($env{'form.crstype'} eq 'official') { |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
|
\%cat_order,\@code_order); |
|
} |
|
$r->print(&header('Course Request','','','',{ 'only_body' => 1}). |
|
$crumb."\n".'<h3>'.&mt('Course Request Details').'</h3>'. |
|
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order, |
|
\@code_order,$uname,$udom)."\n".'</div>'. |
|
&close_popup_form()); |
} elsif ($action eq 'log') { |
} elsif ($action eq 'log') { |
$r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); |
$r->print(&coursereq_log('View request log',$jscript,$loaditems).$crumb); |
} |
} |
Line 744 END
|
Line 800 END
|
return; |
return; |
} |
} |
|
|
|
sub close_popup_form { |
|
my $close= &mt('Close Window'); |
|
return << "END"; |
|
<p><form name="displayreq" action="" method="post"> |
|
<input type="button" name="closeme" value="$close" onclick="javascript:self.close();" /> |
|
</form></p> |
|
END |
|
} |
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$action,$state,$page,$states,$dom) = @_; |
my ($r,$action,$state,$page,$states,$dom) = @_; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
Line 793 sub print_request_form {
|
Line 858 sub print_request_form {
|
$message = '<div class="LC_warning">'. |
$message = '<div class="LC_warning">'. |
&mt('No course was found matching your choice of institutional course category.'); |
&mt('No course was found matching your choice of institutional course category.'); |
} |
} |
unless ($code_chk eq 'ok') { |
unless ($code_chk eq 'valid') { |
$prev = 'crstype'; |
$prev = 'crstype'; |
} |
} |
$r->print($message); |
$r->print($message); |
Line 811 sub print_request_form {
|
Line 876 sub print_request_form {
|
$r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box().$codepicker. |
$r->print('<div>'.&Apache::lonhtmlcommon::start_pick_box().$codepicker. |
&Apache::lonhtmlcommon::end_pick_box().'</div>'); |
&Apache::lonhtmlcommon::end_pick_box().'</div>'); |
} else { |
} else { |
|
$next = $states->{$action}[$page+2]; |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
} |
} |
} else { |
} else { |
|
if ($crstype eq 'official') { |
|
$next = $states->{$action}[$page+2]; |
|
} |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
} |
} |
} elsif ($prev eq 'codepick') { |
} elsif ($prev eq 'codepick') { |
|
if ($env{'form.instcode'} eq '') { |
|
$prev = $states->{$action}[$page-2]; |
|
} |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
} elsif ($state eq 'enrollment') { |
} elsif ($state eq 'enrollment') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
Line 837 sub print_request_form {
|
Line 909 sub print_request_form {
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
$r->print('<p>'.&mt('Review the details of the course request before submission.').'</p>'. |
$r->print('<p>'.&mt('Review the details of the course request before submission.').'</p>'. |
&print_review($formname,$dom,\@codetitles,\%cat_titles,\%cat_order, |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order). |
\@code_order). |
|
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
'<input type="hidden" name="cnum" value="'.$cnum.'" />'); |
$navtxt{'next'} = &mt('Submit course request'); |
$navtxt{'next'} = &mt('Submit course request'); |
} elsif ($state eq 'process') { |
} elsif ($state eq 'process') { |
Line 850 sub print_request_form {
|
Line 921 sub print_request_form {
|
$r->print($result); |
$r->print($result); |
} |
} |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
|
if ($state eq 'personnel') { |
|
push(@excluded,'persontotal'); |
|
} |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
$r->print(&Apache::lonhtmlcommon::echo_form_input(\@excluded).'</form>'); |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next,$navtxt{'next'},$state); |
&display_navbuttons($r,$formname,$prev,$navtxt{'prev'},$next,$navtxt{'next'},$state); |
return; |
return; |
Line 902 sub print_enrollment_menu {
|
Line 976 sub print_enrollment_menu {
|
my ($section_form,$crosslist_form,$autoenroll_form); |
my ($section_form,$crosslist_form,$autoenroll_form); |
$section_form = &inst_section_selector($dom,$instcode); |
$section_form = &inst_section_selector($dom,$instcode); |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
if (!defined($crosslisttotal)) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
if ($env{'form.addcrosslist'}) { |
if ($env{'form.addcrosslist'}) { |
Line 968 sub inst_section_selector {
|
Line 1042 sub inst_section_selector {
|
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_row(). |
&Apache::loncommon::start_data_table_row(). |
'<th>'.&mt('Include?').'<input type="hidden" name="sectotal" '. |
'<th>'.&mt('Include?').'<input type="hidden" name="sectotal" '. |
'value="'.$sectotal.'"</th>'. |
'value="'.$sectotal.'" /></th>'. |
'<th>'.&mt('Institutional Section').'</th>'. |
'<th>'.&mt('Institutional Section').'</th>'. |
'<th>'.&mt('LON-CAPA section').'</th>'. |
'<th>'.&mt('LON-CAPA section').'</th>'. |
&Apache::loncommon::end_data_table_row(); |
&Apache::loncommon::end_data_table_row(); |
for (my $i=0; $i<@sections; $i++) { |
for (my $i=0; $i<@sections; $i++) { |
my $colflag = $i%2; |
my $colflag = $i%2; |
|
my $checked = ' checked="checked"'; |
|
if ($env{'form.origcnum'}) { |
|
$checked=''; |
|
} |
$output .= &Apache::loncommon::start_data_table_row(). |
$output .= &Apache::loncommon::start_data_table_row(). |
'<td><input type="checkbox" name="sec_'.$i. |
'<td><input type="checkbox" name="sec_'.$i. |
'" checked="checked" /></td>'. |
'"'.$checked.' value="1" /></td>'. |
'<td>'.$sections[$i]. |
'<td>'.$sections[$i]. |
'<input type="hidden" name="secnum_'.$i.'" value="'. |
'<input type="hidden" name="secnum_'.$i.'" value="'. |
$sections[$i].'" /></td>'. |
$sections[$i].'" /></td>'. |
Line 1339 sub print_request_logs {
|
Line 1417 sub print_request_logs {
|
} |
} |
|
|
sub print_review { |
sub print_review { |
my ($formname,$dom,$codetitles,$cat_titles,$cat_order,$code_order) = @_; |
my ($dom,$codetitles,$cat_titles,$cat_order,$code_order,$uname,$udom) = @_; |
my ($types,$typename) = &course_types(); |
my ($types,$typename) = &course_types(); |
my ($owner,$ownername,$owneremail); |
my ($owner,$ownername,$owneremail); |
$owner = $env{'user.name'}.':'.$env{'user.domain'}; |
if ($uname eq '' || $udom eq '') { |
$ownername = &Apache::loncommon::plainname($env{'user.name'}, |
$uname = $env{'user.name'}; |
$env{'user.domain'},'first'); |
$udom = $env{'user.domain'}; |
my %emails = &Apache::loncommon::getemails(); |
} |
|
$owner = $uname.':'.$udom; |
|
$ownername = &Apache::loncommon::plainname($uname,$udom,'first'); |
|
my %emails = &Apache::loncommon::getemails($uname,$udom); |
foreach my $email ('permanentemail','critnotification','notification') { |
foreach my $email ('permanentemail','critnotification','notification') { |
$owneremail = $emails{$email}; |
$owneremail = $emails{$email}; |
last if ($owneremail ne ''); |
last if ($owneremail ne ''); |
Line 1424 sub print_review {
|
Line 1505 sub print_review {
|
&mt('Institutional course/section').'</th>'. |
&mt('Institutional course/section').'</th>'. |
'<th>'.&mt('LON-CAPA section').'</th></tr>'; |
'<th>'.&mt('LON-CAPA section').'</th></tr>'; |
my $xlistinfo; |
my $xlistinfo; |
if ($env{'form.crosslisttotal'}) { |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
if (!$crosslisttotal) { |
if ($env{'form.crosslist_'.$i}) { |
$crosslisttotal = 1; |
$xlistinfo .= '<tr><td>'; |
} |
if (ref($code_order) eq 'ARRAY') { |
for (my $i=0; $i<$crosslisttotal; $i++) { |
if (@{$code_order} > 0) { |
if ($env{'form.crosslist_'.$i}) { |
foreach my $item (@{$code_order}) { |
$xlistinfo .= '<tr><td>'; |
$xlistinfo .= $env{'form.crosslist_'.$i.'_'.$item}; |
if (ref($code_order) eq 'ARRAY') { |
} |
if (@{$code_order} > 0) { |
|
foreach my $item (@{$code_order}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_'.$item}; |
} |
} |
} |
} |
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}.'</td><td>'; |
|
if ($env{'form.crosslist_'.$i.'_lcsec'}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_lcsec'}; |
|
} else { |
|
$xlistinfo .= &mt('None'); |
|
} |
|
$xlistinfo .= '</td></tr>'; |
|
} |
} |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}.'</td><td>'; |
|
if ($env{'form.crosslist_'.$i.'_lcsec'}) { |
|
$xlistinfo .= $env{'form.crosslist_'.$i.'_lcsec'}; |
|
} else { |
|
$xlistinfo .= &mt('None'); |
|
} |
|
$xlistinfo .= '</td></tr>'; |
} |
} |
} |
} |
if ($xlistinfo eq '') { |
if ($xlistinfo eq '') { |
$xlistinfo = '<tr><td colspan="2">'.&mt('None').'</td></tr>'; |
$xlistinfo = '<tr><td colspan="2">'.&mt('None').'</td></tr>'; |
} |
} |
$section_values .= $xlistinfo.'</table></td>'; |
$section_values .= $xlistinfo; |
} |
} |
|
$section_values .= '</table></td>'; |
} |
} |
|
|
my %ctxt = &clone_text(); |
my %ctxt = &clone_text(); |
Line 1525 sub print_review {
|
Line 1609 sub print_review {
|
} |
} |
} |
} |
} |
} |
my $showsec = 'None'; |
my $showsec; |
if (@allsecs) { |
if (@allsecs) { |
$showsec = join(', ',@allsecs); |
$showsec = join(', ',@allsecs); |
} |
} |
|
if ($showsec eq '') { |
|
$showsec = &mt('None'); |
|
} |
|
if ($env{'form.person_'.$i.'_role'} eq 'cc') { |
|
$showsec = &mt('None'); |
|
} |
$personnel_values .= |
$personnel_values .= |
'<tr><td>'.$env{'form.person_'.$i.'_firstname'}.' '. |
'<tr><td>'.$env{'form.person_'.$i.'_firstname'}.' '. |
$env{'form.person_'.$i.'_lastname'}.'</td>'. |
$env{'form.person_'.$i.'_lastname'}.'</td>'. |
Line 1569 sub print_review {
|
Line 1659 sub print_review {
|
'<table class="LC_innerpickbox"><tr>'.$personnel_headers.'</tr>'."\n". |
'<table class="LC_innerpickbox"><tr>'.$personnel_headers.'</tr>'."\n". |
$personnel_values.'</table>'."\n". |
$personnel_values.'</table>'."\n". |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box(); |
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
return $output; |
return $output; |
} |
} |
|
|
Line 1826 sub print_request_outcome {
|
Line 1916 sub print_request_outcome {
|
my ($dom,$codetitles,$code_order) = @_; |
my ($dom,$codetitles,$code_order) = @_; |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
my ($output,$cnum,$now,$req_notifylist,$crstype,$enrollstart,$enrollend, |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,); |
%sections,%crosslistings,%personnel,@baduname,@missingdom,%domconfig,); |
|
my $sectotal = $env{'form.sectotal'}; |
|
my $crosslisttotal = 0; |
$cnum = $env{'form.cnum'}; |
$cnum = $env{'form.cnum'}; |
unless ($cnum =~ /^$match_courseid$/) { |
unless ($cnum =~ /^$match_courseid$/) { |
$output = &mt('Invalid LON-CAPA course number for the new course')."\n"; |
$output = &mt('Invalid LON-CAPA course number for the new course')."\n"; |
Line 1867 sub print_request_outcome {
|
Line 1959 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
$xlistinfo .= $env{'form.crosslist_'.$i.'_instsec'}; |
$crosslistings{$i}{'instcode'} = $xlistinfo; |
$crosslistings{$i}{'inst'} = $xlistinfo; |
if ($xlistinfo ne '') { |
|
$crosslisttotal ++; |
|
} |
|
$crosslistings{$i}{'instsec'} = $env{'form.crosslist_'.$i.'_instsec'}; |
$crosslistings{$i}{'loncapa'} = $env{'form.crosslist_'.$i.'_lcsec'}; |
$crosslistings{$i}{'loncapa'} = $env{'form.crosslist_'.$i.'_lcsec'}; |
} |
} |
} |
} |
Line 1934 sub print_request_outcome {
|
Line 2029 sub print_request_outcome {
|
if ($env{'form.autoadds'}) { |
if ($env{'form.autoadds'}) { |
$autodrops = $env{'form.autoadds'}; |
$autodrops = $env{'form.autoadds'}; |
} |
} |
my $sectotal = 0; |
|
if ($env{'form.sectotal'}) { |
|
$sectotal = $env{'form.sectotal'}; |
|
} |
|
if ($env{'form.autoadds'}) { |
if ($env{'form.autoadds'}) { |
$autodrops = $env{'form.autoadds'}; |
$autodrops = $env{'form.autoadds'}; |
} |
} |
my $crosslisttotal = 0; |
|
if ($env{'form.crosslisttotal'}) { |
|
$crosslisttotal = $env{'form.crosslisttotal'}; |
|
} |
|
my $instcode = ''; |
my $instcode = ''; |
if (exists($env{'form.instcode'})) { |
if (exists($env{'form.instcode'})) { |
$instcode = $env{'form.instcode'}; |
$instcode = $env{'form.instcode'}; |
Line 2018 sub print_request_outcome {
|
Line 2105 sub print_request_outcome {
|
$disposition = &check_autolimit($env{'user.name'},$env{'user.domain'}, |
$disposition = &check_autolimit($env{'user.name'},$env{'user.domain'}, |
$dom,$crstype,$limit,\$message); |
$dom,$crstype,$limit,\$message); |
} elsif ($val eq 'validate') { |
} elsif ($val eq 'validate') { |
my $inststatuslist; |
my ($inststatuslist,$validationchk,$validation); |
if (@inststatuses > 0) { |
if (@inststatuses > 0) { |
$inststatuslist = join(',',@inststatuses); |
$inststatuslist = join(',',@inststatuses); |
} |
} |
Line 2026 sub print_request_outcome {
|
Line 2113 sub print_request_outcome {
|
if (@instsections > 0) { |
if (@instsections > 0) { |
$instseclist = join(',',@instsections); |
$instseclist = join(',',@instsections); |
} |
} |
my $validation = |
$validationchk = |
&Apache::lonnet::auto_validate_instcode('',$dom,$instcode, |
&Apache::lonnet::auto_courserequest_validation($dom, |
$env{'user.name'}.':'.$env{'user.domain'},$inststatuslist, |
$env{'user.name'}.':'.$env{'user.domain'},$crstype, |
$instseclist); |
$inststatuslist,$instcode,$instseclist); |
if ($validation eq 'valid') { |
if ($validationchk =~ /:/) { |
$disposition = 'process'; |
($validation,$message) = split(':',$validationchk); |
} elsif ($validation eq 'rejected') { |
} else { |
$disposition = 'rejected'; |
$validation = $validationchk; |
} elsif ($validation eq 'pending') { |
} |
$disposition = 'pending'; |
if ($validation =~ /^error(.*)$/) { |
} elsif ($disposition eq 'approval') { |
|
$disposition = 'approval'; |
|
} elsif ($disposition =~ /^error(.*)$/) { |
|
$disposition = 'approval'; |
$disposition = 'approval'; |
$validationerror = $1; |
$validationerror = $1; |
} else { |
} else { |
$disposition = 'approval'; |
$disposition = $validation; |
} |
} |
} else { |
} else { |
$disposition = 'approval'; |
$disposition = 'approval'; |
Line 2098 sub print_request_outcome {
|
Line 2182 sub print_request_outcome {
|
$env{'user.domain'},$env{'user.name'}); |
$env{'user.domain'},$env{'user.name'}); |
if ($userreqhash{$statuskey} ne '') { |
if ($userreqhash{$statuskey} ne '') { |
$modified = 1; |
$modified = 1; |
my %queuehash = &Apache::lonnet::get_dom('courserequestqueue', |
my $uname = &Apache::lonnet::get_domainconfiguser($dom); |
[$cnum.'_approval', |
my %queuehash = &Apache::lonnet::get('courserequestqueue', |
$cnum.'_pending'],$dom); |
[$cnum.'_approval', |
|
$cnum.'_pending'],$dom,$uname); |
if (($queuehash{$cnum.'_approval'} ne '') || |
if (($queuehash{$cnum.'_approval'} ne '') || |
($queuehash{$cnum.'_pending'} ne '')) { |
($queuehash{$cnum.'_pending'} ne '')) { |
$queued = 1; |
$queued = 1; |
Line 2206 sub get_processtype {
|
Line 2291 sub get_processtype {
|
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
if (ref($domconfig->{'requestcourses'}) eq 'HASH') { |
%settings = %{$domconfig->{'requestcourses'}}; |
%settings = %{$domconfig->{'requestcourses'}}; |
if (ref($settings{$crstype}) eq 'HASH') { |
if (ref($settings{$crstype}) eq 'HASH') { |
if (($env{'user.adv'}) && (exists($settings{$crstype}{'_LC_adv'}))) { |
if (($env{'user.adv'}) && ($settings{$crstype}{'_LC_adv'} ne '')) { |
$val = $settings{$crstype}{'_LC_adv'}; |
$val = $settings{$crstype}{'_LC_adv'}; |
@{$inststatuses} = ('_LC_adv_'); |
@{$inststatuses} = ('_LC_adv_'); |
} else { |
} else { |
Line 2312 sub check_autolimit {
|
Line 2397 sub check_autolimit {
|
} |
} |
|
|
sub retrieve_settings { |
sub retrieve_settings { |
my ($dom,$cnum) = @_; |
my ($dom,$cnum,$udom,$uname) = @_; |
my ($result,%reqinfo) = &get_request_settings($dom,$cnum); |
if ($udom eq '' || $uname eq '') { |
|
$udom = $env{'user.domain'}; |
|
$uname = $env{'user.name'}; |
|
} |
|
my ($result,%reqinfo) = &get_request_settings($dom,$cnum,$udom,$uname); |
if ($result eq 'ok') { |
if ($result eq 'ok') { |
if (($env{'user.name'} eq $reqinfo{'owner'}) && |
if (($udom eq $reqinfo{'domain'}) && ($uname eq $reqinfo{'owner'})) { |
($env{'user.domain'} eq $reqinfo{'domain'})) { |
|
$env{'form.chome'} = $reqinfo{'coursehome'}; |
$env{'form.chome'} = $reqinfo{'coursehome'}; |
$env{'form.cdescr'} = $reqinfo{'cdescr'}; |
$env{'form.cdescr'} = $reqinfo{'cdescr'}; |
$env{'form.crstype'} = $reqinfo{'crstype'}; |
$env{'form.crstype'} = $reqinfo{'crstype'}; |
Line 2339 sub retrieve_settings {
|
Line 2427 sub retrieve_settings {
|
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autoadds'} = $reqinfo{'autoadds'}; |
$env{'form.autdrops'} = $reqinfo{'autodrops'}; |
$env{'form.autdrops'} = $reqinfo{'autodrops'}; |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
$env{'form.instcode'} = $reqinfo{'instcode'}; |
my %crscode = ( |
my $crscode = { |
instcode => $reqinfo{'instcode'}, |
$cnum => $reqinfo{'instcode'}, |
); |
}; |
&extract_instcode($dom,'instcode',\%crscode); |
&extract_instcode($dom,'instcode',$crscode,$cnum); |
} |
} |
my @currsec; |
my @currsec; |
if (ref($reqinfo{'sections'}) eq 'HASH') { |
if (ref($reqinfo{'sections'}) eq 'HASH') { |
foreach my $i (sort(keys(%{$reqinfo{'sections'}}))) { |
foreach my $i (sort(keys(%{$reqinfo{'sections'}}))) { |
if (ref($reqinfo{'sections'}{$i}) eq 'HASH') { |
if (ref($reqinfo{'sections'}{$i}) eq 'HASH') { |
my $sec = $reqinfo{'sections'}{$i}{'inst'};; |
my $sec = $reqinfo{'sections'}{$i}{'inst'}; |
$env{'form.secnum_'.$i} = $sec; |
$env{'form.secnum_'.$i} = $sec; |
|
$env{'form.sec_'.$i} = '1'; |
if (!grep(/^\Q$sec\E$/,@currsec)) { |
if (!grep(/^\Q$sec\E$/,@currsec)) { |
push(@currsec,$sec); |
push(@currsec,$sec); |
} |
} |
Line 2357 sub retrieve_settings {
|
Line 2446 sub retrieve_settings {
|
} |
} |
} |
} |
} |
} |
if (ref($reqinfo{'crosslistings'}) eq 'HASH') { |
if (ref($reqinfo{'crosslists'}) eq 'HASH') { |
foreach my $i (sort(keys(%{$reqinfo{'crosslistings'}}))) { |
foreach my $i (sort(keys(%{$reqinfo{'crosslists'}}))) { |
if (ref($reqinfo{'crosslistings'}{$i}) eq 'HASH') { |
if (ref($reqinfo{'crosslists'}{$i}) eq 'HASH') { |
$env{'form.crosslist_'.$i.'_lcsec'} = $reqinfo{'crosslistings'}{$i}{'loncapa'}; |
$env{'form.crosslist_'.$i} = '1'; |
my $xlistsec = $reqinfo{'crosslistings'}{$i}{'instsec'}; |
$env{'form.crosslist_'.$i.'_instsec'} = $reqinfo{'crosslists'}{$i}{'instsec'}; |
my %crscode = ( |
$env{'form.crosslist_'.$i.'_lcsec'} = $reqinfo{'crosslists'}{$i}{'loncapa'}; |
$i => $reqinfo{'crosslistings'}{$i}{'instcode'}, |
if ($reqinfo{'crosslists'}{$i}{'instcode'} ne '') { |
); |
my $key = $cnum.$i; |
&extract_instcode($dom,'crosslist',\%crscode,$1,$xlistsec); |
my $crscode = { |
|
$key => $reqinfo{'crosslists'}{$i}{'instcode'}, |
|
}; |
|
&extract_instcode($dom,'crosslist',$crscode,$key,$i); |
|
} |
} |
} |
} |
} |
} |
} |
Line 2391 sub retrieve_settings {
|
Line 2484 sub retrieve_settings {
|
if (grep(/^\Q$sec\E/,@currsec)) { |
if (grep(/^\Q$sec\E/,@currsec)) { |
$env{'form.person_'.$i.'_sec'} = $sec; |
$env{'form.person_'.$i.'_sec'} = $sec; |
} else { |
} else { |
push (@newsecs,$sec); |
push(@newsecs,$sec); |
} |
} |
} |
} |
} |
} |
Line 2413 sub retrieve_settings {
|
Line 2506 sub retrieve_settings {
|
} |
} |
|
|
sub get_request_settings { |
sub get_request_settings { |
my ($dom,$cnum) = @_; |
my ($dom,$cnum,$udom,$uname) = @_; |
my $requestkey = $dom.'_'.$cnum; |
my $requestkey = $dom.'_'.$cnum; |
my ($result,%reqinfo); |
my ($result,%reqinfo); |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
my %history = &Apache::lonnet::restore($requestkey,'courserequests', |
my %history = &Apache::lonnet::restore($requestkey,'courserequests',$udom,$uname); |
$env{'user.domain'},$env{'user.name'}); |
|
my $disposition = $history{'disposition'}; |
my $disposition = $history{'disposition'}; |
if (($disposition eq 'approval') || ($disposition eq 'pending')) { |
if (($disposition eq 'approval') || ($disposition eq 'pending')) { |
if (ref($history{'details'}) eq 'HASH') { |
if (ref($history{'details'}) eq 'HASH') { |
Line 2437 sub get_request_settings {
|
Line 2529 sub get_request_settings {
|
} |
} |
|
|
sub extract_instcode { |
sub extract_instcode { |
my ($cdom,$element,$crscodehashref,$counter,$xlistsec) = @_; |
my ($cdom,$element,$crscode,$crskey,$counter) = @_; |
my (%codes,@codetitles,%cat_titles,%cat_order); |
my (%codes,@codetitles,%cat_titles,%cat_order); |
if (ref($crscodehashref) eq 'HASH') { |
if (&Apache::lonnet::auto_instcode_format('requests',$cdom,$crscode,\%codes, |
if (&Apache::lonnet::auto_instcode_format('requests',$cdom,$crscodehashref, |
\@codetitles,\%cat_titles, |
\%codes,\@codetitles,\%cat_titles,\%cat_order) eq 'ok') { |
\%cat_order) eq 'ok') { |
|
if (ref($codes{$crskey}) eq 'HASH') { |
if (@codetitles > 0) { |
if (@codetitles > 0) { |
my $sel = $element; |
my $sel = $element; |
if ($element eq 'crosslist') { |
if ($element eq 'crosslist') { |
$sel .= '_'.$counter; |
$sel .= '_'.$counter; |
} |
} |
my $lastitem = pop(@codetitles); |
|
foreach my $title (@codetitles) { |
foreach my $title (@codetitles) { |
if (ref($cat_order{$title}) eq 'ARRAY') { |
$env{'form.'.$sel.'_'.$title} = $codes{$crskey}{$title}; |
if (@{$cat_order{$title}} > 0) { |
|
$env{'form.'.$sel.'_'.$title} = $cat_order{$title}[0]; |
|
} |
|
} |
|
} |
|
if ($element eq 'crosslist') { |
|
$env{'form.'.$sel.'_'.$lastitem} = $xlistsec; |
|
} |
} |
} |
} |
} |
} |