version 1.26, 2009/08/27 00:06:18
|
version 1.28, 2009/09/05 20:24:15
|
Line 44 described at http://www.lon-capa.org.
|
Line 44 described at http://www.lon-capa.org.
|
|
|
=item handler() |
=item handler() |
|
|
|
=item get_breadcrumbs() |
|
|
=item header() |
=item header() |
|
|
=item form_elements() |
=item form_elements() |
Line 58 described at http://www.lon-capa.org.
|
Line 60 described at http://www.lon-capa.org.
|
|
|
=item request_administration() |
=item request_administration() |
|
|
|
=item close_popup_form() |
|
|
|
=item get_instcode() |
|
|
=item print_request_form() |
=item print_request_form() |
|
|
=item print_enrollment_menu() |
=item print_enrollment_menu() |
|
|
|
=item show_invalid_crosslists() |
|
|
=item inst_section_selector() |
=item inst_section_selector() |
|
|
=item date_setting_table() |
=item date_setting_table() |
Line 94 described at http://www.lon-capa.org.
|
Line 102 described at http://www.lon-capa.org.
|
|
|
=item check_autolimit() |
=item check_autolimit() |
|
|
=item build_batchcreatehash() |
|
|
|
=item retrieve_settings() |
=item retrieve_settings() |
|
|
=item get_request_settings() |
=item get_request_settings() |
|
|
|
=item extract_instcode() |
|
|
|
=item generate_date_items() |
|
|
=back |
=back |
|
|
=cut |
=cut |
Line 122 sub handler {
|
Line 132 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['action','showdom','cnum']); |
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, |
|
['action','showdom','cnum','state']); |
&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 (%states,%stored); |
my $jscript; |
my ($jscript,$uname,$udom,$result,$warning); |
my ($uname,$udom,$result,$warning); |
|
|
$states{'display'} = ['details']; |
|
$states{'view'} = ['pick_request','details','cancel','removal']; |
|
$states{'log'} = ['filter','display']; |
|
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
|
|
|
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
|
unless ($env{'form.state'} eq 'crstype') { |
|
unshift(@{$states{'new'}},'codepick'); |
|
} |
|
} |
|
|
|
foreach my $key (keys(%states)) { |
|
if (ref($states{$key}) eq 'ARRAY') { |
|
unshift (@{$states{$key}},'crstype'); |
|
} |
|
} |
|
|
|
my @invalidcrosslist; |
|
my %trail = ( |
|
crstype => 'Course Request Action', |
|
codepick => 'Category', |
|
courseinfo => 'Description', |
|
enrollment => 'Access Dates', |
|
personnel => 'Personnel', |
|
review => 'Review', |
|
process => 'Result', |
|
pick_request => 'Display Summary', |
|
details => 'Request Details', |
|
cancel => 'Cancel Request', |
|
removal => 'Outcome', |
|
); |
|
|
|
if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) { |
|
$trail{'enrollment'} = 'Enrollment'; |
|
} |
|
|
|
my ($page,$crumb,$newinstcode,$codechk,$checkedcode) = |
|
&get_breadcrumbs($dom,$action,\$state,\%states,\%trail); |
if ($action eq 'display') { |
if ($action eq 'display') { |
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
if (($dom eq $env{'request.role.domain'}) && (&Apache::lonnet::allowed('ccc',$dom))) { |
my $namespace = 'courserequestqueue'; |
my $namespace = 'courserequestqueue'; |
Line 162 sub handler {
|
Line 211 sub handler {
|
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'}); |
} |
} |
|
} elsif ($env{'form.crstype'} eq 'official') { |
|
if (&Apache::lonnet::auto_run('',$dom)) { |
|
if (($action eq 'new') && (($state eq 'enrollment') || |
|
($state eq 'personnel'))) { |
|
my $checkcrosslist = 0; |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
|
if ($env{'form.crosslist_'.$i}) { |
|
$checkcrosslist ++; |
|
} |
|
} |
|
if ($checkcrosslist) { |
|
my %codechk; |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$lastitem); |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles, |
|
\%cat_titles, |
|
\%cat_order, |
|
\@code_order); |
|
my $numtitles = scalar(@codetitles); |
|
if ($numtitles) { |
|
for (my $i=0; $i<$env{'form.crosslisttotal'}; $i++) { |
|
if ($env{'form.crosslist_'.$i}) { |
|
my $codecheck; |
|
my $crosslistcode = ''; |
|
foreach my $item (@code_order) { |
|
$crosslistcode .= $env{'form.crosslist_'.$i.'_'.$item}; |
|
} |
|
if ($crosslistcode ne '') { |
|
$codechk{$i} = |
|
&Apache::lonnet::auto_validate_instcode('',$dom,$crosslistcode); |
|
} |
|
unless ($codechk{$i} eq 'valid') { |
|
$env{'form.crosslist_'.$i} = ''; |
|
push(@invalidcrosslist,$crosslistcode); |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
} |
} |
my %elements = &form_elements($dom); |
my %elements = &form_elements($dom); |
my $elementsref = {}; |
my $elementsref = {}; |
Line 182 sub handler {
|
Line 271 sub handler {
|
|
|
my $loaditems = &onload_action($action,$state); |
my $loaditems = &onload_action($action,$state); |
|
|
my %states; |
|
$states{'display'} = ['details']; |
|
$states{'view'} = ['pick_request','details','cancel','removal']; |
|
$states{'log'} = ['filter','display']; |
|
$states{'new'} = ['courseinfo','enrollment','personnel','review','process']; |
|
|
|
if (($action eq 'new') && ($env{'form.crstype'} eq 'official')) { |
|
unless ($env{'form.state'} eq 'crstype') { |
|
unshift(@{$states{'new'}},'codepick'); |
|
} |
|
} |
|
|
|
foreach my $key (keys(%states)) { |
|
if (ref($states{$key}) eq 'ARRAY') { |
|
unshift (@{$states{$key}},'crstype'); |
|
} |
|
} |
|
|
|
my %trail = ( |
|
crstype => 'Course Request Action', |
|
codepick => 'Category', |
|
courseinfo => 'Description', |
|
enrollment => 'Access Dates', |
|
personnel => 'Personnel', |
|
review => 'Review', |
|
process => 'Result', |
|
pick_request => 'Display Summary', |
|
details => 'Request Details', |
|
cancel => 'Cancel Request', |
|
removal => 'Outcome', |
|
); |
|
|
|
if (($env{'form.crstype'} eq 'official') && (&Apache::lonnet::auto_run('',$dom))) { |
|
$trail{'enrollment'} = 'Enrollment'; |
|
} |
|
|
|
my $page = 0; |
|
my $crumb; |
|
if (defined($action)) { |
|
my $done = 0; |
|
my $i=0; |
|
if (ref($states{$action}) eq 'ARRAY') { |
|
while ($i<@{$states{$action}} && !$done) { |
|
if ($states{$action}[$i] eq $state) { |
|
$page = $i; |
|
$done = 1; |
|
} |
|
$i++; |
|
} |
|
} |
|
for (my $i=0; $i<@{$states{$action}}; $i++) { |
|
if ($state eq $states{$action}[$i]) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>"$trail{$state}"}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
last; |
|
} else { |
|
if (($state eq 'process') && ($i > 0)) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[0]')", |
|
text=>"$trail{$states{$action}[$i]}"}); |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{href=>"javascript:backPage(document.requestcrs,'$states{$action}[$i]')", |
|
text=>"$trail{$states{$action}[$i]}"}); |
|
} |
|
} |
|
} |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
|
|
|
my %can_request; |
my %can_request; |
my $canreq = &check_can_request($dom,\%can_request); |
my $canreq = &check_can_request($dom,\%can_request); |
if ($action eq 'new') { |
if ($action eq 'new') { |
Line 264 sub handler {
|
Line 279 sub handler {
|
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems, |
&print_main_menu($r,\%can_request,\%states,$dom,$jscript,$loaditems, |
$crumb); |
$crumb); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom, |
$loaditems,$crumb); |
$jscript,$loaditems,$crumb,$newinstcode, |
|
$codechk,$checkedcode,\@invalidcrosslist); |
} |
} |
} else { |
} else { |
$r->print(&header('Course Requests').$crumb. |
$r->print(&header('Course Requests').$crumb. |
Line 289 sub handler {
|
Line 305 sub handler {
|
&close_popup_form()); |
&close_popup_form()); |
} else { |
} else { |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
&request_administration($r,$action,$state,$page,\%states,$dom,$jscript, |
$loaditems,$crumb,$uname,$udom); |
$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 299 sub handler {
|
Line 315 sub handler {
|
return OK; |
return OK; |
} |
} |
|
|
|
sub get_breadcrumbs { |
|
my ($dom,$action,$state,$states,$trail) = @_; |
|
my ($crumb,$newinstcode,$codechk,$checkedcode,$numtitles); |
|
my $page = 0; |
|
if ((ref($states) eq 'HASH') && (ref($trail) eq 'HASH') && (ref($state))) { |
|
if (defined($action)) { |
|
my $done = 0; |
|
my $i=0; |
|
if (ref($states->{$action}) eq 'ARRAY') { |
|
while ($i<@{$states->{$action}} && !$done) { |
|
if ($states->{$action}[$i] eq $$state) { |
|
$page = $i; |
|
$done = 1; |
|
} |
|
$i++; |
|
} |
|
} |
|
if ($env{'form.crstype'} eq 'official') { |
|
if ($page > 1) { |
|
if ($states->{$action}[$page-1] eq 'codepick') { |
|
if ($env{'form.instcode'} eq '') { |
|
($newinstcode,$numtitles) = &get_instcode($dom); |
|
if ($numtitles) { |
|
if ($newinstcode eq '') { |
|
$$state = 'codepick'; |
|
$page --; |
|
} else { |
|
$codechk = |
|
&Apache::lonnet::auto_validate_instcode('', |
|
$dom,$newinstcode); |
|
if ($codechk ne 'valid') { |
|
$$state = 'codepick'; |
|
$page --; |
|
} |
|
$checkedcode = 1; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
for (my $i=0; $i<@{$states->{$action}}; $i++) { |
|
if ($$state eq $states->{$action}[$i]) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>"$trail->{$$state}"}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
last; |
|
} else { |
|
if (($$state eq 'process') || ($$state eq 'removal')) { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{ href => '/adm/requestcourse', |
|
text => "$trail->{$states->{$action}[$i]}", |
|
} |
|
); |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{ href => "javascript:backPage(document.requestcrs,'$states->{$action}[$i]')", |
|
text => "$trail->{$states->{$action}[$i]}", } |
|
); |
|
} |
|
} |
|
} |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
|
} else { |
|
&Apache::lonhtmlcommon::add_breadcrumb( |
|
{text=>'Pick Action'}); |
|
$crumb = &Apache::lonhtmlcommon::breadcrumbs('Course Requests','Course_Requests'); |
|
} |
|
return ($page,$crumb,$newinstcode,$codechk,$checkedcode); |
|
} |
|
|
sub header { |
sub header { |
my ($bodytitle,$jscript,$loaditems,$jsextra,$args) = @_; |
my ($bodytitle,$jscript,$loaditems,$jsextra,$args) = @_; |
if ($jscript) { |
if ($jscript) { |
Line 401 sub form_elements {
|
Line 492 sub form_elements {
|
enrollend_year => 'text', |
enrollend_year => 'text', |
enrollend_minute => 'text', |
enrollend_minute => 'text', |
enrollend_second => 'text', |
enrollend_second => 'text', |
crosslisttotal => 'hidden', |
|
addcrosslist => 'checkbox', |
addcrosslist => 'checkbox', |
autoadds => 'radio', |
autoadds => 'radio', |
autodrops => 'radio', |
autodrops => 'radio', |
Line 420 sub form_elements {
|
Line 510 sub form_elements {
|
if (!$crosslisttotal) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
} |
} |
|
|
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'; |
Line 536 sub print_main_menu {
|
Line 627 sub print_main_menu {
|
my $js = <<"END"; |
my $js = <<"END"; |
|
|
function nextPage(formname) { |
function nextPage(formname) { |
var crschoice = document.requestcrs.crstype.value; |
var crschoice = document.mainmenu_coursetype.crstype.value; |
var actionchoice = document.requestcrs.action.value; |
var actionchoice = document.mainmenu_action.action.value; |
if (check_can_request(crschoice,actionchoice) == true) { |
if (check_can_request(crschoice,actionchoice) == true) { |
if ((actionchoice == 'new') && (crschoice == 'official')) { |
if ((actionchoice == 'new') && (crschoice == 'official')) { |
nextstate = 'codepick'; |
nextstate = 'codepick'; |
} else { |
} else { |
$nextstate_setter |
$nextstate_setter |
} |
} |
|
formname.crstype.value = crschoice; |
|
formname.action.value = actionchoice; |
formname.state.value= nextstate; |
formname.state.value= nextstate; |
formname.submit(); |
formname.submit(); |
} |
} |
Line 598 END
|
Line 691 END
|
|
|
END |
END |
|
|
$r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb. |
$r->print(&header('Course Requests',$js.$jscript,$loaditems).$crumb.'<div>'. |
'<div>'. |
|
'<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
|
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title('Course Domain'). |
&Apache::lonhtmlcommon::row_title(&mt('Course Domain')). |
|
'<form name="domforcourse" method="post" action="/adm/requestcourse">'. |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange)); |
&Apache::loncommon::select_dom_form($dom,'showdom','',1,$onchange)); |
if (!$onchange) { |
if (!$onchange) { |
$r->print(' <input type="submit" name="godom" value="'. |
$r->print(' <input type="submit" name="godom" value="'. |
&mt('Change').'" />'); |
&mt('Change').'" />'); |
} |
} |
$r->print(&Apache::lonhtmlcommon::row_closure(1). |
$r->print('</form>'.&Apache::lonhtmlcommon::row_closure()); |
&Apache::lonhtmlcommon::end_pick_box().'</form></div>'); |
|
|
|
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
my $nexttext = &mt('Next'); |
my $nexttext = &mt('Next'); |
$r->print( |
$r->print(&Apache::lonhtmlcommon::row_title(&mt('Action')).' |
'<div><form name="'.$formname.'" method="post" action="/adm/requestcourse">'. |
<form name="mainmenu_action" method="post" action=""> |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title('Action').' |
|
<input type="hidden" name="showdom" value="'.$dom.'" /> |
|
<select size="1" name="action" > |
<select size="1" name="action" > |
<option value="new">'.&mt('New request').'</option> |
<option value="new">'.&mt('New request').'</option> |
<option value="view">'.&mt('View/Modify/Cancel pending requests').'</option> |
<option value="view">'.&mt('View/Modify/Cancel pending requests').'</option> |
<option value="log">'.&mt('View request history').'</option> |
<option value="log">'.&mt('View request history').'</option> |
</select>'. |
</select></form>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title('Course Type').' |
&Apache::lonhtmlcommon::row_title(&mt('Course Type')).' |
|
<form name="mainmenu_coursetype" method="post" action=""> |
<select size="1" name="crstype"> |
<select size="1" name="crstype"> |
<option value="any">'.&mt('All types').'</option>'); |
<option value="any">'.&mt('All types').'</option>'); |
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { |
if ((ref($types) eq 'ARRAY') && (ref($typename) eq 'HASH')) { |
Line 637 END
|
Line 726 END
|
'</option>'."\n"); |
'</option>'."\n"); |
} |
} |
} |
} |
$r->print('</select> |
$r->print('</select></form>'."\n". |
<input type="hidden" name="state" value="crstype" />'. |
&Apache::lonhtmlcommon::row_closure(1)."\n". |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n". |
&Apache::lonhtmlcommon::end_pick_box().'<br /> |
'<div><form name="'.$formname.'" method="post" action="">'."\n". |
<input type="button" name="next" value="'.$nexttext.'" onclick="javascript:nextPage(document.'.$formname.')" /> |
'<input type="hidden" name="state" value="crstype" />'."\n". |
</form></div>'); |
'<input type="hidden" name="showdom" value="'.$dom.'" />'."\n". |
|
'<input type="hidden" name="crstype" value="" />'."\n". |
|
'<input type="hidden" name="action" value="" />'."\n". |
|
'<input type="button" name="next" value="'.$nexttext. |
|
'" onclick="javascript:nextPage(document.'.$formname.')" />'."\n". |
|
'</form></div>'); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
return; |
return; |
} |
} |
|
|
sub request_administration { |
sub request_administration { |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb,$uname,$udom) = @_; |
my ($r,$action,$state,$page,$states,$dom,$jscript,$loaditems,$crumb, |
|
$newinstcode,$codechk,$checkedcode,$invalidcrosslist,$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 676 END
|
Line 771 END
|
$jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom); |
$jsextra = "\n".&Apache::loncommon::coursebrowser_javascript($dom); |
} |
} |
$r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); |
$r->print(&header('Request a course',$js.$jscript,$loaditems,$jsextra).$crumb); |
&print_request_form($r,$action,$state,$page,$states,$dom); |
&print_request_form($r,$action,$state,$page,$states,$dom,$newinstcode, |
|
$codechk,$checkedcode,$invalidcrosslist); |
} elsif ($action eq 'view') { |
} elsif ($action eq 'view') { |
my $jsextra; |
my $jsextra; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
Line 809 sub close_popup_form {
|
Line 905 sub close_popup_form {
|
END |
END |
} |
} |
|
|
|
sub get_instcode { |
|
my ($dom) = @_; |
|
my ($instcode,$numtitles); |
|
my (@codetitles,%cat_titles,%cat_order,@code_order,$instcode,$code_chk); |
|
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
|
\%cat_order,\@code_order); |
|
$numtitles = scalar(@codetitles); |
|
if (@code_order > 0) { |
|
my $message; |
|
foreach my $item (@code_order) { |
|
$instcode .= $env{'form.instcode_'.$item}; |
|
} |
|
} |
|
return ($instcode,$numtitles); |
|
} |
|
|
sub print_request_form { |
sub print_request_form { |
my ($r,$action,$state,$page,$states,$dom) = @_; |
my ($r,$action,$state,$page,$states,$dom,$newinstcode,$codechk,$checkedcode, |
|
$invalidcrosslist) = @_; |
my $formname = 'requestcrs'; |
my $formname = 'requestcrs'; |
my ($next,$prev,$message,$output,$codepicker,$crstype); |
my ($next,$prev,$message,$output,$codepicker,$crstype); |
$prev = $states->{$action}[$page-1]; |
$prev = $states->{$action}[$page-1]; |
Line 825 sub print_request_form {
|
Line 938 sub print_request_form {
|
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
if ($env{'form.instcode'} ne '') { |
if ($env{'form.instcode'} ne '') { |
$instcode = $env{'form.instcode'}; |
$instcode = $env{'form.instcode'}; |
|
} elsif ($newinstcode ne '') { |
|
$instcode = $newinstcode; |
} |
} |
} |
if ($checkedcode) { |
if ($prev eq 'codepick') { |
if ($codechk eq 'valid') { |
if ($crstype eq 'official') { |
$message = '<div class="LC_info">'. |
&Apache::lonnet::auto_possible_instcodes($dom,\@codetitles,\%cat_titles, |
&mt('The chosen course category [_1] is valid.','<b>'. |
\%cat_order,\@code_order); |
$instcode.'</b>'). |
} |
'<input type="hidden" name="instcode" value="'. |
if (@code_order > 0) { |
$instcode.'" /></div>'; |
my $message; |
|
if ($instcode eq '') { |
|
foreach my $item (@code_order) { |
|
$instcode .= $env{'form.instcode_'.$item}; |
|
} |
|
$r->print('<input type="hidden" name="instcode" value="'.$instcode.'" />'."\n"); |
|
} |
|
if ($instcode ne '') { |
|
$code_chk = &Apache::lonnet::auto_validate_instcode('',$dom,$instcode); |
|
if ($code_chk eq 'valid') { |
|
$message = '<div class="LC_info">'. |
|
&mt('The chosen course category [_1] is valid.','<b>'. |
|
$instcode.'</b>').'</div>'; |
|
} else { |
|
$message = '<div class="LC_warning">'. |
|
&mt('No course was found matching your choice of institutional course category.'); |
|
if ($code_chk ne '') { |
|
$message .= '<br />'.$code_chk; |
|
} |
|
$message .= '</div>'; |
|
} |
|
} else { |
} else { |
$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.'); |
} |
if ($codechk ne '') { |
unless ($code_chk eq 'valid') { |
$message .= '<br />'.$codechk; |
|
} |
|
$message .= '</div>'; |
$prev = 'crstype'; |
$prev = 'crstype'; |
} |
} |
$r->print($message); |
$r->print($message); |
Line 886 sub print_request_form {
|
Line 982 sub print_request_form {
|
$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 '') { |
if ($instcode eq '') { |
$prev = $states->{$action}[$page-2]; |
$prev = $states->{$action}[$page-2]; |
} |
} |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
$r->print(&courseinfo_form($dom,$formname,$crstype,$next)); |
Line 896 sub print_request_form {
|
Line 992 sub print_request_form {
|
\%cat_order,\@code_order); |
\%cat_order,\@code_order); |
} |
} |
$r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles, |
$r->print(&print_enrollment_menu($formname,$instcode,$dom,\@codetitles, |
\%cat_titles,\%cat_order,\@code_order)); |
\%cat_titles,\%cat_order,\@code_order, |
|
$invalidcrosslist)); |
} elsif ($state eq 'personnel') { |
} elsif ($state eq 'personnel') { |
$r->print(&print_personnel_menu($dom,$formname,$crstype)); |
$r->print(&print_personnel_menu($dom,$formname,$crstype,$invalidcrosslist)); |
} elsif ($state eq 'review') { |
} elsif ($state eq 'review') { |
my $cnum; |
my $cnum; |
if ($env{'form.origcnum'} =~ /^($match_courseid)$/) { |
if ($env{'form.origcnum'} =~ /^($match_courseid)$/) { |
Line 908 sub print_request_form {
|
Line 1005 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('<h3>'.&mt('Review course request details before submission').'</h3>'. |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_order,\@code_order). |
&print_review($dom,\@codetitles,\%cat_titles,\%cat_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'); |
Line 917 sub print_request_form {
|
Line 1014 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); |
} |
} |
my $result = &print_request_outcome($dom,\@codetitles,\@code_order); |
my ($storeresult,$result) = &print_request_outcome($dom,\@codetitles, |
|
\@code_order); |
$r->print($result); |
$r->print($result); |
|
if (($storeresult eq 'ok') || ($storeresult eq 'created')) { |
|
$r->print('<p>'); |
|
if ($storeresult eq 'ok') { |
|
$r->print('<a href="/adm/requestcourse?action=view&state=details&showdom='.$dom.'&cnum='. $env{'form.cnum'}.'">'. |
|
&mt('Modify this request').'</a>'.(' 'x4)); |
|
} |
|
$r->print('<a href="/adm/requestcourse">'.&mt('Make another request').'</a></p>'); |
|
return; |
|
} |
} |
} |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
my @excluded = &get_excluded_elements($dom,$states,$action,$state); |
if ($state eq 'personnel') { |
if ($state eq 'personnel') { |
push(@excluded,'persontotal'); |
push(@excluded,'persontotal'); |
} |
} |
|
if ($state eq 'enrollment') { |
|
push(@excluded,'crosslisttotal'); |
|
} |
$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 958 sub get_excluded_elements {
|
Line 1068 sub get_excluded_elements {
|
} |
} |
|
|
sub print_enrollment_menu { |
sub print_enrollment_menu { |
my ($formname,$instcode,$dom,$codetitles,$cat_titles,$cat_order,$code_order) =@_; |
my ($formname,$instcode,$dom,$codetitles,$cat_titles,$cat_order,$code_order, |
my ($sections,$autoenroll,$access_dates); |
$invalidcrosslist) =@_; |
|
my ($sections,$autoenroll,$access_dates,$output); |
my $starttime = time; |
my $starttime = time; |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
my $endtime = time+(6*30*24*60*60); # 6 months from now, approx |
|
|
Line 973 sub print_enrollment_menu {
|
Line 1084 sub print_enrollment_menu {
|
); |
); |
if ($env{'form.crstype'} eq 'official') { |
if ($env{'form.crstype'} eq 'official') { |
if (&Apache::lonnet::auto_run('',$dom)) { |
if (&Apache::lonnet::auto_run('',$dom)) { |
my ($section_form,$crosslist_form,$autoenroll_form); |
$output = &show_invalid_crosslists($invalidcrosslist); |
|
my ($section_form,$crosslist_form); |
$section_form = &inst_section_selector($dom,$instcode); |
$section_form = &inst_section_selector($dom,$instcode); |
|
if ($section_form) { |
|
$sections = &Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&mt('Sections for auto-enrollment').'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$section_form; |
|
} |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
my $crosslisttotal = $env{'form.crosslisttotal'}; |
if (!$crosslisttotal) { |
if (!$crosslisttotal) { |
$crosslisttotal = 1; |
$crosslisttotal = 1; |
Line 992 sub print_enrollment_menu {
|
Line 1110 sub print_enrollment_menu {
|
'<input name="crosslisttotal" type="hidden" value="'.$crosslisttotal.'" />'. |
'<input name="crosslisttotal" type="hidden" value="'.$crosslisttotal.'" />'. |
'<input name="addcrosslist" type="checkbox" value="'.$crosslisttotal.'"'. |
'<input name="addcrosslist" type="checkbox" value="'.$crosslisttotal.'"'. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
' onclick="javascript:nextPage(document.'.$formname.",'".$env{'form.state'}. |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(1); |
"'".');" />'.&mt('Add?').&Apache::lonhtmlcommon::row_closure(); |
} |
$sections .= &Apache::lonhtmlcommon::row_headline. |
if ($section_form || $crosslist_form) { |
'<h3>'.&mt('Crosslisted courses for auto-enrollment').'</h3>'. |
$sections = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_closure(1). |
$section_form.$crosslist_form. |
$crosslist_form; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
|
} |
} |
$autoenroll_form = |
$autoenroll = |
&Apache::lonhtmlcommon::row_title(&mt('Add registered students automatically')). |
&Apache::lonhtmlcommon::row_title(&mt('Add registered students automatically')). |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="autoadds" value="1">'. |
'<input type="radio" name="autoadds" value="1">'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
'<input type="radio" name="autoadds" value="0" checked="checked">'. |
'<input type="radio" name="autoadds" value="0" checked="checked">'. |
&mt('No').'</label></span>'. |
&mt('No').'</label></span>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title(&mt('Drop unregistered students automatically')). |
&Apache::lonhtmlcommon::row_title(&mt('Drop unregistered students automatically')). |
'<span class="LC_nobreak"><label>'. |
'<span class="LC_nobreak"><label>'. |
'<input type="radio" name="autodrops" value="1">'. |
'<input type="radio" name="autodrops" value="1">'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
&mt('Yes').'</label>'.(' 'x3).'<label>'. |
'<input type="radio" name="autodrops" value="0" checked="checked">'. |
'<input type="radio" name="autodrops" value="0" checked="checked">'. |
&mt('No').'</label></span>'. |
&mt('No').'</label></span>'. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&date_setting_table($starttime,$endtime,$formname,'enroll',%enrolltitles); |
&date_setting_table($starttime,$endtime,$formname,'enroll',%enrolltitles); |
if ($autoenroll_form) { |
|
$autoenroll = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
|
$autoenroll_form. |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
|
} |
|
} |
} |
} |
} |
my $access_dates_form = |
my $access_dates = |
&date_setting_table($starttime,$endtime,$formname,'access',%accesstitles); |
&date_setting_table($starttime,$endtime,$formname,'access',%accesstitles); |
if ($access_dates_form) { |
$output .= &Apache::lonhtmlcommon::start_pick_box(); |
$access_dates = '<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
if ($sections) { |
$access_dates_form. |
$output .= $sections; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
} |
|
if ($autoenroll) { |
|
$output .= &Apache::lonhtmlcommon::row_headline('Auto-enroll'). |
|
'<h3>'.&mt('Auto-enrollment settings').'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$autoenroll; |
|
} |
|
if ($access_dates) { |
|
my $header = &mt('Access dates for students'); |
|
if ($env{'form.crstype'} eq 'community') { |
|
$header = &mt('Access dates for community members'); |
|
} |
|
$output .= &Apache::lonhtmlcommon::row_headline('Access'). |
|
'<h3>'.$header.'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
$access_dates |
} |
} |
return $sections.$autoenroll.$access_dates; |
return '<div>'.&Apache::lonhtmlcommon::start_pick_box().$output. |
|
&Apache::lonhtmlcommon::end_pick_box().'</div>'; |
} |
} |
|
|
|
sub show_invalid_crosslists { |
|
my ($invalidcrosslist) = @_; |
|
my $output; |
|
if (ref($invalidcrosslist) eq 'ARRAY') { |
|
if (@{$invalidcrosslist} > 0) { |
|
$output = '<div class="LC_warning">'. |
|
&mt('The following crosslisted courses were invalid:').'<ul>'; |
|
foreach my $item (@{$invalidcrosslist}) { |
|
$output .= '<li>'.$item.'</li>'; |
|
} |
|
$output .= '</ul></div><br />'; |
|
} |
|
} |
|
return $output; |
|
} |
|
|
|
|
sub inst_section_selector { |
sub inst_section_selector { |
my ($dom,$instcode) = @_; |
my ($dom,$instcode) = @_; |
my @sections = &Apache::lonnet::auto_get_sections(undef,$dom,$instcode); |
my @sections = &Apache::lonnet::auto_get_sections(undef,$dom,$instcode); |
my $sectotal = scalar(@sections); |
my $sectotal = scalar(@sections); |
my $output; |
my $output; |
if ($sectotal) { |
if ($sectotal) { |
$output .= &Apache::lonhtmlcommon::row_title('Sections'). |
$output .= &Apache::lonhtmlcommon::row_title(&mt('Sections of [_1]',$instcode)). |
&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" '. |
Line 1075 sub date_setting_table {
|
Line 1220 sub date_setting_table {
|
$starttime,'','','',1,'','','',1); |
$starttime,'','','',1,'','','',1); |
my $endform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'end', |
my $endform = &Apache::lonhtmlcommon::date_setter($formname,$prefix.'end', |
$endtime,'','','',1,'','','',1); |
$endtime,'','','',1,'','','',1); |
|
my $closure = ''; |
if ($prefix eq 'access') { |
if ($prefix eq 'access') { |
$perpetual = ' <span class="LC_nobreak"><label>'. |
$perpetual = ' <span class="LC_nobreak"><label>'. |
'<input type="checkbox" name="no_end_date" />'. |
'<input type="checkbox" name="no_end_date" />'. |
&mt('No end date').'</label></span>'; |
&mt('No end date').'</label></span>'; |
|
$closure = '1'; |
} |
} |
$table = &Apache::lonhtmlcommon::row_title($datetitles{'start'}). |
$table = &Apache::lonhtmlcommon::row_title($datetitles{'start'}). |
$startform. |
$startform. |
&Apache::lonhtmlcommon::row_closure(). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title($datetitles{'end'}). |
&Apache::lonhtmlcommon::row_title($datetitles{'end'}). |
$endform.$perpetual. |
$endform.$perpetual. |
&Apache::lonhtmlcommon::row_closure(1); |
&Apache::lonhtmlcommon::row_closure($closure); |
return $table; |
return $table; |
} |
} |
|
|
sub print_personnel_menu { |
sub print_personnel_menu { |
my ($dom,$formname,$crstype) = @_; |
my ($dom,$formname,$crstype,$invalidcrosslist) = @_; |
my $output = '<div>'.&Apache::lonhtmlcommon::start_pick_box(); |
my $output; |
|
if ($crstype eq 'official') { |
|
if (&Apache::lonnet::auto_run('',$dom)) { |
|
$output .= &show_invalid_crosslists($invalidcrosslist); |
|
} |
|
} |
|
$output .= '<div>'.&Apache::lonhtmlcommon::start_pick_box(); |
my $persontotal = $env{'form.persontotal'}; |
my $persontotal = $env{'form.persontotal'}; |
if ((!defined($persontotal)) || (!$persontotal)) { |
if ((!defined($persontotal)) || (!$persontotal)) { |
$persontotal = 1; |
$persontotal = 1; |
Line 1109 sub print_personnel_menu {
|
Line 1262 sub print_personnel_menu {
|
$type = 'Community'; |
$type = 'Community'; |
} |
} |
foreach my $role (@roles) { |
foreach my $role (@roles) { |
my $plrole=&Apache::lonnet::plaintext($role,$type); |
my $plrole = &Apache::lonnet::plaintext($role,$type); |
$roleoptions .= ' <option value="'.$role.'">'.$plrole.'</option>'."\n"; |
$roleoptions .= ' <option value="'.$role.'">'.$plrole.'</option>'."\n"; |
} |
} |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
if (keys(%customroles) > 0) { |
if (keys(%customroles) > 0) { |
foreach my $cust (sort(keys(%customroles))) { |
foreach my $cust (sort(keys(%customroles))) { |
my $custrole='cr_cr_'.$env{'user.domain'}. |
my $custrole="cr/$env{'user.domain'}/$env{'user.name'}/$cust"; |
'_'.$env{'user.name'}.'_'.$cust; |
|
$roleoptions .= ' <option value="'.$custrole.'">'.$cust.'</option>'."\n"; |
$roleoptions .= ' <option value="'.$custrole.'">'.$cust.'</option>'."\n"; |
} |
} |
} |
} |
Line 1152 sub print_personnel_menu {
|
Line 1304 sub print_personnel_menu {
|
$newtitle = &mt('Other').': '; |
$newtitle = &mt('Other').': '; |
} |
} |
|
|
|
if ($persontotal) { |
|
$output .= &Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&mt('Requestor is automatically assigned Course Coordinator role.').' '.&mt('Include other personnel?').'</h3>'; |
|
} |
for (my $i=0; $i<$persontotal; $i++) { |
for (my $i=0; $i<$persontotal; $i++) { |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my @linkargs = map { 'person_'.$i.'_'.$_ } (@items); |
my $linkargstr = join("','",@linkargs); |
my $linkargstr = join("','",@linkargs); |
Line 1619 sub print_review {
|
Line 1775 sub print_review {
|
if ($env{'form.person_'.$i.'_role'} eq 'cc') { |
if ($env{'form.person_'.$i.'_role'} eq 'cc') { |
$showsec = &mt('None'); |
$showsec = &mt('None'); |
} |
} |
|
my $role = $env{'form.person_'.$i.'_role'}; |
$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>'. |
'<td>'.$env{'form.person_'.$i.'_uname'}.':'. |
'<td>'.$env{'form.person_'.$i.'_uname'}.':'. |
$env{'form.person_'.$i.'_dom'}.'</td>'. |
$env{'form.person_'.$i.'_dom'}.'</td>'. |
'<td>'.&Apache::lonnet::plaintext($env{'form.person_'.$i.'_role'}, |
'<td>'.&Apache::lonnet::plaintext($role,$container).'</td>'. |
$container).'</td>'. |
|
'<td>'.$showsec.'</td></tr>'; |
'<td>'.$showsec.'</td></tr>'; |
} |
} |
} |
} |
Line 1693 function validateForm() {
|
Line 1849 function validateForm() {
|
</script> |
</script> |
|
|
ENDJS |
ENDJS |
|
my $title = &mt('Brief Course Description'); |
|
if ($crstype eq 'community') { |
|
$title = &mt('Brief Community Description'); |
|
} |
my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
my $output .= $js_validate."\n".'<div>'.&Apache::lonhtmlcommon::start_pick_box(). |
&Apache::lonhtmlcommon::row_title('Course Description'). |
&Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.$title.'</h3>'. |
|
&Apache::lonhtmlcommon::row_closure(1). |
|
&Apache::lonhtmlcommon::row_title(&mt('Description')). |
'<input type="text" size="40" name="cdescr" />'; |
'<input type="text" size="40" name="cdescr" />'; |
my ($home_server_pick,$numlib) = |
my ($home_server_pick,$numlib) = |
&Apache::loncommon::home_server_form_item($dom,'chome', |
&Apache::loncommon::home_server_form_item($dom,'chome', |
Line 1705 ENDJS
|
Line 1867 ENDJS
|
&Apache::lonhtmlcommon::row_title(&mt('Home Server for Course')); |
&Apache::lonhtmlcommon::row_title(&mt('Home Server for Course')); |
} |
} |
$output .= $home_server_pick. |
$output .= $home_server_pick. |
|
&Apache::lonhtmlcommon::row_closure(). |
|
&Apache::lonhtmlcommon::row_headline(). |
|
'<h3>'.&mt('Clone content and settings from an existing course?').'</h3>'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::end_pick_box().'</div>'. |
&clone_form($dom,$formname,$crstype). |
'<div>'.&clone_form($dom,$formname,$crstype).'</div>'."\n"; |
&Apache::lonhtmlcommon::end_pick_box().'</div>'."\n"; |
return $output; |
return $output; |
} |
} |
|
|
Line 1721 sub clone_form {
|
Line 1886 sub clone_form {
|
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type); |
&Apache::loncommon::selectcourse_link($formname,'clonecrs','clonedom','','','',$type); |
my %lt = &clone_text(); |
my %lt = &clone_text(); |
my $output .= |
my $output .= |
&Apache::lonhtmlcommon::start_pick_box(). |
|
&Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'cid'}).'<label>'. |
'<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();'. |
'<input type="text" size="25" name="clonecrs" value="" onfocus="this.blur();'. |
'opencrsbrowser('."'$formname','clonecrs','clonedom','','','','$type'".');" />'. |
'opencrsbrowser('."'$formname','clonecrs','clonedom','','','','$type'".');" />'. |
'</label>'.&Apache::lonhtmlcommon::row_closure(1).'<label>'. |
'</label>'.&Apache::lonhtmlcommon::row_closure(1).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'</label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dmn'}).'</label>'. |
$cloneform.'</label>'.&Apache::lonhtmlcommon::row_closure(). |
$cloneform.'</label>'.&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'. |
&Apache::lonhtmlcommon::row_title($lt{'dsh'}).'<label>'. |
'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}. |
'<input type="radio" name="datemode" value="delete" /> '.$lt{'ncd'}. |
'</label><br /><label>'. |
'</label><br /><label>'. |
Line 1736 sub clone_form {
|
Line 1900 sub clone_form {
|
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
'<input type="radio" name="datemode" value="shift" checked="checked" /> '. |
$lt{'shd'}.'</label>'. |
$lt{'shd'}.'</label>'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
'<input type="text" size="5" name="dateshift" value="365" />'. |
&Apache::lonhtmlcommon::row_closure(1). |
&Apache::lonhtmlcommon::row_closure(1); |
&Apache::lonhtmlcommon::end_pick_box(); |
|
return $output; |
return $output; |
} |
} |
|
|
Line 2077 sub print_request_outcome {
|
Line 2240 sub print_request_outcome {
|
accessend => $accessend, |
accessend => $accessend, |
personnel => \%personnel, |
personnel => \%personnel, |
}; |
}; |
my @inststatuses; |
my (@inststatuses,$storeresult,$creationresult); |
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
my $val = &get_processtype($dom,$crstype,\@inststatuses,\%domconfig); |
if ($val eq '') { |
if ($val eq '') { |
if ($crstype eq 'official') { |
if ($crstype eq 'official') { |
Line 2089 sub print_request_outcome {
|
Line 2252 sub print_request_outcome {
|
} else { |
} else { |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
$output = &mt('Unrecognized course type: [_1]',$crstype); |
} |
} |
|
$storeresult = 'notpermitted'; |
} else { |
} else { |
my ($disposition,$message,$reqstatus); |
my ($disposition,$message,$reqstatus); |
my %reqhash = ( |
my %reqhash = ( |
Line 2139 sub print_request_outcome {
|
Line 2303 sub print_request_outcome {
|
if ($message) { |
if ($message) { |
$output .= '<div class="LC_warning">'.$message.'</div>'; |
$output .= '<div class="LC_warning">'.$message.'</div>'; |
} |
} |
|
$storeresult = 'rejected'; |
} elsif ($disposition eq 'process') { |
} elsif ($disposition eq 'process') { |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my %domdefs = &Apache::lonnet::get_domain_defaults($dom); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles); |
my ($logmsg,$newusermsg,$addresult,$enrollcount,$response,$keysmsg,%longroles); |
Line 2156 sub print_request_outcome {
|
Line 2321 sub print_request_outcome {
|
if ($result eq 'created') { |
if ($result eq 'created') { |
$disposition = 'created'; |
$disposition = 'created'; |
$reqstatus = 'created'; |
$reqstatus = 'created'; |
$output = &mt('Your course request has been processed and the course has been created.'). |
my $role_result = &update_requestors_roles($dom,$cnum,$crstype,$details, |
'<br />'. |
\%longroles); |
&mt('You will need to logout and log-in again to be able to select a role in the course.'); |
$output = '<p>'.&mt('Your course request has been processed and the course has been created.'). |
|
'<br />'.$role_result.'</p>'; |
|
$creationresult = 'created'; |
} else { |
} else { |
$output = '<span class="LC_error">'. |
$output = '<span class="LC_error">'. |
&mt('An error occurred when processing your course request.'). |
&mt('An error occurred when processing your course request.'). |
'<br />'. |
'<br />'. |
&mt('You may want to review the request details and submit the request again.'). |
&mt('You may want to review the request details and submit the request again.'). |
'</span>'; |
'</span>'; |
|
$creationresult = 'error'; |
} |
} |
} else { |
} else { |
my $requestid = $cnum.'_'.$disposition; |
my $requestid = $cnum.'_'.$disposition; |
Line 2206 sub print_request_outcome {
|
Line 2374 sub print_request_outcome {
|
} |
} |
} |
} |
} |
} |
my ($storeresult,$statusresult); |
my ($statusresult); |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
if ($requestkey =~ /^($match_domain)_($match_courseid)$/) { |
$storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey, |
$storeresult = &Apache::lonnet::store_userdata(\%reqhash,$requestkey, |
'courserequests'); |
'courserequests'); |
Line 2214 sub print_request_outcome {
|
Line 2382 sub print_request_outcome {
|
my %status = ( |
my %status = ( |
'status:'.$dom.':'.$cnum => $reqstatus, |
'status:'.$dom.':'.$cnum => $reqstatus, |
); |
); |
$statusresult = &Apache::lonnet::put('courserequests',\%status); |
$statusresult = &Apache::lonnet::put('courserequests',\%status); |
} |
} |
} else { |
} else { |
$storeresult = 'error: invalid requestkey format'; |
$storeresult = 'error: invalid requestkey format'; |
Line 2223 sub print_request_outcome {
|
Line 2391 sub print_request_outcome {
|
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the details of your request: [_1].',$storeresult).'</span><br />'; |
&Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult"); |
&Apache::lonnet::logthis("Error saving course request - $requestkey for $env{'user.name'}:$env{'user.domain'} - $storeresult"); |
} elsif ($statusresult ne 'ok') { |
} elsif ($statusresult ne 'ok') { |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the status of your request: [_1].',$statusresult).'</span><br />'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred saving a record of the status of your request: [_1].',$statusresult).'</span><br />'; |
&Apache::lonnet::logthis("Error saving course request status for $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult"); |
&Apache::lonnet::logthis("Error saving course request status for $requestkey (for $env{'user.name'}:$env{'user.domain'}) - $statusresult"); |
} |
} |
if ($modified && $queued && $storeresult eq 'ok') { |
if ($modified && $queued && $storeresult eq 'ok') { |
Line 2234 sub print_request_outcome {
|
Line 2402 sub print_request_outcome {
|
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
$output .= '<span class="LC_warning">'.&mt('An error occurred validating your request with institutional data sources: [_1].',$validationerror).'</p>'; |
} |
} |
} |
} |
|
if ($creationresult ne '') { |
|
return ($creationresult,$output); |
|
} else { |
|
return ($storeresult,$output); |
|
} |
|
} |
|
|
|
sub update_requestors_roles { |
|
my ($dom,$cnum,$crstype,$details,$longroles) = @_; |
|
my $now = time; |
|
my ($active,$future,$numactive,$numfuture,$output); |
|
my $owner = $env{'user.name'}.':'.$env{'user.domain'}; |
|
if (ref($details) eq 'HASH') { |
|
if (ref($details->{'personnel'}) eq 'HASH') { |
|
if (ref($details->{'personnel'}{$owner}) eq 'HASH') { |
|
my @roles; |
|
if (ref($details->{'personnel'}{$owner}{'roles'}) eq 'ARRAY') { |
|
@roles = sort(@{$details->{'personnel'}{$owner}{'roles'}}); |
|
unless (grep(/^cc$/,@roles)) { |
|
push(@roles,'cc'); |
|
} |
|
} else { |
|
@roles = ('cc'); |
|
} |
|
foreach my $role (@roles) { |
|
my $start = $now; |
|
my $end = '0'; |
|
if ($role eq 'st') { |
|
if ($details->{'accessstart'} ne '') { |
|
$start = $details->{'accessstart'}; |
|
} |
|
if ($details->{'accessend'} ne '') { |
|
$end = $details->{'accessend'}; |
|
} |
|
} |
|
my @usecs; |
|
if ($role ne 'cc') { |
|
if (ref($details->{'personnel'}{$owner}{$role}{'usec'}) eq 'ARRAY') { |
|
@usecs = @{$details->{'personnel'}{$owner}{$role}{'usec'}}; |
|
} |
|
} |
|
if ($role eq 'st') { |
|
if (@usecs > 1) { |
|
my $firstsec = $usecs[0]; |
|
@usecs = ($firstsec); |
|
} |
|
} |
|
if (@usecs == 0) { |
|
push(@usecs,''); |
|
} |
|
foreach my $usec (@usecs) { |
|
my (%userroles,%newrole,%newgroups,$spec,$area); |
|
my $area = '/'.$dom.'/'.$cnum; |
|
my $spec = $role.'.'.$area; |
|
if ($usec ne '') { |
|
$spec .= '/'.$usec; |
|
$area .= '/'.$usec; |
|
} |
|
if ($role =~ /^cr\//) { |
|
&Apache::lonnet::custom_roleprivs(\%newrole,$role,$dom, |
|
$cnum,$spec,$area); |
|
} else { |
|
&Apache::lonnet::standard_roleprivs(\%newrole,$role,$dom, |
|
$spec,$cnum,$area); |
|
} |
|
&Apache::lonnet::set_userprivs(\%userroles,\%newrole, |
|
\%newgroups); |
|
$userroles{'user.role.'.$spec} = $start.'.'.$end; |
|
&Apache::lonnet::appenv(\%userroles,[$role,'cm']); |
|
if (($end == 0) || ($end > $now)) { |
|
my $showrole = $role; |
|
if ($role =~ /^cr\//) { |
|
$showrole = &Apache::lonnet::plaintext($role,$crstype); |
|
} elsif (ref($longroles) eq 'HASH') { |
|
if ($longroles->{$role} ne '') { |
|
$showrole = $longroles->{$role}; |
|
} |
|
} |
|
if ($start <= $now) { |
|
$active .= '<li><a href="/adm/roles?selectrole=1&'. $spec.'=1">'.$showrole; |
|
if ($usec ne '') { |
|
$active .= ' - '.&mt('section:').' '.$usec; |
|
} |
|
$active .= '</a></li>'; |
|
$numactive ++; |
|
} else { |
|
$future .= '<li>'.$showrole; |
|
if ($usec ne '') { |
|
$future .= ' - '.&mt('section:').' '.$usec; |
|
} |
|
$future .= '</li>'; |
|
$numfuture ++; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
if ($active) { |
|
if ($numactive == 1) { |
|
$output = &mt('Use the following link to enter the course:'); |
|
} else { |
|
$output = &mt('Use the following links to your new roles to enter the course:'); |
|
} |
|
$output .= ' <ul>'.$active.'</ul><br />'; |
|
} |
|
if ($future) { |
|
$output .= &mt('The following course [quant,_1,role] will become available for selection from your [_2]roles page[_3], once the default student access start date - [_4] - has been reached:',$numfuture,'<a href="/adm/roles">','</a>',&Apache::lonlocal::locallocaltime($details->{'accessstart'})). |
|
' <ul>'.$future.'</ul>'; |
|
} |
return $output; |
return $output; |
} |
} |
|
|