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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 15 May 2008 01:00:38 -0000


raeburn		Wed May 14 21:00:38 2008 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - More compact display for ad hoc roles available to a DC
  - Fix some unbalanced <tr> tags in Recent roles rows.
  - Fix some xhtml - ordering of </span></font>, <input /> etc. (incomplete - font color="" needs to be from css).
  Work in progress.
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.191 loncom/auth/lonroles.pm:1.192
--- loncom/auth/lonroles.pm:1.191	Wed May 14 19:52:52 2008
+++ loncom/auth/lonroles.pm	Wed May 14 21:00:37 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.191 2008/05/14 23:52:52 raeburn Exp $
+# $Id: lonroles.pm,v 1.192 2008/05/15 01:00:37 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -719,7 +719,7 @@
                 $r->print('<tr bgcolor="#77FF77">');
             }
             $r->print('<td></td><td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified').
-                      '</font></span></td><td><font color="'.$tfont.'">'.$tremark.
+                      '</span></font></td><td><font color="'.$tfont.'">'.$tremark.
                       '&nbsp;</font></td></tr>'."\n");
 
             $r->print('</table>');
@@ -752,8 +752,7 @@
 		$output.=$roletext{'user.role.'.$_};
                 if ($_ =~ m-dc\./($match_domain)/- 
 		    && $dcroles{$1}) {
-		    $output .= &allcourses_row($1,'recent').
-                               &allcoauthors_row($1,'recent');
+		    $output .= &adhoc_roles_row($1,'recent');
                 }
 	    } elsif ($numdc > 0) {
                 unless ($_ =~/^error\:/) {
@@ -763,9 +762,8 @@
 	}
 	if ($output) {
 	    $r->print("<tr><td align='center' colspan='5'><font face='arial'>".
-		      &mt('Recent Roles')."</font></td>");
+		      &mt('Recent Roles')."</font></td></tr>");
 	    $r->print($output);
-	    $r->print("</tr>");
             $doheaders ++;
 	}
     }
@@ -787,13 +785,13 @@
     unless ($nochoose) {
 	if ($env{'request.role'} ne 'cm') {
 	    $r->print('<td><input type="submit" value="'.
-		      &mt('Select').'" name="cm"></td>');
+		      &mt('Select').'" name="cm" /></td>');
 	} else {
 	    $r->print('<td>&nbsp;</td>');
 	}
     }
     $r->print('<td colspan="3"><font color="'.$tfont.'"><span class="LC_rolesinfo">'.&mt('No role specified').
-      '</font></span></td><td><font color="'.$tfont.'">'.$tremark.
+      '</span></font></td><td><font color="'.$tfont.'">'.$tremark.
       '&nbsp;</font></td></tr>'."\n");
 
     $r->print('</table>');
@@ -857,8 +855,7 @@
                         if ($sortrole->{$which} =~ m-dc\./($match_domain)/-) {
                             if (ref($dcroles) eq 'HASH') {
                                 if ($dcroles->{$1}) {
-                                    $output .= &allcourses_row($1,'').
-                                               &allcoauthors_row($1,'');
+                                    $output .= &adhoc_roles_row($1,'');
                                 }
                             }
                         }
@@ -997,17 +994,17 @@
         } elsif ($tstatus eq 'is') {
             $roletext.='<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
                         &mt('Select').'" onClick="javascript:enterrole(this.form,\''.
-                        $trolecode."','".$buttonname.'\');"></td>';
+                        $trolecode."','".$buttonname.'\');" /></td>';
         } elsif ($tryagain) {
             $roletext.=
                 '<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
                 &mt('Try Selecting Again').'" onClick="javascript:enterrole(this.form,\''.
-                        $trolecode."','".$buttonname.'\');"></td>';
+                        $trolecode."','".$buttonname.'\');" /></td>';
         } elsif ($advanced) {
             $roletext.=
                 '<td'.$rowspan.'><input name="'.$buttonname.'" type="button" value="'.
                 &mt('Re-Initialize').'" onClick="javascript:enterrole(this.form,\''.
-                        $trolecode."','".$buttonname.'\');"></td>';
+                        $trolecode."','".$buttonname.'\');" /></td>';
         } else {
             $roletext.='<td'.$rowspan.'>&nbsp;</td>';
         }
@@ -1225,28 +1222,23 @@
     return ($roletext);
 }
 
-sub allcourses_row {
+sub adhoc_roles_row {
     my ($dcdom,$rowtype) = @_;
     my $output = '<tr bgcolor="#77FF77">'.
-                 ' <td colspan="5">';
+                 ' <td colspan="5"><table><tr><td><span class="LC_rolesinfo">'
+                 .&mt('[_1]Ad hoc[_2] roles in domain [_3] --',
+                 '<span class="LC_cusr_emph">','</span>',$dcdom).'</span></td><td>';
     my $selectlink = &courselink($dcdom,$rowtype);
     my $ccrole = &Apache::lonnet::plaintext('cc');
-    $output.= '<span class="LC_rolesinfo">'.
-            &mt('[_1]: [_2] from domain [_3]',$ccrole,$selectlink,$dcdom).
-            '</span><br /></tr>'."\n";
-    return $output;
-}
-
-sub allcoauthors_row {
-    my ($dcdom,$rowtype) = @_;
-    my $output = '<tr bgcolor="#77FF77">'.
-                 ' <td colspan="5">';
     my $carole = &Apache::lonnet::plaintext('ca');
     my $inputlink='<input type="text" size="10" name="adhoccauname'.$rowtype.'.'.$dcdom.'" />';
     my $gobutton='<input type="submit" name="adhocca./'.$dcdom.'" value="'.&mt('Go').'" />';
     $output.= '<span class="LC_rolesinfo">'.
-            &mt('[_1]: [_2] in domain [_3] [_4]',$carole,$inputlink,$dcdom,$gobutton).
-            '</span><br /></tr><tr><td colspan="5" height="3"></td></tr>'."\n";
+            &mt('[_1]: [_2]',$ccrole,$selectlink).
+            '</span><br /></td><td>&nbsp;&nbsp;</td><td><span class="LC_rolesinfo">'.
+            &mt('[_1]: [_2] [_3]',$carole,$inputlink,$gobutton).
+            '</span><br /></td></tr></table></td></tr>'.
+            '<tr><td colspan="5" height="3"></td></tr>'."\n";
     return $output;
 }