Diff for /loncom/interface/lonviewclasslist.pm between versions 1.16 and 1.21

version 1.16, 2014/10/26 15:20:25 version 1.21, 2023/11/05 19:59:54
Line 62  sub handler { Line 62  sub handler {
         return OK;          return OK;
     }      }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},      &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'})) {      if (! ($env{'request.course.fn'})) {
         $env{'user.error.msg'}=          $env{'user.error.msg'}=
             "/adm/viewclasslist:not in course role";              "/adm/viewclasslist:not in course role";
Line 76  sub handler { Line 77  sub handler {
         $start_page = &Apache::loncommon::start_page('Classlist',undef,          $start_page = &Apache::loncommon::start_page('Classlist',undef,
                              {'force_register' => $env{'form.register'}});                               {'force_register' => $env{'form.register'}});
     } else {      } else {
         my $brcrum = [{'href' => 'adm/viewclasslist',          my $args = {};
                        'text' => 'View Classlist'},];          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,          $start_page = &Apache::loncommon::start_page('Classlist',undef,
                                                      {'bread_crumbs' => $brcrum});                                                       $args);
     }      }
     $r->print(<<ENDHEADER);      $r->print(<<ENDHEADER);
 $start_page  $start_page
Line 103  ENDHEADER Line 110  ENDHEADER
                                     classlists => $rosterprefs,                                      classlists => $rosterprefs,
                                 };                                  };
                     $changes{'classlists'} = {};                      $changes{'classlists'} = {};
                     &Apache::courseprefs::process_changes($cdom,'classlists',\%values,                      &Apache::courseprefs::process_changes($cdom,$cnum,'classlists',\%values,
                                                           $rosterprefs,                                                            $rosterprefs,
                                                           $changes{'classlists'},                                                            $changes{'classlists'},
                                                           $allitems,\%disallowed,$crstype);                                                            $allitems,\%disallowed,$crstype);
Line 136  ENDHEADER Line 143  ENDHEADER
                    $current->{$setting} = $env{"course.$env{'request.course.id'}.$setting"};                     $current->{$setting} = $env{"course.$env{'request.course.id'}.$setting"};
                }                 }
                my ($output,$rowtotal) =                 my ($output,$rowtotal) =
                    &Apache::courseprefs::print_config_box($r,$cdom,'display',                     &Apache::courseprefs::print_config_box($r,$cdom,$cnum,'display',
                                                           'viewableroster',                                                            'viewableroster',
                                                           $rosterprefs,$current,                                                            $rosterprefs,$current,
                                                           $allitems,$crstype);                                                            $allitems,$crstype);
Line 270  sub html_classlist { Line 277  sub html_classlist {
     }      }
   
     if ($env{'form.action'} eq 'setenv') {      if ($env{'form.action'} eq 'setenv') {
         $Str .= &process_student_prefs();          $Str .= &process_student_prefs($crstype);
     }      }
   
     $Str .= '<h2>'.$heading.'</h2>';      $Str .= '<h2>'.$heading.'</h2>';
Line 279  sub html_classlist { Line 286  sub html_classlist {
     $cdom = $env{'course.'.$cid.'.domain'};      $cdom = $env{'course.'.$cid.'.domain'};
     $cnum = $env{'course.'.$cid.'.num'};      $cnum = $env{'course.'.$cid.'.num'};
   
     my $title;  
     if ($viewsettings->{'limit_to_section'}) {      if ($viewsettings->{'limit_to_section'}) {
         if ($env{'request.course.sec'} eq '') {          if ($env{'request.course.sec'} eq '') {
             $title = &mt($titleplural.' with no section');              $title = &mt($titleplural.' with no section');
Line 293  sub html_classlist { Line 299  sub html_classlist {
     } else {      } else {
         $title = &mt($titleplural.' in any section');          $title = &mt($titleplural.' in any section');
         $listtype = 'in the course';          $listtype = 'in the course';
           if ($crstype eq 'Community') {
               $listtype = 'in the community';
           }
     }      }
   
     if ($viewsettings->{'student_opt_in'}) {      if ($viewsettings->{'student_opt_in'}) {
         if ($env{'request.role'} =~ /^st/)  {          if ($env{'request.role'} =~ /^st/)  {
             $Str .= &print_roster_form();              $Str .= &print_roster_form($crstype);
         }          }
         %publicroster = &Apache::lonnet::dump('publicroster',$cdom,$cnum);          %publicroster = &Apache::lonnet::dump('publicroster',$cdom,$cnum);
     }      }
Line 428  sub html_classlist { Line 436  sub html_classlist {
 }  }
   
 sub print_roster_form {  sub print_roster_form {
       my ($crstype) = @_;
     my $cid = $env{'request.course.id'};      my $cid = $env{'request.course.id'};
     my $showinroster = $env{'environment.internal.'.$cid.'.showinroster'};      my $showinroster = $env{'environment.internal.'.$cid.'.showinroster'};
     my ($showoff,$showon);      my ($showoff,$showon);
Line 438  sub print_roster_form { Line 447  sub print_roster_form {
         $showoff = ' checked="checked" ';          $showoff = ' checked="checked" ';
         $showon = ' ';          $showon = ' ';
     }      }
       my $singular = 'student';
       if ($crstype eq 'Community') {
           $singular = 'member';
       }
     my $output =      my $output =
         '<div class="LC_left_float">'          '<div class="LC_left_float">'
        .'<fieldset><legend>'.&mt('Your roster setting').'</legend>';         .'<fieldset><legend>'.&mt('Your roster setting').'</legend>';
     if ($showinroster) {      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 {      } else {
         $output .=  &mt('You are currently [_1]not[_2] listed in the student-viewable roster.','<b>','</b>');          $output .=  &mt("You are currently [_1]not[_2] listed in the $singular-viewable roster.",'<b>','</b>');
     }      }
     $output .= '<br />'.&mt('Include yourself in the roster?').'&nbsp;&nbsp;'.      $output .= '<br />'.&mt('Include yourself in the roster?').'&nbsp;&nbsp;'.
         '<form name="studentparm" method="post" action="">'.          '<form name="studentparm" method="post" action="">'.
Line 458  sub print_roster_form { Line 471  sub print_roster_form {
 }  }
   
 sub process_student_prefs {  sub process_student_prefs {
       my ($crstype) = @_;
     my $cid = $env{'request.course.id'};      my $cid = $env{'request.course.id'};
     my $cdom = $env{'course.'.$cid.'.domain'};      my $cdom = $env{'course.'.$cid.'.domain'};
     my $cnum = $env{'course.'.$cid.'.num'};      my $cnum = $env{'course.'.$cid.'.num'};
Line 474  sub process_student_prefs { Line 488  sub process_student_prefs {
     if ($pubroster{$student}) {      if ($pubroster{$student}) {
         $sturoster = 1;          $sturoster = 1;
     }      }
   
       my $singular = 'student';
       if ($crstype eq 'Community') {
           $singular = 'member';
       }
     my $output;      my $output;
     if ($sturoster ne $showinroster) {      if ($sturoster ne $showinroster) {
         my %changeHash = (          my %changeHash = (
Line 487  sub process_student_prefs { Line 506  sub process_student_prefs {
             if ($result eq 'ok') {              if ($result eq 'ok') {
                 $output .=                  $output .=
                     &Apache::lonhtmlcommon::confirm_success(                      &Apache::lonhtmlcommon::confirm_success(
                         &mt('Display of your name in the student-viewable roster set to [_1].','<b>'.$visibility.'</b>'));                          &mt("Display of your name in the $singular-viewable roster set to [_1].",'<b>'.$visibility.'</b>'));
             } else {              } else {
                 $output .=                  $output .=
                     &Apache::lonhtmlcommon::confirm_success(                      &Apache::lonhtmlcommon::confirm_success(
Line 501  sub process_student_prefs { Line 520  sub process_student_prefs {
     } else {      } else {
         $output .=          $output .=
             &Apache::lonhtmlcommon::confirm_success(              &Apache::lonhtmlcommon::confirm_success(
                 &mt('Display of your name in the student-viewable roster unchanged (set to [_1]).','<b>'.$visibility.'</b>'));                  &mt("Display of your name in the $singular-viewable roster unchanged (set to [_1]).",'<b>'.$visibility.'</b>'));
     }      }
     $output = &Apache::loncommon::confirmwrapper($output);      $output = &Apache::loncommon::confirmwrapper($output);
     return $output;      return $output;

Removed from v.1.16  
changed lines
  Added in v.1.21


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>