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

raeburn raeburn@source.lon-capa.org
Wed, 02 Jun 2010 15:17:07 -0000


raeburn		Wed Jun  2 15:17:07 2010 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - Bug 6294. 
  - regexp to extract role, domain, num was changed in 1.240. Matches
    $1, $2 and $3 updated accordingly. 
  - Eliminate <tr></tr>
  - &display_cc_role() returns an array.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.248 loncom/auth/lonroles.pm:1.249
--- loncom/auth/lonroles.pm:1.248	Wed Jun  2 14:55:37 2010
+++ loncom/auth/lonroles.pm	Wed Jun  2 15:17:07 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.248 2010/06/02 14:55:37 raeburn Exp $
+# $Id: lonroles.pm,v 1.249 2010/06/02 15:17:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -780,17 +780,26 @@
 	    if (ref($roletext{'user.role.'.$role}) eq 'ARRAY') {
 		$output.= &Apache::loncommon::start_data_table_row().
                           $roletext{'user.role.'.$role}->[0].
-                          &Apache::loncommon::end_data_table_row().
-                          &Apache::loncommon::continue_data_table_row().
-                          $roletext{'user.role.'.$role}->[1].
                           &Apache::loncommon::end_data_table_row();
+                if ($roletext{'user.role.'.$role}->[1] ne '') {
+                    $output .= &Apache::loncommon::continue_data_table_row().
+                               $roletext{'user.role.'.$role}->[1].
+                               &Apache::loncommon::end_data_table_row();
+                }
                 if ($role =~ m{dc\./($match_domain)/} 
 		    && $dcroles{$1}) {
 		    $output .= &adhoc_roles_row($1,'recent');
                 }
 	    } elsif ($numdc > 0) {
                 unless ($role =~/^error\:/) {
-                    $output.=&display_cc_role('user.role.'.$_);
+                    my ($roletext,$role_text_end) = &display_cc_role('user.role.'.$role);
+                    $output.= &Apache::loncommon::start_data_table_row().
+                              $roletext.
+                              &Apache::loncommon::end_data_table_row().
+                              &Apache::loncommon::continue_data_table_row().
+                              $role_text_end.
+                              &Apache::loncommon::end_data_table_row();
+                    $output.=&display_cc_role('user.role.'.$role);
                 }
             }
 	}
@@ -1542,8 +1551,10 @@
     unless ($rolekey =~/^error\:/) {
         if ($rolekey =~ m{^user\.role\.(cc|co)\./($match_domain)/($match_courseid)$}) {
             my $ccrole = $1;
-            my $tcourseid = $2.'_'.$3;
-            my $trolecode = $1.'./'.$2.'/'.$3;
+            my $tdom = $2;
+            my $trest = $3;
+            my $tcourseid = $tdom.'_'.$trest;
+            my $trolecode = $ccrole.'./'.$tdom.'/'.$trest;
             my $twhere;
             my $ttype;
             my $tbg='LC_roles_is';
@@ -1551,7 +1562,7 @@
             if (%newhash) {
                 $twhere=$newhash{'description'}.
                         ' <span style="LC_fontsize_small">'.
-                        &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1).
+                        &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom).
                         '</span>';
                 $ttype = $newhash{'type'};
             } else {
@@ -1560,7 +1571,7 @@
             }
             my $trole = &Apache::lonnet::plaintext($ccrole,$ttype,$tcourseid);
             $twhere.="<br />".&mt('Domain').":".$1;
-            ($roletext,$roletext_end) = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
+            ($roletext,$roletext_end) = &build_roletext($trolecode,$tdom,$trest,'is',$tryagain,$advanced,'',$tbg,$trole,$twhere,'','','',1,'');
         }
     }
     return ($roletext,$roletext_end);
@@ -1578,7 +1589,7 @@
     my $carole = &Apache::lonnet::plaintext('ca');
     my $selectcalink = &coauthorlink($dcdom,$rowtype);
     $output.=$ccrole.': '.$selectcclink
-            .' | '.$carole.': '.$selectcalink
+            .' | '.$carole.': '.$selectcalink.'</td>'
             .&Apache::loncommon::end_data_table_row();
     return $output;
 }