Diff for /loncom/lonnet/perl/lonnet.pm between versions 1.987 and 1.988

version 1.987, 2009/02/18 06:54:22 version 1.988, 2009/03/01 01:12:23
Line 2677  sub get_course_adv_roles { Line 2677  sub get_course_adv_roles {
     my ($cid,$codes) = @_;      my ($cid,$codes) = @_;
     $cid=$env{'request.course.id'} unless (defined($cid));      $cid=$env{'request.course.id'} unless (defined($cid));
     my %coursehash=&coursedescription($cid);      my %coursehash=&coursedescription($cid);
       my $crstype = &Apache::loncommon::course_type($cid);
     my %nothide=();      my %nothide=();
     foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {      foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) {
         if ($user !~ /:/) {          if ($user !~ /:/) {
Line 2707  sub get_course_adv_roles { Line 2708  sub get_course_adv_roles {
                 $returnhash{$role}=$username.':'.$domain;                  $returnhash{$role}=$username.':'.$domain;
             }              }
         } else {          } else {
             my $key=&plaintext($role);              my $key=&plaintext($role,$crstype);
             if ($section) { $key.=' ('.&Apache::lonlocal::mt('Section [_1]',$section).')'; }              if ($section) { $key.=' ('.&Apache::lonlocal::mt('Section [_1]',$section).')'; }
             if ($returnhash{$key}) {              if ($returnhash{$key}) {
         $returnhash{$key}.=','.$username.':'.$domain;          $returnhash{$key}.=','.$username.':'.$domain;
Line 5668  sub devalidate_getgroups_cache { Line 5669  sub devalidate_getgroups_cache {
 # ------------------------------------------------------------------ Plain Text  # ------------------------------------------------------------------ Plain Text
   
 sub plaintext {  sub plaintext {
     my ($short,$type,$cid) = @_;      my ($short,$type,$cid,$forcedefault) = @_;
     if ($short =~ /^cr/) {      if ($short =~ /^cr/) {
  return (split('/',$short))[-1];   return (split('/',$short))[-1];
     }      }
     if (!defined($cid)) {      if (!defined($cid)) {
         $cid = $env{'request.course.id'};          $cid = $env{'request.course.id'};
     }      }
     if (defined($cid) && defined($env{'course.'.$cid.'.'.$short.'.plaintext'})) {      if (defined($cid) && ($env{'course.'.$cid.'.'.$short.'.plaintext'} ne '')) {
         return &Apache::lonlocal::mt($env{'course.'.$cid.'.'.$short.          unless ($forcedefault) {
                                           '.plaintext'});              my $roletext = $env{'course.'.$cid.'.'.$short.'.plaintext'}; 
               &Apache::lonlocal::mt_escape(\$roletext);
               return &Apache::lonlocal::mt($roletext);
           }
     }      }
     my %rolenames = (      my %rolenames = (
                       Course => 'std',                        Course => 'std',
Line 9416  and course level Line 9420  and course level
   
 =item *  =item *
   
 plaintext($short) : return value in %prp hash (rolesplain.tab); plain text  plaintext($short,$type,$cid,$forcedefault) : return value in %prp hash 
 explanation of a user role term  (rolesplain.tab); plain text explanation of a user role term.
   $type is Course (default) or Group.
   If $forcedefault evaluates to true, text returned will be default 
   text for $type. Otherwise, if this is a course, the text returned 
   will be a custom name for the role (if defined in the course's 
   environment).  If no custom name is defined the default is returned.
      
 =item *  =item *
   
 get_my_roles($uname,$udom,$context,$types,$roles,$roledoms,$withsec) :  get_my_roles($uname,$udom,$context,$types,$roles,$roledoms,$withsec) :

Removed from v.1.987  
changed lines
  Added in v.1.988


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