--- loncom/interface/lonviewclasslist.pm 2014/10/26 15:20:25 1.16 +++ loncom/interface/lonviewclasslist.pm 2023/11/05 19:59:54 1.21 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to display the classlist # -# $Id: lonviewclasslist.pm,v 1.16 2014/10/26 15:20:25 raeburn Exp $ +# $Id: lonviewclasslist.pm,v 1.21 2023/11/05 19:59:54 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -62,7 +62,8 @@ sub handler { return OK; } &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, - ['register','forceedit','action','symb','todocs']); + ['register','forceedit','action', + 'symb','todocs','only_body']); if (! ($env{'request.course.fn'})) { $env{'user.error.msg'}= "/adm/viewclasslist:not in course role"; @@ -76,10 +77,16 @@ sub handler { $start_page = &Apache::loncommon::start_page('Classlist',undef, {'force_register' => $env{'form.register'}}); } else { - my $brcrum = [{'href' => 'adm/viewclasslist', - 'text' => 'View Classlist'},]; + my $args = {}; + if ($env{'form.only_body'}) { + $args->{'only_body'} = 1; + } else { + my $brcrum = [{'href' => 'adm/viewclasslist', + 'text' => 'View Classlist'},]; + $args->{'bread_crumbs'} = $brcrum; + } $start_page = &Apache::loncommon::start_page('Classlist',undef, - {'bread_crumbs' => $brcrum}); + $args); } $r->print(< $rosterprefs, }; $changes{'classlists'} = {}; - &Apache::courseprefs::process_changes($cdom,'classlists',\%values, + &Apache::courseprefs::process_changes($cdom,$cnum,'classlists',\%values, $rosterprefs, $changes{'classlists'}, $allitems,\%disallowed,$crstype); @@ -136,7 +143,7 @@ ENDHEADER $current->{$setting} = $env{"course.$env{'request.course.id'}.$setting"}; } my ($output,$rowtotal) = - &Apache::courseprefs::print_config_box($r,$cdom,'display', + &Apache::courseprefs::print_config_box($r,$cdom,$cnum,'display', 'viewableroster', $rosterprefs,$current, $allitems,$crstype); @@ -270,7 +277,7 @@ sub html_classlist { } if ($env{'form.action'} eq 'setenv') { - $Str .= &process_student_prefs(); + $Str .= &process_student_prefs($crstype); } $Str .= '

'.$heading.'

'; @@ -279,7 +286,6 @@ sub html_classlist { $cdom = $env{'course.'.$cid.'.domain'}; $cnum = $env{'course.'.$cid.'.num'}; - my $title; if ($viewsettings->{'limit_to_section'}) { if ($env{'request.course.sec'} eq '') { $title = &mt($titleplural.' with no section'); @@ -293,11 +299,13 @@ sub html_classlist { } else { $title = &mt($titleplural.' in any section'); $listtype = 'in the course'; + if ($crstype eq 'Community') { + $listtype = 'in the community'; + } } - if ($viewsettings->{'student_opt_in'}) { if ($env{'request.role'} =~ /^st/) { - $Str .= &print_roster_form(); + $Str .= &print_roster_form($crstype); } %publicroster = &Apache::lonnet::dump('publicroster',$cdom,$cnum); } @@ -428,6 +436,7 @@ sub html_classlist { } sub print_roster_form { + my ($crstype) = @_; my $cid = $env{'request.course.id'}; my $showinroster = $env{'environment.internal.'.$cid.'.showinroster'}; my ($showoff,$showon); @@ -438,13 +447,17 @@ sub print_roster_form { $showoff = ' checked="checked" '; $showon = ' '; } + my $singular = 'student'; + if ($crstype eq 'Community') { + $singular = 'member'; + } my $output = '
' .'
'.&mt('Your roster setting').''; if ($showinroster) { - $output .= &mt('You are currently listed in the student-viewable roster.'); + $output .= &mt("You are currently listed in the $singular-viewable roster."); } else { - $output .= &mt('You are currently [_1]not[_2] listed in the student-viewable roster.','',''); + $output .= &mt("You are currently [_1]not[_2] listed in the $singular-viewable roster.",'',''); } $output .= '
'.&mt('Include yourself in the roster?').'  '. '
'. @@ -458,6 +471,7 @@ sub print_roster_form { } sub process_student_prefs { + my ($crstype) = @_; my $cid = $env{'request.course.id'}; my $cdom = $env{'course.'.$cid.'.domain'}; my $cnum = $env{'course.'.$cid.'.num'}; @@ -474,6 +488,11 @@ sub process_student_prefs { if ($pubroster{$student}) { $sturoster = 1; } + + my $singular = 'student'; + if ($crstype eq 'Community') { + $singular = 'member'; + } my $output; if ($sturoster ne $showinroster) { my %changeHash = ( @@ -487,7 +506,7 @@ sub process_student_prefs { if ($result eq 'ok') { $output .= &Apache::lonhtmlcommon::confirm_success( - &mt('Display of your name in the student-viewable roster set to [_1].',''.$visibility.'')); + &mt("Display of your name in the $singular-viewable roster set to [_1].",''.$visibility.'')); } else { $output .= &Apache::lonhtmlcommon::confirm_success( @@ -501,7 +520,7 @@ sub process_student_prefs { } else { $output .= &Apache::lonhtmlcommon::confirm_success( - &mt('Display of your name in the student-viewable roster unchanged (set to [_1]).',''.$visibility.'')); + &mt("Display of your name in the $singular-viewable roster unchanged (set to [_1]).",''.$visibility.'')); } $output = &Apache::loncommon::confirmwrapper($output); return $output;