--- loncom/interface/lonwhatsnew.pm 2006/03/15 19:41:26 1.52 +++ loncom/interface/lonwhatsnew.pm 2007/09/26 12:34:19 1.73 @@ -1,5 +1,5 @@ # -# $Id: lonwhatsnew.pm,v 1.52 2006/03/15 19:41:26 albertel Exp $ +# $Id: lonwhatsnew.pm,v 1.73 2007/09/26 12:34:19 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,6 +39,8 @@ use Apache::lonuserstate; use Apache::Constants qw(:common :http); use Time::Local; use GDBM_File; +use lib '/home/httpd/lib/perl/'; +use LONCAPA; #---------------------------- # handler @@ -97,35 +99,35 @@ sub handler { text=>"Display Action Items"}); if (($command eq 'chgthreshold') && $checkallowed{'abovethreshold'}) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage, text=>"Change thresholds"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Thresholds' + ("What's New?",#'Course_Action_Items_Thresholds' )); } elsif (($command eq 'chginterval') && $checkallowed{'versionchanges'} ) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=chginterval&refpage='.$refpage, text=>"Change interval"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Intervals' + ("What's New?",#'Course_Action_Items_Intervals' )); } elsif (($command eq 'chgdisc') && $checkallowed{'coursediscussion'}) { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=chgdisc&refpage='.$refpage, text=>"Change discussion display"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Intervals' + ("What's New?",#'Course_Action_Items_Intervals' )); } elsif ($command eq 'courseinit') { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage, + ({href=>'/adm/whatsnew?command=courseinit&refpage='.$refpage, text=>"Course initialization preference"}); $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Initialization' + ("What's New?",#'Course_Action_Items_Initialization' )); } else { $r->print(&Apache::lonhtmlcommon::breadcrumbs - (undef,"What's New?",#'Course_Action_Items_Display' + ("What's New?",#'Course_Action_Items_Display' )); } &display_main_box($r,$command,$refpage,\%checkallowed); @@ -142,7 +144,7 @@ sub display_main_box { 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 $lctype = lc(&Apache::loncommon::course_type()); $r->print('
');
my %threshold_titles = &Apache::lonlocal::texthash (
@@ -152,24 +154,24 @@ sub display_main_box {
);
my %interval_titles = &Apache::lonlocal::texthash (
- -1 => 'since start of course',
+ -1 => "since start of $lctype",
2592000 => 'since last month',
604800 => 'since last week',
86400 => 'since yesterday',
);
my %initpage = &Apache::lonlocal::texthash (
- firstres => 'first resource in the course',
+ firstres => "first resource in the $lctype",
whatsnew => "what's new? page",
userpref => 'your general user preferences',
- coursespecific => 'specific setting for this course',
+ coursespecific => "specific setting for this $lctype",
);
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
if (($command eq 'chgthreshold')
&& $checkallowed->{'abovethreshold'}) {
- &display_threshold_config($r,$refpage,$tabbg,\%threshold_titles,
+ &display_threshold_config($r,$refpage,\%threshold_titles,
$cdom,$crs);
} elsif (($command eq 'chginterval')
&& $checkallowed->{'versionchanges'}) {
@@ -180,7 +182,7 @@ sub display_main_box {
} elsif ($command eq 'courseinit') {
&courseinit_config($r,$refpage,\%initpage);
} else {
- &display_actions_box($r,$tabbg,$command,$refpage,\%threshold_titles,
+ &display_actions_box($r,$command,$refpage,\%threshold_titles,
\%interval_titles,\%initpage,$cdom,$crs,$checkallowed);
}
my $end_page = &Apache::loncommon::end_page();
@@ -225,7 +227,9 @@ END
';
}
- return &Apache::loncommon::start_page('Course Action Items',$scripttag);
+ my $course_type=&Apache::loncommon::course_type();
+ return &Apache::loncommon::start_page($course_type.' Action Items',
+ $scripttag);
}
#-------------------------------
@@ -236,19 +240,20 @@ END
#-------------------------------
sub display_actions_box {
- my ($r,$tabbg,$command,$refpage,$threshold_titles,$interval_titles,
- $initpage,$cdom,$crs,$checkallowed) = @_;
- my $rowColor1 = "#ffffff";
- my $rowColor2 = "#eeeeee";
-
+ my ($r,$command,$refpage,$threshold_titles,$interval_titles,$initpage,
+ $cdom,$crs,$checkallowed) = @_;
my $udom = $env{'user.domain'};
my $uname = $env{'user.name'};
my $cid = $env{'request.course.id'};
-
+ my $crstype = &Apache::loncommon::course_type();
+ my $lctype = lc($crstype);
+ my %stulabel = (
+ 'Course' => 'students',
+ 'Group' => 'members',
+ );
my %lt = &Apache::lonlocal::texthash(
- 'yacc' => 'You are accessing an invalid course.',
+ 'yacc' => 'You are accessing an invalid course',
'gtfr' => 'Go to first resource',
- 'pgse' => 'Page set to be displayed after you have selected a role in this course?',
'hial' => 'Hide all',
'shal' => 'Show all',
);
@@ -277,16 +282,12 @@ sub display_actions_box {
$result = &store_courseinit_setting($uname,$udom,$cid,$initpage);
}
- my %threshold = (
- av_attempts => 2,
- degdiff => 0.5,
- numstudents => 2,
- );
+ my %threshold = ();
my %pagedesc = &Apache::lonlocal::texthash (
firstres => 'First resource',
whatsnew => "What's New? page",
userpref => 'user preference',
- coursespecific => 'course only',
+ coursespecific => $lctype.' only',
default => 'default',
);
@@ -294,7 +295,7 @@ sub display_actions_box {
my $currinit = $pagedesc{$initdisp}.' ('.$pagedesc{$initcontrol}.')';
unless ($cid) {
- $r->print(' '); + $r->print(' '.$lt{'yacc'}.' '); return; } @@ -303,17 +304,15 @@ sub display_actions_box { &GDBM_READER(),0640)) { my $furl=$bighash{'first_url'}; untie(%bighash); - $r->print(''.$lt{'gtfr'}. - ''); + $r->print(''.$lt{'gtfr'}. + ' '); } } - $r->print($lt{'pgse'}.' '.&mt('Currently: [_1]',''.$currinit.''). - ' '); - + $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype). + '. '.&mt('Currently: [_1]',$currinit).'. '. + &mt('Change for just this '.$lctype.'',$refpage).' '. + &mt('or for all your courses.',$refpage).' '); + if ($command eq 'reset') { $result = &process_reset($cdom,$crs); } elsif ($command eq 'update') { @@ -327,9 +326,9 @@ sub display_actions_box { my $store_result=&store_display_settings($uname,$udom,$cid,$checkallowed); unless ($store_result eq 'ok') { - &Apache::lonnet::logthis('Error storing whatsnew settings: '. - $store_result.' for '.'user '.$uname.':'.$udom.' in course '.$cid); - $result .= &mt('Unable to store visibility settings due to [_1]', + &Apache::lonnet::logthis('Error saving whatsnew settings: '. + $store_result.' for '.'user '.$uname.':'.$udom.' in '.$lctype.' '.$cid); + $result .= &mt('Unable to save visibility settings due to [_1]', $store_result); } @@ -354,19 +353,22 @@ sub display_actions_box { } my %headings = &Apache::lonlocal::texthash( - coursediscussion => 'Unread course discussion posts', + coursediscussion => 'Unread '.$lctype.' discussion posts', handgrading => 'Problems requiring handgrading', haserrors => 'Problems with errors', - versionchanges => 'Resources in course with version changes '.$interval, - coursenormalmail => 'New course messages', - coursecritmail => 'New critical messages in course', + versionchanges => 'Resources in '.$lctype.' with version changes '.$interval, + coursenormalmail => 'New '.$lctype.' messages', + coursecritmail => 'New critical messages in '.$lctype, ); if ($$checkallowed{'abovethreshold'}) { &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'}; + $headings{'abovethreshold'} = + &mt('Problems with av. attempts ≥ [_1] or deg. difficulty ≥ [_2] and total number of '.$stulabel{$crstype}.' with submissions ≥ [_3]', + $threshold{'av_attempts'},$threshold{'degdiff'}, + $threshold{'numstudents'}); my @actionorder = ('handgrading','haserrors','abovethreshold','versionchanges','coursediscussion','coursenormalmail','coursecritmail'); @@ -390,7 +392,7 @@ sub display_actions_box { } if ($needitems) { - &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread); + &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread); } if ($show{'coursenormalmail'}) { $msgcount = &getnormalmail(\@newmsgs); @@ -409,7 +411,7 @@ sub display_actions_box { } } - $r->print('
|