[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm /interface lonpreferences.pm /lonnet/perl lonnet.pm

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 26 Jun 2006 18:56:50 -0000


albertel		Mon Jun 26 14:56:50 2006 EDT

  Modified files:              
    /loncom/lonnet/perl	lonnet.pm 
    /loncom/auth	lonroles.pm 
    /loncom/interface	lonpreferences.pm 
  Log:
  - extend plaintext to handle cr roles
  - lonroles makes use of the improved plaintext
  - from mlucas
  
  
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.757 loncom/lonnet/perl/lonnet.pm:1.758
--- loncom/lonnet/perl/lonnet.pm:1.757	Thu Jun 22 11:34:16 2006
+++ loncom/lonnet/perl/lonnet.pm	Mon Jun 26 14:56:03 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # TCP networking package
 #
-# $Id: lonnet.pm,v 1.757 2006/06/22 15:34:16 albertel Exp $
+# $Id: lonnet.pm,v 1.758 2006/06/26 18:56:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1885,9 +1885,6 @@
 	    (!$nothide{$username.':'.$domain})) { next; }
 	if ($role eq 'cr') { next; }
         my $key=&plaintext($role);
-	if ($role =~ /^cr/) {
-	    $key=(split('/',$role))[3];
-	}
         if ($section) { $key.=' (Sec/Grp '.$section.')'; }
         if ($returnhash{$key}) {
 	    $returnhash{$key}.=','.$username.':'.$domain;
@@ -4113,6 +4110,9 @@
 
 sub plaintext {
     my ($short,$type,$cid) = @_;
+    if ($short =~ /^cr/) {
+	return (split('/',$short))[-1];
+    }
     if (!defined($cid)) {
         $cid = $env{'request.course.id'};
     }
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.158 loncom/auth/lonroles.pm:1.159
--- loncom/auth/lonroles.pm:1.158	Thu Jun 22 19:22:47 2006
+++ loncom/auth/lonroles.pm	Mon Jun 26 14:56:37 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.158 2006/06/22 23:22:47 albertel Exp $
+# $Id: lonroles.pm,v 1.159 2006/06/26 18:56:37 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -516,10 +516,8 @@
 		    if ($tremark) { $tremark.='<br />'; }
                     $tremark.=&mt('Defined by ').$rauthor.
 			&mt(' at ').$rdomain.'.';
-                    $trole=$rrole;
-                } else {
-                    $trole=Apache::lonnet::plaintext($role);
-                }
+		}
+		$trole=Apache::lonnet::plaintext($role);
                 my $ttype;
                 my $twhere;
                 my ($tdom,$trest,$tsection)=
Index: loncom/interface/lonpreferences.pm
diff -u loncom/interface/lonpreferences.pm:1.92 loncom/interface/lonpreferences.pm:1.93
--- loncom/interface/lonpreferences.pm:1.92	Thu Jun 22 19:30:33 2006
+++ loncom/interface/lonpreferences.pm	Mon Jun 26 14:56:50 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Preferences
 #
-# $Id: lonpreferences.pm,v 1.92 2006/06/22 23:30:33 albertel Exp $
+# $Id: lonpreferences.pm,v 1.93 2006/06/26 18:56:50 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -307,7 +307,7 @@
         my %frozen_roles =
                &Apache::lonhtmlcommon::get_recent_frozen('roles',$env{'environment.recentrolesn'});
         
-        my %role_text = &rolespref_get_role_text(keys(%recent_roles));
+        my %role_text = &rolespref_get_role_text([keys(%recent_roles)]);
         my @sorted_roles = sort {$role_text{$a} cmp $role_text{$b}} keys(%role_text);
 
         $roles_check_list .=
@@ -364,10 +364,11 @@
     foreach my $item (@$roles) {
 # get course information
         my ($role,$rest) = split(/\./, $item);
-        my $trole = &Apache::lonnet::plaintext($role);
+        my $trole = "";
+        $trole = &Apache::lonnet::plaintext($role);
         my ($tdomain,$other,$tsection)= split(/\//,Apache::lonnet::declutter($rest));
         my $tother = '-';
-        if ($role =~ /cc|st|in|ta/ ) {
+        if ($role =~ /^(cc|st|in|ta|ep|cr)/ ) {
             my %newhash=&Apache::lonnet::coursedescription($tdomain."_".$other);
             $tother = " - ".$newhash{'description'};
         } elsif ($role =~ /dc/) {