--- loncom/interface/lonwhatsnew.pm 2010/09/19 15:05:59 1.98.2.4 +++ loncom/interface/lonwhatsnew.pm 2012/02/08 17:07:02 1.101.2.1.2.1 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.98.2.4 2010/09/19 15:05:59 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.101.2.1.2.1 2012/02/08 17:07:02 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -89,7 +89,7 @@ sub handler { if ( ! $env{'request.course.fn'} || ! $checkallowed{'whatsnew'}) { # Not in a course, or no whn priv in course - $env{'user.error.msg'}="/adm/whatsnew::whn:0:0:Cannot display what's new page"; + $env{'user.error.msg'}="/adm/whatsnew:whn:0:0:Cannot display what's new page"; return HTTP_NOT_ACCEPTABLE; } @@ -237,7 +237,7 @@ sub display_main_box { &display_interval_config($r,$refpage,\%interval_titles,'oldroles'); } elsif (($command eq 'chgcrslogininterval') && $checkallowed->{'crslogin'}) { - &display_interval_config($r,$refpage,\%interval_titles,'crslogin'); + &display_interval_config($r,$refpage,\%interval_titles,'crslogin'); } else { &display_actions_box($r,$command,$refpage,\%threshold_titles, \%interval_titles,\%initpage,$cdom,$crs,$checkallowed); @@ -263,7 +263,7 @@ sub display_header { my $scripttag; unless ($command eq 'chgthreshold' || $command eq 'chginterval' || - $command eq 'chgoldroleinterval' || + $command eq 'chgoldroleinterval' || $command eq 'chgnewroleinterval' || $command eq 'chgcrslogininterval') { $scripttag = <<"END"; '); $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.') @@ -912,10 +886,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,$custommenu) = @_; + $crstype,$itemserror,$loggedin,$logincount) = @_; if ($$checkallowed{$action}) { - &start_box($r,$show,$headings,$action,$refpage,$action,$custommenu); + &start_box($r,$show,$headings,$action,$refpage,$action); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$ungraded,$itemserror); @@ -925,7 +899,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,$custommenu); + $res_title,$itemserror); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, $countunread,$res_title,$itemserror); @@ -942,7 +916,7 @@ sub display_launcher { } elsif ($action eq 'crslogin') { #LAST LOGIN &display_crslogins($r,$logincount,$loggedin,$interval->{'crslogin'}, $crstype); - + } } &end_box($r); @@ -953,7 +927,7 @@ sub display_launcher { sub getitems { my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, $tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, - $starttime,$countunread,$custommenu) = @_; + $starttime,$countunread) = @_; 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].','','').'
'; @@ -1013,7 +987,7 @@ sub getitems { # Maxtries and degree of difficulty for problem parts, unless handgradeable if ($$show{'abovethreshold'}) { &check_thresholds($resource,$symb,\%resourcetracker, - $triggered,$threshold,$warnings,$custommenu); + $triggered,$threshold,$warnings); } } @@ -1087,7 +1061,7 @@ sub check_bombed { } sub check_thresholds { - my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings,$custommenu) = @_; + my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; # Compile maxtries and degree of difficulty for problem parts, unless handgradeable my @parts = @{$resource->parts()}; my %stats; @@ -1097,6 +1071,9 @@ sub check_thresholds { if ($resource->handgrade($part) eq 'yes') { next; } + if ($resource->is_anonsurvey($part)) { + next; + } if ($resource->is_survey($part)) { next; } @@ -1145,17 +1122,12 @@ sub check_thresholds { $$triggered{$symb}{text}[$partcount] = ' '.&mt('single part').''; } - if ($custommenu) { - $$triggered{$symb}{text}[$partcount] .= ' - '.$stats{$part}{users}.''; - } else { - $$triggered{$symb}{text}[$partcount] .= ' - '.$stats{$part}{users}.' - '.$stats{$part}{attempts}.' - '.$stats{$part}{degdiff}.' - '.$lastreset{$part}.' - '; - } + $$triggered{$symb}{text}[$partcount] .= ' + '.$stats{$part}{users}.' + '.$stats{$part}{attempts}.' + '.$stats{$part}{degdiff}.' + '.$lastreset{$part}.' + '; $partcount ++; } $$triggered{$symb}{numparts} = $partcount; @@ -1166,14 +1138,7 @@ sub check_thresholds { sub get_curr_thresholds { - my ($threshold,$uname,$udom,$cid,$cdom,$crs,$custommenu) = @_; - if ($custommenu) { - %$threshold = (av_attempts => 0, - degdiff => 0.00000000000000, - numstudents => 1 - ); - return; - } + my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_; # set default values %$threshold = (av_attempts => 2, degdiff => 0.5, @@ -1265,7 +1230,7 @@ sub process_reset { sub process_update { my ($uname,$udom,$threshold_titles) = @_; - my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'
'; + my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'

'; foreach (keys %env) { next if ($_!~/^form\.(.+)\_setparmval$/); my $name = $1; @@ -1276,17 +1241,17 @@ sub process_update { my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/); if ($put_result eq 'ok') { - $setoutput.=&mt('Set threshold for [_1] to [_2]', + $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Set threshold for [_1] to [_2]', ''.$$threshold_titles{$shortname}.'', - ''.$value.'').'
'; + ''.$value.'').'
'); } else { - $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].', + $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set threshold for [_1] to [_2] due to [_3].', ''.$name.'',''.$value.'', - ''.$put_result.'').'
'; + ''.$put_result.'').'
',1); } } } - return $setoutput; + return &Apache::loncommon::confirmwrapper($setoutput); } sub getnormalmail { @@ -1301,7 +1266,6 @@ sub getnormalmail { &Apache::lonmsg::unpackmsgid($msgid); if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { - my $numsendtime = $sendtime; if ($status eq 'new') { $sendtime = &Apache::lonlocal::locallocaltime($sendtime); $msgcount ++; @@ -1333,7 +1297,6 @@ sub getcritmail { &Apache::lonmsg::unpackmsgid($msgid); if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { if (defined($sendtime) && $sendtime!~/error/) { - my $numsendtime = $sendtime; $sendtime = &Apache::lonlocal::locallocaltime($sendtime); $critmsgcount ++; if ($shortsubj eq '') { @@ -1583,7 +1546,7 @@ sub getloggedin { } } return $logincount; -} +} sub checkversions { my ($cdom,$crs,$navmap,$changed,$starttime) = @_; @@ -1601,7 +1564,7 @@ sub checkversions { 'lastrevisiondate'); $revdate = &Apache::lonlocal::locallocaltime($revdate); my $linkurl=&Apache::lonnet::clutter($key); - my $usedversion=$navmap->usedVersion('version_'.$linkurl); + my $usedversion=$navmap->usedVersion($linkurl); my @resources = $navmap->getResourceByUrl($linkurl,1); if (($usedversion) && ($usedversion ne 'mostrecent')) { $version = $usedversion; @@ -1685,7 +1648,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$custommenu) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1699,35 +1662,16 @@ sub display_abovethreshold { ); if (@{$warnings} > 0) { @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; - 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(''. - ''.$lt{'reso'}.''. - ''.$lt{'part'}.''.$lt{'nust'}.''); - } else { - $r->print('
'. + $r->print(''. ' '."\n". ' '. "\n"); - $r->print(''. - ''.$lt{'reso'}.''. - ''.$lt{'part'}.''.$lt{'nust'}.''. - ''.$lt{'avat'}.''.$lt{'dedi'}.''. - ''.$lt{'lare'}.''. - $lt{'reco'}.''); - } + $r->print(''. + ''.$lt{'reso'}.''. + ''.$lt{'part'}.''.$lt{'nust'}.''. + ''.$lt{'avat'}.''.$lt{'dedi'}.''. + ''.$lt{'lare'}.''. + $lt{'reco'}.''); my $row; foreach my $res (@{$warnings}) { $row++; @@ -1759,9 +1703,7 @@ sub display_abovethreshold { } } } - unless ($custommenu) { - $r->print('
'); - } + $r->print('
'); } elsif ($itemserror) { $r->print(''.$itemserror.''); } else { @@ -1872,7 +1814,7 @@ sub display_crslogins { 'number' => 'Total number of logins', ); if ($logincount) { - + my $hdr = ''. ''.$lt{'user'}.''. ''.$lt{'role'}.''. @@ -1914,18 +1856,18 @@ sub display_crslogins { } my $table; foreach my $person (sort(keys(%bylastname))) { - if (ref($bylastname{$person}) eq 'ARRAY') { - foreach my $item (@{$bylastname{$person}}) { + if (ref($bylastname{$person}) eq 'ARRAY') { + foreach my $item (@{$bylastname{$person}}) { $numlogin ++; my $css_class = $numlogin%2?' class="LC_odd_row"':''; - $table .= '