version 1.97, 2009/11/19 14:05:46
|
version 1.103, 2011/03/31 17:54:10
|
Line 42 use Time::Local;
|
Line 42 use Time::Local;
|
use GDBM_File; |
use GDBM_File; |
use lib '/home/httpd/lib/perl/'; |
use lib '/home/httpd/lib/perl/'; |
use LONCAPA; |
use LONCAPA; |
|
use HTML::Entities; |
|
|
#---------------------------- |
#---------------------------- |
# handler |
# handler |
Line 87 sub handler {
|
Line 88 sub handler {
|
|
|
if ( ! $env{'request.course.fn'} || ! $checkallowed{'whatsnew'}) { |
if ( ! $env{'request.course.fn'} || ! $checkallowed{'whatsnew'}) { |
# Not in a course, or no whn priv in course |
# Not in a course, or no whn priv in course |
$env{'user.error.msg'}="/adm/whatsnew::whn:0:0:Cannot display what's new page"; |
$env{'user.error.msg'}="/adm/whatsnew:whn:0:0:Cannot display what's new page"; |
return HTTP_NOT_ACCEPTABLE; |
return HTTP_NOT_ACCEPTABLE; |
} |
} |
|
|
Line 345 sub display_actions_box {
|
Line 346 sub display_actions_box {
|
if ($refpage eq 'start') { |
if ($refpage eq 'start') { |
if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
&GDBM_READER(),0640)) { |
&GDBM_READER(),0640)) { |
my $furl=$bighash{'first_url'}; |
my $furl=&HTML::Entities::encode($bighash{'first_url'},'"<>&'); |
untie(%bighash); |
untie(%bighash); |
$header .= '<b><a href="'.$furl.'">'.$lt{'gtfr'}. |
$header .= '<b><a href="'.$furl.'">'.$lt{'gtfr'}. |
'</a></b><br />'; |
'</a></b><br />'; |
Line 973 sub check_thresholds {
|
Line 974 sub check_thresholds {
|
if ($resource->handgrade($part) eq 'yes') { |
if ($resource->handgrade($part) eq 'yes') { |
next; |
next; |
} |
} |
|
if ($resource->is_anonsurvey($part)) { |
|
next; |
|
} |
if ($resource->is_survey($part)) { |
if ($resource->is_survey($part)) { |
next; |
next; |
} |
} |
Line 1129 sub process_reset {
|
Line 1133 sub process_reset {
|
|
|
sub process_update { |
sub process_update { |
my ($uname,$udom,$threshold_titles) = @_; |
my ($uname,$udom,$threshold_titles) = @_; |
my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br />'; |
my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br/><br />'; |
foreach (keys %env) { |
foreach (keys %env) { |
next if ($_!~/^form\.(.+)\_setparmval$/); |
next if ($_!~/^form\.(.+)\_setparmval$/); |
my $name = $1; |
my $name = $1; |
Line 1140 sub process_update {
|
Line 1144 sub process_update {
|
|
|
my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/); |
my ($shortname) = ($name =~ /^\Q$env{'request.course.id'}\E:threshold_(.+)$/); |
if ($put_result eq 'ok') { |
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]', |
'<b>'.$$threshold_titles{$shortname}.'</b>', |
'<b>'.$$threshold_titles{$shortname}.'</b>', |
'<b>'.$value.'</b>').'<br />'; |
'<b>'.$value.'</b>').'<br />'); |
} else { |
} 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].', |
'<b>'.$name.'</b>','<b>'.$value.'</b>', |
'<b>'.$name.'</b>','<b>'.$value.'</b>', |
'<tt>'.$put_result.'</tt>').'<br />'; |
'<tt>'.$put_result.'</tt>').'<br />',1); |
} |
} |
} |
} |
} |
} |
return $setoutput; |
return &Apache::loncommon::confirmwrapper($setoutput); |
} |
} |
|
|
sub getnormalmail { |
sub getnormalmail { |
Line 1165 sub getnormalmail {
|
Line 1169 sub getnormalmail {
|
&Apache::lonmsg::unpackmsgid($msgid); |
&Apache::lonmsg::unpackmsgid($msgid); |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (defined($sendtime) && $sendtime!~/error/) { |
if (defined($sendtime) && $sendtime!~/error/) { |
my $numsendtime = $sendtime; |
|
if ($status eq 'new') { |
if ($status eq 'new') { |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$msgcount ++; |
$msgcount ++; |
Line 1197 sub getcritmail {
|
Line 1200 sub getcritmail {
|
&Apache::lonmsg::unpackmsgid($msgid); |
&Apache::lonmsg::unpackmsgid($msgid); |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if (defined($sendtime) && $sendtime!~/error/) { |
if (defined($sendtime) && $sendtime!~/error/) { |
my $numsendtime = $sendtime; |
|
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$critmsgcount ++; |
$critmsgcount ++; |
if ($shortsubj eq '') { |
if ($shortsubj eq '') { |
Line 1471 sub display_handgrade {
|
Line 1473 sub display_handgrade {
|
foreach my $res (@{$tograde}) { |
foreach my $res (@{$tograde}) { |
$rowNum ++; |
$rowNum ++; |
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my $css_class = $rowNum%2?' class="LC_odd_row"':''; |
my ($map,$id,$url)=&Apache::lonnet::decode_symb($res); |
my $linkurl='/adm/grades'; |
my $linkurl=&Apache::lonnet::clutter($url); |
|
$linkurl .= '?symb='.&escape($res); |
|
if ($$ungraded{$res}{'enclink'}) { |
if ($$ungraded{$res}{'enclink'}) { |
$linkurl = |
$linkurl.='?symb='.$$ungraded{$res}{'encsymb'}; |
$$ungraded{$res}{'enclink'}.'?symb='.$$ungraded{$res}{'encsymb'}; |
} else { |
} |
$linkurl.='?symb='.&escape($res); |
|
} |
|
$linkurl.='&command=ungraded'; |
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
$r->print('<tr'.$css_class.'><td><a href="'.$linkurl.'">'.$$ungraded{$res}{title}.'</a></td><td class="LC_right_item">'.$$ungraded{$res}{count}.'</td></tr>'); |
} |
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
Line 1840 sub store_interval_setting {
|
Line 1842 sub store_interval_setting {
|
\%interval_settings,$udom,$uname); |
\%interval_settings,$udom,$uname); |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
if (ref($interval_titles->{$context}) eq 'HASH') { |
if (ref($interval_titles->{$context}) eq 'HASH') { |
$result = &mt('New filter setting: [_1].','<b>'. |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('New filter setting: [_1].','<b>'. |
$interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />'; |
$interval_titles->{$context}->{$env{'form.interval'}}.'</b>').'<br />'); |
} |
} |
} else { |
} else { |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
&Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'. |
&Apache::lonnet::logthis('Error saving whatsnew '.$context.' interval setting'. |
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
' '.$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].', |
'<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>', |
'<b>'.$interval_titles->{$context}->{$env{'form.interval'}}.'</b>', |
'<tt>'.$outcome.'</tt>.<br />'); |
'<tt>'.$outcome.'</tt>'),1); |
} |
} |
} |
} |
return $result; |
return &Apache::loncommon::confirmwrapper($result); |
} |
} |
|
|
sub store_discussion_setting { |
sub store_discussion_setting { |
Line 1864 sub store_discussion_setting {
|
Line 1866 sub store_discussion_setting {
|
my $outcome = &Apache::lonnet::put('nohist_whatsnew', |
my $outcome = &Apache::lonnet::put('nohist_whatsnew', |
\%discussion_settings,$udom,$uname); |
\%discussion_settings,$udom,$uname); |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
$result = &mt('Count unread posts in discussions display set to [_1]', |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Count unread posts in discussions display set to [_1]', |
'<b>'.&mt($env{'form.countunread'}).'</b>').'<br />'; |
'<b>'.&mt($env{'form.countunread'}).'</b>').'<br />'); |
|
|
} else { |
} else { |
my $lctype = lc(&Apache::loncommon::course_type()); |
my $lctype = lc(&Apache::loncommon::course_type()); |
&Apache::lonnet::logthis('Error saving whatsnew countunread setting'. |
&Apache::lonnet::logthis('Error saving whatsnew countunread setting'. |
' '.$outcome.' for '.$uname.':'.$udom.' in '.$lctype.' '.$cid); |
' '.$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].', |
' due to [_2].', |
'<b>'.&mt($env{'form.countunread'}).'</b>', |
'<b>'.&mt($env{'form.countunread'}).'</b>', |
'<tt>'.$outcome.'</tt>.<br />'); |
'<tt>'.$outcome.'</tt>'),1); |
} |
} |
} |
} |
return $result; |
return &Apache::loncommon::confirmwrapper($result); |
} |
} |
|
|
sub store_courseinit_setting { |
sub store_courseinit_setting { |
Line 1902 sub store_courseinit_setting {
|
Line 1904 sub store_courseinit_setting {
|
\%courseinit_settings,$udom,$uname); |
\%courseinit_settings,$udom,$uname); |
if ($outcome eq 'ok') { |
if ($outcome eq 'ok') { |
if ($page_control eq 'global preferences') { |
if ($page_control eq 'global preferences') { |
$result = &mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>'); |
$result = &Apache::lonhtmlcommon::confirm_success(&mt("Page displayed after role selection in $lctype now set by [_1]user's global preferences[_2].",'<b>','</b>')); |
} else { |
} else { |
$result = &mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
$result = &Apache::lonhtmlcommon::confirm_success(&mt('Page displayed after role selection in this '.$lctype.' set to [_1].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>'); |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>')); |
} |
} |
} else { |
} else { |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
&Apache::lonnet::logthis('Error saving whatsnew courseinit '. |
'setting: '.$outcome.' for '.$uname. |
'setting: '.$outcome.' for '.$uname. |
':'.$udom.' in '.$lctype.' '.$cid); |
':'.$udom.' in '.$lctype.' '.$cid); |
if ($page_control eq 'global preferences') { |
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].', |
' due to [_2].', |
'<b>'.$page_control.'</b>', |
'<b>'.$page_control.'</b>', |
'<tt>'.$outcome.'</tt>.<br />'); |
'<tt>'.$outcome.'</tt>'),1); |
} else { |
} 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].' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>' |
,'<b>'.$$initpage{$env{'form.courseinit_page'}}.'</b>' |
,'<tt>'.$outcome.'</tt>') |
,'<tt>'.$outcome.'</tt>'),1); |
.'<br />'; |
|
} |
} |
} |
} |
} |
} |
} |
} |
return $result; |
return &Apache::loncommon::confirmwrapper($result); |
} |
} |
|
|
sub start_box { |
sub start_box { |
Line 1957 sub start_box {
|
Line 1958 sub start_box {
|
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'">'.$lt{'chth'}.'</a></td> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgthreshold&refpage='.$refpage.'">'.$lt{'chth'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} elsif (($caller eq 'versionchanges') && ($$show{$caller})) { |
} elsif (($caller eq 'versionchanges') && ($$show{$caller})) { |
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chginterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} elsif ($caller eq 'coursediscussion') { |
} elsif ($caller eq 'coursediscussion') { |
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'">'.$lt{'chop'}.'</a></td> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgdisc&refpage='.$refpage.'">'.$lt{'chop'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} elsif (($caller eq 'newroles') && ($$show{$caller})) { |
} elsif (($caller eq 'newroles') && ($$show{$caller})) { |
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgnewroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} elsif (($caller eq 'oldroles') && ($$show{$caller})) { |
} elsif (($caller eq 'oldroles') && ($$show{$caller})) { |
if ($$show{$caller}) { |
if ($$show{$caller}) { |
$r->print(' |
$r->print(' |
<tr> |
<tr> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
<td class="LC_subheader" colspan="2"><a href="/adm/whatsnew?command=chgoldroleinterval&refpage='.$refpage.'">'.$lt{'chin'}.'</a></td> |
</tr>'); |
</tr>'); |
} |
} |
} |
} |