--- loncom/interface/lonwhatsnew.pm 2009/02/19 16:12:21 1.88
+++ loncom/interface/lonwhatsnew.pm 2010/04/14 00:38:19 1.102
@@ -1,5 +1,5 @@
#
-# $Id: lonwhatsnew.pm,v 1.88 2009/02/19 16:12:21 hauer Exp $
+# $Id: lonwhatsnew.pm,v 1.102 2010/04/14 00:38:19 www 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,
@@ -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',
@@ -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();
@@ -683,7 +689,7 @@ 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 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.'.')
);
@@ -725,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'}
@@ -968,6 +974,9 @@ sub check_thresholds {
if ($resource->handgrade($part) eq 'yes') {
next;
}
+ if ($resource->is_anonsurvey($part)) {
+ next;
+ }
if ($resource->is_survey($part)) {
next;
}
@@ -1124,7 +1133,7 @@ sub process_reset {
sub process_update {
my ($uname,$udom,$threshold_titles) = @_;
- my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'
';
+ my $setoutput = ''.&mt('Changes to threshold(s) for problem tracking:').'
';
foreach (keys %env) {
next if ($_!~/^form\.(.+)\_setparmval$/);
my $name = $1;
@@ -1135,17 +1144,17 @@ sub process_update {
my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/);
if ($put_result eq 'ok') {
- $setoutput.=&mt('Set threshold for [_1] to [_2]',
+ $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Set threshold for [_1] to [_2]',
''.$$threshold_titles{$shortname}.'',
- ''.$value.'').'
';
+ ''.$value.'').'
');
} else {
- $setoutput.=&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
+ $setoutput.= &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set threshold for [_1] to [_2] due to [_3].',
''.$name.'',''.$value.'',
- ''.$put_result.'').'
';
+ ''.$put_result.'').'
',1);
}
}
}
- return $setoutput;
+ return &Apache::loncommon::confirmwrapper($setoutput);
}
sub getnormalmail {
@@ -1160,10 +1169,9 @@ sub getnormalmail {
&Apache::lonmsg::unpackmsgid($msgid);
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');
}
@@ -1192,7 +1200,6 @@ sub getcritmail {
&Apache::lonmsg::unpackmsgid($msgid);
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) {
if (defined($sendtime) && $sendtime!~/error/) {
- my $numsendtime = $sendtime;
$sendtime = &Apache::lonlocal::locallocaltime($sendtime);
$critmsgcount ++;
if ($shortsubj eq '') {
@@ -1466,13 +1473,13 @@ sub display_handgrade {
foreach my $res (@{$tograde}) {
$rowNum ++;
my $css_class = $rowNum%2?' class="LC_odd_row"':'';
- my ($map,$id,$url)=&Apache::lonnet::decode_symb($res);
- my $linkurl=&Apache::lonnet::clutter($url);
- $linkurl .= '?symb='.&escape($res);
+ my $linkurl='/adm/grades';
if ($$ungraded{$res}{'enclink'}) {
- $linkurl =
- $$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'};
- }
+ $linkurl.='?symb='.$$ungraded{$res}{'encsymb'};
+ } else {
+ $linkurl.='?symb='.&escape($res);
+ }
+ $linkurl.='&command=ungraded';
$r->print(''.$$ungraded{$res}{title}.' | '.$$ungraded{$res}{count}.' |
');
}
} elsif ($itemserror) {
@@ -1835,19 +1842,19 @@ sub store_interval_setting {
\%interval_settings,$udom,$uname);
if ($outcome eq 'ok') {
if (ref($interval_titles->{$context}) eq 'HASH') {
- $result = &mt('New filter setting: [_1].',''.
- $interval_titles->{$context}->{$env{'form.interval'}}.'').'
';
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('New filter setting: [_1].',''.
+ $interval_titles->{$context}->{$env{'form.interval'}}.'').'
');
}
} else {
my $lctype = lc(&Apache::loncommon::course_type());
&Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'.
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
- $result = &mt('Unable to set interval to [_1] due to [_2].',
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set interval to [_1] due to [_2].',
''.$interval_titles->{$context}->{$env{'form.interval'}}.'',
- ''.$outcome.'.
');
+ ''.$outcome.''),1);
}
}
- return $result;
+ return &Apache::loncommon::confirmwrapper($result);
}
sub store_discussion_setting {
@@ -1859,20 +1866,20 @@ sub store_discussion_setting {
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]',
- ''.&mt($env{'form.countunread'}).'').'
';
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('Count unread posts in discussions display set to [_1]',
+ ''.&mt($env{'form.countunread'}).'').'
');
} else {
my $lctype = lc(&Apache::loncommon::course_type());
&Apache::lonnet::logthis('Error saving whatsnew countunread setting'.
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid);
- $result = &mt('Unable to set "number unread posts display" to [_1]'.
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set "number unread posts display" to [_1]'.
' due to [_2].',
''.&mt($env{'form.countunread'}).'',
- ''.$outcome.'.
');
+ ''.$outcome.''),1);
}
}
- return $result;
+ return &Apache::loncommon::confirmwrapper($result);
}
sub store_courseinit_setting {
@@ -1897,30 +1904,29 @@ 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 [_1]user's global preferences[_2].",'','');
+ $result = &Apache::lonhtmlcommon::confirm_success(&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 [_1].'
- ,''.$$initpage{$env{'form.courseinit_page'}}.'');
+ $result = &Apache::lonhtmlcommon::confirm_success(&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 '.
'setting: '.$outcome.' for '.$uname.
':'.$udom.' in '.$lctype.' '.$cid);
if ($page_control eq 'global preferences') {
- $result = &mt('Unable to set control of page display to [_1]'.
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set control of page display to [_1]'.
' due to [_2].',
''.$page_control.'',
- ''.$outcome.'.
');
+ ''.$outcome.''),1);
} else {
- $result = &mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
+ $result = &Apache::lonhtmlcommon::confirm_success(&mt('Unable to set page display, after role selection, for this '.$lctype.' to [_1] due to [_2].'
,''.$$initpage{$env{'form.courseinit_page'}}.''
- ,''.$outcome.'')
- .'
';
+ ,''.$outcome.''),1);
}
}
}
}
- return $result;
+ return &Apache::loncommon::confirmwrapper($result);
}
sub start_box {
@@ -1952,35 +1958,35 @@ sub start_box {
if ($$show{$caller}) {
$r->print('
-
+
');
}
} elsif (($caller eq 'versionchanges') && ($$show{$caller})) {
if ($$show{$caller}) {
$r->print('
-
+
');
}
} elsif ($caller eq 'coursediscussion') {
if ($$show{$caller}) {
$r->print('
-
+
');
}
} elsif (($caller eq 'newroles') && ($$show{$caller})) {
if ($$show{$caller}) {
$r->print('
-
+
');
}
} elsif (($caller eq 'oldroles') && ($$show{$caller})) {
if ($$show{$caller}) {
$r->print('
-
+
');
}
}