--- loncom/interface/lonwhatsnew.pm 2008/12/12 15:48:05 1.83
+++ loncom/interface/lonwhatsnew.pm 2009/11/24 02:43:45 1.98
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.83 2008/12/12 15:48:05 raeburn Exp $
+# $Id: lonwhatsnew.pm,v 1.98 2009/11/24 02:43:45 raeburn 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
@@ -99,7 +100,7 @@ sub handler {
&Apache::lonhtmlcommon::clear_breadcrumbs();
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/whatsnew',
- text=>"Display Action Items"});
+ text=>"What's New?"});
if (($command eq 'chgthreshold') && $checkallowed{'abovethreshold'}) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>'/adm/whatsnew?command=chgthreshold&refpage='.$refpage,
@@ -194,7 +195,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",
);
@@ -267,7 +268,7 @@ END
';
}
my $course_type=&Apache::loncommon::course_type();
- return &Apache::loncommon::start_page($course_type.' Action Items',
+ return &Apache::loncommon::start_page("What's New?",
$scripttag);
}
@@ -288,7 +289,7 @@ sub display_actions_box {
my $lctype = lc($crstype);
my %stulabel = (
'Course' => 'students',
- 'Group' => 'members',
+ 'Community' => 'members',
);
my %lt = &Apache::lonlocal::texthash(
'yacc' => 'You are accessing an invalid course',
@@ -327,7 +328,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',
@@ -341,27 +342,30 @@ sub display_actions_box {
return;
}
+ my $header = '';
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);
- $r->print(''.$lt{'gtfr'}.
- ' ');
+ $header .= ''.$lt{'gtfr'}.
+ ' ';
}
}
- $r->print(&mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
+ $header .= &mt('Page set to be displayed after you have selected a role in this '.$lctype).'.'
.' '
.&mt('Currently: [_1].',''.$currinit.'')
.' '
- .&mt('[_1]Change[_2] for just [_3]this course[_4] or for all [_5]your courses[_6].'
+ .&mt('[_1]Change[_2] for just [_3]this '.$lctype.'[_4] or for [_5]all your courses/communities[_6].'
,''
,''
,''
,''
,''
,'')
- .'
');
+ .' ';
+
+ $r->print(&Apache::loncommon::head_subbox($header));
if ($command eq 'reset') {
$result = &process_reset($cdom,$crs);
@@ -378,12 +382,14 @@ sub display_actions_box {
unless ($store_result eq 'ok') {
&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);
+ $result .= ''
+ .&mt('Unable to save visibility settings due to [_1]',
+ $store_result)
+ .'';
}
if ($result) {
- $r->print($result.'');
+ $r->print($result.'');
}
$r->rflush();
@@ -490,8 +496,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);
@@ -533,7 +540,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 ++;
}
}
@@ -593,7 +600,7 @@ sub display_threshold_config {
&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table()."\n".
- '
+ '
');
@@ -649,7 +656,7 @@ sub display_interval_config {
}
$r->print('
');
+ &mt('Save').'" />');
return;
}
@@ -680,9 +687,9 @@ function toggle_countunread(choice) {
}
');
$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('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("This can increase the time taken to gather data for the [_1]What's New Page[_2] by a few seconds.",'','')
.' '
.&mt('Currently set to [_1].',''.$current.'.')
);
@@ -724,7 +731,7 @@ sub courseinit_config {
'anis' => 'and is set to display',
'padc' => 'Page display controlled by',
'chce' => 'Choose '.$lctype.' entry',
- 'moce' => 'Modify '.$lctype.' entry',
+ 'moce' => 'Save',
);
$r->print(<<"END");
$lt{'chwp'}
@@ -786,23 +793,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
@@ -825,6 +832,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;});
@@ -883,6 +894,7 @@ sub getitems {
}
}
+ return;
}
sub check_discussions {
@@ -1155,9 +1167,9 @@ sub getnormalmail {
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {
if (defined($sendtime) && $sendtime!~/error/) {
my $numsendtime = $sendtime;
- $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
if ($status eq 'new') {
- $msgcount ++;
+ $sendtime = &Apache::lonlocal::locallocaltime($sendtime);
+ $msgcount ++;
if ($shortsubj eq '') {
$shortsubj = &mt('No subject');
}
@@ -1446,7 +1458,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',
@@ -1469,13 +1481,15 @@ sub display_handgrade {
}
$r->print('