--- loncom/interface/lonwhatsnew.pm 2008/08/26 01:12:16 1.80
+++ loncom/interface/lonwhatsnew.pm 2009/02/19 16:12:21 1.88
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.80 2008/08/26 01:12:16 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.88 2009/02/19 16:12:21 hauer Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -194,7 +194,7 @@ sub display_main_box {
);
my %initpage = &Apache::lonlocal::texthash (
firstres => "first resource in the $lctype",
- whatsnew => "what's new? page",
+ whatsnew => "What's New Page",
userpref => 'your general user preferences',
coursespecific => "specific setting for this $lctype",
);
@@ -327,7 +327,7 @@ sub display_actions_box {
my %threshold = ();
my %pagedesc = &Apache::lonlocal::texthash (
firstres => 'First resource',
- whatsnew => "What's New? page",
+ whatsnew => "What's New Page",
userpref => 'user preference',
coursespecific => $lctype.' only',
default => 'default',
@@ -354,11 +354,13 @@ sub display_actions_box {
.' '
.&mt('Currently: [_1].',''.$currinit.'')
.' '
- .&mt('Change for just [_1]this course[_2]'
- .' or for all [_3]your courses[_2].'
+ .&mt('[_1]Change[_2] for just [_3]this course[_4] or for all [_5]your courses[_6].'
+ ,''
+ ,''
,''
,''
- ,'')
+ ,''
+ ,'')
.'
');
if ($command eq 'reset') {
@@ -488,8 +490,9 @@ sub display_actions_box {
}
}
+ my $itemserror;
if ($needitems) {
- &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
+ $itemserror = &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\%changed,\@newdiscussions,\@tograde,\@bombs,\@warnings,\%threshold,$cdom,$crs,\%res_title,\%show,$starttime,$countunread);
}
if ($show{'coursenormalmail'}) {
$msgcount = &getnormalmail(\@newmsgs);
@@ -531,7 +534,7 @@ sub display_actions_box {
if ($displayed == $halfway) {
$r->print('
');
}
- &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype);
+ &display_launcher($r,$actionitem,$refpage,$checkallowed,\%show,\%headings,\%res_title,\@tograde,\%ungraded,\@bombs,\%bombed,\%changed,\@warnings,\%triggered,\@newdiscussions,\%unread,$msgcount,\@newmsgs,$critmsgcount,\@critmsgs,\%interval,$countunread,\%expired,$expirecount,\%activated,$activecount,$crstype,$itemserror);
$displayed ++;
}
}
@@ -591,7 +594,7 @@ sub display_threshold_config {
&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table()."\n".
- '
+ '
');
@@ -647,7 +650,7 @@ sub display_interval_config {
}
$r->print('
');
+ &mt('Save').'" />');
return;
}
@@ -677,7 +680,13 @@ function toggle_countunread(choice) {
document.discussionswitch.submit();
}
');
- $r->print(' '.&mt('Choose whether or not to display a count of the number of new posts for each resource or bulletin board which has unread posts.').' '.&mt("This can increase the time taken to gather data for the 'What's New?' page by a few seconds.").' '.&mt("Currently set to $current."));
+ $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.')
+ .' '
+ .&mt("This can increase the time taken to gather data for the 'What's New Page' by a few seconds.")
+ .' '
+ .&mt('Currently set to [_1].',''.$current.'.')
+ );
$r->print('
');
@@ -778,23 +787,23 @@ sub display_launcher {
$tograde,$ungraded,$bombs,$bombed,$changed,$warnings,$triggered,
$newdiscussions,$unread,$msgcount,$newmsgs,$critmsgcount,$critmsgs,
$interval,$countunread,$expired,$expirecount,$activated,$activecount,
- $crstype) = @_;
+ $crstype,$itemserror) = @_;
if ($$checkallowed{$action}) {
&start_box($r,$show,$headings,$action,$refpage,$action);
if ($$show{$action}) {
if ($action eq 'handgrading') { # UNGRADED ITEMS
- &display_handgrade($r,$tograde,$ungraded);
+ &display_handgrade($r,$tograde,$ungraded,$itemserror);
} elsif ($action eq 'haserrors') { # BOMBS
- &display_haserrors($r,$bombs,$bombed,$res_title);
+ &display_haserrors($r,$bombs,$bombed,$res_title,$itemserror);
} elsif ($action eq 'versionchanges') { # VERSION CHANGES
- &display_versionchanges($r,$changed,$res_title,$interval->{'versions'});
+ &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);
+ $res_title,$itemserror);
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION
&display_coursediscussion($r,$newdiscussions,$unread,
- $countunread,$res_title);
+ $countunread,$res_title,$itemserror);
} elsif ($action eq 'coursenormalmail') { # NORMAL MESSAGES
&display_coursenormalmail($r,$msgcount,$newmsgs);
} elsif ($action eq 'coursecritmail') { # CRITICAL MESSAGES
@@ -817,6 +826,10 @@ sub getitems {
$tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show,
$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].','','').'';
+ return $itemserror;
+ }
# force retrieve Resource to seed the part id cache we'll need it later
my @allres=$navmap->retrieveResources(undef,
sub {if ($_[0]->is_problem) { $_[0]->parts();} return 1;});
@@ -875,6 +888,7 @@ sub getitems {
}
}
+ return;
}
sub check_discussions {
@@ -1438,7 +1452,7 @@ sub checkversions {
}
sub display_handgrade {
- my ($r,$tograde,$ungraded) = @_;
+ my ($r,$tograde,$ungraded,$itemserror) = @_;
my %lt = &Apache::lonlocal::texthash(
'prna' => 'Problem Name',
'nmun' => 'Number ungraded',
@@ -1461,13 +1475,15 @@ sub display_handgrade {
}
$r->print('
');
}
}
sub display_haserrors {
- my ($r,$bombs,$bombed,$res_title) = @_;
+ my ($r,$bombs,$bombed,$res_title,$itemserror) = @_;
my $bombnum = 0;
my %lt = &Apache::lonlocal::texthash(
reso => 'Resource',
@@ -1486,6 +1502,8 @@ sub display_haserrors {
'
'.
$$bombed{$bomb}{errorcount}.'
');
}
+ } elsif ($itemserror) {
+ $r->print('
'.$itemserror.'
');
} else {
$r->print('
'.$lt{'noer'}.'
');
}
@@ -1493,7 +1511,7 @@ sub display_haserrors {
}
sub display_abovethreshold {
- my ($r,$refpage,$warnings,$triggered,$res_title) = @_;
+ my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_;
my %lt = &Apache::lonlocal::texthash(
reso => 'Resource',
part => 'Part',
@@ -1549,13 +1567,15 @@ sub display_abovethreshold {
}
}
$r->print('
');
+ } elsif ($itemserror) {
+ $r->print('
'.$itemserror.'
');
} else {
$r->print('
'.$lt{'nopr'}.'
');
}
}
sub display_versionchanges {
- my ($r,$changed,$res_title,$interval) = @_;
+ my ($r,$changed,$res_title,$interval,$itemserror) = @_;
my %lt = &Apache::lonlocal::texthash(
'reso' => 'Resource',
'revd' => 'Last revised',
@@ -1582,6 +1602,8 @@ sub display_versionchanges {
$$changed{$item}{'current'}.'
'.
$$changed{$item}{'version'}.'
');
}
+ } elsif ($itemserror) {
+ $r->print('
'.$itemserror.'
');
} else {
$r->print('
'
.&mt('No '.$interval).'
');
@@ -1647,7 +1669,7 @@ sub display_rolechanges {
}
sub display_coursediscussion {
- my ($r,$newdiscussions,$unread,$countunread,$res_title) = @_;
+ my ($r,$newdiscussions,$unread,$countunread,$res_title,$itemserror) = @_;
my $lctype = lc(&Apache::loncommon::course_type());
my %lt = &Apache::lonlocal::texthash(
'loca' => 'Location',
@@ -1677,7 +1699,7 @@ sub display_coursediscussion {
my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
my $disclink = $feedurl.'?symb='.$$unread{$ressymb}{symb};
if ($feedurl =~ /bulletinboard/) {
- $type = 'Bulletin Board';
+ $type = 'Discussion Board';
}
if ($$unread{$ressymb}{'enclink'}) {
$disclink = $$unread{$ressymb}{'enclink'}.'?symb='.$$unread{$ressymb}{'encsymb'};
@@ -1695,6 +1717,8 @@ sub display_coursediscussion {
}
$r->print("\n");
}
+ } elsif ($itemserror) {
+ $r->print('
'.$itemserror.'
');
} else {
$r->print('
'.$lt{'noun'}.'
');
}
@@ -1873,9 +1897,10 @@ 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 user's global preferences.");
+ $result = &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 [_2]',$lctype,$$initpage{$env{'form.courseinit_page'}});
+ $result = &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 '.
@@ -1887,8 +1912,10 @@ sub store_courseinit_setting {
''.$page_control.'',
''.$outcome.'. ');
} else {
- $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_2] due to [_3]. ',
- $$initpage{$env{'form.courseinit_page'}},$outcome);
+ $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
+ ,''.$$initpage{$env{'form.courseinit_page'}}.''
+ ,''.$outcome.'')
+ .' ';
}
}
}