--- loncom/interface/lonwhatsnew.pm 2010/08/09 23:39:43 1.98.2.2 +++ loncom/interface/lonwhatsnew.pm 2010/08/10 03:28:53 1.98.2.3 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.98.2.2 2010/08/09 23:39:43 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.98.2.3 2010/08/10 03:28:53 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -267,6 +267,7 @@ sub display_header { $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { $scripttag = <<"END"; '; } @@ -556,17 +558,21 @@ sub display_actions_box { $countunread = 'on'; } if ($$checkallowed{'abovethreshold'}) { - &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs); + &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu); } - $headings{'abovethreshold'} = - &mt('(Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_4]', - $threshold{'av_attempts'},$threshold{'degdiff'}, - '
',$threshold{'numstudents'}); + if ($custommenu) { + $headings{'abovethreshold'} = &mt('Questions with submissions'); + } else { + $headings{'abovethreshold'} = + &mt('(Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2]) [_3] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_4]', + $threshold{'av_attempts'},$threshold{'degdiff'}, + '
',$threshold{'numstudents'}); + } my @actionorder; if ($custommenu) { - @actionorder = ('coursenormalmail','coursecritmail','newroles','oldroles','crslogin'); + @actionorder = ('coursenormalmail','coursecritmail','abovethreshold','newroles','oldroles','crslogin'); } else { @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail','newroles','oldroles'); } @@ -593,7 +599,7 @@ sub display_actions_box { my $itemserror; if ($needitems) { - $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread); + $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread,$custommenu); } if ($show{'coursenormalmail'}) { $msgcount = &getnormalmail(\@newmsgs); @@ -621,7 +627,11 @@ sub display_actions_box { } } - $r->print(''; } - $$triggered{$symb}{text}[$partcount] .= ' - - - - - '; + if ($custommenu) { + $$triggered{$symb}{text}[$partcount] .= ' + '; + } else { + $$triggered{$symb}{text}[$partcount] .= ' + + + + + '; + } $partcount ++; } $$triggered{$symb}{numparts} = $partcount; @@ -1146,7 +1166,14 @@ sub check_thresholds { sub get_curr_thresholds { - my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_; + my ($threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu) = @_; + if ($custommenu) { + %$threshold = (av_attempts => 0, + degdiff => 0.00000000000000, + numstudents => 1 + ); + return; + } # set default values %$threshold = (av_attempts => 2, degdiff => 0.5, @@ -1658,7 +1685,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$custommenu) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1672,16 +1699,35 @@ sub display_abovethreshold { ); if (@{$warnings} > 0) { @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; - $r->print(''. + if ($custommenu) { + my (%bynum,@overthresh); + foreach my $item (@{$warnings}) { + my ($probnum) = ($res_title->{$item} =~ /^Problem\s+(\d+)$/); + if ($probnum ne '') { + $bynum{$probnum} = $item; + } + } + foreach my $num (sort { $a <=> $b } keys(%bynum)) { + push(@overthresh,$bynum{$num}); + } + @{$warnings} = @overthresh; + } + if ($custommenu) { + $r->print(''. + ''. + ''); + } else { + $r->print(''. ' '."\n". ' '. "\n"); - $r->print(''. - ''. - ''. - ''. - ''); + $r->print(''. + ''. + ''. + ''. + ''); + } my $row; foreach my $res (@{$warnings}) { $row++; @@ -1713,7 +1759,9 @@ sub display_abovethreshold { } } } - $r->print(''); + unless ($custommenu) { + $r->print(''); + } } elsif ($itemserror) { $r->print(''); } else { @@ -1824,14 +1872,15 @@ sub display_crslogins { 'number' => 'Total number of logins', ); if ($logincount) { - $r->print(''. + + my $hdr = ''. ''. ''. ''. ''. ''. ''. - ''); + ''); + $table .= ''. + $table .= ''. ''. ''. - ''); + ''; } } } - $r->print(''); + '" />'.$table); } } else { $r->print(''); if (($caller eq 'abovethreshold') && ($$show{$caller})) { - if ($$show{$caller}) { + if ($$show{$caller} && !$custommenu) { $r->print('
'); + $r->print(''); + unless($custommenu) { + $r->print(''); + } + $r->print(' +
'); my $displayed = 0; my $totalboxes = 0; @@ -635,22 +645,25 @@ sub display_actions_box { my $halfway = 4; # my $halfway = int($totalboxes/2) + $totalboxes%2; if ($custommenu) { - $halfway = 2; + $halfway = 3; } foreach my $actionitem (@actionorder) { if ($$checkallowed{$actionitem}) { if ($displayed == $halfway) { $r->print(' '); } - &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount); + &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror,\%loggedin,$logincount,$custommenu); $displayed ++; } } $r->print(' -
'); + if ($custommenu) { + $r->print("\n"); + } } #------------------------------- @@ -783,12 +796,14 @@ sub display_discussion_config { 'off' => 'on', ); $r->print(''); $r->print('
' .&mt('Choose whether or not to display a count of the number of new posts for each resource or discussion board which has unread posts.') @@ -897,10 +912,10 @@ sub display_launcher { $tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered, $newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs, $interval,$countunread,$expired,$expirecount,$activated,$activecount, - $crstype,$itemserror,$loggedin,$logincount) = @_; + $crstype,$itemserror,$loggedin,$logincount,$custommenu) = @_; if ($$checkallowed{$action}) { - &start_box($r,$show,$headings,$action,$refpage,$action); + &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$ungraded,$itemserror); @@ -910,7 +925,7 @@ sub display_launcher { &display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS &display_abovethreshold($r,$refpage,$warnings,$triggered, - $res_title,$itemserror); + $res_title,$itemserror,$custommenu); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, $countunread,$res_title,$itemserror); @@ -938,7 +953,7 @@ sub display_launcher { sub getitems { my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, - $starttime,$countunread) = @_; + $starttime,$countunread,$custommenu) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); if (!defined($navmap)) { my $itemserror = ''.&mt('An error occurred retrieving information about the course.').'
'.&mt('It is recommended that you [_1]re-select the course[_2].','','').'
'; @@ -998,7 +1013,7 @@ sub getitems { # Maxtries and degree of difficulty for problem parts, unless handgradeable if ($$show{'abovethreshold'}) { &check_thresholds($resource,$symb,\%resourcetracker, - $triggered,$threshold,$warnings); + $triggered,$threshold,$warnings,$custommenu); } } @@ -1072,7 +1087,7 @@ sub check_bombed { } sub check_thresholds { - my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; + my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,$custommenu) = @_; # Compile maxtries and degree of difficulty for problem parts, unless handgradeable my @parts = @{$resource->parts()}; my %stats; @@ -1130,12 +1145,17 @@ sub check_thresholds { $$triggered{$symb}{text}[$partcount] = '
'.&mt('single part').''.$stats{$part}{users}.''.$stats{$part}{attempts}.''.$stats{$part}{degdiff}.''.$lastreset{$part}.''.$stats{$part}{users}.''.$stats{$part}{users}.''.$stats{$part}{attempts}.''.$stats{$part}{degdiff}.''.$lastreset{$part}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.''.$lt{'avat'}.''.$lt{'dedi'}.''.$lt{'lare'}.''. - $lt{'reco'}.'
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.''.$lt{'avat'}.''.$lt{'dedi'}.''.$lt{'lare'}.''. + $lt{'reco'}.'


'.$itemserror.'
'.$lt{'number'}.''.$lt{'role'}.''.$lt{'sec'}.'
'.$lt{'sec'}; my (%bylastname,%counts); if (ref($loggedin) eq 'HASH') { my @logins = sort { $b <=> $a } (keys(%{$loggedin})); @@ -1863,12 +1912,13 @@ sub display_crslogins { } } } + my $table; foreach my $person (sort(keys(%bylastname))) { if (ref($bylastname{$person}) eq 'ARRAY') { foreach my $item (@{$bylastname{$person}}) { $numlogin ++; my $css_class = $numlogin%2?' class="LC_odd_row"':''; - $r->print('
'.$counts{$role}{$sec}.''.$showrole.''.$sec.'
'.$sec.'
'. @@ -2157,7 +2207,7 @@ sub store_courseinit_setting { } sub start_box { - my ($r,$show,$heading,$caller,$refpage) = @_; + my ($r,$show,$heading,$caller,$refpage,$action,$custommenu) = @_; my %lt = &Apache::lonlocal::texthash( chth => 'Change thresholds?', chin => 'Change interval?', @@ -2182,7 +2232,7 @@ sub start_box { '.$showhide.'
'.$lt{'chth'}.'