File:  [LON-CAPA] / loncom / interface / lonwhatsnew.pm
Revision 1.8: download - view: text, annotated - select for diffs
Mon Apr 11 15:33:46 2005 UTC (19 years, 2 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
- wrap_symb ddoes the checking so no need to check it before calling it

    1: #
    2: # $Id: lonwhatsnew.pm,v 1.8 2005/04/11 15:33:46 albertel Exp $
    3: #
    4: # Copyright Michigan State University Board of Trustees
    5: #
    6: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
    7: #
    8: # LON-CAPA is free software; you can redistribute it and/or modify
    9: # it under the terms of the GNU General Public License as published by
   10: # the Free Software Foundation; either version 2 of the License, or
   11: # (at your option) any later version.
   12: #
   13: # LON-CAPA is distributed in the hope that it will be useful,
   14: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   15: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   16: # GNU General Public License for more details.
   17: #
   18: # You should have received a copy of the GNU General Public License
   19: # along with LON-CAPA; if not, write to the Free Software
   20: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   21: #
   22: # /home/httpd/html/adm/gpl.txt
   23: #
   24: # http://www.lon-capa.org/
   25: #
   26: 
   27: 
   28: package Apache::lonwhatsnew;
   29: 
   30: use strict;
   31: use lib qw(/home/httpd/lib/perl);
   32: use Apache::lonnet;
   33: use Apache::loncommon();
   34: use Apache::lonhtmlcommon();
   35: use Apache::lonlocal;
   36: use Apache::loncoursedata();
   37: use Apache::lonnavmaps();
   38: use Apache::Constants qw(:common :http);
   39: use Time::Local;
   40: 
   41: #----------------------------
   42: # handler
   43: #
   44: #----------------------------
   45: 
   46: sub handler {
   47:     my $r = shift;
   48:     if ($r->header_only) {
   49:         &Apache::loncommon::content_type($r,'text/html');
   50:         $r->send_http_header;
   51:         return OK;
   52:     }
   53:     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']);
   54: 
   55:     my $command = $env{'form.command'};
   56: 
   57:     if ($command eq '') {
   58:         $command = "info";
   59:     }
   60: 
   61:     &Apache::loncommon::content_type($r,'text/html');
   62:     $r->send_http_header;
   63:     $r->print(&display_header());
   64:     if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('vsa',$env{'request.course.id'})))) {
   65:         # Not in a course, or not allowed to modify parms
   66:         $env{'user.error.msg'}="/adm/whatsnew:vsa:0:0:Cannot display student activity";
   67:         return HTTP_NOT_ACCEPTABLE;
   68:     }
   69: 
   70:     &Apache::lonhtmlcommon::clear_breadcrumbs();
   71:     if ($command eq 'config') {
   72:         &Apache::lonhtmlcommon::add_breadcrumb
   73:             ({href=>'/adm/whatsnew?command=config',
   74:               text=>"Configure display"});
   75:         $r->print(&Apache::lonhtmlcommon::breadcrumbs
   76:             (undef,'Course Action Items','Course_Action_Items_Config'));
   77:     } else {
   78:         &Apache::lonhtmlcommon::add_breadcrumb
   79:             ({href=>'/adm/whatsnew?command=info',
   80:               text=>"Display Action Items"});
   81:         $r->print(&Apache::lonhtmlcommon::breadcrumbs
   82:             (undef,'Course Action Items','Course_Action_Items_Display'));
   83:     }
   84:     &display_main_box($r,$command);
   85: }
   86: 
   87: #------------------------------
   88: # display_main_box
   89: #
   90: # Display all the elements within the main box
   91: #------------------------------
   92:                                                                                 
   93: sub display_main_box {
   94:     my ($r,$command) = @_;
   95:     my $domain=&Apache::loncommon::determinedomain();
   96:     my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain);
   97:     my $selconfig;
   98:     my $selinfo;
   99:     if ($command eq 'config') {
  100:         $selinfo = 'selected="selected"';
  101:     } else {
  102:         $selconfig = 'selected="selected"';
  103:     }
  104:     my $picker = ('
  105: <form>
  106:  <nobr>
  107:   <input type="submit" value="'.&mt('Change page to:').'" />
  108:    <select name="command">
  109:     <option value="info" '.$selinfo.'">'.&mt('Display Action Items').'</option>
  110:     <option value="" '.$selconfig.'">'.&mt('Configure Settings').'</option>
  111:    </select>
  112:  </nobr>
  113: </form>');
  114:                                                                                
  115:     $r->print('<table width="100%" border="0" cellpadding="5" cellspacing="0"><tr><td width="100%">');
  116:                                                                                
  117:     if ($command eq 'config') {
  118:         &display_config_box($r,$picker);
  119:     } else {
  120:         &display_actions_box($r,$picker);
  121:     }
  122:     $r->print(<<END_OF_BLOCK);
  123:   </td>
  124:  </tr>
  125: </table><br />
  126: </body>
  127: </html>
  128: END_OF_BLOCK
  129: }
  130: 
  131: #-------------------------------
  132: # display_header
  133: #
  134: # Display the header information and set
  135: # up the HTML
  136: #-------------------------------
  137: 
  138: sub display_header{
  139:     my $html=&Apache::lonxml::xmlbegin();
  140:     my $bodytag=&Apache::loncommon::bodytag('Course Action Items');
  141:     return(<<ENDHEAD);
  142: $html
  143: <head>
  144: <title>Course Action Items</title>
  145: </head>
  146: $bodytag
  147: ENDHEAD
  148: }
  149: 
  150: #-------------------------------
  151: # display_actions_box
  152: #
  153: # Display the action items
  154: #
  155: #-------------------------------
  156:                                                                                 
  157: sub display_actions_box() {
  158:     my ($r,$picker) = @_;
  159: 
  160:     my $rowColor1 = "#ffffff";
  161:     my $rowColor2 = "#eeeeee";
  162:     my $rowColor;
  163: 
  164:     my %unread = ();
  165:     my %ungraded = ();
  166:     my %bombed = ();
  167:     my @newmsgs = ();
  168:     my @critmsgs = ();
  169:     my @newdiscussions = ();
  170:     my @tograde = ();
  171:     my @bombs = ();
  172: 
  173:     my $domain=&Apache::loncommon::determinedomain();
  174:     my $function;
  175:     if ($env{'request.role'}=~/^(cc|in|ta|ep)/) {
  176:         $function='coordinator';
  177:     }
  178:     if ($env{'request.role'}=~/^(su|dc|ad|li)/) {
  179:         $function='admin';
  180:     }
  181: 
  182:     my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
  183:     my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
  184: 
  185:     &getitems(\%unread,\%ungraded,\%bombed,\@newdiscussions,\@tograde,\@bombs);
  186:     my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);
  187: 
  188:     unless ($env{'request.course.id'}) {
  189:         $r->print('<br /><b><center>You are accessing an invalid course</center></b><br /><br />');
  190:         return;
  191:     }
  192: 
  193:     $r->print('<b>'.$picker.'</b><br /><hr width="100%" /><table border="0" width="100%" cellpadding="2" cellspacing="4"><tr><td align="left" valign="top" width="45%">');
  194: 
  195: ## UNREAD COURSE DISCUSSION POSTS ##
  196:     $r->print(<<"END");
  197:               <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">
  198:                <tr><td>
  199:                 <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
  200:                  <tr>
  201:                   <td bgcolor="$tabbg"><b>Unread course discussion posts:</b></td>
  202:                  </tr>
  203:                  <tr>
  204:                    <td bgcolor="#ffffff">
  205:                    <table cellpadding="2" cellspacing="0" border="0" width="100%">
  206: END
  207: 
  208:     if (@newdiscussions > 0) {
  209:         $r->print('<tr bgcolor="#cccccc"><td><b><small>Location</small></b></td><td><b><small>Type</small></b><td align="right"><b><small>Number of new posts</small></b></td></tr>');
  210: #        @newdiscussions = sort { &cmp_title($a,$b) } @newdiscussions;
  211:         my $rowNum = 0;
  212:         foreach my $ressymb (@newdiscussions) {
  213:             my $forum_title = $unread{$ressymb}{'title'};
  214:             my $type = 'Resource';
  215: 	    my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
  216:             if ($feedurl =~ /bulletinboard/) {
  217:                 $type = 'Bulletin Board';
  218:             }
  219:             my $unreadnum = keys(%{$unread{$ressymb}});
  220:             $unreadnum = $unreadnum - 2;
  221:             if ($unreadnum > 0) {
  222:                 if ($rowNum %2 == 1) {
  223:                     $rowColor = $rowColor1;
  224:                 } else {
  225:                     $rowColor = $rowColor2;
  226:                 }
  227:                 $r->print('<tr bgcolor="'.$rowColor.'"><td><small><a href="'.$feedurl.'?symb='.$unread{$ressymb}{symb}.'">'.$forum_title.':</a>&nbsp;</td><td><small>'.$type.'</small></td><td align="right">'.$unreadnum.'&nbsp;</td></tr>');
  228:                 $rowNum ++;
  229:             }
  230:         }
  231:     } else {
  232:         $r->print('<tr><td bgcolor="#ffffff"><br><center>&nbsp;<i><b><small>No unread posts in course discussions</small></b></i><br><br></td></tr>');
  233:     }
  234:     $r->print('</table></td></tr></table></td></tr></table><br />');
  235: 
  236: ## UNGRADED ITEMS ##
  237:     $r->print(<<END);
  238:            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">
  239:             <tr><td>
  240:              <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
  241:               <tr>
  242:                <td bgcolor="$tabbg"><b>Problems requiring handgrading:</b></td></tr>
  243:                   <tr>
  244:                    <td bgcolor="#ffffff">
  245:                      <table cellpadding="2" cellspacing="0" border="0" width="100%">
  246: END
  247: 
  248:     if (@tograde > 0) {
  249:         $r->print('<tr bgcolor="#cccccc"><td><b><small>Problem Name</small></b></td><td align="right"><b><small>Number ungraded</small></b></td></tr>');
  250:         my $rowNum = 0;
  251:         foreach my $res (@tograde) {
  252:             if ($rowNum %2 == 1) {
  253:                 $rowColor = $rowColor1;
  254:             } else {
  255:                 $rowColor = $rowColor2;
  256:             }
  257:             my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
  258:             my $linkurl=&Apache::lonnet::clutter($url);
  259:             $linkurl .= '?symb='.&Apache::lonnet::escape($res);
  260: 
  261:             $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>');
  262:             $rowNum ++;
  263:         }
  264:     } else {
  265:         $r->print('<tr><td bgcolor="#ffffff"><br><center><i><b><small>&nbsp;&nbsp;No problems require handgrading&nbsp;&nbsp;</small><br><br></b></i></td></tr>');
  266:     }
  267:     $r->print('</table></td></tr></table></td></tr></table><br />');
  268: 
  269: ## BOMBS ##
  270:      $r->print(<<"END");
  271:            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">
  272:             <tr>
  273:              <td>
  274:                <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
  275:                <tr>
  276:                 <td bgcolor="$tabbg"><b>Problems with errors</b></td>
  277:                </tr>
  278:                 <tr>
  279:                 <td bgcolor="#ffffff">
  280:                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
  281: END
  282:      my $bombnum = 0;
  283:      if (@bombs > 0) {
  284: #        @bombs = sort { &cmp_title($a,$b) } @bombs;
  285:         foreach my $bomb (@bombs) {
  286:             if ($bombnum %2 == 1) {
  287:                  $rowColor = $rowColor1;
  288:             } else {
  289:                 $rowColor = $rowColor2;
  290:             }
  291:             $r->print('<tr bgcolor="'.$rowColor.'"><td>'.$bombed{$bomb}{errorlink}.'</td></tr>');
  292:             $bombnum ++;
  293:         }
  294:     } else {
  295:         $r->print('<tr><td bgcolor="#ffffff"><br /><center><b><i><small>No problems with errors</small></i></b></center><br /></td></tr>');
  296:     }
  297:     $r->print('</table></td></tr></table></td></tr></table><br />');
  298: 
  299:     $r->print('</td><td width="5%">&nbsp;</td><td align="left" valign="top" width-"50%">');
  300: 
  301: ## MESSAGES ##
  302:     $r->print(<<END);
  303:            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">
  304:             <tr>
  305:              <td>
  306:               <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
  307:                <tr>
  308:                 <td bgcolor="$tabbg"><b>New course messages</b></td>
  309:                </tr>
  310:                <tr>
  311:                 <td bgcolor="#ffffff">
  312:                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
  313: END
  314:     if ($msgcount > 0) {
  315:         $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>');
  316:         my $rowNum = 0;
  317:         my $mailcount = 1; 
  318:         foreach my $msg (@newmsgs) {
  319:             if ($rowNum %2 == 1) {
  320:                 $rowColor = $rowColor1;
  321:             } else {
  322:                 $rowColor = $rowColor2;
  323:             }
  324:             $r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. &nbsp;<small></td><td valign="top"><small><a href="/adm/mail?">'.$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>');
  325:             $rowNum ++;
  326:             $mailcount ++;
  327:         }
  328:     } else {
  329:         $r->print('<tr><td bgcolor="#ffffff" width="100%"><center><br /><b><i><small>No new course messages</small></i></b><br /><br /></center></td></tr>');
  330:     }
  331: 
  332:     $r->print('</table></td></tr></table></td></tr></table><br />');
  333: 
  334:     $r->print(<<END);
  335:            <table border="0" cellpadding="0" cellspacing="0" bgcolor="#000000" width="100%">
  336:             <tr>
  337:              <td>
  338:               <table border="0" cellpadding="1" cellspacing="1" bgcolor="#000000" width="100%">
  339:                <tr>
  340:                 <td bgcolor="$tabbg"><b>New critical messages in course</b></td>
  341:                </tr>
  342:                <tr>                 <td bgcolor="#ffffff">
  343:                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
  344: END
  345: 
  346:     if ($critmsgcount > 0) {
  347:         $r->print('<tr bgcolor="#cccccc"><td><b><small>Number</small></b></td><td><b><small>Subject</small></b></td><td><b><small>Sender</small></b></td><td><b><small>Date/Time</small></b></td></tr>');
  348:         my $rowNum = 0;
  349:         my $mailcount = 1;
  350:         foreach my $msg (@critmsgs) {
  351:             if ($rowNum %2 == 1) {
  352:                 $rowColor = $rowColor1;
  353:             } else {
  354:                 $rowColor = $rowColor2;
  355:             }
  356:             $r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. &nbsp;<small></td><td valign="top"><small><a href="/adm/mail?">'.$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>');
  357:             $rowNum ++;
  358:             $mailcount ++;
  359:         }
  360:     } else {
  361:         $r->print('<tr><td bgcolor="#ffffff" width="100%"><center><br /><b><i><small>No unread critical messages in course</small></i></b><br /><br /></center></td></tr>');
  362:     }
  363:                                                                                
  364:     $r->print('</table></td></tr></table></td></tr></table><br />');
  365: 
  366:     $r->print('
  367:            </table>
  368:           </td>
  369:          </tr>
  370:         </table>');
  371:     $r->print('</td></tr></table>');
  372: }
  373: 
  374: sub getitems {
  375:     my ($unread,$ungraded,$bombed,$newdiscussions,$tograde,$bombs) = @_;
  376:     my $navmap = Apache::lonnavmaps::navmap->new();
  377:     my @allres=$navmap->retrieveResources();
  378:     my %discussiontime = &Apache::lonnet::dump('discussiontimes',
  379:                $env{'course.'.$env{'request.course.id'}.'.domain'},
  380:                $env{'course.'.$env{'request.course.id'}.'.num'});
  381:     my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}.'_discuss',$env{'user.domain'},$env{'user.name'},'lastread');
  382:     my %lastreadtime = ();
  383:     my @discussions = ();
  384:     my ($classlist,$keylist) = &Apache::loncoursedata::get_classlist();
  385: 
  386:     foreach my $key (keys(%lastread)) {
  387:         my $newkey = $key;
  388:         $newkey =~ s/_lastread$//;
  389:         $lastreadtime{$newkey} = $lastread{$key};
  390:     }
  391:     foreach my $resource (@allres) {
  392:         my $result = '';
  393:         my $applies = 0;
  394:         my $symb = $resource->symb();
  395:         %{$$bombed{$symb}} = ();
  396:         %{$$ungraded{$symb}} = ();
  397:         my $title = $resource->compTitle();
  398:         my $ressymb = $resource->wrap_symb();
  399: # Check for unread discussion postings
  400:         if (defined($discussiontime{$ressymb})) {
  401:             push(@discussions,$ressymb);
  402:             my $prevread = 0;
  403:             my $unreadcount = 0;
  404:             %{$$unread{$ressymb}} = ();
  405:             $$unread{$ressymb}{'title'} = $title;
  406:             $$unread{$ressymb}{'symb'} = $symb;
  407:             if (defined($lastreadtime{$ressymb})) {
  408:                 $prevread = $lastreadtime{$ressymb};
  409:             }
  410:             my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'},
  411:             $env{'course.'.$env{'request.course.id'}.'.domain'},
  412:             $env{'course.'.$env{'request.course.id'}.'.num'});
  413:             if ($contrib{'version'}) {
  414:                 for (my $id=1;$id<=$contrib{'version'};$id++) {
  415:                     unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) {
  416:                         if ($prevread <$contrib{$id.':timestamp'}) {
  417:                             $$unread{$ressymb}{$unreadcount} = $id.': '.$contrib{$id.':subject'};
  418:                             $unreadcount ++;
  419:                             push(@{$newdiscussions}, $ressymb);
  420:                         }
  421:                     }
  422:                 }
  423:             }
  424:         }
  425: 
  426: # Check for ungraded problems
  427:         if ($resource->is_problem()) {
  428:             my $ctr = 0;
  429:             my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb);
  430:             my ($partlist,$handgrade,$responseType) = &Apache::grades::response_type($url,$symb);
  431:             foreach my $student (keys(%$classlist)) {
  432:                 my ($uname,$udom) = split(/:/,$student);
  433:                 my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist);
  434:                 my $submitted = 0;
  435:                 my $graded = 0;
  436:                 foreach (keys(%status)) {
  437:                     $submitted = 1 if ($status{$_} ne 'nothing');
  438:                     $graded = 1 if ($status{$_} !~ /^correct/);
  439:                     my ($foo,$partid,$foo1) = split(/\./,$_);
  440:                     if ($status{'resource.'.$partid.'.submitted_by'} ne '') {
  441:                         $submitted = 0;
  442:                     }
  443:                 }
  444:                 next if (!$submitted || !$graded);
  445:                 $ctr ++;
  446:             }
  447:             if ($ctr) {
  448:                 $$ungraded{$symb}{count} = $ctr;
  449:                 $$ungraded{$symb}{title} = $title;
  450:                 push(@{$tograde}, $symb);
  451:             }
  452:         }
  453: 
  454: # Check for bombs
  455:         if ($resource->getErrors()) {
  456:             my $errors = $resource->getErrors();
  457:             my @bombs = split(/,/, $errors);
  458:             my $errorcount = scalar(@bombs);
  459:             my $errorlink = '<a href="/adm/email?display='.
  460:                             &Apache::lonnet::escape($$bombs[0]).'">';
  461:             $$bombed{$symb}{errorcount} = $errorcount;
  462:             $$bombed{$symb}{errorlink} = $errorlink;
  463:             push(@{$bombs}, $symb);
  464:         }
  465:     }
  466: # Compile maxtries and degree of difficulty.
  467: }
  468: 
  469: sub getmail {
  470:     my ($newmsgs,$critmsgs) = @_;
  471: # Check for unread mail in course
  472:     my $msgcount = 0;
  473: 
  474:     my @messages = &Apache::lonnet::getkeys('nohist_email');
  475:     foreach my $message (@messages) {
  476: 	my $msgid=&Apache::lonnet::escape($message);
  477:         my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)=
  478:             &Apache::lonmsg::unpackmsgid($msgid);
  479:         if ($fromcid eq $env{'request.course.id'}) {
  480:             if (defined($sendtime) && $sendtime!~/error/) {
  481:                 my $numsendtime = $sendtime;
  482:                 $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
  483:                 if ($status eq 'new') {
  484:                     $$msgcount ++;
  485:                     push(@{$newmsgs}, {
  486:                         msgid    => $msgid,
  487:                         sendtime => $sendtime,
  488:                         shortsub => &Apache::lonnet::unescape($shortsubj),
  489:                         from     => $fromname,
  490:                         fromdom  => $fromdom
  491:                         });
  492:                 }
  493:             }
  494:         }
  495:     }
  496: 
  497: # Check for critical messages in course
  498:     my %what=&Apache::lonnet::dump('critical');
  499:     my $result = '';
  500:     my $critmsgcount = 0;
  501:     foreach my $msgid (sort(keys(%what))) {
  502:         my ($sendtime,$shortsubj,$fromname,$fromdom,$fromcid,$status)=
  503:             &Apache::lonmsg::unpackmsgid($_);
  504:         if ($fromcid eq  $env{'request.course.id'}) {
  505:             if (defined($sendtime) && $sendtime!~/error/) {
  506:                 my $numsendtime = $sendtime;
  507:                 $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
  508:                 $critmsgcount ++;
  509:                 push(@{$critmsgs}, {
  510:                         msgid    => $msgid,
  511:                         sendtime => $sendtime,
  512:                         shortsub => &Apache::lonnet::unescape($shortsubj),
  513:                         from     => $fromname,
  514:                         fromdom  => $fromdom
  515:                         });
  516:             }
  517:         }
  518:     }
  519:     return ($msgcount,$critmsgcount);
  520: }
  521: 
  522: sub cmp_title {
  523:     my ($atitle,$btitle) = (lc($_[0]->compTitle),lc($_[1]->compTitle));
  524:     $atitle=~s/^\s*//;
  525:     $btitle=~s/^\s*//;
  526:     return $atitle cmp $btitle;
  527: }
  528: 
  529: 1;

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