Diff for /loncom/interface/lonwhatsnew.pm between versions 1.66 and 1.72

version 1.66, 2006/12/03 05:45:13 version 1.72, 2007/06/06 17:35:32
Line 144  sub display_main_box { Line 144  sub display_main_box {
     my ($r,$command,$refpage,$checkallowed) = @_;      my ($r,$command,$refpage,$checkallowed) = @_;
     my $domain=&Apache::loncommon::determinedomain();      my $domain=&Apache::loncommon::determinedomain();
     my $function = &Apache::loncommon::get_users_function();      my $function = &Apache::loncommon::get_users_function();
     my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);  
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     $r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">');      $r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">');
   
Line 172  sub display_main_box { Line 171  sub display_main_box {
   
     if (($command eq 'chgthreshold')       if (($command eq 'chgthreshold') 
  && $checkallowed->{'abovethreshold'}) {   && $checkallowed->{'abovethreshold'}) {
         &display_threshold_config($r,$refpage,$tabbg,\%threshold_titles,          &display_threshold_config($r,$refpage,\%threshold_titles,
                                                                    $cdom,$crs);                                                                     $cdom,$crs);
     } elsif (($command eq 'chginterval')       } elsif (($command eq 'chginterval') 
      && $checkallowed->{'versionchanges'}) {       && $checkallowed->{'versionchanges'}) {
Line 183  sub display_main_box { Line 182  sub display_main_box {
     } elsif ($command eq 'courseinit') {      } elsif ($command eq 'courseinit') {
         &courseinit_config($r,$refpage,\%initpage);          &courseinit_config($r,$refpage,\%initpage);
     } else {      } else {
         &display_actions_box($r,$tabbg,$command,$refpage,\%threshold_titles,          &display_actions_box($r,$command,$refpage,\%threshold_titles,
                         \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);                          \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
     }      }
     my $end_page = &Apache::loncommon::end_page();      my $end_page = &Apache::loncommon::end_page();
Line 241  END Line 240  END
 #-------------------------------  #-------------------------------
                                                                                                                                                                   
 sub display_actions_box {  sub display_actions_box {
     my ($r,$tabbg,$command,$refpage,$threshold_titles,$interval_titles,      my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage,
                                       $initpage,$cdom,$crs,$checkallowed) = @_;          $cdom,$crs,$checkallowed) = @_;
     my $rowColor1 = "#ffffff";  
     my $rowColor2 = "#eeeeee";  
   
     my $udom = $env{'user.domain'};      my $udom = $env{'user.domain'};
     my $uname = $env{'user.name'};      my $uname = $env{'user.name'};
     my $cid = $env{'request.course.id'};      my $cid = $env{'request.course.id'};
Line 315  sub display_actions_box { Line 311  sub display_actions_box {
     $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).      $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).
               '. <nobr>'.&mt('Currently: <i>[_1]</i>',$currinit).'.&nbsp;&nbsp;'.                '. <nobr>'.&mt('Currently: <i>[_1]</i>',$currinit).'.&nbsp;&nbsp;'.
               &mt('<b>Change</b> for just <a href="/adm/whatsnew?command=courseinit&refpage=[_1]">this '.$lctype.'</a>',$refpage).' '.                &mt('<b>Change</b> for just <a href="/adm/whatsnew?command=courseinit&refpage=[_1]">this '.$lctype.'</a>',$refpage).' '.
               &mt('or for all <a href="/adm/preferences?action=changecourseinit&refpage=[_1]">your courses</a>',$refpage).'</nobr><br /><hr />');                &mt('or for all <a href="/adm/preferences?action=changecourseinit&refpage=[_1]">your courses</a>.',$refpage).'</nobr><br /><hr />');
   
     if ($command eq 'reset') {      if ($command eq 'reset') {
         $result = &process_reset($cdom,$crs);          $result = &process_reset($cdom,$crs);
Line 330  sub display_actions_box { Line 326  sub display_actions_box {
     my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed);      my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed);
   
     unless ($store_result eq 'ok') {       unless ($store_result eq 'ok') { 
         &Apache::lonnet::logthis('Error storing whatsnew settings: '.          &Apache::lonnet::logthis('Error saving whatsnew settings: '.
             $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid);              $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
         $result .= &mt('Unable to store visibility settings due to [_1]',          $result .= &mt('Unable to save visibility settings due to [_1]',
                        $store_result);                          $store_result); 
     }      }
   
Line 396  sub display_actions_box { Line 392  sub display_actions_box {
     }      }
   
     if ($needitems) {      if ($needitems) {
         &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);          &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
     }      }
     if ($show{'coursenormalmail'}) {      if ($show{'coursenormalmail'}) {
         $msgcount = &getnormalmail(\@newmsgs);          $msgcount = &getnormalmail(\@newmsgs);
Line 432  sub display_actions_box { Line 428  sub display_actions_box {
             if ($displayed == $halfway) {              if ($displayed == $halfway) {
                 $r->print('</td><td width="6%">&nbsp;</td><td align="left" valign="top" width="47%">');                  $r->print('</td><td width="6%">&nbsp;</td><td align="left" valign="top" width="47%">');
             }              }
             &display_launcher($r,$actionitem,$refpage,$checkallowed,$tabbg,$rowColor1,$rowColor2,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,$interval,$countunread);              &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);
             $displayed ++;               $displayed ++; 
         }          }
     }      }
Line 454  sub display_actions_box { Line 450  sub display_actions_box {
 #-------------------------------  #-------------------------------
                                                                                                                                                                   
 sub display_threshold_config {  sub display_threshold_config {
     my ($r,$refpage,$tabbg,$threshold_titles,$cdom,$crs) = @_;      my ($r,$refpage,$threshold_titles,$cdom,$crs) = @_;
     my $uname = $env{'user.name'};      my $uname = $env{'user.name'};
     my $udom = $env{'user.dom'};      my $udom = $env{'user.dom'};
     my $cid = $env{'request.course.id'};      my $cid = $env{'request.course.id'};
Line 471  sub display_threshold_config { Line 467  sub display_threshold_config {
                          );                           );
     &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);      &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs);
   
     $r->print('<br /><form name="thresholdform" method="post" action="/adm/whatsnew">      $r->print('<br /><form name="thresholdform" method="post" action="/adm/whatsnew">'.
         <table border="0" cellpadding="2" cellspacing="4">                &Apache::loncommon::start_data_table().
          <tr>                &Apache::loncommon::start_data_table_header_row().
           <td align="left" valign="top" width="45%">               '<th>'.&mt('Threshold Name').'</th>'."\n".
            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000">               '<th>'.&mt('Current value').'</th>'."\n".
             <tr>               '<th>'.&mt('Change?').'</th>'."\n".
              <td>                &Apache::loncommon::end_data_table_header_row());
                <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000">  
                 <tr>  
                 <td bgcolor="#ffffff">  
                  <table cellspacing="0" cellpadding="4" border="0">  
      <tr bgcolor="'.$tabbg.'">  
       <th>Threshold Name</th>  
       <th>Current value</th>  
       <th>Change?</th>  
      </tr>');  
     my $rowNum =0;  
     foreach my $type (@thresholditems) {      foreach my $type (@thresholditems) {
         my $parameter = $env{'request.course.id'}.':threshold_'.$type;          my $parameter = $env{'request.course.id'}.':threshold_'.$type;
 # onchange is javascript to automatically check the 'Set' button.  # onchange is javascript to automatically check the 'Set' button.
         my $onchange = 'onFocus="javascript:window.document.forms'.          my $onchange = 'onFocus="javascript:window.document.forms'.
               "['thresholdform'].elements['".$parameter."_setparmval']".                "['thresholdform'].elements['".$parameter."_setparmval']".
               '.checked=true;"';                '.checked=true;"';
         if ($rowNum %2 == 1) {          $r->print(&Apache::loncommon::start_data_table_row()."\n".
             $rowColor = $rowColor1;                   '<td>'.$threshold_titles{$type}.'</td>'."\n".
         } else {                   '<td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value',
             $rowColor = $rowColor2;  
         }  
         $r->print('  
      <tr bgcolor="'.$rowColor.'">  
       <td>'.$threshold_titles{$type}.'</td>  
       <td>'.&Apache::lonhtmlcommon::textbox($parameter.'_value',  
                                             $threshold{$type},                                              $threshold{$type},
                                             10,$onchange).'</td>                                              10,$onchange).'</td>'."\n".
       <td>'                   '<td>'.
            .&Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').                   &Apache::lonhtmlcommon::checkbox($parameter.'_setparmval').
       '</td>                   '</td>'."\n".
      </tr>');                   &Apache::loncommon::end_data_table_row());
         $rowNum ++;  
     }      }
     $r->print('</table></td></tr></table></td></tr></table>      $r->print(&Apache::loncommon::end_data_table()."\n".
            <br /><input type="submit" name="threshold" value="Make changes" />            '<br /><input type="submit" name="threshold" value="Make changes" />
                  <input type="hidden" name="command" value="update" />                   <input type="hidden" name="command" value="update" />
                  <input type="hidden" name="refpage" value="'.$refpage.'" />                   <input type="hidden" name="refpage" value="'.$refpage.'" />
                </form>');                 </form>');
Line 542  sub display_interval_config { Line 521  sub display_interval_config {
 <select name="interval">  <select name="interval">
 ');  ');
     foreach my $key (reverse sort ({$a cmp $b} (keys(%{$interval_titles})))) {      foreach my $key (reverse sort ({$a cmp $b} (keys(%{$interval_titles})))) {
         $r->print('<option value="'.$key.'">Version changes '.$$interval_titles{$key}.          $r->print('<option value="'.$key.'">'.&mt('Version changes').' '.$$interval_titles{$key}.
                   '</option>'."\n");                    '</option>'."\n");
     }      }
     $r->print('</select>&nbsp;&nbsp;      $r->print('</select>&nbsp;&nbsp;
Line 577  function toggle_countunread(choice) { Line 556  function toggle_countunread(choice) {
     document.discussionswitch.submit();      document.discussionswitch.submit();
 }  }
 </script>');  </script>');
     $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt('This can increase the time taken to gather data for the [_1] page by a few seconds.',"<i>What's New?</i>").'&nbsp;&nbsp;'.&mt('Currently set to [_1].','<b>'.$current.'</b>'));      $r->print('<br />'.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').'<br />'.&mt("This can increase the time taken to gather data for the '<i>What's New?</i>' page by a few seconds.").'&nbsp;&nbsp;'.&mt("Currently set to <b>$current</b>."));
     $r->print('<br /><br />      $r->print('<br /><br />
 <form method="post" name="discussionswitch" action="/adm/whatsnew">  <form method="post" name="discussionswitch" action="/adm/whatsnew">
 <input type="hidden" name="command" value="newdiscconf" />  <input type="hidden" name="command" value="newdiscconf" />
Line 674  sub curr_courseinit { Line 653  sub curr_courseinit {
 }  }
   
 sub display_launcher {  sub display_launcher {
     my ($r,$action,$refpage,$checkallowed,$tabbg,$rowColor1,$rowColor2,$show,      my ($r,$action,$refpage,$checkallowed,$show,$headings,$res_title,
         $headings,$res_title,$tograde,$ungraded,$bombs,$bombed,$changed,          $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
         $warnings,$triggered,$newdiscussions,$unread,$msgcount,$newmsgs,          $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
                           $critmsgcount,$critmsgs,$interval,$countunread) = @_;          $interval,$countunread) = @_;
   
     if ($$checkallowed{$action}) {      if ($$checkallowed{$action}) {
         &start_box($r,$tabbg,$show,$headings,$action,$refpage,$action);          &start_box($r,$show,$headings,$action,$refpage,$action);
         if ($$show{$action}) {          if ($$show{$action}) {
             if ($action eq 'handgrading') {    # UNGRADED ITEMS              if ($action eq 'handgrading') {    # UNGRADED ITEMS
                 &display_handgrade($r,$tograde,$rowColor1,$rowColor2,                  &display_handgrade($r,$tograde,$ungraded);
                                                                     $ungraded);  
             } elsif ($action eq 'haserrors') { # BOMBS              } elsif ($action eq 'haserrors') { # BOMBS
                 &display_haserrors($r,$bombs,$rowColor1,$rowColor2,$bombed,                  &display_haserrors($r,$bombs,$bombed,$res_title);
                                                                    $res_title);  
             } elsif ($action eq 'versionchanges') { # VERSION CHANGES              } elsif ($action eq 'versionchanges') { # VERSION CHANGES
                 &display_versionchanges($r,$changed,$res_title,$rowColor1,                  &display_versionchanges($r,$changed,$res_title,$interval);
                                                          $rowColor2,$interval);  
   
             } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS              } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS
                 &display_abovethreshold($r,$refpage,$warnings,$triggered,                  &display_abovethreshold($r,$refpage,$warnings,$triggered,
  $res_title);   $res_title);
             } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION              } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
                 &display_coursediscussion($r,$newdiscussions,$unread,                  &display_coursediscussion($r,$newdiscussions,$unread,
                                 $countunread,$res_title,$rowColor1,$rowColor2);                                  $countunread,$res_title);
             } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES              } elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES
                 &display_coursenormalmail($r,$msgcount,$newmsgs,$rowColor1,                  &display_coursenormalmail($r,$msgcount,$newmsgs);
                                                                    $rowColor2);  
             } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES              } elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES
                 &display_coursecritmail($r,$critmsgcount,$critmsgs,$rowColor1,                  &display_coursecritmail($r,$critmsgcount,$critmsgs);
                                                                    $rowColor2);  
             }              }
         }          }
         &end_box($r);          &end_box($r);
Line 713  sub display_launcher { Line 686  sub display_launcher {
   
 sub getitems {  sub getitems {
     my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,      my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions,
         $tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,          $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
                                  $res_title,$show,$starttime,$countunread) = @_;          $starttime,$countunread) = @_;
     my $navmap = Apache::lonnavmaps::navmap->new();      my $navmap = Apache::lonnavmaps::navmap->new();
     # force retrieve Resource to seed the part id cache we'll need it later      # force retrieve Resource to seed the part id cache we'll need it later
     my @allres=$navmap->retrieveResources(undef,      my @allres=$navmap->retrieveResources(undef,
Line 794  sub check_discussions { Line 767  sub check_discussions {
     $$unread{$ressymb}{'lastpost'} = $resource->last_post_time();      $$unread{$ressymb}{'lastpost'} = $resource->last_post_time();
           
     if ($countunread eq 'on') {      if ($countunread eq 'on') {
  $$unread{$ressymb}{'unreadcount'} = $resource->unread_discussion();   $$unread{$ressymb}{'unreadcount'} = 
                               $resource->discussion_info('unread');
     }      }
 }  }
   
Line 848  sub check_thresholds { Line 822  sub check_thresholds {
     my %stats;      my %stats;
     my %lastreset = ();      my %lastreset = ();
     my $warning = 0;      my $warning = 0;
     my $rowColor;  
     foreach my $part (@parts) {      foreach my $part (@parts) {
         if ($resource->handgrade($part) eq 'yes') {          if ($resource->handgrade($part) eq 'yes') {
             next;              next;
Line 1138  sub checkversions { Line 1111  sub checkversions {
 }  }
   
 sub display_handgrade {  sub display_handgrade {
     my ($r,$tograde,$rowColor1,$rowColor2,$ungraded) = @_;      my ($r,$tograde,$ungraded) = @_;
     my $rowColor;  
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                         'prna' => 'Problem Name',                          'prna' => 'Problem Name',
                         'nmun' => 'Number ungraded',                          'nmun' => 'Number ungraded',
                         'nopr' => 'No problems require handgrading',                          'nopr' => 'No problems require handgrading',
     );      );
     if (@{$tograde} > 0) {      if (@{$tograde} > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.$lt{'prna'}.'</small></b></td><td align="right"><b><small>'.$lt{'nmun'}.'</small></b></td></tr>');          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
                     $lt{'prna'}.'</td><td class="LC_right_item">'.
                     $lt{'nmun'}.'</td></tr>');
         my $rowNum = 0;          my $rowNum = 0;
         foreach my $res (@{$tograde}) {          foreach my $res (@{$tograde}) {
             if ($rowNum %2 == 1) {              $rowNum ++;
                 $rowColor = $rowColor1;              my $css_class = $rowNum%2?' class="LC_odd_row"':'';
             } else {  
                 $rowColor = $rowColor2;  
             }  
             my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);              my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
             my $linkurl=&Apache::lonnet::clutter($url);              my $linkurl=&Apache::lonnet::clutter($url);
             $linkurl .= '?symb='.&escape($res);              $linkurl .= '?symb='.&escape($res);
Line 1161  sub display_handgrade { Line 1132  sub display_handgrade {
                 $linkurl =                   $linkurl = 
                     $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};                      $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};
             }               } 
             $r->print('<tr bgcolor="'.$rowColor.'"><td><a href="'.$linkurl.'"><small>'.$$ungraded{$res}{title}.'</small></a></td><td align="right"><small>'.$$ungraded{$res}{count}.'</small></td></tr>');              $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>');
             $rowNum ++;  
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff"><br><center><i><b><small>&nbsp;&nbsp;'.$lt{'nopr'}.'&nbsp;&nbsp;</small><br><br></b></i></td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
     }      }
 }  }
   
 sub display_haserrors {  sub display_haserrors {
     my ($r,$bombs,$rowColor1,$rowColor2,$bombed,$res_title) = @_;      my ($r,$bombs,$bombed,$res_title) = @_;
     my $bombnum = 0;      my $bombnum = 0;
     my $rowColor;  
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                                    reso => 'Resource',                                     reso => 'Resource',
                                    nmer => 'Number of errors',                                     nmer => 'Number of errors',
                                    noer => 'No problems with errors',                                     noer => 'No problems with errors',
     );      );
     if (@{$bombs} > 0) {      if (@{$bombs} > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.$lt{'reso'}.'</small></b></td><td align="right"><b><small>'.$lt{'nmer'}.'</small></b></td></tr>');          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
                     $lt{'reso'}.'</td><td class="LC_right_item">'.
                     $lt{'nmer'}.'</td></tr>');
         @{$bombs} = sort { &cmp_title($a,$b,$res_title) } @{$bombs};          @{$bombs} = sort { &cmp_title($a,$b,$res_title) } @{$bombs};
         foreach my $bomb (@{$bombs}) {          foreach my $bomb (@{$bombs}) {
             if ($bombnum %2 == 1) {  
                 $rowColor = $rowColor1;  
             } else {  
                 $rowColor = $rowColor2;  
             }  
             $r->print('<tr bgcolor="'.$rowColor.'"><td><small>'.$$bombed{$bomb}{errorlink}.'</small></td><td align="right"><small>'.$$bombed{$bomb}{errorcount}.'</small></td></tr>');  
             $bombnum ++;              $bombnum ++;
               my $css_class = $bombnum%2?' class="LC_odd_row"':'';
               $r->print('<tr'.$css_class.'><td>'.$$bombed{$bomb}{errorlink}.
                         '</td><td class="LC_right_item">'.
                         $$bombed{$bomb}{errorcount}.'</td></tr>');
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff"><br /><center><b><i><small>'.$lt{'noer'}.'</small></i></b></center><br /></td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'noer'}.'</td></tr>');
     }      }
     return;      return;
 }  }
Line 1216  sub display_abovethreshold { Line 1185  sub display_abovethreshold {
                 ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.                  ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.
                 "\n");                  "\n");
         $r->print('<tr class="LC_info_row">'.          $r->print('<tr class="LC_info_row">'.
   '<td class="LC_first_item">'.$lt{'reso'}.'</td>'.    '<td class="LC_left_item">'.$lt{'reso'}.'</td>'.
   '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.    '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.
   '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.    '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.
   '<td>'.$lt{'lare'}.'</td><td>'.$lt{'reco'}.'</td></tr>');    '<td>'.$lt{'lare'}.'</td><td  class="LC_right_item">'.
                     $lt{'reco'}.'</td></tr>');
  my $row;   my $row;
         foreach my $res (@{$warnings}) {          foreach my $res (@{$warnings}) {
     $row++;      $row++;
Line 1234  sub display_abovethreshold { Line 1204  sub display_abovethreshold {
                 $linkurl =                   $linkurl = 
                   $$triggered{$res}{'enclink'}.'?symb='.$$triggered{$res}{'encsymb'};                    $$triggered{$res}{'enclink'}.'?symb='.$$triggered{$res}{'encsymb'};
             }              }
             my $css_class = $row%2?'LC_odd_row':'';              my $css_class = $row%2?' class="LC_odd_row"':'';
             $r->print('<tr class="'.$css_class.'">'.              $r->print('<tr'.$css_class.'>'.
       '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.        '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.
       $$triggered{$res}{title}.'</a></td>');        $$triggered{$res}{title}.'</a></td>');
                       if (ref($$triggered{$res}{text}) eq 'ARRAY') {                        if (ref($$triggered{$res}{text}) eq 'ARRAY') {
Line 1251  sub display_abovethreshold { Line 1221  sub display_abovethreshold {
                 }                  }
             }              }
         }          }
         $r->print('<tr class="LC_info_row"><td colspan="7"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');          $r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');
     } else {      } else {
         $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'nopr'}.'</td></tr>');
     }      }
 }  }
   
 sub display_versionchanges {  sub display_versionchanges {
     my ($r,$changed,$res_title,$rowColor1,$rowColor2,$interval) = @_;      my ($r,$changed,$res_title,$interval) = @_;
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
         'reso' => 'Resource',          'reso' => 'Resource',
         'revd' => 'Last revised',          'revd' => 'Last revised',
Line 1266  sub display_versionchanges { Line 1236  sub display_versionchanges {
         'veru' => 'Version used',          'veru' => 'Version used',
         'noup' => 'No updated versions',           'noup' => 'No updated versions', 
     );      );
     my $rowColor;  
     if (keys(%{$changed}) > 0) {      if (keys(%{$changed}) > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.$lt{'reso'}.'</small></b></td><td><b><small>'.$lt{'revd'}.'</small></b></td><td><b><small>'.$lt{'newv'}.'</small></b></td><td><b><small>'.$lt{'veru'}.'</small></b></td></tr>');          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
                             $lt{'reso'}.'</td><td>'.$lt{'revd'}.'</td><td>'.
                             $lt{'newv'}.'</td><td class="LC_right_item">'.
                     $lt{'veru'}.'</td></tr>');
         my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed});          my @changes = sort { &cmp_title($a,$b,$res_title) } keys(%{$changed});
         my $changenum = 0;          my $changenum = 0;
         foreach my $item (@changes) {          foreach my $item (@changes) {
             if ($changenum %2 == 1) {              $changenum ++;
                 $rowColor = $rowColor1;              my $css_class = $changenum%2?' class="LC_odd_row"':'';
             } else {  
                 $rowColor = $rowColor2;  
             }  
             my ($map,$id,$url)=&Apache::lonnet::decode_symb($item);              my ($map,$id,$url)=&Apache::lonnet::decode_symb($item);
             my $linkurl=&Apache::lonnet::clutter($url);              my $linkurl=&Apache::lonnet::clutter($url);
             $linkurl .= '?symb='.&escape($item);              $linkurl .= '?symb='.&escape($item);
   
             $r->print('<tr bgcolor="'.$rowColor.'"><td><small><a href="'.$linkurl.'">'.$$res_title{$item}.'</a></small></td><td><small>'.$$changed{$item}{'revdate'}.'</small></td><td><small>'.$$changed{$item}{'current'}.'</small></td><td><small>'.$$changed{$item}{'version'}.'</small></td></tr>');              $r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.
             $changenum ++;                        $$res_title{$item}.'</a></td><td>'.
                         $$changed{$item}{'revdate'}.'</td><td>'.
                         $$changed{$item}{'current'}.'</td><td>'.
                         $$changed{$item}{'version'}.'</td></tr>');
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff"><br /><center><b><i><small>'.$lt{'noup'}.' '.$interval.'</small></i></b></center><br /></td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.$lt{'noup'}.
                     ' '.$interval.'</td></tr>');
     }      }
     return;      return;
 }  }
     
 sub display_coursediscussion {  sub display_coursediscussion {
     my ($r,$newdiscussions,$unread,$countunread,$res_title,$rowColor1,      my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_;
                                                               $rowColor2) = @_;  
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     my %lt = &Apache::lonlocal::texthash(      my %lt = &Apache::lonlocal::texthash(
                 'loca' => 'Location',                  'loca' => 'Location',
Line 1303  sub display_coursediscussion { Line 1273  sub display_coursediscussion {
                 'noun' => 'No unread posts in '.$lctype.' discussions',                  'noun' => 'No unread posts in '.$lctype.' discussions',
                 'tmlp' => 'Time of last post',                   'tmlp' => 'Time of last post', 
     );      );
     my $rowColor;  
     if (@{$newdiscussions} > 0) {      if (@{$newdiscussions} > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.$lt{'loca'}.          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
                   '</small></b></td><td><b><small>'.$lt{'type'}.                    $lt{'loca'}.'</td><td>'.
                   '</small></b>');                    $lt{'type'}.'</td>');
         if ($countunread eq 'on') {          if ($countunread eq 'on') {
             $r->print('<td><b><small>'.$lt{'tmlp'}.'</small></b></td>'.              $r->print('<td>'.$lt{'tmlp'}.'</td>'.
                       '<td align="right"><b><small>'.$lt{'numn'}.                        '<td class="LC_right_item">'.$lt{'numn'}.'</td>');
                       '</small></b></td>');  
         } else {          } else {
             $r->print('<td align="right"><b><small>'.$lt{'tmlp'}.              $r->print('<td class="LC_right_item">'.$lt{'tmlp'}.'</td>');
                          '</small></b></td>');  
         }          }
         $r->print("</tr>\n");          $r->print("</tr>\n");
         @{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) }          @{$newdiscussions} = sort { &cmp_title($a,$b,$res_title) }
                                                             @{$newdiscussions};                                                              @{$newdiscussions};
         my $rowNum = 0;          my $rowNum = 0;
         foreach my $ressymb (@{$newdiscussions}) {          foreach my $ressymb (@{$newdiscussions}) {
               $rowNum ++;
             my $forum_title = $$unread{$ressymb}{'title'};              my $forum_title = $$unread{$ressymb}{'title'};
             my $type = 'Resource';              my $type = 'Resource';
             my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);              my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
Line 1331  sub display_coursediscussion { Line 1299  sub display_coursediscussion {
             if ($$unread{$ressymb}{'enclink'}) {              if ($$unread{$ressymb}{'enclink'}) {
                 $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};                  $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};
             }              }
             if ($rowNum %2 == 1) {              my $css_class = $rowNum%2?' class="LC_odd_row"':'';
                 $rowColor = $rowColor1;  
             } else {  
                 $rowColor = $rowColor2;  
             }  
             my $lastpost = &Apache::lonnavmaps::timeToHumanString(              my $lastpost = &Apache::lonnavmaps::timeToHumanString(
                                                $$unread{$ressymb}{'lastpost'});                                                 $$unread{$ressymb}{'lastpost'});
             $r->print('<tr bgcolor="'.$rowColor.'"><td><small><a href="'.$disclink.'">'.$forum_title.'</a>&nbsp;</td><td><small>'.$type.'&nbsp;</small></td>');              $r->print('<tr'.$css_class.'><td><a href="'.$disclink.'">'.$forum_title.'</a>&nbsp;</td><td>'.&mt($type).'&nbsp;</td>');
             if ($countunread eq 'on') {              if ($countunread eq 'on') {
                 my $unreadnum = $$unread{$ressymb}{'unreadcount'};                  my $unreadnum = $$unread{$ressymb}{'unreadcount'};
                 $r->print('<td><small>'.$lastpost.'<small></td><td align="right">'.                  $r->print('<td>'.$lastpost.'</td><td class="LC_right_item">'.
                           '<small>',$unreadnum.'&nbsp;</small></td>');                            $unreadnum.'&nbsp;</td>');
             } else {              } else {
                 $r->print('<td align="right"><small>'.$lastpost.'</small></td>');                  $r->print('<td class="LC_right_item">'.$lastpost.'</td>');
             }              }
             $r->print("</tr>\n");              $r->print("</tr>\n");
             $rowNum ++;  
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff"><br><center>&nbsp;<i><b><small>'.          $r->print('<tr class="LC_empty_row"><td>'.$lt{'noun'}.'</td></tr>');
                   $lt{'noun'}.'</small></b></i><br><br></td></tr>');  
     }      }
 }  }
   
 sub display_coursenormalmail {  sub display_coursenormalmail {
     my ($r,$msgcount,$newmsgs,$rowColor1,$rowColor2) = @_;      my ($r,$msgcount,$newmsgs) = @_;
     my $rowColor;  
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     if ($msgcount > 0) {      if ($msgcount > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.&mt('Number').'</small></b></td><td><b><small>'.&mt('Subject').'</small></b></td><td><b><small>'.&mt('Sender').'</small></b></td><td><b><small>'.&mt('Date/Time').'</small></b></td></tr>');          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
         my $rowNum = 0;                    &mt('Number').'</td><td>'.&mt('Subject').'</td><td>'.
         my $mailcount = 1;                    &mt('Sender').'</td><td class="LC_right_item">'.
                     &mt('Date/Time').'</td></tr>');
           my $mailcount = 0;
         foreach my $msg (@{$newmsgs}) {          foreach my $msg (@{$newmsgs}) {
             if ($rowNum %2 == 1) {  
                 $rowColor = $rowColor1;  
             } else {  
                 $rowColor = $rowColor2;  
             }  
             $r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. &nbsp;</small></td><td valign="top"><small><a href="/adm/communicate">'.$msg->{'shortsub'}.'</a>&nbsp; &nbsp;</small></td><td valign="top"><small>&nbsp;'.$msg->{'from'}.'@'.$msg->{'fromdom'}.'&nbsp;</small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>');  
             $rowNum ++;  
             $mailcount ++;              $mailcount ++;
               my $css_class = $mailcount%2?' class="LC_odd_row"':'';
               $r->print('<tr'.$css_class.'><td>'.$mailcount.
                         '. &nbsp;</td><td><a href="/adm/communicate">'.
                         $msg->{'shortsub'}.'</a>&nbsp; &nbsp;</td><td>&nbsp;'.
                         $msg->{'from'}.':'.$msg->{'fromdom'}.'&nbsp;</td><td>'.
                         $msg->{'sendtime'}.'</td></tr>');
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff" width="100%"><center><br /><b><i><small>'.&mt('No new '.$lctype.' messages').'</small></i></b><br /><br /></center></td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.
                     &mt('No new '.$lctype.' messages').'</td></tr>');
     }      }
 }  }
   
 sub display_coursecritmail {  sub display_coursecritmail {
     my ($r,$critmsgcount,$critmsgs,$rowColor1,$rowColor2) = @_;      my ($r,$critmsgcount,$critmsgs) = @_;
     my $rowColor;  
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
     if ($critmsgcount > 0) {      if ($critmsgcount > 0) {
         $r->print('<tr bgcolor="#cccccc"><td><b><small>'.&mt('Number').'</small></b></td><td><b><small>'.&mt('Subject').'</small></b></td><td><b><small>'.&mt('Sender').'</small></b></td><td><b><small>'.&mt('Date/Time').'</small></b></td></tr>');          $r->print('<tr class="LC_info_row"><td class="LC_left_item">'.
         my $rowNum = 0;                    &mt('Number').'</td><td>'.&mt('Subject').'</td><td>'.
         my $mailcount = 1;                    &mt('Sender').'</td><td class="LC_right_item">'.
                     &mt('Date/Time').'</td></tr>');
           my $mailcount = 0;
         foreach my $msg (@{$critmsgs}) {          foreach my $msg (@{$critmsgs}) {
             if ($rowNum %2 == 1) {  
                 $rowColor = $rowColor1;  
             } else {  
                 $rowColor = $rowColor2;  
             }  
             $r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. &nbsp;<small></td><td valign="top"><small><a href="/adm/email?folder=critical">'.$msg->{'shortsub'}.'</a>&nbsp; &nbsp;</small></td><td valign="top"><small>&nbsp;'.$msg->{'from'}.'@'.$msg->{'fromdom'}.'&nbsp;</small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>');  
             $rowNum ++;  
             $mailcount ++;              $mailcount ++;
               my $css_class = $mailcount%2?' class="LC_odd_row"':'';
               $r->print('<tr'.$css_class.'><td>'.$mailcount.
                         '. &nbsp;</td><td><a href="/adm/email?folder=critical">'.
                         $msg->{'shortsub'}.'</a>&nbsp; &nbsp;</td><td>&nbsp;'.
                         $msg->{'from'}.':'.$msg->{'fromdom'}.'&nbsp;</td><td>'.
                         $msg->{'sendtime'}.'</td></tr>');
         }          }
     } else {      } else {
         $r->print('<tr><td bgcolor="#ffffff" width="100%"><center><br /><b><i><small>'.&mt('No unread critical messages in '.$lctype).'</small></i></b><br /><br /></center></td></tr>');          $r->print('<tr class="LC_empty_row"><td>'.
                     &mt('No unread critical messages in '.$lctype).
                     '</td></tr>');
     }      }
 }  }
   
Line 1459  sub store_interval_setting { Line 1424  sub store_interval_setting {
   
         } else {          } else {
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error storing whatsnew interval setting'.              &Apache::lonnet::logthis('Error saving whatsnew interval setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);                  ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
             $result = &mt('Unable to set interval to [_1] due to [_2].',              $result = &mt('Unable to set interval to [_1] due to [_2].',
                          '<b>'.$$interval_titles{$env{'form.interval'}}.'</b>',                           '<b>'.$$interval_titles{$env{'form.interval'}}.'</b>',
Line 1483  sub store_discussion_setting { Line 1448  sub store_discussion_setting {
                                                                                                                                                                       
         } else {          } else {
     my $lctype = lc(&Apache::loncommon::course_type());      my $lctype = lc(&Apache::loncommon::course_type());
             &Apache::lonnet::logthis('Error storing whatsnew countunread setting'.              &Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
                 ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);                  ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
             $result = &mt('Unable to set "number unread posts display" to [_1]'.              $result = &mt('Unable to set "number unread posts display" to [_1]'.
                           ' due to [_2].',                            ' due to [_2].',
Line 1521  sub store_courseinit_setting { Line 1486  sub store_courseinit_setting {
                     $result = &mt('Page displayed after role selection in this '.$lctype.' set to <b>[_2]</b>',$lctype,$$initpage{$env{'form.courseinit_page'}});                      $result = &mt('Page displayed after role selection in this '.$lctype.' set to <b>[_2]</b>',$lctype,$$initpage{$env{'form.courseinit_page'}});
                 }                  }
             } else {              } else {
                 &Apache::lonnet::logthis('Error storing whatsnew courseinit '.                  &Apache::lonnet::logthis('Error saving whatsnew courseinit '.
                                          'setting: '.$outcome.' for '.$uname.                                           'setting: '.$outcome.' for '.$uname.
                                          ':'.$udom.' in '.$lctype.' '.$cid);                                           ':'.$udom.' in '.$lctype.' '.$cid);
                 if ($page_control eq 'global preferences') {                  if ($page_control eq 'global preferences') {
Line 1540  sub store_courseinit_setting { Line 1505  sub store_courseinit_setting {
 }  }
   
 sub start_box {  sub start_box {
     my ($r,$tabbg,$show,$heading,$caller,$refpage) = @_;      my ($r,$show,$heading,$caller,$refpage) = @_;
     my %lt = &Apache::lonlocal::texthash(       my %lt = &Apache::lonlocal::texthash( 
                        chth => 'Change thresholds?',                         chth => 'Change thresholds?',
                        chin => 'Change interval?',                         chin => 'Change interval?',
                        chop => 'Change options?',                         chop => 'Change options?',
     );      );
     my ($showhide,$class);      my $showhide;
     if ($$show{$caller}) {      if ($$show{$caller}) {
         $showhide = '<b><a href="javascript:change_display(document.visible.'.          $showhide = '<b><a href="javascript:change_display(document.visible.'.
                                'display_'.$caller.",'hide'".');">Hide</a></b>';                                 'display_'.$caller.",'hide'".');">'.
                                  &mt('Hide').'</a></b>';
         
     } else {      } else {
         $showhide = '<b><a href="javascript:change_display(document.visible.'.          $showhide = '<b><a href="javascript:change_display(document.visible.'.
                                'display_'.$caller.",'show'".');">Show</a></b>';                                 'display_'.$caller.",'show'".');">'.
                                  &mt('Show').'</a></b>';
     }      }
           
     $r->print('      $r->print('
          <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">           <table class="LC_nested_outer">
           <tr>            <tr>
            <td>             <th>'.$$heading{$caller}.'</th>
             <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">             <th class="LC_right_item">'.$showhide.'</th>
               <tr>            </tr>');
                <td bgcolor="'.$tabbg.'">  
                 <table width="100%" border="0" cellspacing="0" cellpadding="0">  
                  <tr>  
                   <td><b>'.$$heading{$caller}.'</b></td>  
                   <td valign="top" align="right">'.$showhide.'</td>  
                  </tr>  
                 </table>  
                </td>  
               </tr>');  
      if (($caller eq 'abovethreshold') && ($$show{$caller})) {       if (($caller eq 'abovethreshold') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td bgcolor="'.$tabbg.'" align="right"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'"><b><small>'.$lt{'chth'}.'</small></b></a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'">'.$lt{'chth'}.'</a></td>
               </tr>');                </tr>');
          }           }
  $class='class="LC_whatsnew"';  
      } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {       } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td bgcolor="'.$tabbg.'" align="right"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'"><b><small>'.$lt{'chin'}.'</small></b></a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td>
               </tr>');                </tr>');
          }           }
      } elsif ($caller eq 'coursediscussion') {       } elsif ($caller eq 'coursediscussion') {
          if ($$show{$caller}) {           if ($$show{$caller}) {
              $r->print('               $r->print('
               <tr>                <tr>
                 <td bgcolor="'.$tabbg.'" align="right"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'"><b><small>'.$lt{'chop'}.'</small></b></a></td>                  <td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'">'.$lt{'chop'}.'</a></td>
               </tr>');                </tr>');
          }           }
      }       }
     $r->print('      $r->print('
               <tr>                <tr>
                <td bgcolor="#ffffff">                 <td colspan="2">
                 <table cellpadding="2" cellspacing="0" border="0" width="100%" '.$class.'>                  <table class="LC_nested">
 ');  ');
     return;      return;
 }  }
Line 1605  sub start_box { Line 1562  sub start_box {
 sub end_box {  sub end_box {
     my ($r) = shift;      my ($r) = shift;
     $r->print('      $r->print('
       </table>  
      </td>  
     </tr>  
    </table>     </table>
   </td>    </td>
  </tr>   </tr>

Removed from v.1.66  
changed lines
  Added in v.1.72


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