[LON-CAPA-cvs] cvs: loncom /auth lonroles.pm

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 08 Nov 2003 21:51:44 -0000


albertel		Sat Nov  8 16:51:44 2003 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - addresses Gerd's concern, puts a header seperator if the user has more than one class of roles
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.75 loncom/auth/lonroles.pm:1.76
--- loncom/auth/lonroles.pm:1.75	Sat Nov  8 07:06:38 2003
+++ loncom/auth/lonroles.pm	Sat Nov  8 16:51:44 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.75 2003/11/08 12:06:38 albertel Exp $
+# $Id: lonroles.pm,v 1.76 2003/11/08 21:51:44 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -519,11 +519,31 @@
 	    }
         }
     }
-    foreach my $type ('Construction Space','Course','Domain','System') {
+    my $doheaders=-1;
+    foreach my $type (&mt('Construction Space'),&mt('Course'),
+		      &mt('Domain'),&mt('System')) {
+	my $haverole=0;
 	foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
 	    if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { 
-		$r->print($roletext{$sortrole{$which}});
+		$haverole=1;
 	    }
+	}
+	if ($haverole) { $doheaders++; }
+    }
+    foreach my $type (&mt('Construction Space'),&mt('Course'),
+		      &mt('Domain'),&mt('System')) {
+	my $output;
+	foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
+	    if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { 
+		$output.=$roletext{$sortrole{$which}};
+	    }
+	}
+	if ($output) {
+	    if ($doheaders > 0) {
+		$r->print("<tr bgcolor='#99ff99'>".
+			  "<td align='center' colspan='7'>$type</td>");
+	    }
+	    $r->print($output);	    
 	}
     }
     my $tremark='';