--- loncom/interface/lonwhatsnew.pm 2005/12/15 13:38:58 1.38 +++ loncom/interface/lonwhatsnew.pm 2005/12/19 21:39:37 1.39 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.38 2005/12/15 13:38:58 raeburn Exp $ +# $Id: lonwhatsnew.pm,v 1.39 2005/12/19 21:39:37 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -52,15 +52,20 @@ sub handler { $r->send_http_header; return OK; } - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['command']); + &Apache::loncommon::get_unprocessed_cgi( + $ENV{'QUERY_STRING'},['command','refpage']); my $command = $env{'form.command'}; + my $refpage = $env{'form.refpage'}; &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - if (! (($env{'request.course.fn'}) && (&Apache::lonnet::allowed('bre',$env{'request.course.id'})))) { - # Not in a course, or not allowed to view action items - $env{'user.error.msg'}="/adm/whatsnew:bre:0:0:Cannot display what's new screen"; + my $crsid = $env{'request.course.id'}; + $crsid =~ s/_/\//; + if ((!($env{'request.course.id'})) || + ($env{'request.role'} !~ /\Q$crsid\E$/)) { + # Not in a course, or no role in course + $env{'user.error.msg'}="/adm/whatsnew::0:0:Cannot display what's new screen"; return HTTP_NOT_ACCEPTABLE; } @@ -82,21 +87,33 @@ sub handler { text=>"Display Action Items"}); if (($command eq 'chgthreshold') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chgthreshold', + ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage, text=>"Change thresholds"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Thresholds')); } elsif (($command eq 'chginterval') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chginterval', + ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage, text=>"Change interval"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Intervals')); + } elsif (($command eq 'chgdisc') && (&Apache::lonnet::allowed('pch',$env{'request.course.id'}))) { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage, + text=>"Change discussion display"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Course Action Items','Course_Action_Items_Intervals')); + } elsif ($command eq 'courseinit') { + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage, + text=>"Course initialization preference"}); + $r->print(&Apache::lonhtmlcommon::breadcrumbs + (undef,'Course Action Items','Course_Action_Items_Initialization')); } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs (undef,'Course Action Items','Course_Action_Items_Display')); } - &display_main_box($r,$command,\%checkallowed); + &display_main_box($r,$command,$refpage,\%checkallowed); return OK; } @@ -107,37 +124,48 @@ sub handler { #------------------------------ sub display_main_box { - my ($r,$command,$checkallowed) = @_; + my ($r,$command,$refpage,$checkallowed) = @_; my $domain=&Apache::loncommon::determinedomain(); my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain); $r->print(''); foreach my $res (@{$warnings}) { if ($warningnum %2 == 1) { @@ -1124,7 +1310,7 @@ sub display_coursediscussion { $r->print(''. ''); @@ -1151,7 +1337,7 @@ sub display_coursediscussion { my $lastpost = &Apache::lonnavmaps::timeToHumanString( $$unread{$ressymb}{'lastpost'}); $r->print(''); - if ($countunread) { + if ($countunread eq 'on') { my $unreadnum = $$unread{$ressymb}{'unreadcount'}; $r->print(''); @@ -1276,11 +1462,81 @@ sub store_interval_setting { return $result; } +sub store_discussion_setting { + my ($uname,$udom,$cid) = @_; + my %discussion_settings; + my $result; + if (defined($env{'form.countunread'})) { + $discussion_settings{$cid.':countunread'} = $env{'form.countunread'}; + 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]', + ''.$env{'form.countunread'}.'
'); + + } else { + &Apache::lonnet::logthis('Error storing whatsnew countunread setting'. + ' '.$outcome.' for '.$uname.':'.$udom.' in course '.$cid); + $result = &mt('Unable to set "number unread posts display" to [_1]'. + ' due to [_2].', + ''.$env{'form.countunread'}.'', + ''.$outcome.'.
'); + } + } + return $result; +} + +sub store_courseinit_setting { + my ($uname,$udom,$cid,$initpage) = @_; + my %courseinit_settings; + my $page_control; + my $result; + if (defined($env{'form.courseinit_control'})) { + if ($env{'form.courseinit_control'} eq 'userpref') { + $courseinit_settings{$cid.':courseinit'} = ''; + $page_control = 'global preferences'; + } else { + if (defined($env{'form.courseinit_page'})) { + $courseinit_settings{$cid.':courseinit'} = + $env{'form.courseinit_page'}; + $page_control = 'course specific setting'; + } + } + if ($page_control) { + my $outcome = &Apache::lonnet::put('nohist_whatsnew', + \%courseinit_settings,$udom,$uname); + if ($outcome eq 'ok') { + if ($page_control eq 'global preferences') { + $result = &mt('Page displayed after role selection in course now set by [_1]',"user's global preferences."); + } else { + $result = &mt('Page displayed after role selection in this course set to [_1]',''.$$initpage{$env{'form.courseinit_page'}}.'.'); + } + } else { + &Apache::lonnet::logthis('Error storing whatsnew courseinit '. + 'setting: '.$outcome.' for '.$uname. + ':'.$udom.' in course '.$cid); + if ($page_control eq 'global preferences') { + $result = &mt('Unable to set control of page display to [_1]'. + ' due to [_2].', + ''.$page_control.'', + ''.$outcome.'.
'); + } else { + $result = &mt('Unable to set page display, after role selection, for this course to [_1] due to [_2].', + ''.$$initpage{$env{'form.courseinit_page'}}.'', + ''.$outcome.'.
'); + } + } + } + } + return $result; +} + sub start_box { - my ($r,$tabbg,$show,$heading,$caller) = @_; + my ($r,$tabbg,$show,$heading,$caller,$refpage) = @_; my %lt = &Apache::lonlocal::texthash( chth => 'Change thresholds?', chin => 'Change interval?', + chop => 'Change options?', ); my $showhide; if ($$show{$caller}) { @@ -1310,12 +1566,17 @@ sub start_box { if (($caller eq 'abovethreshold') && ($$show{$caller})) { $r->print(' - + '); } elsif (($caller eq 'versionchanges') && ($$show{$caller})) { $r->print(' - + + '); + } elsif ($caller eq 'coursediscussion') { + $r->print(' + + '); } $r->print('
'); - my %threshold_titles = ( + my %threshold_titles = &Apache::lonlocal::texthash ( av_attempts => 'Average number of attempts', degdiff => 'Degree of difficulty', numstudents => 'Total number of students with submissions', ); - my %interval_titles = ( + my %interval_titles = &Apache::lonlocal::texthash ( -1 => 'since start of course', 2592000 => 'since last month', 604800 => 'since last week', 86400 => 'since yesterday', ); + my %initpage = &Apache::lonlocal::texthash ( + firstres => 'first resource in the course', + whatsnew => "what's new? page", + userpref => 'your general user preferences', + coursespecific => 'specific setting for this course', + ); my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; my $crs = $env{'course.'.$env{'request.course.id'}.'.num'}; if (($command eq 'chgthreshold') && (&Apache::lonnet::allowed('vgr',$env{'request.course.id'}))) { - &display_threshold_config($r,$command,$tabbg,\%threshold_titles, + &display_threshold_config($r,$refpage,$tabbg,\%threshold_titles, $cdom,$crs); } elsif (($command eq 'chginterval') && (&Apache::lonnet::allowed('opa',$env{'request.course.id'}))) { - &display_interval_config($r,\%interval_titles); + &display_interval_config($r,$refpage,\%interval_titles); + } elsif (($command eq 'chgdisc') && + (&Apache::lonnet::allowed('pch',$env{'request.course.id'}))) { + &display_discussion_config($r,$refpage); + } elsif ($command eq 'courseinit') { + &courseinit_config($r,$refpage,\%initpage); } else { - &display_actions_box($r,$command,\%threshold_titles,\%interval_titles, - $cdom,$crs,$checkallowed); + &display_actions_box($r,$command,$refpage,\%threshold_titles, + \%interval_titles,\%initpage,$cdom,$crs,$checkallowed); } $r->print(< @@ -155,7 +183,7 @@ END_OF_BLOCK # up the HTML #------------------------------- -sub display_header{ +sub display_header { my ($command,$checkallowed) = @_; my $html=&Apache::lonxml::xmlbegin(); my $bodytag=&Apache::loncommon::bodytag('Course Action Items'); @@ -171,7 +199,10 @@ function change_display(caller,change) { function changeAll(change) { END foreach my $item (keys(%{$checkallowed})) { - $scripttag.='document.visible.display_'.$item.'.value=change'."\n"; + if ($$checkallowed{$item}) { + $scripttag.='document.visible.display_'.$item.'.value=change'. + "\n"; + } } $scripttag.='document.visible.submit(); } @@ -195,9 +226,9 @@ ENDHEAD # #------------------------------- -sub display_actions_box() { - my ($r,$command,$threshold_titles,$interval_titles,$cdom,$crs, - $checkallowed) = @_; +sub display_actions_box { + my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage, + $cdom,$crs,$checkallowed) = @_; my $rowColor1 = "#ffffff"; my $rowColor2 = "#eeeeee"; @@ -208,9 +239,7 @@ sub display_actions_box() { my %lt = &Apache::lonlocal::texthash( 'yacc' => 'You are accessing an invalid course.', 'gtfr' => 'Go to first resource', - 'chyp' => 'Change your preferences', - 'tsup' => 'to suppress display of this screen when accessing'. - ' this course in the future.', + 'pgse' => 'Page set to be displayed after you have selected a role in this course?', 'hial' => 'Hide all', 'shal' => 'Show all', ); @@ -243,11 +272,26 @@ sub display_actions_box() { $function='admin'; } + my $result; + if ($command eq 'newcourseinit') { + $result = &store_courseinit_setting($uname,$udom,$cid,$initpage); + } + my %threshold = ( av_attempts => 2, degdiff => 0.5, numstudents => 2, ); + my %pagedesc = &Apache::lonlocal::texthash ( + firstres => 'First resource', + whatsnew => "What's New page", + userpref => 'user preference', + coursespecific => 'course only', + default => 'default', + ); + + my ($initcontrol,$initdisp) = &curr_courseinit(); + my $currinit = $pagedesc{$initdisp}.' ('.$pagedesc{$initcontrol}.')'; my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); @@ -257,23 +301,30 @@ sub display_actions_box() { return; } - if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', + if ($refpage eq 'start') { + if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', &GDBM_READER(),0640)) { - my $furl=$bighash{'first_url'}; - $r->print(''.$lt{'gtfr'}. - ''. - '
'.$lt{'chyp'}.'
'.$lt{'tsup'}.'

'); - untie(%bighash); + my $furl=$bighash{'first_url'}; + untie(%bighash); + $r->print(''.$lt{'gtfr'}. + '
'); + } } - - my $result; + $r->print($lt{'pgse'}.' '.&mt('Currently: [_1]',''.$currinit.''). + '  '.&mt('[_1] for just [_2]','Change', + 'this course').' '.&mt('or for all [_1].', + 'your courses').'

'); if ($command eq 'reset') { $result = &process_reset($cdom,$crs); } elsif ($command eq 'update') { - $result = &process_update($cdom,$crs,$threshold_titles); + $result = &process_update($uname,$udom,$threshold_titles); } elsif ($command eq 'newinterval') { $result = &store_interval_setting($uname,$udom,$cid,$interval_titles); + } elsif ($command eq 'newdiscconf') { + $result = &store_discussion_setting($uname,$udom,$cid); } my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed); @@ -300,7 +351,10 @@ sub display_actions_box() { $timediff = time; } my $starttime = $now - $timediff; - my $countunread = 1; + my $countunread = $display_settings{$cid.':countunread'}; + unless (defined($countunread)) { + $countunread = 'on'; + } my %headings = &Apache::lonlocal::texthash( coursediscussion => 'Unread course discussion posts', @@ -312,7 +366,7 @@ sub display_actions_box() { ); if ($$checkallowed{'abovethreshold'}) { - &get_curr_thresholds(\%threshold,$cdom,$crs); + &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs); } $headings{'abovethreshold'} = &mt('Problems with av. attempts').' ≥ '.$threshold{'av_attempts'}.' '.&mt('or deg. difficulty').' ≥ '.$threshold{'degdiff'}.'
'.&mt('and total number of students with submissions').' ≥ '.$threshold{'numstudents'}; @@ -356,7 +410,7 @@ sub display_actions_box() { } } - $r->print('
'); + $r->print('
'); my $displayed = 0; my $totalboxes = keys(%{$checkallowed}); @@ -364,9 +418,9 @@ sub display_actions_box() { foreach my $actionitem (@actionorder) { if ($$checkallowed{$actionitem}) { if ($displayed == $halfway) { - $r->print(' '); + $r->print(' '); } - &display_launcher($r,$actionitem,$checkallowed,$tabbg,$rowColor1,$rowColor2,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,$interval,$countunread); + &display_launcher($r,$actionitem,$refpage,$checkallowed,$tabbg,$rowColor1,$rowColor2,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,$interval,$countunread); $displayed ++; } } @@ -388,19 +442,25 @@ sub display_actions_box() { #------------------------------- sub display_threshold_config { - my ($r,$command,$tabbg,$threshold_titles,$cdom,$crs) = @_; + my ($r,$refpage,$tabbg,$threshold_titles,$cdom,$crs) = @_; + my $uname = $env{'user.name'}; + my $udom = $env{'user.dom'}; + my $cid = $env{'request.course.id'}; my %threshold = (); my $rowColor1 = "#ffffff"; my $rowColor2 = "#eeeeee"; my $rowColor; my @thresholditems = ("av_attempts","degdiff","numstudents"); - my %threshold_titles = ( + foreach my $item (@thresholditems) { + $threshold{$item} = ''; + } + my %threshold_titles = &Apache::lonlocal::texthash( av_attempts => 'Average number of attempts', degdiff => 'Degree of difficulty', numstudents => 'Total number of students with submissions', ); - &get_curr_thresholds(\%threshold,$cdom,$crs); + &get_curr_thresholds(\%threshold,$uname,$udom,$cid,$cdom,$crs); $r->print('
@@ -420,7 +480,7 @@ sub display_threshold_config { '); my $rowNum =0; foreach my $type (@thresholditems) { - my $parameter = 'internal.threshold_'.$type; + my $parameter = $env{'request.course.id'}.':threshold_'.$type; # onchange is javascript to automatically check the 'Set' button. my $onchange = 'onFocus="javascript:window.document.forms'. "['thresholdform'].elements['".$parameter."_setparmval']". @@ -445,6 +505,7 @@ sub display_threshold_config { $r->print('

+ '); } @@ -456,16 +517,18 @@ sub display_threshold_config { #------------------------------- sub display_interval_config { - my ($r,$interval_titles) = @_; - my $current = &get_curr_interval($env{'user.name'}, - $env{'user.domain'},$env{'request.course.id'}); + my ($r,$refpage,$interval_titles) = @_; + my $current = &get_current($env{'user.name'},$env{'user.domain'}, + $env{'request.course.id'},'interval'); $r->print('
'.&mt('Choose the time window to use for display of version changes for resources in the course.')); unless ($current eq '') { - $r->print(' '.&mt('Current value is ').$$interval_titles{$current}.'

'); + $r->print(' '.&mt('Current value is [_1]',''. + $$interval_titles{$current}.'.')); } $r->print('

+ + +on +    +off +'); + $r->print('

+
'); + return; +} + +#--------------------------------------------------- +# courseinit_config +# +# Set page displayed when course loads after +# selecting a role in the course from the roles page. +# +#--------------------------------------------------- + +sub courseinit_config { + my ($r,$refpage,$initpage) = @_; + my ($control,$current) = &curr_courseinit(); + my @chgstate = ('userpref','coursespecific'); + my @chgentry = ('firstres','whatsnew'); + my %lt = &Apache::lonlocal::texthash( + 'chwp' => 'Choose which page will be displayed when you enter this course after selecting a role.', + 'cuva' => 'Current value is determined by', + 'anis' => 'and is set to display', + 'padc' => 'Page display controlled by', + 'chce' => 'Choose course entry', + 'moce' => 'Modify course entry', + ); + $r->print(<<"END"); +
$lt{'chwp'} +
$lt{'cuva'}: +$$initpage{$control} $lt{'anis'} +$$initpage{$current}.

+
+ + +$lt{'padc'}   +END + foreach my $choice (@chgstate) { + $r->print(''.$$initpage{$choice}.'  '); + } + $r->print('

'.&mt('If').' '.$$initpage{'coursespecific'}. + '
'.$lt{'chce'}." \n"); + foreach my $choice (@chgentry) { + $r->print(''.$$initpage{$choice}.'  '); + } + $r->print('

'); + return; +} + +sub curr_courseinit { + my $current = &get_current($env{'user.name'},$env{'user.domain'}, + $env{'request.course.id'},'courseinit'); + my %userenv = &Apache::lonnet::get('environment',['course_init_display']); + my $control; + if ($current eq '') { + $control = 'userpref'; + if (exists($userenv{'firstres'})) { + $current = 'firstres'; + } else { + $current = 'whatsnew'; + } + } else { + $control = 'coursespecific'; + } + return ($control,$current); +} + sub display_launcher { - my ($r,$action,$checkallowed,$tabbg,$rowColor1,$rowColor2,$show, + my ($r,$action,$refpage,$checkallowed,$tabbg,$rowColor1,$rowColor2,$show, $headings,$res_title,$tograde,$ungraded,$bombs,$bombed,$changed, $warnings,$triggered,$newdiscussions,$unread,$msgcount,$newmsgs, $critmsgcount,$critmsgs,$interval,$countunread) = @_; if ($$checkallowed{$action}) { - &start_box($r,$tabbg,$show,$headings,$action); + &start_box($r,$tabbg,$show,$headings,$action,$refpage); if ($$show{$action}) { if ($action eq 'handgrading') { # UNGRADED ITEMS &display_handgrade($r,$tograde,$rowColor1,$rowColor2, @@ -498,8 +660,8 @@ sub display_launcher { $rowColor2,$interval); } elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS - &display_abovethreshold($r,$warnings,$triggered,$res_title, - $rowColor1,$rowColor2); + &display_abovethreshold($r,$refpage,$warnings,$triggered, + $res_title,$rowColor1,$rowColor2); } elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION &display_coursediscussion($r,$newdiscussions,$unread, $countunread,$res_title,$rowColor1,$rowColor2); @@ -594,7 +756,7 @@ sub getitems { foreach my $ressymb (@{$newdiscussions}) { $$unread{$ressymb}{'lastpost'} = $$discussiontime{$ressymb}; } - if ($countunread) { #Get count of unread postings for each resource + if ($countunread eq 'on') { #Get count of unread postings for each resource my $discussiondata = $navmap->get_discussion_data(); foreach my $ressymb (@{$newdiscussions}) { &get_discussions($cdom,$crs,$discussiondata,$ressymb, @@ -640,7 +802,7 @@ sub get_discussions { $deleted = $$discussiondata{$id.':'.$ressymb.':deleted'}; $deletedflag = 1; } - } else { + } else { unless (($hidden =~/\.$id\./) || ($deleted =~/\.$id\./)) { if ($prevread <$$discussiondata{$id.':'.$ressymb.':timestamp'}) { $unreadcount ++; @@ -775,38 +937,60 @@ sub check_thresholds { sub get_curr_thresholds { - my ($threshold,$cdom,$crs) = @_; - my %coursesettings = &Apache::lonnet::dump('environment', - $cdom,$crs,'internal.threshold'); - if (exists($coursesettings{'internal.threshold_av_attempts'})) { - $$threshold{'av_attempts'} = $coursesettings{'internal.threshold_av_attempts'}; + my ($threshold,$uname,$udom,$cid,$cdom,$crs) = @_; + my %thresholdsettings = &Apache::lonnet::dump('nohist_whatsnew',$udom, + $uname,$cid.':threshold'); + my $thresholdcount = 0; + my ($tmp) = %thresholdsettings; + unless ($tmp =~ /^Error/) { + foreach my $item (keys %{$threshold}) { + if (exists($thresholdsettings{$cid.':threshold_'.$item})) { + $$threshold{$item} = + $thresholdsettings{$cid.':threshold_'.$item}; + $thresholdcount ++; + } + } } - if (exists($coursesettings{'internal.threshold_degdiff'})) { - $$threshold{'degdiff'} = $coursesettings{'internal.threshold_degdiff'}; + if ($thresholdcount == 3) { + return; } - if (exists($coursesettings{'internal.threshold_numstudents'})) { - $$threshold{'numstudents'} = $coursesettings{'internal.threshold_numstudents'}; + my %coursesettings = &Apache::lonnet::dump('environment', + $cdom,$crs,'internal.threshold'); + my ($temp) = %coursesettings; + unless ($temp =~ /^Error/) { + foreach my $item (keys %{$threshold}) { + unless (exists($thresholdsettings{$cid.':threshold_'.$item})) { + if (exists($coursesettings{'internal.threshold_'.$item})) { + $$threshold{$item} = + $coursesettings{'internal.threshold_'.$item}; + } + } + } } + return; } -sub get_curr_interval { - my ($uname,$udom,$cid); - my $interval; - my %settings = &Apache::lonnet::dump('nohist_whatsnew',$uname,$udom,$cid,':interval'); +sub get_current { + my ($uname,$udom,$cid,$caller) = @_; + my $currvalue; + my %settings = &Apache::lonnet::dump('nohist_whatsnew',$udom,$uname,$cid. + ':'.$caller); my ($tmp) = %settings; if ($tmp =~ /^Error/) { - &logthis(); + &logthis('Error retrieving '.$caller.' setting from nohist_whatsnew for '. + $uname.";".$udom.' in '.$cid); } else { - $interval = $settings{$cid.':interval'}; + $currvalue = $settings{$cid.':'.$caller}; } - return $interval; + return $currvalue; } sub process_reset { my ($dom,$crs) = @_; - my $result = 'Counters reset for following problems (and parts):
'; + my $result = ''.&mt('Counters reset for following problems (and parts):'). + '
'; my @agg_types = ('attempts','users','correct'); - my %agg_titles = ( + my %agg_titles = &Apache::lonlocal::texthash ( attempts => 'Number of submissions', users => 'Students with submissions', correct => 'Number of correct submissions', @@ -842,17 +1026,17 @@ sub process_reset { } sub process_update { - my ($dom,$crs,$threshold_titles) = @_; + my ($uname,$udom,$threshold_titles) = @_; my $setoutput = 'Changes to threshold(s) for problem tracking:
'; foreach (keys %env) { next if ($_!~/^form\.(.+)\_setparmval$/); my $name = $1; my $value = $env{'form.'.$name.'_value'}; if ($name && defined($value)) { - my $put_result = &Apache::lonnet::put('environment', - {$name=>$value},$dom,$crs); + my $put_result = &Apache::lonnet::put('nohist_whatsnew', + {$name=>$value},$udom,$uname); - my ($shortname) = ($name =~ /^internal\.threshold_(.+)$/); + my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/); if ($put_result eq 'ok') { $setoutput.=&mt('Set threshold for [_1] to [_2]', ''.$$threshold_titles{$shortname}.'', @@ -1033,7 +1217,7 @@ sub display_haserrors { } sub display_abovethreshold { - my ($r,$warnings,$triggered,$res_title,$rowColor1,$rowColor2) = @_; + my ($r,$refpage,$warnings,$triggered,$res_title,$rowColor1,$rowColor2) = @_; my %lt = &Apache::lonlocal::texthash( reso => 'Resource', part => 'Part', @@ -1050,7 +1234,9 @@ sub display_abovethreshold { if (@{$warnings} > 0) { @{$warnings} = sort { &cmp_title($a,$b,$res_title) } @{$warnings}; $r->print('
'. - ' '."\n"); + ' '."\n". + ' '. + "\n"); $r->print('
'.$lt{'reso'}.''.$lt{'part'}.''.$lt{'nust'}.''.$lt{'avat'}.''.$lt{'dedi'}.''.$lt{'lare'}.''.$lt{'reco'}.'
'.$lt{'loca'}. ''.$lt{'type'}. ''); - if ($countunread) { + if ($countunread eq 'on') { $r->print(''.$lt{'tmlp'}.''.$lt{'numn'}. '
'.$forum_title.' '.$type.' '.$lastpost.''. '',$unreadnum.' 
'.$lt{'chth'}.''.$lt{'chth'}.'
'.$lt{'chin'}.''.$lt{'chin'}.'
'.$lt{'chop'}.'