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

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 08 Nov 2005 21:54:06 -0000


albertel		Tue Nov  8 16:54:06 2005 EDT

  Modified files:              
    /loncom/auth	lonroles.pm 
  Log:
  - the roles screen got some reorg to increase the space avaible for remarks, and to better associate the DC role with the associated line for the CC in any course line.
  
  
  
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.131 loncom/auth/lonroles.pm:1.132
--- loncom/auth/lonroles.pm:1.131	Tue Nov  1 16:59:24 2005
+++ loncom/auth/lonroles.pm	Tue Nov  8 16:54:03 2005
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # User Roles Screen
 #
-# $Id: lonroles.pm,v 1.131 2005/11/01 21:59:24 albertel Exp $
+# $Id: lonroles.pm,v 1.132 2005/11/08 21:54:03 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -461,7 +461,8 @@
                 my $trole;
                 if ($role =~ /^cr\//) {
                     my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
-                    $tremark.='<br />'.&mt('Defined by ').$rauthor.
+		    if ($tremark) { $tremark.='<br />'; }
+                    $tremark.=&mt('Defined by ').$rauthor.
 			&mt(' at ').$rdomain.'.';
                     $trole=$rrole;
                 } else {
@@ -589,8 +590,7 @@
     $r->print('<br /><table><tr>');
     unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }
     $r->print('<th>'.&mt('User Role').'</th><th>'.&mt('Extent').
-         '</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'.
-	      &mt('Remarks and Calendar Announcements').'</th></tr>'."\n");
+         '</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th></tr>'."\n");
     my $doheaders=-1;
     foreach my $type ('Domain','Construction Space','Course','System') {
 	my $haverole=0;
@@ -616,7 +616,7 @@
             } 
 	}
 	if ($output) {
-	    $r->print("<tr><td align='center' colspan='6'><font face='arial'>".
+	    $r->print("<tr><td align='center' colspan='5'><font face='arial'>".
 		      &mt('Recent Roles')."</font></td>");
 	    $r->print($output);
 	    $r->print("</tr>");
@@ -628,7 +628,7 @@
         $r->print(&coursepick_jscript());
         $r->print(&Apache::loncommon::coursebrowser_javascript());
     }
-    foreach my $type ('Construction Space','Course','Domain','System') {
+    foreach my $type ('Construction Space','Domain','Course','System') {
 	my $output;
 	foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
 	    if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) { 
@@ -643,7 +643,7 @@
 	if ($output) {
 	    if ($doheaders > 0) {
 		$r->print("<tr>".
-			  "<td align='center' colspan='6'><font face='arial'>".&mt($type)."</font></td></tr>");
+			  "<td align='center' colspan='5'><font face='arial'>".&mt($type)."</font></td></tr>");
 	    }
 	    $r->print($output);	
 	}
@@ -665,7 +665,7 @@
 	    $r->print('<td>&nbsp;</td>');
 	}
     }
-    $r->print('<td colspan="4"><font color="'.$tfont.'">'.&mt('No role specified').
+    $r->print('<td colspan="3"><font color="'.$tfont.'">'.&mt('No role specified').
       '</font></td><td><font color="'.$tfont.'">'.$tremark.
       '&nbsp;</font></td></tr>'."\n");
 
@@ -765,40 +765,46 @@
 sub build_roletext {
     my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
     my $roletext='<tr bgcolor="'.$tbg.'">';
+    my $is_dc=($trolecode =~ m/^dc\./);
+    my $rowspan=($is_dc) ? ''
+                         : ' rowspan="2" ';
+
     unless ($nochoose) {
         if (!$button) {
             if ($switchserver) {
-                $roletext.='<td><a href="/adm/switchserver?'.
+                $roletext.='<td'.$rowspan.'><a href="/adm/switchserver?'.
                 $switchserver.'">'.&mt('Switch Server').'</a></td>';
             } else {
                 $roletext.=('<td>&nbsp;</td>');
             }
         } elsif ($tstatus eq 'is') {
-            $roletext.=('<td><input type=submit value="'.
+            $roletext.=('<td'.$rowspan.'><input type=submit value="'.
                         &mt('Select').'" name="'.
                         $trolecode.'"></td>');
         } elsif ($tryagain) {
             $roletext.=
-                '<td><input type=submit value="'.
+                '<td'.$rowspan.'><input type=submit value="'.
                 &mt('Try Selecting Again').'" name="'.$trolecode.'"></td>';
         } elsif ($advanced) {
             $roletext.=
-                '<td><input type=submit value="'.
+                '<td'.$rowspan.'><input type=submit value="'.
                 &mt('Re-Initialize').'" name="'.$trolecode.'"></td>';
         } else {
-            $roletext.='<td>&nbsp;</td>';
+            $roletext.='<td'.$rowspan.'>&nbsp;</td>';
         }
     }
     $tremark.=&Apache::lonannounce::showday(time,1,
                  &Apache::lonannounce::readcalendar($tdom.'_'.$trest));
 
-
     $roletext.='<td><font color="'.$tfont.'">'.$trole.
 	       '</font></td><td><font color="'.$tfont.'">'.$twhere.
                '</font></td><td><font color="'.$tfont.'">'.$tpstart.
                '</font></td><td><font color="'.$tfont.'">'.$tpend.
-               '</font></td><td><font color="'.$tfont.'">'.$tremark.
-               '&nbsp;</font></td></tr>'."\n";
+               '</font></td></tr>';
+    if (!$is_dc) {
+	$roletext.='<tr bgcolor="'.$tbg.'"><td colspan="4"><font color="'.$tfont.'">'.$tremark.
+	    '&nbsp;</font></td></tr><tr><td colspan="5" height="3"></td></tr>'."\n";
+    }
     return $roletext;
 }
 
@@ -895,7 +901,7 @@
         if (pickedCourse != '') {
             if (numbutton != -1) {
                 var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
-                opener.document.rolechoice.elements[numbutton+1].name = courseTarget
+                opener.document.rolechoice.elements[numbutton].name = courseTarget
                 opener.document.rolechoice.submit()
             }
         }
@@ -951,19 +957,14 @@
     my $dcdom = shift;
     my $ccrole = Apache::lonnet::plaintext('cc');
     my $selectlink = &courselink($dcdom);
-    my $output = '<tr bgcolor="#99FF99">'.
-              '<td><input type="button" value="'.
-              &mt('Select').'" name="ccpick_'.$dcdom.'"'.
-              'onClick="verifyCoursePick(this)">'.
-              '<input type="hidden" name="pick_'.$dcdom.'" value="1"></td>'.
-              '<td><font color="#002200">'.
-              $ccrole.'</font></td>'.
-              '<td><font color="#002200">'.&mt('All courses').':<b>&nbsp;'.
-              $selectlink.'</b>'.
-              '<br />'.&mt('Domain').':'.$dcdom.'</font>'.
-              '<td colspan="3"><font color="#002200">'.
-              &mt('Course Coordinator access to all courses in domain').
-              ': <b>'.$dcdom.'</b></font></td></tr>'."\n";
+    my $output = '<tr bgcolor="#77FF77">'.
+	'<input type="hidden" name="ccpick_'.$dcdom.'" />'.
+	'<input type="hidden" name="pick_'.$dcdom.'" value="1" />'.
+	'<td colspan="5">'.
+	'<font color="#002200">'.$ccrole.'</font>'.
+	' <b>'.$selectlink.'</b>'.
+	' from '.&mt('Domain').' '.$dcdom.
+	'<tr><td colspan="5" height="3"></td></tr>'."\n";
     return $output;
 }