version 1.105.2.7, 2013/10/21 23:31:24
|
version 1.105.2.12, 2016/10/23 21:52:26
|
Line 73 sub handler {
|
Line 73 sub handler {
|
['vcl','newroles',1], |
['vcl','newroles',1], |
['vcl','oldroles',1], |
['vcl','oldroles',1], |
['whn','crslogin',1], |
['whn','crslogin',1], |
|
['mgr','resetcounters',1], |
) { |
) { |
my ($perm,$key,$check_section) = @{ $perm_check }; |
my ($perm,$key,$check_section) = @{ $perm_check }; |
my $scope = $env{'request.course.id'}; |
my $scope = $env{'request.course.id'}; |
Line 441 sub display_actions_box {
|
Line 442 sub display_actions_box {
|
$r->print(&Apache::loncommon::head_subbox($header)); |
$r->print(&Apache::loncommon::head_subbox($header)); |
|
|
if ($command eq 'reset') { |
if ($command eq 'reset') { |
$result = &process_reset($cdom,$crs); |
$result = &process_reset($cdom,$crs,$checkallowed); |
} elsif ($command eq 'update') { |
} elsif ($command eq 'update') { |
$result = &process_update($uname,$udom,$threshold_titles); |
$result = &process_update($uname,$udom,$threshold_titles); |
} elsif ($command eq 'newinterval') { |
} elsif ($command eq 'newinterval') { |
Line 596 sub display_actions_box {
|
Line 597 sub display_actions_box {
|
|
|
my $itemserror; |
my $itemserror; |
if ($needitems) { |
if ($needitems) { |
$itemserror = &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,$checkallowed); |
} |
} |
my $classlist; |
my $classlist; |
if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) { |
if ($show{'oldroles'} || $show{'newroles'} || $show{'crslogin'}) { |
Line 799 function toggle_countunread(choice) {
|
Line 800 function toggle_countunread(choice) {
|
.'<br />' |
.'<br />' |
.&mt("This can increase the time taken to gather data for the [_1]What's New Page[_2] by a few seconds.",'<i>','</i>') |
.&mt("This can increase the time taken to gather data for the [_1]What's New Page[_2] by a few seconds.",'<i>','</i>') |
.' ' |
.' ' |
.&mt('Currently set to [_1].','<b>'.$current.'</b>.') |
.&mt('Currently set to [_1].','<b>'.$current.'</b>') |
); |
); |
$r->print('<br /><br /> |
$r->print('<br /><br /> |
<form method="post" name="discussionswitch" action="/adm/whatsnew"> |
<form method="post" name="discussionswitch" action="/adm/whatsnew"> |
Line 914 sub display_launcher {
|
Line 915 sub display_launcher {
|
&display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); |
&display_versionchanges($r,$changed,$res_title,$interval->{'versions'},$itemserror); |
} elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS |
} elsif ($action eq 'abovethreshold') { # DEGDIFF/AV. TRIES TRIGGERS |
&display_abovethreshold($r,$refpage,$warnings,$triggered, |
&display_abovethreshold($r,$refpage,$warnings,$triggered, |
$res_title,$itemserror); |
$res_title,$itemserror,$checkallowed); |
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION |
} elsif ($action eq 'coursediscussion') { # UNREAD COURSE DISCUSSION |
&display_coursediscussion($r,$newdiscussions,$unread, |
&display_coursediscussion($r,$newdiscussions,$unread, |
$countunread,$res_title,$itemserror); |
$countunread,$res_title,$itemserror); |
Line 941 sub display_launcher {
|
Line 942 sub display_launcher {
|
sub getitems { |
sub getitems { |
my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, |
my ($unread,$ungraded,$bombed,$triggered,$changed,$newdiscussions, |
$tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, |
$tograde,$bombs,$warnings,$threshold,$cdom,$crs,$res_title,$show, |
$starttime,$countunread) = @_; |
$starttime,$countunread,$checkallowed) = @_; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
if (!defined($navmap)) { |
if (!defined($navmap)) { |
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
my $itemserror = '<span class="LC_warning">'.&mt('An error occurred retrieving information about the course.').'<br />'.&mt('It is recommended that you [_1]re-select the course[_2].','<a href="/adm/roles">','</a>').'</span>'; |
Line 1001 sub getitems {
|
Line 1002 sub getitems {
|
# Maxtries and degree of difficulty for problem parts, unless handgradeable |
# Maxtries and degree of difficulty for problem parts, unless handgradeable |
if ($$show{'abovethreshold'}) { |
if ($$show{'abovethreshold'}) { |
&check_thresholds($resource,$symb,\%resourcetracker, |
&check_thresholds($resource,$symb,\%resourcetracker, |
$triggered,$threshold,$warnings); |
$triggered,$threshold,$warnings, |
|
$checkallowed); |
} |
} |
|
|
} |
} |
Line 1075 sub check_bombed {
|
Line 1077 sub check_bombed {
|
} |
} |
|
|
sub check_thresholds { |
sub check_thresholds { |
my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings) = @_; |
my ($resource,$symb,$resourcetracker,$triggered,$threshold,$warnings, |
|
$checkallowed) = @_; |
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable |
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable |
my @parts = @{$resource->parts()}; |
my @parts = @{$resource->parts()}; |
my %stats; |
my %stats; |
Line 1141 sub check_thresholds {
|
Line 1144 sub check_thresholds {
|
<td>'.$stats{$part}{users}.'</td> |
<td>'.$stats{$part}{users}.'</td> |
<td>'.$stats{$part}{attempts}.'</td> |
<td>'.$stats{$part}{attempts}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$stats{$part}{degdiff}.'</td> |
<td>'.$lastreset{$part}.'</td> |
<td>'.$lastreset{$part}.'</td>'; |
<td><input type="checkbox" name="'.$resetname.'" /><input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
if ($checkallowed->{'resetcounters'}) { |
|
$$triggered{$symb}{text}[$partcount] .= |
|
'<td><input type="checkbox" name="'.$resetname.'" />'. |
|
'<input type="hidden" name="'.$resettitle.'" value="'.&escape($$triggered{$symb}{title}).'" /></td>'; |
|
} |
$partcount ++; |
$partcount ++; |
} |
} |
$$triggered{$symb}{numparts} = $partcount; |
$$triggered{$symb}{numparts} = $partcount; |
Line 1164 sub get_curr_thresholds {
|
Line 1171 sub get_curr_thresholds {
|
my $thresholdcount = 0; |
my $thresholdcount = 0; |
my ($tmp) = %thresholdsettings; |
my ($tmp) = %thresholdsettings; |
unless ($tmp =~ /^(con_lost|error|no_such_host)/i) { |
unless ($tmp =~ /^(con_lost|error|no_such_host)/i) { |
foreach my $item (keys %{$threshold}) { |
foreach my $item (keys(%{$threshold})) { |
if (exists($thresholdsettings{$cid.':threshold_'.$item})) { |
if (exists($thresholdsettings{$cid.':threshold_'.$item})) { |
$$threshold{$item} = |
$$threshold{$item} = |
$thresholdsettings{$cid.':threshold_'.$item}; |
$thresholdsettings{$cid.':threshold_'.$item}; |
Line 1179 sub get_curr_thresholds {
|
Line 1186 sub get_curr_thresholds {
|
$cdom,$crs,'internal.threshold'); |
$cdom,$crs,'internal.threshold'); |
my ($temp) = %coursesettings; |
my ($temp) = %coursesettings; |
unless ($temp =~ /^(con_lost|error|no_such_host)/i) { |
unless ($temp =~ /^(con_lost|error|no_such_host)/i) { |
foreach my $item (keys %{$threshold}) { |
foreach my $item (keys(%{$threshold})) { |
unless (exists($thresholdsettings{$cid.':threshold_'.$item})) { |
unless (exists($thresholdsettings{$cid.':threshold_'.$item})) { |
if (exists($coursesettings{'internal.threshold_'.$item})) { |
if (exists($coursesettings{'internal.threshold_'.$item})) { |
$$threshold{$item} = |
$$threshold{$item} = |
Line 1204 sub get_current {
|
Line 1211 sub get_current {
|
} |
} |
|
|
sub process_reset { |
sub process_reset { |
my ($dom,$crs) = @_; |
my ($dom,$crs,$checkallowed) = @_; |
|
if (!$checkallowed->{'resetcounters'}) { |
|
return '<b>'.&mt('You do not the required privileges to reset counters'). |
|
'</b><br />'; |
|
} |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
my $result = '<b>'.&mt('Counters reset for following problems (and parts):'). |
'</b><br />'; |
'</b><br />'; |
my @agg_types = ('attempts','users','correct'); |
my @agg_types = ('attempts','users','correct'); |
Line 1246 sub process_reset {
|
Line 1257 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/><br />'; |
my $setoutput = '<b>'.&mt('Changes to threshold(s) for problem tracking:').'</b><br/><br />'; |
foreach (keys %env) { |
foreach my $key (keys(%env)) { |
next if ($_!~/^form\.(.+)\_setparmval$/); |
my $name; |
my $name = $1; |
if ($key =~/^form\.(.+)\_setparmval$/) { |
|
$name = $1; |
|
} else { |
|
next; |
|
} |
my $value = $env{'form.'.$name.'_value'}; |
my $value = $env{'form.'.$name.'_value'}; |
if ($name && defined($value) && ($value ne '')) { |
if ($name && defined($value) && ($value ne '')) { |
my $put_result = &Apache::lonnet::put('nohist_whatsnew', |
my $put_result = &Apache::lonnet::put('nohist_whatsnew', |
Line 1271 sub process_update {
|
Line 1286 sub process_update {
|
|
|
sub getnormalmail { |
sub getnormalmail { |
my ($newmsgs) = @_; |
my ($newmsgs) = @_; |
# Check for unread mail in course |
# Check for unread messages in user's INBOX (which were sent in context of current course). |
my $msgcount = 0; |
my $msgcount = 0; |
|
my @messages = &Apache::lonnet::getkeys('nohist_email'); |
my @messages = sort(&Apache::lonnet::getkeys('nohist_email')); |
return $msgcount if (!@messages); |
foreach my $message (@messages) { |
my %emailstatus = &Apache::lonnet::dump('email_status'); |
my $msgid=&escape($message); |
foreach my $msgid (sort(@messages)) { |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
if ((!$emailstatus{$msgid}) || ($emailstatus{$msgid} eq 'new')) { |
&Apache::lonmsg::unpackmsgid($msgid); |
my $skipstatus; |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
if ($emailstatus{$msgid} eq 'new') { |
if (defined($sendtime) && $sendtime!~/error/) { |
$skipstatus = 1; |
if ($status eq 'new') { |
} |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
$msgcount ++; |
&Apache::lonmsg::unpackmsgid($msgid,undef,$skipstatus,undef, |
if ($shortsubj eq '') { |
$env{'request.course.id'}); |
$shortsubj = &mt('No subject'); |
if (($fromcid) && ($fromcid eq $env{'request.course.id'})) { |
|
if (defined($sendtime) && $sendtime!~/error/) { |
|
if (($emailstatus{$msgid} eq 'new') || ($status eq 'new')) { |
|
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
|
$msgcount ++; |
|
if ($shortsubj eq '') { |
|
$shortsubj = &mt('No subject'); |
|
} |
|
push(@{$newmsgs}, { |
|
msgid => $msgid, |
|
sendtime => $sendtime, |
|
shortsub => $shortsubj, |
|
from => $fromname, |
|
fromdom => $fromdom |
|
}); |
} |
} |
push(@{$newmsgs}, { |
|
msgid => $msgid, |
|
sendtime => $sendtime, |
|
shortsub => $shortsubj, |
|
from => $fromname, |
|
fromdom => $fromdom |
|
}); |
|
} |
} |
} |
} |
} |
} |
Line 1303 sub getnormalmail {
|
Line 1325 sub getnormalmail {
|
|
|
sub getcritmail { |
sub getcritmail { |
my ($critmsgs) = @_; |
my ($critmsgs) = @_; |
# Check for critical messages in course |
# Check for critical messages which were sent in context of current course. |
my %what=&Apache::lonnet::dump('critical'); |
my %what=&Apache::lonnet::dump('critical'); |
my $result = ''; |
my $result = ''; |
my $critmsgcount = 0; |
my $critmsgcount = 0; |
foreach my $msgid (sort(keys(%what))) { |
foreach my $msgid (sort(keys(%what))) { |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
my ($sendtime,$shortsubj,$fromname,$fromdom,$status,$fromcid)= |
&Apache::lonmsg::unpackmsgid($msgid); |
&Apache::lonmsg::unpackmsgid($msgid,undef,1,undef, |
|
$env{'request.course.id'}); |
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/) { |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
$sendtime = &Apache::lonlocal::locallocaltime($sendtime); |
Line 1663 sub display_haserrors {
|
Line 1686 sub display_haserrors {
|
} |
} |
|
|
sub display_abovethreshold { |
sub display_abovethreshold { |
my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror) = @_; |
my ($r,$refpage,$warnings,$triggered,$res_title,$itemserror,$checkallowed) = @_; |
my %lt = &Apache::lonlocal::texthash( |
my %lt = &Apache::lonlocal::texthash( |
reso => 'Resource', |
reso => 'Resource', |
part => 'Part', |
part => 'Part', |
Line 1682 sub display_abovethreshold {
|
Line 1705 sub display_abovethreshold {
|
'<input type="hidden" name="command" value="" /></td>'. |
'<input type="hidden" name="command" value="" /></td>'. |
'<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'. |
'<td>'.$lt{'part'}.'</td><td>'.$lt{'nust'}.'</td>'. |
'<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'. |
'<td>'.$lt{'avat'}.'</td><td>'.$lt{'dedi'}.'</td>'. |
'<td>'.$lt{'lare'}.'</td><td class="LC_right_item">'. |
'<td>'.$lt{'lare'}.'</td>'); |
$lt{'reco'}.'</td></tr>'); |
if ($checkallowed->{'resetcounters'}) { |
|
$r->print('<td class="LC_right_item">'.$lt{'reco'}.'</td>'); |
|
} |
|
$r->print('</tr>'); |
my $row; |
my $row; |
foreach my $res (@{$warnings}) { |
foreach my $res (@{$warnings}) { |
$row++; |
$row++; |
Line 1715 sub display_abovethreshold {
|
Line 1741 sub display_abovethreshold {
|
} |
} |
} |
} |
} |
} |
$r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>'); |
if ($checkallowed->{'resetcounters'}) { |
|
$r->print('<tr class="LC_info_row"><td colspan="7" class="LC_right_item"><br /><input type="button" name="counters" value="'.$lt{'rese'}.'" onclick="javascript:thresholdreset();" /></td></tr>'); |
|
} |
} elsif ($itemserror) { |
} elsif ($itemserror) { |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
$r->print('<tr class="LC_empty_row"><td>'.$itemserror.'</td></tr>'); |
} else { |
} else { |
Line 1866 sub display_crslogins {
|
Line 1894 sub display_crslogins {
|
my $udom = $user->{'udom'}; |
my $udom = $user->{'udom'}; |
my $fullname; |
my $fullname; |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
if (ref($classlist->{$uname.':'.$udom}) eq 'ARRAY') { |
$fullname = $classlist->{$user}->[$fullnameidx]; |
$fullname = $classlist->{$uname.':'.$udom}->[$fullnameidx]; |
} else { |
} else { |
$fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); |
$fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); |
} |
} |