--- loncom/interface/lonwhatsnew.pm 2005/12/22 22:39:49 1.38.2.2 +++ loncom/interface/lonwhatsnew.pm 2005/12/19 21:39:37 1.39 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.38.2.2 2005/12/22 22:39:49 albertel 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,39 +124,48 @@ sub handler { #------------------------------ sub display_main_box { - my ($r,$command,$checkallowed) = @_; + my ($r,$command,$refpage,$checkallowed) = @_; my $domain=&Apache::loncommon::determinedomain(); - my $function = &Apache::loncommon::get_users_function(); - my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); - + my $tabbg=&Apache::loncommon::designparm('coordinator.tabbg',$domain); $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,$tabbg,$command,\%threshold_titles,
- \%interval_titles,$cdom,$crs,$checkallowed);
+ &display_actions_box($r,$command,$refpage,\%threshold_titles,
+ \%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
}
$r->print(< '); 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.''). + ' '); 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); @@ -294,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', @@ -306,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'}; @@ -350,7 +410,7 @@ sub display_actions_box() { } } - $r->print('
+ '); } @@ -450,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(' |