--- loncom/interface/lonwhatsnew.pm 2006/09/07 19:31:26 1.62 +++ loncom/interface/lonwhatsnew.pm 2006/12/03 05:45:13 1.66 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.62 2006/09/07 19:31:26 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.66 2006/12/03 05:45:13 raeburn 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', @@ -747,6 +740,10 @@ sub getitems { %{$$ungraded{$symb}} = (); %{$$triggered{$symb}} = (); $$triggered{$symb}{numparts} = 0; + if ($resource->encrypted()) { + $$triggered{$symb}{'enclink'} = $resource->link(); + $$triggered{$symb}{'encsymb'} = $resource->shown_symb(); + } my $title = $resource->compTitle(); $$res_title{$symb} = $title; my $ressymb = $resource->wrap_symb(); @@ -788,6 +785,10 @@ sub check_discussions { %{$$unread{$ressymb}} = (); $$unread{$ressymb}{'title'} = $title; $$unread{$ressymb}{'symb'} = $symb; + if ($resource->encrypted()) { + $$unread{$ressymb}{'enclink'} = $resource->link(); + $$unread{$ressymb}{'encsymb'} = $resource->shown_symb(); + } push(@{$newdiscussions}, $ressymb); $$unread{$ressymb}{'lastpost'} = $resource->last_post_time(); @@ -814,7 +815,11 @@ sub check_handgraded { if (@ungraded > 0) { $$ungraded{$symb}{count} = scalar(@ungraded); $$ungraded{$symb}{title} = $title; - push(@{$tograde}, $symb); + if ($resource->encrypted()) { + $$ungraded{$symb}{'enclink'} = $resource->link(); + $$ungraded{$symb}{'encsymb'} = $resource->shown_symb(); + } + push(@{$tograde},$symb); } } } @@ -913,6 +918,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; @@ -1004,7 +1014,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); @@ -1147,7 +1157,10 @@ sub display_handgrade { my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); my $linkurl=&Apache::lonnet::clutter($url); $linkurl .= '?symb='.&escape($res); - + if ($$ungraded{$res}{'enclink'}) { + $linkurl = + $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'}; + } $r->print(''.$$ungraded{$res}{title}.''.$$ungraded{$res}{count}.''); $rowNum ++; } @@ -1217,6 +1230,10 @@ sub display_abovethreshold { $rowspan = 'rowspan="'.$$triggered{$res}{numparts}.'"'; } $linkurl .= '?symb='.&escape($res); + if ($$triggered{$res}{'enclink'}) { + $linkurl = + $$triggered{$res}{'enclink'}.'?symb='.$$triggered{$res}{'encsymb'}; + } my $css_class = $row%2?'LC_odd_row':''; $r->print(''. ''. @@ -1236,7 +1253,7 @@ sub display_abovethreshold { } $r->print('
'); } else { - $r->print('
'.$lt{'nopr'}.'
'); + $r->print(''.$lt{'nopr'}.''); } } @@ -1307,9 +1324,13 @@ sub display_coursediscussion { my $forum_title = $$unread{$ressymb}{'title'}; my $type = 'Resource'; my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb); + my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb}; if ($feedurl =~ /bulletinboard/) { $type = 'Bulletin Board'; } + if ($$unread{$ressymb}{'enclink'}) { + $disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'}; + } if ($rowNum %2 == 1) { $rowColor = $rowColor1; } else { @@ -1317,7 +1338,7 @@ sub display_coursediscussion { } my $lastpost = &Apache::lonnavmaps::timeToHumanString( $$unread{$ressymb}{'lastpost'}); - $r->print('
'.$forum_title.' '.$type.' '); + $r->print(''.$forum_title.' '.$type.' '); if ($countunread eq 'on') { my $unreadnum = $$unread{$ressymb}{'unreadcount'}; $r->print(''.$lastpost.''.