Diff for /loncom/interface/lonnavmaps.pm between versions 1.321 and 1.325

version 1.321, 2005/04/11 12:20:22 version 1.325, 2005/04/15 21:28:54
Line 1588  END Line 1588  END
     my @allres=$navmap->retrieveResources();      my @allres=$navmap->retrieveResources();
     foreach my $resource (@allres) {      foreach my $resource (@allres) {
  if ($resource->hasDiscussion()) {   if ($resource->hasDiscussion()) {
     my $ressymb = $resource->symb();      $haveDisc .= $resource->wrap_symb().':';
                     if ($ressymb =~ m-___adm/\w+/\w+/\d+/bulletinboard$-) {  
                         $ressymb = $resource->wrap_symb();  
     }  
     $haveDisc .= $ressymb.':';  
     $totdisc ++;      $totdisc ++;
  }   }
     }      }
Line 2118  sub generate_course_user_opt { Line 2114  sub generate_course_user_opt {
     my $udom=$env{'user.domain'};      my $udom=$env{'user.domain'};
     my $uhome=$env{'user.home'};      my $uhome=$env{'user.home'};
     my $cid=$env{'request.course.id'};      my $cid=$env{'request.course.id'};
     my $chome=$env{'course.'.$cid.'.home'};  
     my ($cdom,$cnum)=split(/\_/,$cid);      my ($cdom,$cnum)=split(/\_/,$cid);
           
     my $userprefix=$uname.'_'.$udom.'_';      my %useropt; my %courseopt;
       
     my %courserdatas; my %useropt; my %courseopt; my %userrdatas;  
     unless ($uhome eq 'no_host') {       unless ($uhome eq 'no_host') { 
 # ------------------------------------------------- Get coursedata (if present)  # ------------------------------------------------- Get coursedata (if present)
  unless ((time-$courserdatas{$cid.'.last_cache'})<240) {   %courseopt=&Apache::lonnet::dump('resourcedata',$cdom,$cnum);
     my $reply=&Apache::lonnet::reply('dump:'.$cdom.':'.$cnum.   # Check for network failure
      ':resourcedata',$chome);   my ($tmp)=keys(%courseopt);
     # Check for network failure  
     if ( $reply =~ /no.such.host/i || $reply =~ /con_lost/i) {   if ( $tmp =~ /no.such.host/i || $tmp =~ /con_lost/i) {
  $self->{NETWORK_FAILURE} = 1;      $self->{NETWORK_FAILURE} = 1;
     } elsif ($reply!~/^error\:/) {      undef(%courseopt);
  $courserdatas{$cid}=$reply;   } elsif ($tmp=~/^error\:/) {
  $courserdatas{$cid.'.last_cache'}=time;      undef(%courseopt);
     }  
  }  
  foreach (split(/\&/,$courserdatas{$cid})) {  
     my ($name,$value)=split(/\=/,$_);  
     $courseopt{$userprefix.&Apache::lonnet::unescape($name)}=  
  &Apache::lonnet::unescape($value);  
  }   }
   
 # --------------------------------------------------- Get userdata (if present)  # --------------------------------------------------- Get userdata (if present)
  unless ((time-$userrdatas{$uname.'___'.$udom.'.last_cache'})<240) {  
     my $reply=&Apache::lonnet::reply('dump:'.$udom.':'.$uname.':resourcedata',$uhome);   %useropt=&Apache::lonnet::dump('resourcedata',$udom,$uname);
     if ($reply!~/^error\:/) {   ($tmp)=keys(%courseopt);
  $userrdatas{$uname.'___'.$udom}=$reply;   if ($tmp=~/^error\:/) {
  $userrdatas{$uname.'___'.$udom.'.last_cache'}=time;      undef(%useropt);
     }   } elsif ( $tmp=~/no.such.host/i || $tmp=~/con.lost/i ) {
     # check to see if network failed      # check to see if network failed
     elsif ( $reply=~/no.such.host/i || $reply=~/con.*lost/i )      $self->{NETWORK_FAILURE} = 1;
     {      undef(%useropt);
  $self->{NETWORK_FAILURE} = 1;  
     }  
  }  
  foreach (split(/\&/,$userrdatas{$uname.'___'.$udom})) {  
     my ($name,$value)=split(/\=/,$_);  
     $useropt{$userprefix.&Apache::lonnet::unescape($name)}=  
  &Apache::lonnet::unescape($value);  
  }   }
  $self->{COURSE_OPT} = \%courseopt;   $self->{COURSE_OPT} = \%courseopt;
  $self->{USER_OPT} = \%useropt;   $self->{USER_OPT} = \%useropt;
Line 2195  sub generate_email_discuss_status { Line 2176  sub generate_email_discuss_status {
   
     my %feedback=();      my %feedback=();
     my %error=();      my %error=();
     my $keys = &Apache::lonnet::reply('keys:'.      my @keys = &Apache::lonnet::getkeys('nohist_email',$env{'user.domain'},
       $env{'user.domain'}.':'.   $env{'user.name'});
       $env{'user.name'}.':nohist_email',  
       $env{'user.home'});  
           
     foreach my $msgid (split(/\&/, $keys)) {      foreach my $msgid (@keys) {
  $msgid=&Apache::lonnet::unescape($msgid);  
  if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) {   if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) {
     my $plain=      my $plain=
  &Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid));   &Apache::lonnet::unescape(&Apache::lonnet::unescape($msgid));
Line 2285  sub hasDiscussion { Line 2263  sub hasDiscussion {
   
     #return defined($self->{DISCUSSION_TIME}->{$symb});      #return defined($self->{DISCUSSION_TIME}->{$symb});
   
 # backward compatibility (bulletin boards used to be 'wrapped')      # backward compatibility (bulletin boards used to be 'wrapped')
     my $ressymb = $symb;      my $ressymb = $self->wrap_symb($symb);
     if ($ressymb =~ m-___adm/\w+/\w+/\d+/bulletinboard$-) {  
         $ressymb = $self->wrap_symb($ressymb);  
     }  
     if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) {      if ( defined ( $self->{LAST_READ}->{$ressymb} ) ) {
         return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb};          return $self->{DISCUSSION_TIME}->{$ressymb} > $self->{LAST_READ}->{$ressymb};
     } else {      } else {
Line 2298  sub hasDiscussion { Line 2273  sub hasDiscussion {
     }      }
 }  }
   
 # Private method: Does the given resource (as a symb string) have  
 # current feedback? Returns the string in the feedback hash, which  
 # will be false if it does not exist.  
   
 sub wrap_symb {  sub wrap_symb {
     my $self=shift;      my $self = shift;
     my $symb = shift;      my $symb = shift;
     my $ressymb = $symb;      if ($symb =~ m-___(adm/\w+/\w+/)(\d+)(/bulletinboard)$-) {
     if ($ressymb =~ m-___(adm/\w+/\w+/)(\d+)(/bulletinboard)$-) {          unless ($symb =~ m|adm/wrapper/adm|) {
         unless ($ressymb =~ m|adm/wrapper/adm|) {              $symb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3;
             $ressymb = 'bulletin___'.$2.'___adm/wrapper/'.$1.$2.$3;  
         }          }
     }      }
     return $ressymb;      return $symb;
 }  }
   
   # Private method: Does the given resource (as a symb string) have
   # current feedback? Returns the string in the feedback hash, which
   # will be false if it does not exist.
   
 sub getFeedback {   sub getFeedback { 
     my $self = shift;      my $self = shift;
     my $symb = shift;      my $symb = shift;
Line 2469  sub parmval_real { Line 2443  sub parmval_real {
   
     my $symbparm=$symb.'.'.$what;      my $symbparm=$symb.'.'.$what;
     my $mapparm=$mapname.'___(all).'.$what;      my $mapparm=$mapname.'___(all).'.$what;
     my $usercourseprefix=$uname.'_'.$udom.'_'.$cid;      my $usercourseprefix=$cid;
   
     my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what;      my $seclevel= $usercourseprefix.'.['.$csec.'].'.$what;
     my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm;      my $seclevelr=$usercourseprefix.'.['.$csec.'].'.$symbparm;

Removed from v.1.321  
changed lines
  Added in v.1.325


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