Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.933 and 1.938

version 1.933, 2007/12/21 04:22:53 version 1.938, 2008/01/18 02:18:07
Line 2200  sub flushcourselogs { Line 2200  sub flushcourselogs {
             }              }
         }          }
         $courseidbuffer{$coursehombuf{$crsid}}{$crsid} = {          $courseidbuffer{$coursehombuf{$crsid}}{$crsid} = {
             'description' => &escape($coursedescrbuf{$crsid}),              'description' => $coursedescrbuf{$crsid},
             'inst_code'    => &escape($courseinstcodebuf{$crsid}),              'inst_code'    => $courseinstcodebuf{$crsid},
             'type'        => &escape($coursetypebuf{$crsid}),              'type'        => $coursetypebuf{$crsid},
             'owner'       => &escape($courseownerbuf{$crsid}),              'owner'       => $courseownerbuf{$crsid},
         };          };
     }      }
 #  #
Line 2399  sub get_course_adv_roles { Line 2399  sub get_course_adv_roles {
     my %coursehash=&coursedescription($cid);      my %coursehash=&coursedescription($cid);
     my %nothide=();      my %nothide=();
     foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {      foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {
  $nothide{join(':',split(/[\@\:]/,$user))}=1;          if ($user !~ /:/) {
       $nothide{join(':',split(/[\@]/,$user))}=1;
           } else {
               $nothide{$user}=1;
           }
     }      }
     my %returnhash=();      my %returnhash=();
     my %dumphash=      my %dumphash=
Line 2427  sub get_course_adv_roles { Line 2431  sub get_course_adv_roles {
 }  }
   
 sub get_my_roles {  sub get_my_roles {
     my ($uname,$udom,$context,$types,$roles,$roledoms,$withsec)=@_;      my ($uname,$udom,$context,$types,$roles,$roledoms,$withsec,$hidepriv)=@_;
     unless (defined($uname)) { $uname=$env{'user.name'}; }      unless (defined($uname)) { $uname=$env{'user.name'}; }
     unless (defined($udom)) { $udom=$env{'user.domain'}; }      unless (defined($udom)) { $udom=$env{'user.domain'}; }
     my %dumphash;      my (%dumphash,%nothide);
     if ($context eq 'userroles') {       if ($context eq 'userroles') { 
         %dumphash = &dump('roles',$udom,$uname);          %dumphash = &dump('roles',$udom,$uname);
     } else {      } else {
         %dumphash=          %dumphash=
             &dump('nohist_userroles',$udom,$uname);              &dump('nohist_userroles',$udom,$uname);
           if ($hidepriv) {
               my %coursehash=&coursedescription($udom.'_'.$uname);
               foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {
                   if ($user !~ /:/) {
                       $nothide{join(':',split(/[\@]/,$user))} = 1;
                   } else {
                       $nothide{$user} = 1;
                   }
               }
           }
     }      }
     my %returnhash=();      my %returnhash=();
     my $now=time;      my $now=time;
Line 2486  sub get_my_roles { Line 2500  sub get_my_roles {
                 }                  }
             }              }
         }          }
           if ($hidepriv) {
               if ((&privileged($username,$domain)) &&
                   (!$nothide{$username.':'.$domain})) { 
                   next;
               }
           }
         if ($withsec) {          if ($withsec) {
             $returnhash{$username.':'.$domain.':'.$role.':'.$section} =              $returnhash{$username.':'.$domain.':'.$role.':'.$section} =
                 $tstart.':'.$tend;                  $tstart.':'.$tend;
Line 2555  sub courseidput { Line 2575  sub courseidput {
         foreach my $cid (keys(%$storehash)) {          foreach my $cid (keys(%$storehash)) {
             $what .= &escape($cid).'=';              $what .= &escape($cid).'=';
             foreach my $item ('description','inst_code','owner','type') {              foreach my $item ('description','inst_code','owner','type') {
                 $what .= &escape($storehash->{$item}).':';                  $what .= &escape($storehash->{$cid}{$item}).':';
             }              }
             $what =~ s/\:$/&/;              $what =~ s/\:$/&/;
         }          }
Line 4848  sub auto_run { Line 4868  sub auto_run {
             $response = 1;              $response = 1;
         }          }
     } else {      } else {
         my $homeserver = &homeserver($cnum,$cdom);          my $homeserver;
         $response = &reply('autorun:'.$cdom,$homeserver);          if (&is_course($cdom,$cnum)) {
               $homeserver = &homeserver($cnum,$cdom);
           } else {
               $homeserver = &domain($cdom,'primary');
           }
           if ($homeserver ne 'no_host') {
               $response = &reply('autorun:'.$cdom,$homeserver);
           }
     }      }
     return $response;      return $response;
 }  }
Line 6690  sub EXT { Line 6717  sub EXT {
     if ($part eq '') { $part='0'; }      if ($part eq '') { $part='0'; }
     my @partgeneral=&EXT('resource.'.$part.'.'.$qualifierrest,      my @partgeneral=&EXT('resource.'.$part.'.'.$qualifierrest,
  $symbparm,$udom,$uname,$section,1);   $symbparm,$udom,$uname,$section,1);
     if (@partgeneral) { return &get_reply(\@partgeneral); }      if (defined($partgeneral[0])) { return &get_reply(\@partgeneral); }
  }   }
  if ($recurse) { return undef; }   if ($recurse) { return undef; }
  my $pack_def=&packages_tab_default($filename,$varname);   my $pack_def=&packages_tab_default($filename,$varname);
Line 8860  explanation of a user role term Line 8887  explanation of a user role term
   
 =item *  =item *
   
 get_my_roles($uname,$udom,$context,$types,$roles,$roledoms) :  get_my_roles($uname,$udom,$context,$types,$roles,$roledoms,$withsec) :
 All arguments are optional. Returns a hash of a roles, either for  All arguments are optional. Returns a hash of a roles, either for
 co-author/assistant author roles for a user's Construction Space  co-author/assistant author roles for a user's Construction Space
 (default), or if $context is 'userroles', roles for the user himself,  (default), or if $context is 'userroles', roles for the user himself,
Line 8868  In the hash, keys are set to colon-separ Line 8895  In the hash, keys are set to colon-separ
 (optionally) if $withsec is true, a fourth colon-separated item - $section.  (optionally) if $withsec is true, a fourth colon-separated item - $section.
 For each key, value is set to colon-separated start and end times for  For each key, value is set to colon-separated start and end times for
 the role.  If no username and domain are specified, will default to  the role.  If no username and domain are specified, will default to
 currnt user/domain. Types, roles, and roledoms are references to arrays  current user/domain. Types, roles, and roledoms are references to arrays
 of role statuses (active, future or previous), roles   of role statuses (active, future or previous), roles 
 (e.g., cc,in, st etc.) and domains of the roles which can be used  (e.g., cc,in, st etc.) and domains of the roles which can be used
 to restrict the list of roles reported. If no array ref is   to restrict the list of roles reported. If no array ref is 

Removed from v.1.933  
changed lines
  Added in v.1.938


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