--- loncom/interface/lonpreferences.pm 2005/06/06 16:23:55 1.62 +++ loncom/interface/lonpreferences.pm 2005/06/06 22:39:59 1.63 @@ -1,7 +1,7 @@ # The LearningOnline Network # Preferences # -# $Id: lonpreferences.pm,v 1.62 2005/06/06 16:23:55 raeburn Exp $ +# $Id: lonpreferences.pm,v 1.63 2005/06/06 22:39:59 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -973,6 +973,74 @@ $message ENDVCSCREEN } +################################################################ +# Subroutines for page display on course access (Course Coordinators) +################################################################ +sub coursedisplaychanger { + my $r = shift; + my $user = $env{'user.name'}; + my $domain = $env{'user.domain'}; + my %userenv = &Apache::lonnet::get + ('environment',['course_init_display']); + + my $firstselect='checked="checked"'; + my $whatsnewselect=''; + if ($userenv{'course_init_display'} eq 'firstres') { + $firstselect=''; + $whatsnewselect='checked="checked"'; + } + my $whatsnew_off=&mt('Display the first resource in the course.'); + my $whatsnew_on=&mt('Display a summary of items in the course which require action from the course coordinator.'); + + $r->print('
'.&mt('Set the page to be displayed when you select the role of Course Coordinator').':'); + $r->print(< + + $whatsnew_off
+ $whatsnew_on +ENDLSCREEN + $r->print('
+'); +} + +sub verify_and_change_coursepage { + my $r = shift; + my $message=''; + my %lt = &Apache::lonlocal::texthash( + 'when' => 'Whenever you select the Course Coordinator role from the roles screen', + 'ywbt' => 'you will be taken to the start of the course.', + 'apwb' => 'a page will be displayed that lists items in the course that may require action from you.', + 'gtts' => 'Go to the start of the course', + 'dasp' => 'Display a summary page listing course action items', + ); + my $newdisp = $env{'form.newdisp'}; + if ($newdisp eq 'firstres') { + $message .= $lt{'when'}.', '.$lt{'ywbt'}.'
'; + &Apache::lonnet::put('environment',{'course_init_display' => $newdisp}); + &Apache::lonnet::appenv('environment.course_init_display' => $newdisp); + } else { + $message .= $lt{'when'}.', '.$lt{'apwb'}.'
'; + &Apache::lonnet::del('environment',['course_init_display']); + &Apache::lonnet::delenv('environment\.course_init_display'); + } + if (($env{'request.course.fn'}) && ($env{'request.course.id'})) { + if ($newdisp eq 'firstres') { + my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; + my ($furl,$ferr)= + &Apache::lonuserstate::readmap($cdom.'/'.$cnum); + $message .= '
'.$lt{'gtts'}.' '.&mt('now').''; + } else { + $message .= '
'.$lt{'dasp'}.''; + } + } + $r->print(<
+ENDVCSCREEN +} + + ###################################################### # other handler subroutines # ###################################################### @@ -1153,7 +1221,22 @@ sub handler { text => 'Change Math Preferences'}, printmenu => 'yes', })); - + if($env{'request.role'} =~ /^cc\.\//) { + push (@Options,({ action => 'changecourseinit', + linktext => 'Change Course Initialization Preference', + href => '/adm/preferences', + subroutine => \&coursedisplaychanger, + breadcrumb => + { href => '/adm/preferences?action=changecourseinit', + text => 'Change Course Init. Pref.'}, + }, + { action => 'verify_and_change_coursepage', + breadcrumb => + { href => '/adm/preferences?action=changecourseinit', text => 'Change Course Initialization Preference'}, + printmenu => 'yes', + subroutine => \&verify_and_change_coursepage, + })); + } if ($env{'user.name'} =~ /^(albertel|fox|foxr|koretemey|korte|hallmat3|turtle|raeburn)$/) { push (@Options,({ action => 'debugtoggle',