Diff for /loncom/interface/lonwhatsnew.pm between versions 1.125 and 1.126

version 1.125, 2017/09/13 23:35:07 version 1.126, 2020/03/30 11:04:13
Line 91  sub handler { Line 91  sub handler {
                             ['vcl','newroles',1],                              ['vcl','newroles',1],
                             ['vcl','oldroles',1],                              ['vcl','oldroles',1],
                             ['whn','crslogin',1],                              ['whn','crslogin',1],
                               ['vcl','sessions',1],
                             ['mgr','resetcounters',1],                              ['mgr','resetcounters',1],
     ) {      ) {
  my ($perm,$key,$check_section) = @{ $perm_check };   my ($perm,$key,$check_section) = @{ $perm_check };
Line 170  sub handler { Line 171  sub handler {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs          $r->print(&Apache::lonhtmlcommon::breadcrumbs
             ("What's New?",#'Course_Action_Items_Intervals'              ("What's New?",#'Course_Action_Items_Intervals'
              ));               ));
       } elsif ($command eq 'chgsessionlimit' && $checkallowed{'sessions'}) {
           &Apache::lonhtmlcommon::add_breadcrumb
               ({href=>'/adm/whatsnew?command=chgsessionlimit&refpage='.$refpage,
                 text=>"Change session range"});
           $r->print(&Apache::lonhtmlcommon::breadcrumbs
               ("What's New?",#'Course_Action_Items_Sessions'
                ));
     } else {      } else {
         $r->print(&Apache::lonhtmlcommon::breadcrumbs          $r->print(&Apache::lonhtmlcommon::breadcrumbs
             ("What's New?",#'Course_Action_Items_Display'              ("What's New?",#'Course_Action_Items_Display'
Line 221  sub display_main_box { Line 229  sub display_main_box {
                    604800 => 'last logins for users in last 7 days',                     604800 => 'last logins for users in last 7 days',
                     86400 => 'last logins for users in last 24 hours',                      86400 => 'last logins for users in last 24 hours',
                    );                     );
       my %sessions = (
                        300  => 'course sessions active in the last 5 minutes',
                        600  => 'course sessions active in the last 10 minutes',
                        1800 => 'course sessions active in the last 30 minutes',
                        7200 => 'course sessions active in the last 2 hours',
                       -7200 => 'course sessions with last activity more than 2 hours ago',
                      );
     my %interval_titles = (      my %interval_titles = (
         versions => \%versions,          versions => \%versions,
         newroles => \%newroles,          newroles => \%newroles,
         oldroles => \%oldroles,          oldroles => \%oldroles,
         crslogin => \%crslogins,          crslogin => \%crslogins,
           sessions => \%sessions,
     );      );
     my %initpage = &Apache::lonlocal::texthash (      my %initpage = &Apache::lonlocal::texthash (
                      firstres => "first resource in the $lctype",                       firstres => "first resource in the $lctype",
Line 254  sub display_main_box { Line 270  sub display_main_box {
     } elsif (($command eq 'chgcrslogininterval')      } elsif (($command eq 'chgcrslogininterval')
              && $checkallowed->{'crslogin'}) {               && $checkallowed->{'crslogin'}) {
         &display_interval_config($r,$refpage,\%interval_titles,'crslogin');          &display_interval_config($r,$refpage,\%interval_titles,'crslogin');
       } elsif (($command eq 'chgsessionlimit')
                && $checkallowed->{'sessions'}) {
           &display_interval_config($r,$refpage,\%interval_titles,'sessions');
     } else {      } else {
         &display_actions_box($r,$command,$refpage,\%threshold_titles,          &display_actions_box($r,$command,$refpage,\%threshold_titles,
                         \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);                          \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
Line 298  END Line 317  END
                             "\n";                              "\n";
             }              }
         }          }
         $scripttag.='document.visible.submit();          $scripttag.=<<"ENDTOGG";
       document.visible.submit();
 }  }
   
 function thresholdreset() {  function thresholdreset() {
Line 306  function thresholdreset() { Line 326  function thresholdreset() {
     document.visible.submit();      document.visible.submit();
 }  }
   
 function togglelogins() {  function toggledetails(prefix) {
     var total = document.visible.logincount.value;      var total = document.visible[prefix+'count'].value;
     var sumrow = document.visible.loginrow.value;      var sumrow = document.visible[prefix+'row'].value;
     if (total == 0) {      if (total == 0) {
         return;          return;
     }      }
     var showlogindetails = 0;      var showdetails = 0;
     for (var i=0; i<document.visible.logindetails.length; i++) {      for (var i=0; i<document.visible[prefix+'details'].length; i++) {
         if (document.visible.logindetails[i].checked) {          if (document.visible[prefix+'details'][i].checked) {
             showlogindetails = document.visible.logindetails[i].value;              showdetails = document.visible[prefix+'details'][i].value;
         }          }
     }      }
     var detval = "none";      var detval = "none";
     var sumval = "";      var sumval = "";
     if (showlogindetails == 1) {      if (showdetails == 1) {
         detval = "";          detval = "";
         sumval = "none";          sumval = "none";
     }      }
     for (var j=0; j<total; j++) {      for (var j=0; j<total; j++) {
         var counter = j+1;          var counter = j+1;
         var itemid = "logindet_"+counter;          var itemid = prefix+"det_"+counter;
         personele = document.getElementById(itemid);          personele = document.getElementById(itemid);
         if (personele != null) {          if (personele != null) {
             personele.style.display = detval;              personele.style.display = detval;
         }          }
     }      }
     var detheaderele = document.getElementById("logintitledet");      var detheaderele = document.getElementById(prefix+"titledet");
     if (detheaderele != null) {      if (detheaderele != null) {
         detheaderele.style.display = detval;          detheaderele.style.display = detval;
     }      }
     for (var k=0; k<sumrow; k++) {      for (var k=0; k<sumrow; k++) {
         var counter = k+1;          var counter = k+1;
         var itemid = "loginsum_"+counter;          var itemid = prefix+"sum_"+counter;
         logincatele = document.getElementById(itemid);          catele = document.getElementById(itemid);
         if (logincatele != null) {          if (catele != null) {
             logincatele.style.display = sumval;              catele.style.display = sumval;
         }          }
     }      }
     var sumheaderele = document.getElementById("logintitlesum");      var sumheaderele = document.getElementById(prefix+"titlesum");
     if (sumheaderele != null) {      if (sumheaderele != null) {
         sumheaderele.style.display = sumval;          sumheaderele.style.display = sumval;
     }      }
Line 352  function togglelogins() { Line 372  function togglelogins() {
 }  }
 // ]]>  // ]]>
 </script>  </script>
 ';  ENDTOGG
     }      }
     my $course_type=&Apache::loncommon::course_type();      my $course_type=&Apache::loncommon::course_type();
     return &Apache::loncommon::start_page("What's New?",      return &Apache::loncommon::start_page("What's New?",
Line 404  sub display_actions_box { Line 424  sub display_actions_box {
     my %activated;      my %activated;
     my %loggedin;      my %loggedin;
     my $logincount;      my $logincount;
       my %sessions;
       my $sessioncount;
     my %res_title = ();      my %res_title = ();
     my %show = ();      my %show = ();
     my $needitems = 0;      my $needitems = 0;
Line 548  sub display_actions_box { Line 570  sub display_actions_box {
         $headings{'crslogin'} = &mt('Last login for users in last 24 hours');          $headings{'crslogin'} = &mt('Last login for users in last 24 hours');
     }      }
   
       $timediff{'sessions'} = $display_settings{$cid.':sessionactivity'};
       unless (defined($timediff{'sessions'})) { $timediff{'sessions'} = 7200; }
       $interval{'sessions'} = $interval_titles->{'sessions'}->{$timediff{'sessions'}};
   
       if ($timediff{'sessions'} == -7200) {
           $headings{'sessions'} = &mt('Session with activity more than 2 hours ago');
       } elsif ($timediff{'sessions'} == 7200) {
           $headings{'sessions'} = &mt('Session with activity in last 2 hours');
       } elsif ($timediff{'sessions'} == 1800) {
           $headings{'sessions'} = &mt('Session with activity in last 30 minutes');
       } elsif ($timediff{'sessions'} == 600) {
           $headings{'sessions'} = &mt('Session with activity in last 10 minutes');
       } elsif ($timediff{'sessions'} == 300) {
           $headings{'sessions'} = &mt('Session with activity in last 5 minutes');
       }
   
     my ($now,$starttime,$activatedstart,$expiredstart,$crsloginstart);      my ($now,$starttime,$activatedstart,$expiredstart,$crsloginstart);
     $now = time;      $now = time;
   
Line 588  sub display_actions_box { Line 626  sub display_actions_box {
     $threshold{'av_attempts'},$threshold{'degdiff'},      $threshold{'av_attempts'},$threshold{'degdiff'},
     '<br />',$threshold{'numstudents'});      '<br />',$threshold{'numstudents'});
   
     my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles','crslogin');      my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles','crslogin','sessions');
     my %actioncolumn = (      my %actioncolumn = (
                          handgrading      => 'left',                           handgrading      => 'left',
                          haserrors        => 'left',                           haserrors        => 'left',
Line 600  sub display_actions_box { Line 638  sub display_actions_box {
                          newroles         => 'right',                           newroles         => 'right',
                          oldroles         => 'right',                           oldroles         => 'right',
                          crslogin         => 'right',                           crslogin         => 'right',
                            sessions         => 'right',
                        );                         );
   
     foreach my $key (keys(%{$checkallowed})) {      foreach my $key (keys(%{$checkallowed})) {
Line 627  sub display_actions_box { Line 666  sub display_actions_box {
         $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$checkallowed);          $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$checkallowed);
     }      }
     my $classlist;      my $classlist;
     if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) {      if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'} || $show{'sessions'}) {
         $classlist = &Apache::loncoursedata::get_classlist();          $classlist = &Apache::loncoursedata::get_classlist();
     }      }
     if ($show{'coursenormalmail'}) {      if ($show{'coursenormalmail'}) {
Line 645  sub display_actions_box { Line 684  sub display_actions_box {
     if ($show{'crslogin'}) {      if ($show{'crslogin'}) {
         $logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart);          $logincount = &getloggedin($cdom,$crs,\%loggedin,$crsloginstart);
     }      }
       if ($show{'sessions'}) {
           $sessioncount = &getsessions($cdom,$crs,\%sessions,$timediff{'sessions'},$classlist);
       }
     $r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a>      $r->print(qq|<a href="javascript:changeAll('hide');">$lt{'hial'}</a>
      &nbsp;&nbsp;<a href="javascript:changeAll('show');">$lt{'shal'}</a>       &nbsp;&nbsp;<a href="javascript:changeAll('show');">$lt{'shal'}</a>
      <form method="post" name="visible" action="/adm/whatsnew">\n|);       <form method="post" name="visible" action="/adm/whatsnew">\n|);
Line 674  sub display_actions_box { Line 716  sub display_actions_box {
                 $r->print('</td><td>&nbsp;</td><td class="LC_right_col" >');                  $r->print('</td><td>&nbsp;</td><td class="LC_right_col" >');
                 $currcolumn = 'right';                   $currcolumn = 'right'; 
             }              }
             &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,$classlist);              &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,\%sessions,$sessioncount,$classlist);
             $displayed ++;               $displayed ++; 
         }          }
     }      }
Line 755  sub display_interval_config { Line 797  sub display_interval_config {
         $setting = 'oldroleinterval';          $setting = 'oldroleinterval';
     } elsif ($context eq 'newroles') {      } elsif ($context eq 'newroles') {
         $setting = 'newroleinterval';           $setting = 'newroleinterval'; 
       } elsif ($context eq 'sessions') {
           $setting = 'sessionactivity';
     }      }
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     my $current = &get_current($env{'user.name'},$env{'user.domain'},      my $current = &get_current($env{'user.name'},$env{'user.domain'},
Line 765  sub display_interval_config { Line 809  sub display_interval_config {
         $r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'<br />');          $r->print('<br />'.&mt('Choose the time window to use to display roles for which access to the '.$lctype.' became available.').'<br />');
     } elsif ($context eq 'crslogin') {      } elsif ($context eq 'crslogin') {
         $r->print('<br />'.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).'<br />');          $r->print('<br />'.&mt('Choose the time window to use to display the last login by a user in the '.$lctype).'<br />');
       } elsif ($context eq 'sessions') {
           $r->print('<br />'.&mt('Choose the time limit to use to display active user sessions in the '.$lctype.'.').'<br />');
     } else {      } else {
         $r->print('<br />'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'<br />');          $r->print('<br />'.&mt('Choose the time window to use to display resources in the '.$lctype.' with version changes.').'<br />');
     }      }
Line 785  sub display_interval_config { Line 831  sub display_interval_config {
 ');  ');
     if (ref($interval_titles) eq 'HASH') {      if (ref($interval_titles) eq 'HASH') {
         if (ref($interval_titles->{$context}) eq 'HASH') {          if (ref($interval_titles->{$context}) eq 'HASH') {
             foreach my $key (reverse sort ({$a cmp $b} (keys(%{$interval_titles->{$context}})))) {              my @sorted;
               if ($context eq 'sessions') {
                   @sorted = sort { $a <=> $b } (keys(%{$interval_titles->{$context}}));
                   push(@sorted,shift(@sorted));
               } else {
                   @sorted = reverse sort ({$a cmp $b} (keys(%{$interval_titles->{$context}})));
               }
               foreach my $key (@sorted) {
                 $r->print('<option value="'.$key.'">'.&mt($interval_titles->{$context}->{$key}).                  $r->print('<option value="'.$key.'">'.&mt($interval_titles->{$context}->{$key}).
                           '</option>'."\n");                            '</option>'."\n");
             }              }
Line 930  sub display_launcher { Line 983  sub display_launcher {
         $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,          $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
         $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,          $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
         $interval,$countunread,$expired,$expirecount,$activated,$activecount,          $interval,$countunread,$expired,$expirecount,$activated,$activecount,
         $crstype,$itemserror,$loggedin,$logincount,$classlist) = @_;          $crstype,$itemserror,$loggedin,$logincount,$sessions,$sessioncount,
           $classlist) = @_;
   
     if ($$checkallowed{$action}) {      if ($$checkallowed{$action}) {
         &start_box($r,$show,$headings,$action,$refpage);          &start_box($r,$show,$headings,$action,$refpage);
Line 958  sub display_launcher { Line 1012  sub display_launcher {
                 &display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'},                  &display_rolechanges($r,$expirecount,$expired,$interval->{'oldroles'},
                                      $crstype,$classlist);                                       $crstype,$classlist);
             } elsif ($action eq 'crslogin') { #LAST LOGIN              } elsif ($action eq 'crslogin') { #LAST LOGIN
                 &display_crslogins($r,$logincount,$loggedin,$interval->{'crslogin'},                  &display_activity($r,'logins',$logincount,$loggedin,$interval->{'crslogin'},
                                    $crstype,$classlist);                                     $crstype,$classlist);
               } elsif ($action eq 'sessions') { #ACTIVE SESSIONS
                   &display_activity($r,'sessions',$sessioncount,$sessions,$interval->{'sessions'},
                                     $crstype,$classlist);
             }              }
         }          }
         &end_box($r);          &end_box($r);
Line 1033  sub getitems { Line 1090  sub getitems {
       $triggered,$threshold,$warnings,        $triggered,$threshold,$warnings,
                               $checkallowed);                                $checkallowed);
         }          }
   
     }      }
     return;       return; 
 }  }
Line 1616  sub getloggedin { Line 1672  sub getloggedin {
     return $logincount;      return $logincount;
 }  }
   
   sub getsessions {
       my ($cdom,$cnum,$sessions,$lastactive,$classlist) = @_;
       my $context = 'course';
       my ($permission,$allowed) =
           &Apache::lonuserutils::get_permission($context);
       my %crs_sessions = &Apache::lonnet::get_course_sessions($cnum,$cdom,$lastactive);
       my $sessioncount = 0;
       if (keys(%crs_sessions) > 0) {
           if (ref($classlist) eq 'HASH') {
               my $viewablesec = &Apache::lonuserutils::viewable_section($permission);
               my $secidx = &Apache::loncoursedata::CL_SECTION();
               my %coursepersonnel=&Apache::lonnet::get_course_adv_roles($cdom.'_'.$cnum,1);
               my %personnel;
               foreach my $role (sort(keys(%coursepersonnel))) {
                   my ($rolecode,$section);
                   if ($role =~ /:/) {
                       ($rolecode,$section) = split(/:/,$role);
                   } else {
                       $rolecode = $role;
                   }
                   if ($viewablesec ne '') {
                       next if ($viewablesec ne $section);
                   }
                   foreach my $user (split(/\,/,$coursepersonnel{$role})) {
                       push(@{$personnel{$user}{$rolecode}},$section);
                   }
               }
               foreach my $key (keys(%crs_sessions)) {
                   if (exists($classlist->{$key})) {
                       my $student = $classlist->{$key};
                       my $section = $student->[$secidx];
                       my $lastaccess = $crs_sessions{$key};
                       if ($viewablesec ne '') {
                           next if ($viewablesec ne $section);
                       }
                       my ($stuname,$studom) = split(/:/,$key);
                       my %info = (
                                    'section' => $section,
                                    'role'    => 'st',
                                    'uname'   => $stuname,
                                    'udom'    => $studom,
                       );
                       $sessioncount ++;
                       push(@{$sessions->{$lastaccess}},\%info);
                   } elsif (exists($personnel{$key})) {
                       my $lastaccess = $crs_sessions{$key};
                       my ($uname,$udom) = split(/:/,$key);
                       if (ref($personnel{$key}) eq 'HASH') {
                           my ($showrole,$showsec);
                           foreach my $possrole ('cc','co','in','ta','ep','ad','st') {
                               if (exists($personnel{$key}{$possrole})) {
                                   $showrole = $possrole;
                                   $showsec = join(', ',@{$personnel{$key}{$possrole}});
                                   last;
                               }
                           }
                           my %info = (
                                        'section' => $showsec,
                                        'role'    => $showrole,
                                        'uname'   => $uname,
                                        'udom'    => $udom,
                           );
                           $sessioncount ++;
                           push(@{$sessions->{$lastaccess}},\%info);
                       }
                   }
               }
           }
       }
       return $sessioncount;
   }
   
 sub checkversions {  sub checkversions {
     my ($cdom,$crs,$navmap,$changed,$starttime) = @_;      my ($cdom,$crs,$navmap,$changed,$starttime) = @_;
     my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs);      my %changes=&Apache::lonnet::dump('versionupdate',$cdom,$crs);
Line 1882  sub display_rolechanges { Line 2010  sub display_rolechanges {
     return;      return;
 }  }
   
 sub display_crslogins {  sub display_activity {
     my ($r,$logincount,$loggedin,$interval,$crstype,$classlist) = @_;      my ($r,$context,$count,$details,$interval,$crstype,$classlist) = @_;
     return unless (ref($classlist) eq 'HASH');      return unless (ref($classlist) eq 'HASH');
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'user'   => 'User',          'user'   => 'User',
Line 1891  sub display_crslogins { Line 2019  sub display_crslogins {
         'sec'    => 'Section',          'sec'    => 'Section',
         'number' => 'Total number of logins',          'number' => 'Total number of logins',
     );      );
     if ($logincount) {      my $prefix = 'login';
       if ($context eq 'sessions') {
           $lt{'number'} = &mt('Total number of active user sessions');
           $lt{'active'} = &mt('Last active');
           $prefix = 'session';
       }
       if ($count) {
   
         my $hdr = '<tr class="LC_info_row" style="display:none" id="logintitledet">'.          my $hdr = '<tr class="LC_info_row" style="display:none" id="'.$prefix.'titledet">'.
                   '<td class="LC_left_item">'.$lt{'user'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'user'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'role'}.'</td>'.                    '<td class="LC_left_item">'.$lt{'role'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'sec'}.'</td></tr>'.                    '<td class="LC_left_item">'.$lt{'sec'}.'</td>';
                   '<tr class="LC_info_row" id="logintitlesum">'.          if ($context eq 'sessions') {
                   '<td class="LC_left_item">'.$lt{'number'}.'</td>'.              $hdr .= '<td class="LC_left_item">'.$lt{'active'}.'</td>';
                   '<td class="LC_left_item">'.$lt{'role'}.'</td>'.          }
                   '<td class="LC_left_item">'.$lt{'sec'};          $hdr .= '</tr>'."\n".
                   '<tr class="LC_info_row" id="'.$prefix.'titlesum">'.
                   '<td class="LC_left_item">'.$lt{'number'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'role'}.'</td>'.
                   '<td class="LC_left_item">'.$lt{'sec'};
         my (%bylastname,%counts);          my (%bylastname,%counts);
         if (ref($loggedin) eq 'HASH') {          if (ref($details) eq 'HASH') {
             my @logins = sort { $b <=> $a } (keys(%{$loggedin}));              my @items = sort { $b <=> $a } (keys(%{$details}));
             my $numlogin = 0;              my $num = 0;
             my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME();              my $fullnameidx = &Apache::loncoursedata::CL_FULLNAME();
             foreach my $item (@logins) {              foreach my $item (@items) {
                 if (ref($loggedin->{$item}) eq 'ARRAY') {                  if (ref($details->{$item}) eq 'ARRAY') {
                     foreach my $user (@{$loggedin->{$item}}) {                      foreach my $user (@{$details->{$item}}) {
                         if (ref($user) eq 'HASH') {                          if (ref($user) eq 'HASH') {
                             my $section;                              my $section;
                             my $role =                              my $role =
                                 &Apache::lonnet::plaintext($user->{'role'},$crstype);                                  &Apache::lonnet::plaintext($user->{'role'},$crstype);
                             my $status = &mt($user->{'status'});  
                             if ($user->{'section'} eq '') {                              if ($user->{'section'} eq '') {
                                 $section = &mt('none');                                  $section = &mt('none');
                             } else {                              } else {
Line 1930  sub display_crslogins { Line 2067  sub display_crslogins {
                             }                              }
                             my $link =                              my $link =
                                 &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);                                  &Apache::loncommon::aboutmewrapper($fullname,$uname,$udom);
                             push(@{$bylastname{$fullname}},                              my $entry = '<td>'.$link.'</td>'.
                                                           '<td>'.$link.'</td>'.                                          '<td>'.$role.'</td>'.
                                                           '<td>'.$role.'</td>'.                                          '<td>'.$section.'</td>';
                                                           '<td>'.$section.'</td>');                              if ($context eq 'sessions') {
                                   $entry .= '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>';
                               }
                               push(@{$bylastname{$fullname}},$entry);
                         }                          }
                     }                      }
                 }                  }
Line 1942  sub display_crslogins { Line 2082  sub display_crslogins {
             foreach my $person (sort(keys(%bylastname))) {              foreach my $person (sort(keys(%bylastname))) {
                 if (ref($bylastname{$person}) eq 'ARRAY') {                  if (ref($bylastname{$person}) eq 'ARRAY') {
                     foreach my $item (@{$bylastname{$person}}) {                      foreach my $item (@{$bylastname{$person}}) {
                         $numlogin ++;                          $num ++;
                         my $css_class = $numlogin%2?' class="LC_odd_row"':'';                          my $css_class = $num%2?' class="LC_odd_row"':'';
                         $table .= '<tr'.$css_class.' style="display:none;"  id="logindet_'.$numlogin.'">'.$item.'</tr>';                          $table .= '<tr'.$css_class.' style="display:none;"  id="'.$prefix.'det_'.$num.'">'.$item.'</tr>';
                     }                      }
                 }                  }
             }              }
Line 1955  sub display_crslogins { Line 2095  sub display_crslogins {
                     foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) {                      foreach my $sec (sort { $b <=> $a } (keys(%{$counts{$role}}))) {
                         $numrow ++;                          $numrow ++;
                         my $css_class = $numrow%2?' class="LC_odd_row"':'';                          my $css_class = $numrow%2?' class="LC_odd_row"':'';
                         $table .= '<tr '.$css_class.' id="loginsum_'.$numrow.'">'.                          $table .= '<tr '.$css_class.' id="'.$prefix.'sum_'.$numrow.'">'.
                                   '<td>'.$counts{$role}{$sec}.'</td>'.                                    '<td>'.$counts{$role}{$sec}.'</td>'.
                                   '<td>'.$showrole.'</td>'.                                    '<td>'.$showrole.'</td>'.
                                   '<td>'.$sec.'</td></tr>';                                    '<td>'.$sec.'</td></tr>';
                    }                     }
                 }                  }
             }              }
             $r->print($hdr.'<input type="hidden" name="logincount" value="'.$numlogin.              $r->print($hdr.'<input type="hidden" name="'.$prefix.'count" value="'.$num.
                       '" /><input type="hidden" name="loginrow" value="'.$numrow.                        '" /><input type="hidden" name="'.$prefix.'row" value="'.$numrow.
                       '" /></td></tr>'.$table);                        '" /></td></tr>'.$table);
         }          }
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.          $r->print('<tr class="LC_empty_row"><td>'.
                   &mt('There are no '.$interval).                    &mt('There are no '.$interval).
                   '<input type="hidden" name="logincount" value="'.$logincount.                    '<input type="hidden" name="'.$prefix.'count" value="'.$count.
                   '." /></td></tr>');                    '." /></td></tr>');
     }      }
     return;      return;
 }  }
    
 sub display_coursediscussion {  sub display_coursediscussion {
     my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_;      my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_;
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
Line 2137  sub store_interval_setting { Line 2277  sub store_interval_setting {
             $interval_settings{$cid.':newroleinterval'} = $env{'form.interval'};              $interval_settings{$cid.':newroleinterval'} = $env{'form.interval'};
         } elsif ($context eq 'crslogin') {          } elsif ($context eq 'crslogin') {
             $interval_settings{$cid.':crslogininterval'} = $env{'form.interval'};              $interval_settings{$cid.':crslogininterval'} = $env{'form.interval'};
           } elsif ($context eq 'sessions') {
               $interval_settings{$cid.':sessionactivity'} = $env{'form.interval'};
         } else {          } else {
             $interval_settings{$cid.':interval'} = $env{'form.interval'};              $interval_settings{$cid.':interval'} = $env{'form.interval'};
         }          }
Line 2295  sub start_box { Line 2437  sub start_box {
         if ($$show{$caller}) {          if ($$show{$caller}) {
             $r->print('              $r->print('
               <tr>                <tr>
                 <td class="LC_subheader" align="left"><span class="LC_nobreak"><label><input type="radio" name="logindetails" value="0" checked="checked" onclick="javascript:togglelogins();" />&nbsp;'.&mt('Summary').'</label><label><input type="radio" name="logindetails" value="1" onclick="javascript:togglelogins();" />&nbsp;'.&mt('Details').'</label></span></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgcrslogininterval&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>                  <td class="LC_subheader" align="left"><span class="LC_nobreak"><label><input type="radio" name="logindetails" value="0" checked="checked" onclick="javascript:toggledetails('."'login'".');" />&nbsp;'.&mt('Summary').'</label><label><input type="radio" name="logindetails" value="1" onclick="javascript:toggledetails('."'login'".');" />&nbsp;'.&mt('Details').'</label></span></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgcrslogininterval&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
                 </tr>');
           }
       } elsif (($caller eq 'sessions') && ($$show{$caller})) {
           if ($$show{$caller}) {
               $r->print('
                 <tr>
                   <td class="LC_subheader" align="left"><span class="LC_nobreak"><label><input type="radio" name="sessiondetails" value="0" checked="checked" onclick="javascript:toggledetails('."'session'".');" />&nbsp;'.&mt('Summary').'</label><label><input type="radio" name="sessiondetails" value="1" onclick="javascript:toggledetails('."'session'".');" />&nbsp;'.&mt('Details').'</label></span></td><td class="LC_subheader"><a href="/adm/whatsnew?command=chgsessionlimit&amp;refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
               </tr>');                </tr>');
         }          }
     }      }
   
     $r->print('      $r->print('
               <tr>                <tr>
                <td colspan="2">                 <td colspan="2">

Removed from v.1.125  
changed lines
  Added in v.1.126


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