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

raeburn lon-capa-cvs@mail.lon-capa.org
Thu, 07 Sep 2006 19:31:29 -0000


raeburn		Thu Sep  7 15:31:29 2006 EDT

  Modified files:              
    /loncom/interface	lonwhatsnew.pm 
  Log:
  In the threshold table, keep row color invariant for all table cells associated with a specific multi-part problem.
  
  
Index: loncom/interface/lonwhatsnew.pm
diff -u loncom/interface/lonwhatsnew.pm:1.61 loncom/interface/lonwhatsnew.pm:1.62
--- loncom/interface/lonwhatsnew.pm:1.61	Wed Sep  6 15:20:04 2006
+++ loncom/interface/lonwhatsnew.pm	Thu Sep  7 15:31:26 2006
@@ -1,5 +1,5 @@
 #
-# $Id: lonwhatsnew.pm,v 1.61 2006/09/06 19:20:04 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.62 2006/09/07 19:31:26 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -883,29 +883,28 @@
     }
     if ($warning) {
         $$triggered{$symb}{title} = $resource->title;
+        my $partcount = 0;
+        @{$$triggered{$symb}{text}} = ();
         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>'."\n";
-                }
                 if (@parts > 1) {
-                    $$triggered{$symb}{text} .= '
+                    $$triggered{$symb}{text}[$partcount] = '
                      <td>part - '.$part.'</td>';
                 } else {
-                    $$triggered{$symb}{text} .= '
+                    $$triggered{$symb}{text}[$partcount] = '
                      <td>single part</td>';
                 }
-                $$triggered{$symb}{text} .= '
+                $$triggered{$symb}{text}[$partcount] .= '
                      <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} ++;
+                     <td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>';
+                $partcount ++;
             }
+            $$triggered{$symb}{numparts} = $partcount;
         }
         push(@{$warnings},$symb);
     }
@@ -1218,10 +1217,22 @@
                 $rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"';
             }
             $linkurl .= '?symb='.&escape($res);
-            $r->print('<tr class="'.($row%2?'LC_odd_row':'').'">'.
+            my $css_class = $row%2?'LC_odd_row':'';
+            $r->print('<tr class="'.$css_class.'">'.
 		      '<td class="LC_first_item" '.$rowspan.'><a href="'.$linkurl.'">'.
-		      $$triggered{$res}{title}.'</a></td>'.
-		      $$triggered{$res}{text});
+		      $$triggered{$res}{title}.'</a></td>');
+                      if (ref($$triggered{$res}{text}) eq 'ARRAY') {
+		          $r->print($$triggered{$res}{text}[0]);
+                      }
+                      $r->print('</tr>');
+            if (ref($$triggered{$res}{text}) eq 'ARRAY') {
+                if (@{$$triggered{$res}{text}} > 1) {
+                    for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) {
+                        $r->print('<tr class="'.$css_class.'">'.
+                                  $$triggered{$res}{text}[$i].'</tr>');
+                    }
+                }
+            }
         }
         $r->print('<tr class="LC_info_row"><td colspan="7"><br /><input type="submit" name="counters" value="'.$lt{'rese'}.'" /></td></tr></form>');
     } else {