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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 21:20:25 -0000


This is a MIME encoded message

--albertel1152307225
Content-Type: text/plain

albertel		Fri Jul  7 17:20:25 2006 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm 
  Log:
  - change user table data_tabled
  
  
--albertel1152307225
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060707172025.txt"

Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.47 loncom/interface/loncoursegroups.pm:1.48
--- loncom/interface/loncoursegroups.pm:1.47	Fri Jul  7 17:04:57 2006
+++ loncom/interface/loncoursegroups.pm	Fri Jul  7 17:20:25 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.47 2006/07/07 21:04:57 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.48 2006/07/07 21:20:25 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -59,8 +59,6 @@
 
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
                         ['action','refpage','state','groupname','branch']);
-    my $function = &Apache::loncommon::get_users_function();
-    my $tabcol = &Apache::loncommon::designparm($function.'.tabbg');
     my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
     my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
 
@@ -91,9 +89,6 @@
     $idx{uname} = &Apache::loncoursedata::CL_SNAME();
     $idx{section} = &Apache::loncoursedata::CL_SECTION();
 
-    my $rowColor1 = "#dddddd";
-    my $rowColor2 = "#eeeeee";
-
     my $action = $env{'form.action'};
     my $state = $env{'form.state'};
     if ((!defined($action)) || ($action eq 'view')) {
@@ -104,9 +99,9 @@
     if ($action eq 'create' || $action eq 'modify' || $action eq 'view') { 
         if ($view_permission || $manage_permission) {
             &group_administration($r,$action,$state,$cdom,$cnum,
-                                  $tabcol,\%functions,\%idx,$view_permission,
-                                  $manage_permission,$rowColor1,$rowColor2,
-                                  $gpterm,$ucgpterm,$crstype);
+                                  \%functions,\%idx,$view_permission,
+                                  $manage_permission,$gpterm,$ucgpterm,
+				  $crstype);
         } else {
             $r->print(&mt('You do not have [_1] administration '.
                           'privileges in this [_2]',$gpterm,lc($crstype)));
@@ -348,9 +343,8 @@
 }
 
 sub group_administration {
-    my ($r,$action,$state,$cdom,$cnum,$tabcol,$functions,$idx,
-        $view_permission,$manage_permission,$rowColor1,$rowColor2,$gpterm,
-        $ucgpterm,$crstype) = @_;
+    my ($r,$action,$state,$cdom,$cnum,$functions,$idx,$view_permission,
+	$manage_permission,$gpterm,$ucgpterm,$crstype) = @_;
     my %sectioncount = ();
     my @tools = ();
     my @types = ();
@@ -865,14 +859,14 @@
                    {text=>"$trail{$action}{$state}"});
                 $r->print(&Apache::lonhtmlcommon::breadcrumbs
 			  ("$crumbtitle Manager"));
-                &display_control($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+                &display_control($r,$cdom,$cnum,$action,$state,$page,
                        \%sectioncount,$groupname,$description,$functions,
                        \@tools,$toolprivs,$fixedprivs,$startdate,$enddate,
                        \%users,\%userdata,$idx,\%memchg,\%usertools,
                        $view_permission,$manage_permission,
                        \%stored,$granularity,$quota,$specificity,\@types,\@roles,
-                       \@sections,\%states,\%navbuttons,$rowColor1,$rowColor2,
-                       $gpterm,$ucgpterm,$crstype);
+                       \@sections,\%states,\%navbuttons,$gpterm,$ucgpterm,
+				 $crstype);
                 last;
             } else {
                 if (($state eq 'result') && ($i > 0)) {
@@ -960,12 +954,12 @@
 }
 
 sub display_control {
-    my ($r,$cdom,$cnum,$tabcol,$action,$state,$page,$sectioncount,$groupname,
+    my ($r,$cdom,$cnum,$action,$state,$page,$sectioncount,$groupname,
         $description,$functions,$tools,$toolprivs,$fixedprivs,$startdate,
         $enddate,$users,$userdata,$idx,$memchg,$usertools,
         $view_permission,$manage_permission,$stored,$granularity,$quota,
-        $specificity,$types,$roles,$sections,$states,$navbuttons,$rowColor1,
-        $rowColor2,$gpterm,$ucgpterm,$crstype) = @_;
+        $specificity,$types,$roles,$sections,$states,$navbuttons,
+	$gpterm,$ucgpterm,$crstype) = @_;
     if ($action eq 'create') {
         if ($state eq 'pick_name') {
             &general_settings_form($r,$cdom,$cnum,$action,$state,$page,
@@ -1007,12 +1001,11 @@
                                    $sectioncount,$stored,$states,$navbuttons,
                                    $gpterm,$ucgpterm,$crstype);
         } elsif ($state eq 'change_members') {
-            &change_members_form($r,$cdom,$cnum,$tabcol,$action,$state,$page,
+            &change_members_form($r,$cdom,$cnum,$action,$state,$page,
                                  $groupname,$description,$startdate,$enddate,
                                  $tools,$fixedprivs,$functions,$users,
                                  $userdata,$granularity,$quota,$specificity,
-                                 $idx,$states,$navbuttons,$rowColor1,$rowColor2,
-                                 $gpterm,$ucgpterm);
+                                 $idx,$states,$navbuttons,$gpterm,$ucgpterm);
         } elsif ($state eq 'add_members') {
             &add_members_form($r,$action,$state,$page,$startdate,
                               $enddate,$groupname,$description,$granularity,
@@ -1579,7 +1572,7 @@
 ');
     if (@{$available} > 0) {
         $r->print('<b>Available:</b>
-                    <table cellpadding="" cellspacing="1"><tr>');
+                    <table class="LC_group_priv"><tr>');
         my $rowcell = int(@{$available}/2) + @{$available}%2;
         for (my $i=0; $i<@{$available}; $i++) {
             if (@{$available} > 3) {
@@ -1597,7 +1590,7 @@
     }
     if (@{$unavailable} > 0) {
         $r->print('<b>Unavailable:</b>
-                    <table cellpadding="0" cellspacing="1"  border="0"><tr>');
+                    <table class="LC_group_priv"><tr>');
         my $rowcell = int(@{$unavailable}/2) + @{$unavailable}%2;
         for (my $j=0; $j<@{$unavailable}; $j++) {
             if (@{$unavailable} > 3) {
@@ -1671,14 +1664,16 @@
      <tr>');
         &check_uncheck_buttons($r,$formname,'member',$lt{'addm'});
         if (@{$available} > 0 && $granularity eq 'Yes') {
-            $r->print('<td><nobr>
+            $r->print('<td>
      <fieldset><legend><b>'.$lt{'setf'}.'</b></legend>
+      <nobr>
       <input type="button" value="check all"
         onclick="javascript:checkAllTools(document.'.$formname.')" />
         &nbsp;&nbsp;
       <input type="button" value="uncheck all"
         onclick="javascript:uncheckAllTools(document.'.$formname.')" />
-     </fieldset></nobr></td>');
+      </nobr>
+     </fieldset></td>');
         }
         $r->print('</tr></table>
         ');
@@ -2028,10 +2023,10 @@
 
 
 sub change_members_form {
-    my ($r,$cdom,$cnum,$tabcol,$action,$formname,$page,$groupname,$description,
+    my ($r,$cdom,$cnum,$action,$formname,$page,$groupname,$description,
         $startdate,$enddate,$tools,$fixedprivs,$functions,$users,$userdata,
-        $granularity,$quota,$specificity,$idx,$states,$navbuttons,$rowColor1,
-        $rowColor2,$gpterm,$ucgpterm) = @_;
+        $granularity,$quota,$specificity,$idx,$states,$navbuttons,$gpterm,
+	$ucgpterm) = @_;
     my %lt = &Apache::lonlocal::texthash(
                                          grse => "$ucgpterm settings",
                                          mogm => "Modify $gpterm membership",
@@ -2055,17 +2050,16 @@
 			    $groupname,$description,$granularity,$quota,
 			    \@available,\@unavailable,$gpterm,$ucgpterm);
     &topic_bar($r,2,$lt{'mogm'});
-    &current_membership($r,$cdom,$cnum,$formname,$tabcol,$rowColor1,
-                        $rowColor2,$groupname,\@available,\@unavailable,
-                        $fixedprivs,$granularity,$specificity);
+    &current_membership($r,$cdom,$cnum,$formname,$groupname,\@available,
+			\@unavailable,$fixedprivs,$granularity,$specificity);
     &display_navbuttons($r,$formname,$$states{$action}[$page-1],$prevtext,
                         $$states{$action}[$page+1],$nexttext);
     return;
 }
 
 sub current_membership {
-    my ($r,$cdom,$cnum,$formname,$tabcol,$rowColor1,$rowColor2,$groupname,
-        $available,$unavailable,$fixedprivs,$granularity,$specificity) = @_;
+    my ($r,$cdom,$cnum,$formname,$groupname,$available,$unavailable,
+	$fixedprivs,$granularity,$specificity) = @_;
     my %membership = &Apache::lonnet::get_group_membership($cdom,$cnum,
                                                                    $groupname);
     my %lt = &Apache::lonlocal::texthash(
@@ -2087,9 +2081,6 @@
                                             $available);
     if (keys(%{$current}) > 0) {
         $r->print('
- <tr>
-  <td>&nbsp;</td>
-  <td colspan="2">
    <table>
     <tr>');
         if ($num_expire) {
@@ -2126,51 +2117,41 @@
         $r->print(<<"END");
    </tr>
   </table>
-  </td>
-  <td width="100%">&nbsp;</td>
- </tr>
- <tr>
-  <td colspan="4">&nbsp;</td>
- </tr>
- <tr>
-  <td>&nbsp;</td>
-  <td colspan="3">
+  <br />
 END
-        $r->print(&Apache::lonhtmlcommon::start_pick_box());
+        $r->print(&Apache::loncommon::start_data_table().
+		  &Apache::loncommon::start_data_table_header_row());
         $r->print(<<"END");
-   <table border="0" cellpadding="4" cellspacing="1">
-    <tr bgcolor="$tabcol" align="center">
-     <td><b>$lt{'actn'}</b></td>
-     <td><b><a href="javascript:changeSort('fullname')">$lt{'name'}</a></b></td>
-     <td><b><a href="javascript:changeSort('username')">$lt{'usnm'}</a></b>
-     </td>
-     <td><b><a href="javascript:changeSort('domain')">$lt{'doma'}</a></b></td>
-     <td><b><a href="javascript:changeSort('id')">ID</a></b></td>
-     <td><b><a href="javascript:changeSort('start')">$lt{'stda'}</a></b></td>
-     <td><b><a href="javascript:changeSort('end')">$lt{'enda'}</a></b></td>
+     <th>$lt{'actn'}</th>
+     <th><a href="javascript:changeSort('fullname')">$lt{'name'}</a></th>
+     <th><a href="javascript:changeSort('username')">$lt{'usnm'}</a></th>
+     <th><a href="javascript:changeSort('domain')">$lt{'doma'}</a></th>
+     <th><a href="javascript:changeSort('id')">ID</a></th>
+     <th><a href="javascript:changeSort('start')">$lt{'stda'}</a></th>
+     <th><a href="javascript:changeSort('end')">$lt{'enda'}</a></th>
 END
         my $colspan = 0;
         if ($hastools) {
-            $r->print('<td><b>'.$lt{'curf'}.'</b></td>');
-            $colspan ++;  
+            $r->print('<th>'.$lt{'curf'}.'</th>');
+            $colspan++;  
         }
         if ($addtools) {
-            $r->print('<td><b>Additional Functionality</b></td>');
-            $colspan ++;
+            $r->print('<th>'.&mt('Additional Functionality').'</th>');
+            $colspan++;
         }
-        $r->print('</tr>');
+        $r->print(&Apache::loncommon::end_data_table_header_row());
         if ($colspan) {
             if ($granularity eq 'Yes') {
-                $r->print('<tr bgcolor="#cccccc">
+                $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense LC_data_table_highlight').'
  <td colspan="7">&nbsp;</td>
- <td colspan="'.$colspan.'" align="center"><small><nobr><b>'.&mt('All:').
+ <td colspan="'.$colspan.'" align="center"><nobr><b>'.&mt('All:').
   '</b>&nbsp;');
                 foreach my $tool (@{$available}) {
                     $r->print('<label><input type="checkbox" name="togglefunc"'.
    ' onclick="javascript:toggleTools(document.'.$formname.'.user_'.$tool.',this);"'.
-   ' value="'.$tool.'">'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');
+   ' value="'.$tool.'" />'.'<b>'.$tool.'</b></label>&nbsp;&nbsp;&nbsp;');
                 }
-                $r->print('</nobr></small></td></tr>');
+                $r->print('</nobr></td></tr>');
             }
         }
         my %Sortby = ();
@@ -2187,23 +2168,16 @@
                 push(@{$Sortby{$$current{$user}{fullname}}},$user);
             }
         }
-        my $rowNum = 0;
-        my $rowColor;
         foreach my $key (sort(keys(%Sortby))) {
             foreach my $user (@{$Sortby{$key}}) {
-                if ($rowNum %2 == 1) {
-                    $rowColor = $rowColor1;
-                } else {
-                    $rowColor = $rowColor2;
-                }
                 my $id = $$current{$user}{id};
                 my $fullname = $$current{$user}{fullname};
                 my $udom = $$current{$user}{udom};
                 my $uname = $$current{$user}{uname};
                 my $start = $$current{$user}{start};
                 my $end = $$current{$user}{end};
-                $r->print('<tr bgcolor="'.$rowColor.'">
-                            <td><small>');
+                $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').'
+                            <td>');
                 if ($$current{$user}{changestate} eq 'reenable') {
                     $r->print('<nobr><label>'. 
    '<input type="checkbox" name="reenable" value="'.$user.'" />'.
@@ -2226,13 +2200,15 @@
    '</label></nobr>');
                 }
                 $r->print('
-   </td>
-   <td><small>'.
-    $fullname.'</small></td><td><small>'.$uname.'</small></td><td><small>'.
-    $udom.'</small></td><td><small>'.$id.'</small></td><td><small>'.$start.
-    '</small></td><td><small>'.$end.'</small></td>');
+   </td>'.
+   '<td>'.$fullname.'</td>'.
+   '<td>'.$uname.'</td>'.
+   '<td>'. $udom.'</td>'.
+   '<td>'.$id.'</td>'.
+   '<td>'.$start.'</td>'.
+   '<td>'.$end.'</td>');
                 if ($hastools) {
-                    $r->print('<td align="left"><small><nobr>'.
+                    $r->print('<td align="left"><nobr>'.
                                   '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;');
                     foreach my $tool (@{$$current{$user}{currtools}}) {
                         if ($granularity eq 'Yes') {
@@ -2248,10 +2224,10 @@
                          }
                          $r->print('&nbsp;&nbsp;&nbsp;');
                     }
-                    $r->print('</nobr></small></td>');
+                    $r->print('</nobr></td>');
                 }
                 if ($addtools) {
-                    $r->print('<td align="left"><small>');
+                    $r->print('<td align="left">');
                     if ($granularity eq 'Yes') {
                         foreach my $tool (@{$$current{$user}{newtools}}) {
                             $r->print('<nobr><label><input type="checkbox"
@@ -2267,16 +2243,12 @@
                                           '</nobr>&nbsp;&nbsp;&nbsp;');
                         }
                     }
-                    $r->print('</small></td>');
+                    $r->print('</td>');
                 }
-                $r->print('</tr>'."\n");
-                $rowNum ++;
+                $r->print(&Apache::loncommon::end_data_table_row()."\n");
             }
         }
-        $r->print(&Apache::lonhtmlcommon::end_pick_box());
-        $r->print('
-  </td>
- </tr>');
+        $r->print(&Apache::loncommon::end_data_table());
     }
     return;
 }
@@ -2285,16 +2257,16 @@
     my ($r,$formname,$field,$title,$colspan) = @_;
     $r->print('
      <td '.$colspan.'>
-      <nobr>
        <fieldset>
        <legend><b>'.$title.'</b></legend>
+      <nobr>
        <input type="button" value="check all"
        onclick="javascript:checkAll(document.'.$formname.'.'.$field.')" />
        &nbsp;&nbsp;
        <input type="button" value="uncheck all"
        onclick="javascript:uncheckAll(document.'.$formname.'.'.$field.')" />
-       </fieldset>
       </nobr>
+       </fieldset>
      </td>
 ');
 }

--albertel1152307225--