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

albertel lon-capa-cvs@mail.lon-capa.org
Fri, 07 Jul 2006 15:54:15 -0000


This is a MIME encoded message

--albertel1152287655
Content-Type: text/plain

albertel		Fri Jul  7 11:54:15 2006 EDT

  Modified files:              
    /loncom/interface	loncoursegroups.pm loncommon.pm 
  Log:
  - start css on course groups interface
  - data table can take optional additional class attrs
  
  
--albertel1152287655
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060707115415.txt"

Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.38 loncom/interface/loncoursegroups.pm:1.39
--- loncom/interface/loncoursegroups.pm:1.38	Tue Jul  4 20:12:37 2006
+++ loncom/interface/loncoursegroups.pm	Fri Jul  7 11:54:15 2006
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: loncoursegroups.pm,v 1.38 2006/07/05 00:12:37 raeburn Exp $
+# $Id: loncoursegroups.pm,v 1.39 2006/07/07 15:54:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -112,40 +112,37 @@
                           'privileges in this [_2]',$gpterm,lc($crstype)));
         }
     } else {
-        &print_main_menu($r,$cdom,$cnum,$function,$tabcol,\%functions,\%idx,
-                         $view_permission,$manage_permission,$action,$state,
-                         $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+        &print_main_menu($r,$cdom,$cnum,\%functions,\%idx,$view_permission,
+			 $manage_permission,$action,$state,$gpterm,$ucgpterm,
+			 $crstype);
     }
     return OK;
 }
 
 sub print_main_menu {
-    my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission,
-        $manage_permission,$action,$state,$rowColor1,$rowColor2,$gpterm,
-        $ucgpterm,$crstype) = @_;
+    my ($r,$cdom,$cnum,$functions,$idx,$view_permission,$manage_permission,
+	$action,$state,$gpterm,$ucgpterm,$crstype) = @_;
     my $pagename = "$crstype $ucgpterm".'s';
     my $jscript = qq|
 function changeSort(caller) {
     document.$state.sortby.value = caller;
     document.$state.submit();
 }\n|;
-    $r->print(&header($pagename,$jscript,$action,$state,
-                      undef,$function));
+    $r->print(&header($pagename,$jscript,$action,$state));
     &Apache::lonhtmlcommon::add_breadcrumb
         ({href=>"/adm/coursegroups",
           text=>"$pagename"});
     $r->print(&Apache::lonhtmlcommon::breadcrumbs($pagename));
-    &display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,
-                    $view_permission,$manage_permission,$action,$state,
-                    $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+    &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
+		    $manage_permission,$action,$state,$gpterm,$ucgpterm,
+		    $crstype);
     $r->print(&footer());
     return;
 }
 
 sub display_groups {
-    my ($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,$view_permission,
-        $manage_permission,$action,$state,$rowColor1,$rowColor2,$gpterm,
-        $ucgpterm,$crstype) = @_;
+    my ($r,$cdom,$cnum,$functions,$idx,$view_permission,
+        $manage_permission,$action,$state,$gpterm,$ucgpterm,$crstype) = @_;
     my %curr_groups = ();
     my %grp_info = ();
     my %actionlinks = (
@@ -188,28 +185,24 @@
                 $r->print('<br /><a href="/adm/coursegroups?action=create&refpage='.$env{'form.refpage'}.'">'.$lt{'crng'}.'</a>');
             }
             $r->print('<br /><br />');
-            $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{'act'}</b></td>
-        <td><b><a href="javascript:changeSort('groupname')">$lt{'gname'}</a></b></td>
-        <td><b><a href="javascript:changeSort('description')">$lt{'desc'}</a></b></td>
-        <td><b><a href="javascript:changeSort('creator')">$lt{'crea'}</a></b>
-        </td>
-        <td><b><a href="javascript:changeSort('creation')">$lt{'crtd'}</a></b>
-        </td>
-        <td><b><a href="javascript:changeSort('modified')">$lt{'last'}</a></b>
-        </td>
-        <td><b>$lt{'func'}</b>
-        </td>
-        <td><b><a href="javascript:changeSort('quota')">$lt{'quot'}</a></b></td>
-        <td><b><a href="javascript:changeSort('totalmembers')">$lt{'memb'}</a></b></td>
-        <td><b><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></b></td>
-        <td><b><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></b></td>
-        <td><b><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></b></td>
-       </tr>
+        <th>$lt{'act'}</th>
+        <th><a href="javascript:changeSort('groupname')">$lt{'gname'}</a></th>
+        <th><a href="javascript:changeSort('description')">$lt{'desc'}</a></th>
+        <th><a href="javascript:changeSort('creator')">$lt{'crea'}</a></th>
+        <th><a href="javascript:changeSort('creation')">$lt{'crtd'}</a></th>
+        <th><a href="javascript:changeSort('modified')">$lt{'last'}</a></th>
+        <th>$lt{'func'}</b></td>
+        <th><a href="javascript:changeSort('quota')">$lt{'quot'}</a></th>
+        <th><a href="javascript:changeSort('totalmembers')">$lt{'memb'}</a></th>
+        <th><a href="javascript:changeSort('totalfiles')">$lt{'file'}</a></th>
+        <th><a href="javascript:changeSort('boards')">$lt{'dibd'}</a></th>
+        <th><a href="javascript:changeSort('diskuse')">$lt{'dius'}</a></th>
 END
+	    $r->print(&Apache::loncommon::end_data_table_header_row());
             my %Sortby = ();
             foreach my $group (sort(keys(%curr_groups))) {
                 %{$grp_info{$group}} = 
@@ -259,17 +252,10 @@
                     push(@{$Sortby{$group}},$group);
                 }
             }
-            my $rowNum = 0;
-            my $rowColor;
             foreach my $key (sort(keys(%Sortby))) {
                 foreach my $group (@{$Sortby{$key}}) {
-                    if ($rowNum %2 == 1) {
-                        $rowColor = $rowColor1;
-                    } else {
-                        $rowColor = $rowColor2;
-                    }
                     my $description = 
-                   &unescape($grp_info{$group}{'description'});
+			&unescape($grp_info{$group}{'description'});
                     my $creator = $grp_info{$group}{'creator'};
                     my $creation = $grp_info{$group}{'creation'};
                     my $modified = $grp_info{$group}{'modified'}; 
@@ -302,12 +288,23 @@
                                       $group.'">'.$lt{'modify'}.'</a>';
                         }
                     }
-                    $r->print('<tr bgcolor="'.$rowColor.'"><td><small>'.$link.'</small></td><td><small>'.$group.'</small></td><td><small>'.$description.'</small></td><td><small>'.$creator.'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($creation).'</small></td><td><small>'. &Apache::lonnavmaps::timeToHumanString($modified).'</small></td><td><small>'.$functionality.'</small></td><td align="right"><small>'.$quota.'</small></td><td align="right"><small>'.$totalmembers.'</small></td><td align="right"><small><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></small></td><td align="right"><small>'.$boards.'</small></td><td align="right"><small>'.$diskuse.'</small></td></tr>');
-                    $rowNum ++;
+                    $r->print(&Apache::loncommon::start_data_table_row('LC_data_table_dense').
+			      '<td>'.$link.'</td>'.
+			      '<td>'.$group.'</td>'.
+			      '<td>'.$description.'</td>'.
+			      '<td>'.$creator.'</td>'.
+			      '<td>'. &Apache::lonnavmaps::timeToHumanString($creation).'</td>'.
+			      '<td>'. &Apache::lonnavmaps::timeToHumanString($modified).'</td>'.
+			      '<td>'.$functionality.'</td>'.
+			      '<td align="right">'.$quota.'</td>'.
+			      '<td align="right">'.$totalmembers.'</td>'.
+			      '<td align="right"><nobr>'.&mt('Files: ').$totalfiles.'</nobr><br /><nobr>'.&mt('Folders: ').$totaldirs.'</nobr></td>'.
+			      '<td align="right">'.$boards.'</td>'.
+			      '<td align="right">'.$diskuse.'</td>'.
+			      &Apache::loncommon::end_data_table_row());
                 }
             }
-            $r->print('</table>');
-            $r->print(&Apache::lonhtmlcommon::end_pick_box());
+            $r->print(&Apache::loncommon::end_data_table());
             $r->print('<input type="hidden" name="refpage" '.
                       'value="'.$env{'form.refpage'}.'" />');
             if ($action eq 'view') {
@@ -817,7 +814,7 @@
     my $loaditems =  &onload_action($action,$state);
     my $crumbtitle = "$crstype $ucgpterm".'s'; 
     $r->print(&header("$crumbtitle Manager",
-		      $jscript,$action,$state,$page,$function,$loaditems));
+		      $jscript,$action,$state,$page,$loaditems));
 
     if ($env{'form.refpage'} eq 'enrl') {
         &Apache::lonhtmlcommon::add_breadcrumb
@@ -895,9 +892,9 @@
         my $crumbtitle = "$crstype $ucgpterm".'s Manager';
         $r->print(&Apache::lonhtmlcommon::breadcrumbs
 		  (&mt($crumbtitle)));
-        &display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,
-                        $view_permission,$manage_permission,$action,$state,
-                        $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+        &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
+			$manage_permission,$action,$state,$gpterm,$ucgpterm,
+			$crstype);
 
     }
     $r->print(&footer());
@@ -1002,9 +999,9 @@
     } elsif ($action eq 'modify') {
         my $groupname = $env{'form.groupname'};
         if ($state eq 'pick_group') {
-            &display_groups($r,$cdom,$cnum,$function,$tabcol,$functions,$idx,
-                            $view_permission,$manage_permission,$action,$state,
-                            $rowColor1,$rowColor2,$gpterm,$ucgpterm,$crstype);
+            &display_groups($r,$cdom,$cnum,$functions,$idx,$view_permission,
+			    $manage_permission,$action,$state,$gpterm,
+			    $ucgpterm,$crstype);
         } elsif ($state eq 'pick_task') {
             &modify_menu($r,$groupname,$page,$gpterm);
         } elsif ($state eq 'change_settings') {
@@ -1060,13 +1057,12 @@
 }
 
 sub header {
-    my ($bodytitle,$jscript,$action,$state,$page,$function,$loaditems) = @_;
+    my ($bodytitle,$jscript,$action,$state,$page,$loaditems) = @_;
     my $start_page=
 	&Apache::loncommon::start_page($bodytitle,
 				       '<script type="text/javascript">'.
 				       $jscript.'</script>',
-				       {'function'    => $function,
-					'add_entries' => $loaditems,});
+				       {'add_entries' => $loaditems,});
     my $output = <<"END";
 $start_page
 <form method="POST" name="$state">
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.421 loncom/interface/loncommon.pm:1.422
--- loncom/interface/loncommon.pm:1.421	Fri Jul  7 09:40:16 2006
+++ loncom/interface/loncommon.pm	Fri Jul  7 11:54:15 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.421 2006/07/07 13:40:16 albertel Exp $
+# $Id: loncommon.pm,v 1.422 2006/07/07 15:54:15 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -3265,6 +3265,9 @@
   border: 1px solid #000000;
   border-collapse: separate;
 }
+.LC_data_table_dense {
+  font-size: small;
+}
 table.LC_data_table tr th, table.LC_calendar tr th, table.LC_mail_list tr th {
   font-weight: bold;
   background-color: $data_table_head;
@@ -3272,7 +3275,7 @@
 }
 table.LC_data_table tr td {
   background-color: $data_table_light;
-  padding: 0px;
+  padding: 1px;
 }
 table.LC_data_table tr.LC_even_row td {
   background-color: $data_table_dark;
@@ -3884,8 +3887,10 @@
 {
     my $row_count;
     sub start_data_table {
+	my ($add_class) = @_;
+	my $css_class = (join(' ','LC_data_table',$add_class));
 	undef($row_count);
-	return '<table class="LC_data_table">'."\n";
+	return '<table class="'.$css_class.'">'."\n";
     }
 
     sub end_data_table {
@@ -3894,8 +3899,11 @@
     }
 
     sub start_data_table_row {
+	my ($add_class) = @_;
 	$row_count++;
-	return  '<tr '.(($row_count % 2)?'':'class="LC_even_row"').'>'."\n";;
+	my $css_class = ($row_count % 2)?'':'LC_even_row';
+	my $css_class = (join(' ',$css_class,$add_class));
+	return  '<tr class="'.$css_class.'">'."\n";;
     }
 
     sub end_data_table_row {

--albertel1152287655--