[LON-CAPA-cvs] cvs: loncom /interface loncreateuser.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 22 Nov 2006 21:55:53 -0000


raeburn		Wed Nov 22 16:55:53 2006 EDT

  Modified files:              
    /loncom/interface	loncreateuser.pm 
  Log:
  More replacement of table tags with calls to data_table routines in loncommon.
  
  Code to generate different bgcolors for different courses eliminated now that multiple courses no longer displayed in the DC's CUSR view.
  
  
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.135 loncom/interface/loncreateuser.pm:1.136
--- loncom/interface/loncreateuser.pm:1.135	Wed Nov 22 11:06:28 2006
+++ loncom/interface/loncreateuser.pm	Wed Nov 22 16:55:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Create a user
 #
-# $Id: loncreateuser.pm,v 1.135 2006/11/22 16:06:28 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.136 2006/11/22 21:55:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1755,9 +1755,6 @@
 	my $area=$coursedata{'description'};
         my $type=$coursedata{'type'};
 	if (!defined($area)) { $area=&mt('Unavailable course').': '.$protectedcourse; }
-	my $bgcol=$thiscourse;
-	$bgcol=~s/[^7-9a-e]//g;
-	$bgcol=substr($bgcol.$bgcol.$bgcol.'ffffff',2,6);
 	my ($domain,$cnum)=split(/\//,$thiscourse);
         my %sections_count;
         if (defined($env{'request.course.id'})) {
@@ -1769,12 +1766,10 @@
 	foreach my $role ('st','ta','ep','in','cc') {
 	    if (&Apache::lonnet::allowed('c'.$role,$thiscourse)) {
 		my $plrole=&Apache::lonnet::plaintext($role);
-		$table .= <<ENDEXTENT;
-<tr bgcolor="#$bgcol">
-<td><input type="checkbox" name="act_$protectedcourse\_$role"></td>
-<td>$plrole</td>
-<td>$area<br />Domain: $domain</td>
-ENDEXTENT
+		$table .= &Apache::loncommon::start_data_table_row().
+'<td><input type="checkbox" name="act_'.$protectedcourse.'_'.$role.'"></td>
+<td>'.$plrole.'</td>
+<td>'.$area.'<br />Domain: '.$domain.'</td>'."\n";
 	        if ($role ne 'cc') {
                     if (%sections_count) {
                         my $currsec = &course_sections(\%sections_count,$protectedcourse.'_'.$role);
@@ -1803,7 +1798,7 @@
 <a href=
 "javascript:pjump('date_end','End Date $plrole',document.cu.end_$protectedcourse\_$role.value,'end_$protectedcourse\_$role','cu.pres','dateset')">$lt{'sed'}</a></td>
 ENDTIMEENTRY
-                $table.= "</tr>\n";
+                $table.= &Apache::loncommon::end_data_table_row();
             }
         }
         foreach my $cust (sort keys %customroles) {
@@ -1811,12 +1806,10 @@
 		my $plrole=$cust;
                 my $customrole=$protectedcourse.'_cr_cr_'.$env{'user.domain'}.
 		    '_'.$env{'user.name'}.'_'.$plrole;
-		$table .= <<END;
-<tr bgcolor="#$bgcol">
-<td><input type="checkbox" name="act_$customrole"></td>
-<td>$plrole</td>
-<td>$area</td>
-END
+		$table .= &Apache::loncommon::start_data_table_row().
+'<td><input type="checkbox" name="act_'.$customrole.'"></td>
+<td>'.$plrole.'</td>
+<td>'.$area.'</td>'."\n";
                 if (%sections_count) {
                     my $currsec = &course_sections(\%sections_count,$customrole);
                     $table.=
@@ -1839,20 +1832,25 @@
 "javascript:pjump('date_start','Start Date $plrole',document.cu.start_$customrole.value,'start_$customrole','cu.pres','dateset')">$lt{'ssd'}</a></td>
 <td><input type=hidden name="end_$customrole" value=''>
 <a href=
-"javascript:pjump('date_end','End Date $plrole',document.cu.end_$customrole.value,'end_$customrole','cu.pres','dateset')">$lt{'sed'}</a></td></tr>
+"javascript:pjump('date_end','End Date $plrole',document.cu.end_$customrole.value,'end_$customrole','cu.pres','dateset')">$lt{'sed'}</a></td>
 ENDENTRY
+               $table .= &Apache::loncommon::end_data_table_row();
            }
 	}
     }
     return '' if ($table eq ''); # return nothing if there is nothing 
                                  # in the table
-    my $result = <<ENDTABLE;
-<h4>$lt{'crl'}</h4>
-<table border=2><tr><th>$lt{'act'}</th><th>$lt{'rol'}</th><th>$lt{'ext'}</th>
-<th>$lt{'grs'}</th><th>$lt{'sta'}</th><th>$lt{'end'}</th></tr>
-$table
-</table>
-ENDTABLE
+    my $result = '
+<h4>'.$lt{'crl'}.'</h4>'.
+&Apache::loncommon::start_data_table().
+&Apache::loncommon::start_data_table_header_row().
+'<th>'.$lt{'act'}.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'ext'}.'</th>
+<th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
+&Apache::loncommon::end_data_table_header_row().
+&Apache::loncommon::start_data_table_row().
+$table.
+&Apache::loncommon::end_data_table_row().
+&Apache::loncommon::end_data_table();
     return $result;
 }
 
@@ -1899,8 +1897,12 @@
                     'sed'  => "Set End Date"
                   );
     my $header = '<h4>'.&mt('Course Level').'</h4>'.
-                 '<table border="2"><tr><th>'.$lt{'typ'}.'</th><th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th></tr>';
-    my $otheritems = '<tr><td><select name="crstype" onChange="javascript:setType();">'."\n".
+                 &Apache::loncommon::start_data_table().
+                 &Apache::loncommon::start_data_table_header_row().
+                 '<th>'.$lt{'typ'}.'</th><th>'.$courseform.'</th><th>'.$lt{'rol'}.'</th><th>'.$lt{'grs'}.'</th><th>'.$lt{'sta'}.'</th><th>'.$lt{'end'}.'</th>'.
+                 &Apache::loncommon::end_data_table_header_row();
+    my $otheritems = &Apache::loncommon::start_data_table_row().
+                     '<td><select name="crstype" onChange="javascript:setType();">'."\n".
                      ' <option value="">'.&mt('Please select')."\n".
                      ' <option value="Course">'.&mt('Course')."\n".
                      ' <option value="Non-standard course">'.&mt('Non-standard course')."\n".
@@ -1935,7 +1937,8 @@
 <a href=
 "javascript:pjump('date_end','End Date',document.cu.end.value,'end','cu.pres','dateset')">$lt{'sed'}</a></td>
 ENDTIMEENTRY
-    $otheritems .= "</tr></table>\n";
+    $otheritems .= &Apache::loncommon::end_data_table_row().
+                   &Apache::loncommon::end_data_table()."\n";
     return $cb_jscript.$header.$hiddenitems.$otheritems;
 }