--- loncom/interface/lonwhatsnew.pm 2009/11/19 14:05:46 1.97 +++ loncom/interface/lonwhatsnew.pm 2010/04/14 00:38:19 1.102 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.97 2009/11/19 14:05:46 bisitz Exp $ +# $Id: lonwhatsnew.pm,v 1.102 2010/04/14 00:38:19 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,6 +42,7 @@ use Time::Local; use GDBM_File; use lib '/home/httpd/lib/perl/'; use LONCAPA; +use HTML::Entities; #---------------------------- # handler @@ -345,7 +346,7 @@ sub display_actions_box { if ($refpage eq 'start') { if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { - my $furl=$bighash{'first_url'}; + my $furl=&HTML::Entities::encode($bighash{'first_url'},'"<>&'); untie(%bighash); $header .= ''.$lt{'gtfr'}. '
'; @@ -973,6 +974,9 @@ sub check_thresholds { if ($resource->handgrade($part) eq 'yes') { next; } + if ($resource->is_anonsurvey($part)) { + next; + } if ($resource->is_survey($part)) { next; } @@ -1129,7 +1133,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; @@ -1140,17 +1144,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 { @@ -1165,7 +1169,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 ++; @@ -1197,7 +1200,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 '') { @@ -1471,13 +1473,13 @@ sub display_handgrade { foreach my $res (@{$tograde}) { $rowNum ++; my $css_class = $rowNum%2?' class="LC_odd_row"':''; - my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); - my $linkurl=&Apache::lonnet::clutter($url); - $linkurl .= '?symb='.&escape($res); + my $linkurl='/adm/grades'; if ($$ungraded{$res}{'enclink'}) { - $linkurl = - $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'}; - } + $linkurl.='?symb='.$$ungraded{$res}{'encsymb'}; + } else { + $linkurl.='?symb='.&escape($res); + } + $linkurl.='&command=ungraded'; $r->print(''.$$ungraded{$res}{title}.''.$$ungraded{$res}{count}.''); } } elsif ($itemserror) { @@ -1840,19 +1842,19 @@ sub store_interval_setting { \%interval_settings,$udom,$uname); if ($outcome eq 'ok') { if (ref($interval_titles->{$context}) eq 'HASH') { - $result = &mt('New filter setting: [_1].',''. - $interval_titles->{$context}->{$env{'form.interval'}}.'').'
'; + $result = &Apache::lonhtmlcommon::confirm_success(&mt('New filter setting: [_1].',''. + $interval_titles->{$context}->{$env{'form.interval'}}.'').'
'); } } else { my $lctype = lc(&Apache::loncommon::course_type()); &Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'. ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid); - $result = &mt('Unable to set interval to [_1] due to [_2].', + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set interval to [_1] due to [_2].', ''.$interval_titles->{$context}->{$env{'form.interval'}}.'', - ''.$outcome.'.
'); + ''.$outcome.''),1); } } - return $result; + return &Apache::loncommon::confirmwrapper($result); } sub store_discussion_setting { @@ -1864,20 +1866,20 @@ sub store_discussion_setting { my $outcome = &Apache::lonnet::put('nohist_whatsnew', \%discussion_settings,$udom,$uname); if ($outcome eq 'ok') { - $result = &mt('Count unread posts in discussions display set to [_1]', - ''.&mt($env{'form.countunread'}).'').'
'; + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Count unread posts in discussions display set to [_1]', + ''.&mt($env{'form.countunread'}).'').'
'); } else { my $lctype = lc(&Apache::loncommon::course_type()); &Apache::lonnet::logthis('Error saving whatsnew countunread setting'. ' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid); - $result = &mt('Unable to set "number unread posts display" to [_1]'. + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set "number unread posts display" to [_1]'. ' due to [_2].', ''.&mt($env{'form.countunread'}).'', - ''.$outcome.'.
'); + ''.$outcome.''),1); } } - return $result; + return &Apache::loncommon::confirmwrapper($result); } sub store_courseinit_setting { @@ -1902,30 +1904,29 @@ sub store_courseinit_setting { \%courseinit_settings,$udom,$uname); if ($outcome eq 'ok') { if ($page_control eq 'global preferences') { - $result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'',''); + $result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'','')); } else { - $result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].' - ,''.$$initpage{$env{'form.courseinit_page'}}.''); + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' + ,''.$$initpage{$env{'form.courseinit_page'}}.'')); } } else { &Apache::lonnet::logthis('Error saving whatsnew courseinit '. 'setting: '.$outcome.' for '.$uname. ':'.$udom.' in '.$lctype.' '.$cid); if ($page_control eq 'global preferences') { - $result = &mt('Unable to set control of page display to [_1]'. + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set control of page display to [_1]'. ' due to [_2].', ''.$page_control.'', - ''.$outcome.'.
'); + ''.$outcome.''),1); } else { - $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' + $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].' ,''.$$initpage{$env{'form.courseinit_page'}}.'' - ,''.$outcome.'') - .'
'; + ,''.$outcome.''),1); } } } } - return $result; + return &Apache::loncommon::confirmwrapper($result); } sub start_box { @@ -1957,35 +1958,35 @@ sub start_box { if ($$show{$caller}) { $r->print(' - '.$lt{'chth'}.' + '.$lt{'chth'}.' '); } } elsif (($caller eq 'versionchanges') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - '.$lt{'chin'}.' + '.$lt{'chin'}.' '); } } elsif ($caller eq 'coursediscussion') { if ($$show{$caller}) { $r->print(' - '.$lt{'chop'}.' + '.$lt{'chop'}.' '); } } elsif (($caller eq 'newroles') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - '.$lt{'chin'}.' + '.$lt{'chin'}.' '); } } elsif (($caller eq 'oldroles') && ($$show{$caller})) { if ($$show{$caller}) { $r->print(' - '.$lt{'chin'}.' + '.$lt{'chin'}.' '); } }