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

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 06 Sep 2006 19:20:05 -0000


This is a MIME encoded message

--albertel1157570405
Content-Type: text/plain

albertel		Wed Sep  6 15:20:05 2006 EDT

  Modified files:              
    /loncom/interface	lonwhatsnew.pm 
  Log:
  - BUG#5008, problems where getting colrs then getting sorted, CSS ing the one table fixes it
  
  
--albertel1157570405
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060906152005.txt"

Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.60 loncom/interface/lonwhatsnew.pm:1.61
--- loncom/interface/lonwhatsnew.pm:1.60	Wed Jul 19 18:01:37 2006
+++ loncom/interface/lonwhatsnew.pm	Wed Sep  6 15:20:04 2006
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.60 2006/07/19 22:01:37 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.61 2006/09/06 19:20:04 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -687,7 +687,7 @@
                           $critmsgcount,$critmsgs,$interval,$countunread) = @_;
 
     if ($$checkallowed{$action}) {
-        &start_box($r,$tabbg,$show,$headings,$action,$refpage);
+        &start_box($r,$tabbg,$show,$headings,$action,$refpage,$action);
         if ($$show{$action}) {
             if ($action eq 'handgrading') {    # UNGRADED ITEMS
                 &display_handgrade($r,$tograde,$rowColor1,$rowColor2,
@@ -701,7 +701,7 @@
 
             } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS
                 &display_abovethreshold($r,$refpage,$warnings,$triggered,
-                                             $res_title);
+					$res_title);
             } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
                 &display_coursediscussion($r,$newdiscussions,$unread,
                                 $countunread,$res_title,$rowColor1,$rowColor2);
@@ -739,7 +739,6 @@
                                                                    $cdom,$crs);
     }
 
-    my $warningnum = 0;
     foreach my $resource (@allres) {
         my $result = '';
         my $applies = 0;
@@ -773,9 +772,8 @@
 
 # Maxtries and degree of difficulty for problem parts, unless handgradeable
         if ($$show{'abovethreshold'}) {  
-            $warningnum = &check_thresholds($resource,$symb,\%resourcetracker,
-                                            $triggered,$threshold,$warnings,
-                                            $warningnum,$rowColor1,$rowColor2);
+            &check_thresholds($resource,$symb,\%resourcetracker,
+			      $triggered,$threshold,$warnings);
         }
 
     }
@@ -839,8 +837,7 @@
 }
 
 sub check_thresholds {
-    my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,
-                                       $warningnum,$rowColor1,$rowColor2) = @_;
+    my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_;
 # Compile maxtries and degree of difficulty for problem parts, unless handgradeable
     my @parts = @{$resource->parts()};
     my %stats;
@@ -885,41 +882,33 @@
         }
     }
     if ($warning) {
-        if ($warningnum%2 == 1) {
-            $rowColor = $rowColor1;
-        } else {
-            $rowColor = $rowColor2;
-        }
-        $$triggered{$symb}{rowColor} = $rowColor;
         $$triggered{$symb}{title} = $resource->title;
         foreach my $part (@parts) {
             if (exists($stats{$part}{users})) {
                 my $resetname = 'reset_'.&escape($symb."\0".$part);
                 my $resettitle = 'title_'.&escape($symb."\0".$part);
                 if ($$triggered{$symb}{numparts}) {
-                    $$triggered{$symb}{text} .= '<tr bgcolor="'.$rowColor.'">'."\n";
+                    $$triggered{$symb}{text} .= '<tr>'."\n";
                 }
                 if (@parts > 1) {
                     $$triggered{$symb}{text} .= '
-                     <td align="right"><small>part - '.$part.'<small></td>';
+                     <td>part - '.$part.'</td>';
                 } else {
                     $$triggered{$symb}{text} .= '
-                     <td align="right"><small>single part</small></td>';
+                     <td>single part</td>';
                 }
                 $$triggered{$symb}{text} .= '
-                     <td align="right"><small>'.$stats{$part}{users}.'</small></td>
-                     <td align="right"><small>'.$stats{$part}{attempts}.'</small></td>
-                     <td align="right"><small>'.$stats{$part}{degdiff}.'</small></td>
-                     <td align="right"><small>'.$lastreset{$part}.'</small></td>
-                     <td align="right"><small><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>
+                     <td>'.$stats{$part}{users}.'</td>
+                     <td>'.$stats{$part}{attempts}.'</td>
+                     <td>'.$stats{$part}{degdiff}.'</td>
+                     <td>'.$lastreset{$part}.'</td>
+                     <td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>
                     </tr>';
                 $$triggered{$symb}{numparts} ++;
             }
         }
         push(@{$warnings},$symb);
-        $warningnum ++;
     }
-    return $warningnum;
 }
 
 
@@ -1214,8 +1203,14 @@
                 ' <input type="hidden" name="command" value="reset" />'."\n".
                 ' <input type="hidden" name="refpage" value="'.$refpage.'" />'.
                 "\n");
-        $r->print('<tr bgcolor="#cccccc"><td><b><small>'.$lt{'reso'}.'</small></b></td><td align="right"><b><small>'.$lt{'part'}.'</small></b></td><td align="right"><b><small>'.$lt{'nust'}.'</small></b></td><td align="right"><b><small>'.$lt{'avat'}.'</small></b></td><td align="right"><b><small>'.$lt{'dedi'}.'</small></b></td><td align="right"><b><small>'.$lt{'lare'}.'</small></b></td><td align="right"><b><small>'.$lt{'reco'}.'</small></b></td></tr>');
+        $r->print('<tr class="LC_info_row">'.
+		  '<td class="LC_first_item">'.$lt{'reso'}.'</td>'.
+		  '<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'.
+		  '<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'.
+		  '<td>'.$lt{'lare'}.'</td><td>'.$lt{'reco'}.'</td></tr>');
+	my $row;
         foreach my $res (@{$warnings}) {
+	    $row++;
             my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
             my $linkurl=&Apache::lonnet::clutter($url);
             my $rowspan;
@@ -1223,11 +1218,14 @@
                 $rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"';
             }
             $linkurl .= '?symb='.&escape($res);
-            $r->print('<tr bgcolor="'.$$triggered{$res}{rowColor}.'"><td '.$rowspan.'><a href="'.$linkurl.'"><small>'.$$triggered{$res}{title}.'</small></a></td>'.$$triggered{$res}{text});
+            $r->print('<tr class="'.($row%2?'LC_odd_row':'').'">'.
+		      '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.
+		      $$triggered{$res}{title}.'</a></td>'.
+		      $$triggered{$res}{text});
         }
-        $r->print('<tr bgcolor="#cccccc"><td colspan="7" align="right"><br /><b><small><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></form>');
+        $r->print('<tr class="LC_info_row"><td colspan="7"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');
     } else {
-        $r->print('<tr><td bgcolor="#ffffff"><br /><center><b><i><small>'.$lt{'nopr'}.'</small></i></b></center><br /></td></tr>');
+        $r->print('<tr class="LC_empty_row"><br />'.$lt{'nopr'}.'<br /></td></tr>');
     }
 }
 
@@ -1516,7 +1514,7 @@
                        chin => 'Change interval?',
                        chop => 'Change options?',
     );
-    my $showhide;
+    my ($showhide,$class);
     if ($$show{$caller}) {
         $showhide = '<b><a href="javascript:change_display(document.visible.'.
                                'display_'.$caller.",'hide'".');">Hide</a></b>';
@@ -1548,6 +1546,7 @@
                 <td bgcolor="'.$tabbg.'" align="right"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'"><b><small>'.$lt{'chth'}.'</small></b></a></td>
               </tr>');
          }
+	 $class='class="LC_whatsnew"';
      } elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
          if ($$show{$caller}) {
              $r->print('
@@ -1563,10 +1562,10 @@
               </tr>');
          }
      }
-     $r->print('
+    $r->print('
               <tr>
                <td bgcolor="#ffffff">
-                <table cellpadding="2" cellspacing="0" border="0" width="100%">
+                <table cellpadding="2" cellspacing="0" border="0" width="100%" '.$class.'>
 ');
     return;
 }

--albertel1157570405--