--- loncom/interface/lonwhatsnew.pm 2006/09/06 19:20:04 1.61
+++ loncom/interface/lonwhatsnew.pm 2006/11/23 00:15:56 1.65
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.61 2006/09/06 19:20:04 albertel Exp $
+# $Id: lonwhatsnew.pm,v 1.65 2006/11/23 00:15:56 banghart Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -286,11 +286,7 @@ sub display_actions_box {
$result = &store_courseinit_setting($uname,$udom,$cid,$initpage);
}
- my %threshold = (
- av_attempts => 2,
- degdiff => 0.5,
- numstudents => 2,
- );
+ my %threshold = ();
my %pagedesc = &Apache::lonlocal::texthash (
firstres => 'First resource',
whatsnew => "What's New? page",
@@ -468,9 +464,6 @@ sub display_threshold_config {
my $rowColor;
my @thresholditems = ("av_attempts","degdiff","numstudents");
- foreach my $item (@thresholditems) {
- $threshold{$item} = '';
- }
my %threshold_titles = &Apache::lonlocal::texthash(
av_attempts => 'Average number of attempts',
degdiff => 'Degree of difficulty',
@@ -883,29 +876,28 @@ sub check_thresholds {
}
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} .= '
'."\n";
- }
if (@parts > 1) {
- $$triggered{$symb}{text} .= '
+ $$triggered{$symb}{text}[$partcount] = '
part - '.$part.' | ';
} else {
- $$triggered{$symb}{text} .= '
+ $$triggered{$symb}{text}[$partcount] = '
single part | ';
}
- $$triggered{$symb}{text} .= '
+ $$triggered{$symb}{text}[$partcount] .= '
'.$stats{$part}{users}.' |
'.$stats{$part}{attempts}.' |
'.$stats{$part}{degdiff}.' |
'.$lastreset{$part}.' |
- |
-
';
- $$triggered{$symb}{numparts} ++;
+ | ';
+ $partcount ++;
}
+ $$triggered{$symb}{numparts} = $partcount;
}
push(@{$warnings},$symb);
}
@@ -914,6 +906,11 @@ sub check_thresholds {
sub get_curr_thresholds {
my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_;
+ # set default values
+ %$threshold = (av_attempts => 2,
+ degdiff => 0.5,
+ numstudents => 2
+ );
my %thresholdsettings = &Apache::lonnet::dump('nohist_whatsnew',$udom,
$uname,$cid.':threshold');
my $thresholdcount = 0;
@@ -1005,7 +1002,7 @@ sub process_update {
next if ($_!~/^form\.(.+)\_setparmval$/);
my $name = $1;
my $value = $env{'form.'.$name.'_value'};
- if ($name && defined($value)) {
+ if ($name && defined($value) && ($value ne '')) {
my $put_result = &Apache::lonnet::put('nohist_whatsnew',
{$name=>$value},$udom,$uname);
@@ -1218,14 +1215,26 @@ sub display_abovethreshold {
$rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"';
}
$linkurl .= '?symb='.&escape($res);
- $r->print(''.
+ my $css_class = $row%2?'LC_odd_row':'';
+ $r->print('
'.
''.
- $$triggered{$res}{title}.' | '.
- $$triggered{$res}{text});
+ $$triggered{$res}{title}.'');
+ if (ref($$triggered{$res}{text}) eq 'ARRAY') {
+ $r->print($$triggered{$res}{text}[0]);
+ }
+ $r->print('
');
+ if (ref($$triggered{$res}{text}) eq 'ARRAY') {
+ if (@{$$triggered{$res}{text}} > 1) {
+ for (my $i=1; $i<@{$$triggered{$res}{text}}; $i++) {
+ $r->print(''.
+ $$triggered{$res}{text}[$i].'
');
+ }
+ }
+ }
}
$r->print('
|
');
} else {
- $r->print('
'.$lt{'nopr'}.'
');
+ $r->print(''.$lt{'nopr'}.' |
');
}
}