--- loncom/auth/lonroles.pm 2008/07/04 14:19:16 1.196 +++ loncom/auth/lonroles.pm 2008/07/18 16:17:39 1.202 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # User Roles Screen # -# $Id: lonroles.pm,v 1.196 2008/07/04 14:19:16 raeburn Exp $ +# $Id: lonroles.pm,v 1.202 2008/07/18 16:17:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,6 +43,7 @@ use Apache::lonpageflip(); use Apache::lonnavdisplay(); use GDBM_File; use LONCAPA qw(:DEFAULT :match); +use HTML::Entities; sub redirect_user { @@ -675,7 +676,8 @@ ENDHEADER } else { if ($countactive > 0) { my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); - $r->print('

'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).'
'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'

'); + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); + $r->print('

'.&mt('[_1]Visit the [_2]Course Catalog[_3] to view all [_4] LON-CAPA courses.','','','',$domdesc).'
'.&mt('If a course is [_1]not[_2] in your list of current courses below, you may be able to enroll if self-enrollment is permitted.','','').'

'); } } @@ -712,19 +714,31 @@ ENDHEADER $r->print(&Apache::loncommon::end_page()); return OK; # Is there only one choice? - } elsif (($countactive==1) && ($env{'request.role'} eq 'cm')) { - $r->print('

'.&mt('Please stand by.').'

'. - ''. + } elsif ($countactive==1) { + my $needs_switchserver; + if ($env{'user.author'}) { + $needs_switchserver = &check_needs_switchserver($possiblerole); + } + if ((!$needs_switchserver) && ($env{'request.role'} eq 'cm')) { + $r->print('

'.&mt('Please stand by.').'

'. + ''. ''); - $r->print("\n"); - $r->rflush(); - $r->print(''); - $r->print(&Apache::loncommon::end_page()); - return OK; + $r->print("\n"); + $r->rflush(); + $r->print(''); + $r->print(&Apache::loncommon::end_page()); + return OK; + } + if ($needs_switchserver) { + $r->print("

".&mt('Server Switch Required')."

\n". + &mt('Construction Space access is only available from '. + 'the home server of the corresponding Author.').'
'. + &mt("Click the 'Switch Server' link to go there.").'
'); + } } # More than one possible role # ----------------------------------------------------------------------- Table - unless ((!&Apache::lonmenu::show_course()) || ($nochoose)) { + unless ((!&Apache::lonmenu::show_course()) || ($nochoose) || ($countactive==1)) { $r->print("

".&mt('Select a Course to Enter')."

\n"); } my $doheaders = &roletable_headers($r,\%roleclass,\%sortrole,$nochoose); @@ -759,27 +773,28 @@ ENDHEADER &Apache::loncommon::authorbrowser_javascript()); } &print_rolerows($r,$doheaders,\%roleclass,\%sortrole,\%dcroles,\%roletext); - my $tremark=''; - my $tfont='#003300'; - if ($env{'request.role'} eq 'cm') { - $r->print(''); - $tremark=&mt('Currently selected. '); - $tfont='#002200'; - } else { - $r->print(''); - } - unless ($nochoose) { - if ($env{'request.role'} ne 'cm') { - $r->print(''); - } else { - $r->print(' '); - } - } - $r->print(''.&mt('No role specified'). - ''.$tremark. - ' '."\n"); - + if ($countactive > 1) { + my $tremark=''; + my $tfont='#003300'; + if ($env{'request.role'} eq 'cm') { + $r->print(''); + $tremark=&mt('Currently selected. '); + $tfont='#002200'; + } else { + $r->print(''); + } + unless ($nochoose) { + if ($env{'request.role'} ne 'cm') { + $r->print(''); + } else { + $r->print(' '); + } + } + $r->print(''.&mt('No role specified'). + ''.$tremark. + ' '."\n"); + } $r->print(''); unless ($nochoose) { $r->print("\n"); @@ -791,10 +806,14 @@ ENDHEADER } $r->print(&Apache::lonnet::getannounce()); if ($advanced) { + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); $r->print('

' .&mt('This is LON-CAPA [_1]',$r->dir_config('lonVersion')) .'
' - .''.&mt('Logout').'

'); + .''.&mt('Logout').'  ' + .'' + .&mt('Course Catalog') + .'

'); } $r->print(&Apache::loncommon::end_page()); return OK; @@ -864,7 +883,8 @@ sub print_rolerows { sub findcourse_advice { my ($r) = @_; my $domdesc = &Apache::lonnet::domain($env{'user.domain'},'description'); - if (&check_autoenroll($env{'user.domain'})) { + my $esc_dom = &HTML::Entities::encode($env{'user.domain'},'"<>&'); + if (&Apache::lonnet::auto_run(undef,$env{'user.domain'})) { $r->print(&mt('If you were expecting to see an active role listed for a particular course in the [_1] domain, it may be missing for one of the following reasons:',$domdesc).'