Diff for /loncom/interface/lonnavmaps.pm between versions 1.392 and 1.393

version 1.392, 2006/10/23 22:48:27 version 1.393, 2006/12/20 23:02:33
Line 2034  sub last_post_time { Line 2034  sub last_post_time {
     return $self->{DISCUSSION_TIME}->{$ressymb};      return $self->{DISCUSSION_TIME}->{$ressymb};
 }  }
   
 sub unread_discussion {  sub discussion_info {
     my $self = shift;      my $self = shift;
     my $symb = shift;      my $symb = shift;
       my $filter = shift;
   
     $self->get_discussion_data();      $self->get_discussion_data();
   
Line 2048  sub unread_discussion { Line 2049  sub unread_discussion {
   
     my $prevread = $self->{LAST_READ}{$ressymb};      my $prevread = $self->{LAST_READ}{$ressymb};
   
     my $unreadcount = 0;      my $count = 0;
     my $hiddenflag = 0;      my $hiddenflag = 0;
     my $deletedflag = 0;      my $deletedflag = 0;
     my ($hidden,$deleted);      my ($hidden,$deleted,%info);
   
     my %subjects;  
   
     for (my $id=$version; $id>0; $id--) {      for (my $id=$version; $id>0; $id--) {
  my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb};   my $vkeys=$self->{DISCUSSION_DATA}{$id.':keys:'.$discsymb};
Line 2069  sub unread_discussion { Line 2068  sub unread_discussion {
  $deletedflag = 1;   $deletedflag = 1;
     }      }
  } else {   } else {
     if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)      if (($hidden !~/\.$id\./) && ($deleted !~/\.$id\./)) {
  && $prevread < $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) {                  if ($filter eq 'unread') {
     $unreadcount++;      if ($prevread >= $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'}) {
     $subjects{$unreadcount}=                          next;
  $id.': '.$self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'};                      }
  }                  }
    $count++;
    $info{$count}{'subject'} =
       $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':subject'};
                   $info{$count}{'id'} = $id;
                   $info{$count}{'timestamp'} = $self->{DISCUSSION_DATA}{$id.':'.$discsymb.':timestamp'};
               }
  }   }
     }      }
     if (wantarray) {      if (wantarray) {
  return ($unreadcount,\%subjects);   return ($count,%info);
     }      }
     return $unreadcount      return $count;
 }  }
   
 sub wrap_symb {  sub wrap_symb {
Line 3835  data was not extracted when the nav map Line 3840  data was not extracted when the nav map
 Returns a false value if there hasn't been discussion otherwise returns  Returns a false value if there hasn't been discussion otherwise returns
 unix timestamp of last time a discussion posting (or edit) was made.  unix timestamp of last time a discussion posting (or edit) was made.
   
 =item * B<unread_discussion>:  =item * B<discussion_info>:
   
 returns in scalar context the count of the number of unread discussion  optional argument is a filter (currently can be 'unread');
 postings  returns in scalar context the count of the number of discussion postings.
   
 returns in list context both the count of postings and a hash ref  returns in list context both the count of postings and a hash ref
 containing the subjects of all unread postings  containing information about the postings (subject, id, timestamp) in a hash.
   
   Default is to return counts for all postings.  However if called with a second argument set to 'unread', will return information about only unread postings.
   
 =item * B<getFeedback>:  =item * B<getFeedback>:
   
Line 3868  sub last_post_time { Line 3875  sub last_post_time {
     return $self->{NAV_MAP}->last_post_time($self->symb());      return $self->{NAV_MAP}->last_post_time($self->symb());
 }  }
   
 sub unread_discussion {  sub discussion_info {
     my $self = shift;      my ($self,$filter) = @_;
     return $self->{NAV_MAP}->unread_discussion($self->symb());      return $self->{NAV_MAP}->discussion_info($self->symb(),$filter);
 }  }
   
 sub getFeedback {  sub getFeedback {

Removed from v.1.392  
changed lines
  Added in v.1.393


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