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

version 1.393, 2006/12/20 23:02:33 version 1.394, 2006/12/20 23:25:13
Line 149  sub getLinkForResource { Line 149  sub getLinkForResource {
         if (defined($res)) {          if (defined($res)) {
     my $anchor;      my $anchor;
     if ($res->is_page()) {      if ($res->is_page()) {
  foreach (@$stack) { if (defined($_)) { $anchor = $_; }  }   foreach my $item (@$stack) { if (defined($item)) { $anchor = $item; }  }
  $anchor=&escape($anchor->shown_symb());   $anchor=&escape($anchor->shown_symb());
  return ($res->link(),$res->shown_symb(),$anchor);   return ($res->link(),$res->shown_symb(),$anchor);
     }      }
Line 167  sub getLinkForResource { Line 167  sub getLinkForResource {
     # (when we first recurse on a map, it puts an undefined resource      # (when we first recurse on a map, it puts an undefined resource
     # on the bottom because $self->{HERE} isn't defined yet, and we      # on the bottom because $self->{HERE} isn't defined yet, and we
     # want the src for the map anyhow)      # want the src for the map anyhow)
     foreach (@$stack) {      foreach my $item (@$stack) {
         if (defined($_)) { $res = $_; }          if (defined($item)) { $res = $item; }
     }      }
   
     return ($res->link(),$res->shown_symb());      return ($res->link(),$res->shown_symb());
Line 904  sub render_communication_status { Line 904  sub render_communication_status {
           
     if ($resource->getFeedback()) {      if ($resource->getFeedback()) {
         my $feedback = $resource->getFeedback();          my $feedback = $resource->getFeedback();
         foreach (split(/\,/, $feedback)) {          foreach my $msgid (split(/\,/, $feedback)) {
             if ($_) {              if ($msgid) {
                 $feedbackHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $feedbackHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='
                     . &escape($_) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New Email').'" src="'.$location.'/feedback.gif" '                      . '<img alt="'.&mt('New Email').'" src="'.$location.'/feedback.gif" '
                     . 'border="0" /></a>';                      . 'border="0" /></a>';
             }              }
Line 917  sub render_communication_status { Line 917  sub render_communication_status {
     if ($resource->getErrors()) {      if ($resource->getErrors()) {
         my $errors = $resource->getErrors();          my $errors = $resource->getErrors();
         my $errorcount = 0;          my $errorcount = 0;
         foreach (split(/,/, $errors)) {          foreach my $msgid (split(/,/, $errors)) {
             last if ($errorcount>=10); # Only output 10 bombs maximum              last if ($errorcount>=10); # Only output 10 bombs maximum
             if ($_) {              if ($msgid) {
                 $errorcount++;                  $errorcount++;
                 $errorHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='                  $errorHTML .= '&nbsp;<a '.$target.' href="/adm/email?display='
                     . &escape($_) . '">'                      . &escape($msgid) . '">'
                     . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" '                      . '<img alt="'.&mt('New Error').'" src="'.$location.'/bomb.gif" '
                     . 'border="0" /></a>';                      . 'border="0" /></a>';
             }              }
Line 1126  sub render { Line 1126  sub render {
     # marker      # marker
     my $filterHash = {};      my $filterHash = {};
     # Figure out what we're not displaying      # Figure out what we're not displaying
     foreach (split(/\,/, $env{"form.filter"})) {      foreach my $item (split(/\,/, $env{"form.filter"})) {
         if ($_) {          if ($item) {
             $filterHash->{$_} = "1";              $filterHash->{$item} = "1";
         }          }
     }      }
   
Line 1901  sub generate_email_discuss_status { Line 1901  sub generate_email_discuss_status {
     my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss',      my %lastread = &Apache::lonnet::dump('nohist_'.$cid.'_discuss',
                                         $env{'user.domain'},$env{'user.name'},'lastread');                                          $env{'user.domain'},$env{'user.name'},'lastread');
     my %lastreadtime = ();      my %lastreadtime = ();
     foreach (keys %lastread) {      foreach my $key (keys %lastread) {
         my $key = $_;          my $shortkey = $key;
         $key =~ s/_lastread$//;          $shortkey =~ s/_lastread$//;
         $lastreadtime{$key} = $lastread{$_};          $lastreadtime{$shortkey} = $lastread{$key};
     }      }
   
     my %feedback=();      my %feedback=();
Line 3122  sub next { Line 3122  sub next {
   
     # filter the next possibilities to remove things we've       # filter the next possibilities to remove things we've 
     # already seen.      # already seen.
     foreach (@$nextUnfiltered) {      foreach my $item (@$nextUnfiltered) {
         if (!defined($self->{ALREADY_SEEN}->{$_->{ID}})) {          if (!defined($self->{ALREADY_SEEN}->{$item->{ID}})) {
             push @$next, $_;              push @$next, $item;
         }          }
     }      }
   
Line 3857  for the resource, or the null string if Line 3857  for the resource, or the null string if
 email data was not extracted when the nav map was constructed. Usually  email data was not extracted when the nav map was constructed. Usually
 used like this:  used like this:
   
  for (split(/\,/, $res->getFeedback())) {   for my $url (split(/\,/, $res->getFeedback())) {
     my $link = &escape($_);      my $link = &escape($url);
     ...      ...
   
 and use the link as appropriate.  and use the link as appropriate.
Line 4052  sub extractParts { Line 4052  sub extractParts {
  $self->{PART_TYPE} = {};   $self->{PART_TYPE} = {};
  return;   return;
     }      }
     foreach (split(/\,/,$metadata)) {      foreach my $entry (split(/\,/,$metadata)) {
  if ($_ =~ /^(?:part|Task)_(.*)$/) {   if ($entry =~ /^(?:part|Task)_(.*)$/) {
     my $part = $1;      my $part = $1;
     # This floods the logs if it blows up      # This floods the logs if it blows up
     if (defined($parts{$part})) {      if (defined($parts{$part})) {
Line 4078  sub extractParts { Line 4078  sub extractParts {
   
   
         # Init the responseIdHash          # Init the responseIdHash
         foreach (@{$self->{PARTS}}) {          foreach my $part (@{$self->{PARTS}}) {
             $responseIdHash{$_} = [];              $responseIdHash{$part} = [];
         }          }
   
         # Now, the unfortunate thing about this is that parts, part name, and          # Now, the unfortunate thing about this is that parts, part name, and
Line 4159  the completion information. Line 4159  the completion information.
 Idiomatic usage of these two methods would probably look something  Idiomatic usage of these two methods would probably look something
 like  like
   
  foreach ($resource->parts()) {   foreach my $part ($resource->parts()) {
     my $dateStatus = $resource->getDateStatus($_);      my $dateStatus = $resource->getDateStatus($part);
     my $completionStatus = $resource->getCompletionStatus($_);      my $completionStatus = $resource->getCompletionStatus($part);
   
     or      or
   
     my $status = $resource->status($_);      my $status = $resource->status($part);
   
     ... use it here ...      ... use it here ...
  }   }

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


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