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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 19:50:23 -0000


This is a MIME encoded message

--albertel1152301823
Content-Type: text/plain

albertel		Fri Jul  7 15:50:23 2006 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm 
  Log:
  - auto addtion of roles selector cssed
  
  
--albertel1152301823
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060707155023.txt"

Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.43 loncom/interface/loncoursegroups.pm:1.44
--- loncom/interface/loncoursegroups.pm:1.43	Fri Jul  7 15:34:20 2006
+++ loncom/interface/loncoursegroups.pm	Fri Jul  7 15:50:21 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.43 2006/07/07 19:34:20 albertel Exp $
+# $Id: loncoursegroups.pm,v 1.44 2006/07/07 19:50:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1197,9 +1197,9 @@
         &privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action,
                                3,$tools,$stored,$toolprivs,$fixedprivs,
                                \@available,$formname,$gpterm,$ucgpterm);
-        &mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
-                         $states,$stored,$navbuttons,4,5,$rowColor1,
-                         $rowColor2,$gpterm,$ucgpterm,$crstype);
+        &mapping_options($r,$action,$formname,$page,$sectioncount,
+                         $states,$stored,$navbuttons,4,5,
+			 $gpterm,$ucgpterm,$crstype);
         $nexttext = $$navbuttons{'mose'};
     }
     $prevtext = $$navbuttons{'gtpp'};
@@ -1491,10 +1491,10 @@
     &privilege_specificity($r,$tabcol,$rowColor1,$rowColor2,$action,
                           $specimg,$tools,$stored,$toolprivs,
                           $fixedprivs,\@available,$formname,$gpterm,$ucgpterm);
-    my $newusers = &pick_new_members($r,$action,$formname,$tabcol,$rowColor1,
-                                    $rowColor2,\@available,$idx,$stored,
-                                    $memimg,$users,$userdata,$granularity,
-                                    \%origmembers,$gpterm,$ucgpterm);
+    my $newusers = &pick_new_members($r,$action,$formname,\@available,$idx,
+				     $stored,$memimg,$users,$userdata,
+				     $granularity,\%origmembers,$gpterm,
+				     $ucgpterm);
     if ($newusers || $action eq 'create') {
         &display_navbuttons($r,$formname,$$states{$action}[$page-1],
                             $$navbuttons{'gtps'},$$states{$action}[$page+1],
@@ -1632,9 +1632,8 @@
 }
 
 sub pick_new_members {
-    my ($r,$action,$formname,$tabcol,$rowColor1,$rowColor2,$available,$idx,
-        $stored,$img,$users,$userdata,$granularity,$origmembers,$gpterm,
-        $ucgpterm) = @_;
+    my ($r,$action,$formname,$available,$idx,$stored,$img,$users,$userdata,
+	$granularity,$origmembers,$gpterm,$ucgpterm) = @_;
     my %lt = &Apache::lonlocal::texthash(
           'gpme' => "$ucgpterm membership",
           'addm' => 'Add members',
@@ -2438,9 +2437,9 @@
         if (keys(%{$sectioncount}) > 0) {
             my $img1 = 7;
             my $img2 = 8;
-            &mapping_options($r,$action,$formname,$page,$tabcol,$sectioncount,
+            &mapping_options($r,$action,$formname,$page,$sectioncount,
                              $states,$stored,$navbuttons,$img1,$img2,
-                             $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+                             $gpterm,$ucgpterm,$crstype);
         }
     }
     my $prevtext = $$navbuttons{'gtps'};
@@ -3070,9 +3069,8 @@
 }
 
 sub mapping_options {
-    my ($r,$action,$formname,$page,$tabcol,$sectioncount,$states,$stored,
-        $navbuttons,$img1,$img2,$rowColor1,$rowColor2,$gpterm,$ucgpterm,
-        $crstype) = @_;
+    my ($r,$action,$formname,$page,$sectioncount,$states,$stored,
+        $navbuttons,$img1,$img2,$gpterm,$ucgpterm,$crstype) = @_;
     my %lt = &Apache::lonlocal::texthash(
         'auto' => "Settings for automatic $gpterm enrollment",
         'gmma' => "$ucgpterm membership mapping to specific sections/roles",
@@ -3088,18 +3086,17 @@
         'auex' => "Automatically expire $gpterm membership when roles are removed?",
         'mapr' => "Mapping of roles and sections affected by automatic $gpterm enrollment/disenrollment follows scheme chosen below.",
     );
-    &automapping($r,$action,$tabcol,$stored,\%lt,$img1);
+    &automapping($r,$action,$stored,\%lt,$img1);
     $r->print('
    <tr>
     <td colspan="4">&nbsp;</td>
    </tr>');
-    &mapping_settings($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,\%lt,
-                      $stored,$img2,$crstype);
+    &mapping_settings($r,$sectioncount,\%lt,$stored,$img2,$crstype);
     return;
 }
 
 sub automapping {
-    my ($r,$action,$tabcol,$stored,$lt,$image) = @_;
+    my ($r,$action,$stored,$lt,$image) = @_;
     my $add = 'off';
     my $drop = 'off';
     if (exists($$stored{'autoadd'})) {
@@ -3110,52 +3107,24 @@
     }
     &topic_bar($r,$image,$$lt{'endi'});
     $r->print('
-  <tr>
-   <td>&nbsp;</td>
-   <td colspan="3">
-    <b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br />
-   </td>
-  </tr>
-  <tr>
-   <td colspan="4">&nbsp;</td>
-  </tr>
-  <tr>
-   <td>&nbsp;</td>
-   <td colspan="3">
+    <b>'.$$lt{'gmma'}.':</b><br />'.$$lt{'adds'}.'<br />'.$$lt{'drops'}.'<br /><br />
    <nobr>'.$$lt{'auad'}.':&nbsp;
     <label><input type="radio" name="autoadd" value="on" />on&nbsp;&nbsp;</label><label><input type="radio" name="autoadd" value="off" checked="checked" />off</label>');
     if ($action eq 'modify') {
         $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.$$lt{'curr'}.' <b>'.$$lt{$add}.'</b>)');
     }
     $r->print('
-    </nobr>
-   </td>
-  </tr>
-  <tr>
-   <td>&nbsp;</td>
-   <td colspan="3">
+    </nobr><br />
     <nobr>'.$$lt{'auex'}.':&nbsp;
     <label><input type="radio" name="autodrop" value="on" />on&nbsp;&nbsp;</label><label><input type="radio" name="autodrop" value="off" checked="checked" />off</label>');
     if ($action eq 'modify') {
         $r->print('&nbsp;&nbsp;&nbsp;&nbsp;('.$$lt{'curr'}.' <b>'.$$lt{$drop}.'</b>)');
     }
-    $r->print('</nobr>
-   </td>
-  </tr>
-  <tr>
-   <td colspan="4">&nbsp;</td>
-  </tr>
-  <tr>
-   <td>&nbsp;</td>
-   <td colspan="3">'.$$lt{'mapr'}.'
-   </td>
-  </tr>
-');
+    $r->print('</nobr><br /><br />'.$$lt{'mapr'});
 }
 
 sub mapping_settings {
-    my ($r,$tabcol,$rowColor1,$rowColor2,$sectioncount,$lt,$stored,$image,
-        $crstype) = @_;
+    my ($r,$sectioncount,$lt,$stored,$image,$crstype) = @_;
     my @sections = keys(%{$sectioncount});
     if (@sections > 0) {
         @sections = sort {$a cmp $b} @sections;
@@ -3163,23 +3132,17 @@
         unshift(@sections,'all'); # Put 'all' at the front of the list
     }
     &topic_bar($r,$image,$$lt{'pirs'});
-    $r->print('
-   <tr>
-    <td>&nbsp;</td>
-    <td colspan="3">
-');
     my @roles = &standard_roles();
     my %customroles = &my_custom_roles();
-    $r->print(&Apache::lonhtmlcommon::start_pick_box());
+    $r->print(&Apache::loncommon::start_data_table().
+	      &Apache::loncommon::start_data_table_header_row());
     $r->print('
-                <tr bgcolor="'.$tabcol.'">
                  <th>'.&mt('Active?').'</th>
                  <th>'.&mt('Role').'</th>');
     if (@sections > 0) {
-        $r->print('<th>'.&mt('Sections').'</th></tr>'."\n");
+        $r->print('<th>'.&mt('Sections').'</th>');
     }
-    my $rowNum = 0;
-    my $rowColor;
+    $r->print(&Apache::loncommon::end_data_table_header_row()."\n");
     foreach my $role (@roles) {
         my $plrole=&Apache::lonnet::plaintext($role,$crstype);
         my $sections_sel;
@@ -3194,33 +3157,25 @@
                               '</td>';
             }
         }
-        if ($rowNum %2 == 1) {
-            $rowColor = $rowColor1;
-        } else {
-            $rowColor = $rowColor2;
-        }
-        $r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '.
+        $r->print(&Apache::loncommon::start_data_table_row().
+		  '<td><input type="checkbox" '.
                   'name="autorole" value="'.$role.'"></td><td>'.$plrole.
-                  '</td>'.$sections_sel.'</tr>');
-        $rowNum ++;
+                  '</td>'.$sections_sel.
+		  &Apache::loncommon::end_data_table_row());
     }
     foreach my $role (sort(keys(%customroles))) {
         my $sections_sel;
         if (@sections > 0) {
-            $sections_sel = '<td>'.&sections_selection(\@sections,'sec_'.$role).
-                                                                        '</td>';
-        }
-        if ($rowNum %2 == 1) {
-            $rowColor = $rowColor1;
-        } else {
-            $rowColor = $rowColor2;
+            $sections_sel = 
+		'<td>'.&sections_selection(\@sections,'sec_'.$role).'</td>';
         }
-        $r->print('<tr bgcolor="'.$rowColor.'"><td><input type="checkbox" '.
+        $r->print(&Apache::loncommon::start_data_table_row().
+		  '<td><input type="checkbox" '.
                   'value="'.$role.'"></td><td>'.$role.'</td>'.
-                  $sections_sel.'</tr>');
-        $rowNum ++;
+                  $sections_sel.
+		  &Apache::loncommon::end_data_table_row());
     }
-    $r->print(&Apache::lonhtmlcommon::end_pick_box());
+    $r->print(&Apache::loncommon::end_data_table());
     return;
 }
 

--albertel1152301823--