version 1.21, 2005/06/09 18:41:08
|
version 1.32, 2005/10/10 13:36:35
|
Line 38 use Apache::lonnavmaps();
|
Line 38 use Apache::lonnavmaps();
|
use Apache::lonuserstate; |
use Apache::lonuserstate; |
use Apache::Constants qw(:common :http); |
use Apache::Constants qw(:common :http); |
use Time::Local; |
use Time::Local; |
|
use GDBM_File; |
|
|
#---------------------------- |
#---------------------------- |
# handler |
# handler |
Line 178 sub display_actions_box() {
|
Line 179 sub display_actions_box() {
|
} |
} |
|
|
my %threshold = ( |
my %threshold = ( |
av_attempts => 0, |
av_attempts => 2, |
degdiff => 0.01, |
degdiff => 0.5, |
numstudents => 0, |
numstudents => 2, |
); |
); |
|
|
my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); |
my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); |
Line 190 sub display_actions_box() {
|
Line 191 sub display_actions_box() {
|
$r->print('<br /><b><center>You are accessing an invalid course.</center></b><br /><br />'); |
$r->print('<br /><b><center>You are accessing an invalid course.</center></b><br /><br />'); |
return; |
return; |
} |
} |
|
if (tie(my %bighash,'GDBM_File',$env{'request.course.fn'}.'.db', |
my ($furl,$ferr)= |
&GDBM_READER(),0640)) { |
&Apache::lonuserstate::readmap($cdom.'/'.$crs); |
my $furl=$bighash{'first_url'}; |
$r->print('<font size="+1"><a href="'.$furl.'">Go to first resource</a></font><a href="/adm/preferences?action=changecourseinit"></font><br />Change your preferences</a> to suppress display of this screen when accessing courses as Course Coordinator in the future.<br /><hr />'); |
$r->print('<font size="+1"><a href="'.$furl.'">Go to first resource</a></font><a href="/adm/preferences?action=changecourseinit"></font><br />Change your preferences</a> to suppress display of this screen when accessing courses as Course Coordinator in the future.<br /><hr />'); |
|
untie(%bighash); |
|
} |
|
|
my $result; |
my $result; |
|
|
Line 205 sub display_actions_box() {
|
Line 208 sub display_actions_box() {
|
if ($result) { |
if ($result) { |
$r->print($result.'<hr width="100%" />'); |
$r->print($result.'<hr width="100%" />'); |
} |
} |
|
$r->rflush(); |
|
|
&get_curr_thresholds(\%threshold,$cdom,$crs); |
&get_curr_thresholds(\%threshold,$cdom,$crs); |
&getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title); |
&getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title); |
Line 264 END
|
Line 268 END
|
@bombs = sort { &cmp_title($a,$b,\%res_title) } @bombs; |
@bombs = sort { &cmp_title($a,$b,\%res_title) } @bombs; |
foreach my $bomb (@bombs) { |
foreach my $bomb (@bombs) { |
if ($bombnum %2 == 1) { |
if ($bombnum %2 == 1) { |
$rowColor = $rowColor1; |
$rowColor = $rowColor1; |
} else { |
} else { |
$rowColor = $rowColor2; |
$rowColor = $rowColor2; |
} |
} |
Line 386 END
|
Line 390 END
|
} else { |
} else { |
$rowColor = $rowColor2; |
$rowColor = $rowColor2; |
} |
} |
$r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. <small></td><td valign="top"><small><a href="/adm/communicate">'.$msg->{'shortsub'}.'</a> </small></td><td valign="top"><small> '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' </small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>'); |
$r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. </small></td><td valign="top"><small><a href="/adm/communicate">'.$msg->{'shortsub'}.'</a> </small></td><td valign="top"><small> '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' </small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>'); |
$rowNum ++; |
$rowNum ++; |
$mailcount ++; |
$mailcount ++; |
} |
} |
Line 418 END
|
Line 422 END
|
} else { |
} else { |
$rowColor = $rowColor2; |
$rowColor = $rowColor2; |
} |
} |
$r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. <small></td><td valign="top"><small><a href="/adm/mail?">'.$msg->{'shortsub'}.'</a> </small></td><td valign="top"><small> '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' </small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>'); |
$r->print('<tr bgcolor="'.$rowColor.'"><td valign="top"><small>'.$mailcount.'. <small></td><td valign="top"><small><a href="/adm/email?folder=critical">'.$msg->{'shortsub'}.'</a> </small></td><td valign="top"><small> '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' </small></td><td valign="top"><small>'.$msg->{'sendtime'}.'</small></td></tr>'); |
$rowNum ++; |
$rowNum ++; |
$mailcount ++; |
$mailcount ++; |
} |
} |
Line 504 sub display_config_box() {
|
Line 508 sub display_config_box() {
|
sub getitems { |
sub getitems { |
my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,$res_title) = @_; |
my ($unread,$ungraded,$bombed,$triggered,$newdiscussions,$tograde,$bombs,$warnings,$rowColor1,$rowColor2,$threshold,$cdom,$crs,$res_title) = @_; |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(); |
# 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;}); |
my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs); |
my %discussiontime = &Apache::lonnet::dump('discussiontimes',$cdom,$crs); |
my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}. |
my %lastread = &Apache::lonnet::dump('nohist_'.$env{'request.course.id'}. |
'_discuss',$env{'user.domain'},$env{'user.name'},'lastread'); |
'_discuss',$env{'user.domain'},$env{'user.name'},'lastread'); |
Line 561 sub getitems {
|
Line 566 sub getitems {
|
if ($resource->is_problem()) { |
if ($resource->is_problem()) { |
my $ctr = 0; |
my $ctr = 0; |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($symb); |
my ($partlist,$handgrade,$responseType) = |
my $partlist=$resource->parts(); |
&Apache::grades::response_type($url,$symb); |
|
my $handgradeable; |
my $handgradeable; |
foreach my $value (values(%{$handgrade})) { |
foreach my $part (@$partlist) { |
if ($value eq 'yes') { $handgradeable=1; last; } |
if ($resource->handgrade($part) eq 'yes') { |
|
$handgradeable=1; last; |
|
} |
|
} |
|
if ($handgradeable) { |
|
foreach my $student (keys(%$classlist)) { |
|
my ($uname,$udom) = split(/:/,$student); |
|
my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist); |
|
my $submitted = 0; |
|
my $ungraded = 0; |
|
foreach (keys(%status)) { |
|
$submitted = 1 if ($status{$_} ne 'nothing'); |
|
$ungraded = 1 if ($status{$_} =~ /^ungraded/); |
|
my ($foo,$partid,$foo1) = split(/\./,$_); |
|
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
|
$submitted = 0; |
|
} |
|
} |
|
next if (!$submitted || !$ungraded); |
|
$ctr ++; |
|
} |
|
if ($ctr) { |
|
$$ungraded{$symb}{count} = $ctr; |
|
$$ungraded{$symb}{title} = $title; |
|
push(@{$tograde}, $symb); |
|
} |
} |
} |
next if (!$handgradeable); |
|
|
|
foreach my $student (keys(%$classlist)) { |
|
my ($uname,$udom) = split(/:/,$student); |
|
my %status=&Apache::grades::student_gradeStatus($url,$symb,$udom,$uname,$partlist); |
|
my $submitted = 0; |
|
my $ungraded = 0; |
|
foreach (keys(%status)) { |
|
$submitted = 1 if ($status{$_} ne 'nothing'); |
|
$ungraded = 1 if ($status{$_} =~ /^ungraded/); |
|
my ($foo,$partid,$foo1) = split(/\./,$_); |
|
if ($status{'resource.'.$partid.'.submitted_by'} ne '') { |
|
$submitted = 0; |
|
} |
|
} |
|
next if (!$submitted || !$ungraded); |
|
$ctr ++; |
|
} |
|
if ($ctr) { |
|
$$ungraded{$symb}{count} = $ctr; |
|
$$ungraded{$symb}{title} = $title; |
|
push(@{$tograde}, $symb); |
|
} |
|
} |
} |
|
|
# Check for bombs |
# Check for bombs |
if ($resource->getErrors()) { |
if ($resource->getErrors()) { |
my $errors = $resource->getErrors(); |
my $errors = $resource->getErrors(); |
$errors =~ s/^,//; |
$errors =~ s/^,//; |
my @bombs = split(/,/, $errors); |
my @bombs = split(/,/, $errors); |
my $errorcount = scalar(@bombs); |
my $errorcount = scalar(@bombs); |
my $errorlink = '<a href="/adm/email?display='. |
my $errorlink = '<a href="/adm/email?display='. |
Line 605 sub getitems {
|
Line 611 sub getitems {
|
$$bombed{$symb}{errorlink} = $errorlink; |
$$bombed{$symb}{errorlink} = $errorlink; |
push(@{$bombs}, $symb); |
push(@{$bombs}, $symb); |
} |
} |
# Compile maxtries and degree of difficulty for problem parts |
# Compile maxtries and degree of difficulty for problem parts, unless handgradeable |
my @parts = @{$resource->parts()}; |
my @parts = @{$resource->parts()}; |
my %stats; |
my %stats; |
my %lastreset = (); |
my %lastreset = (); |
my $warning = 0; |
my $warning = 0; |
my $rowColor; |
my $rowColor; |
foreach my $part (@parts) { |
foreach my $part (@parts) { |
|
if ($resource->handgrade($part) eq 'yes') { |
|
next; |
|
} |
%{$stats{$part}} = (); |
%{$stats{$part}} = (); |
my ($attempts,$users,$corrects,$degdiff,$av_attempts); |
my ($attempts,$users,$corrects,$degdiff,$av_attempts); |
if (exists($resourcetracker{$symb."\0".$part."\0attempts"})) { |
if (exists($resourcetracker{$symb."\0".$part."\0attempts"})) { |
Line 636 sub getitems {
|
Line 645 sub getitems {
|
$stats{$part}{attempts} = $av_attempts; |
$stats{$part}{attempts} = $av_attempts; |
$stats{$part}{users} = $users; |
$stats{$part}{users} = $users; |
$lastreset{$part} = $resourcetracker{$symb."\0".$part."\0resettime"}; |
$lastreset{$part} = $resourcetracker{$symb."\0".$part."\0resettime"}; |
|
if ($lastreset{$part}) { |
|
$lastreset{$part} = &Apache::lonnavmaps::timeToHumanString($lastreset{$part}); |
|
} |
$warning = 1; |
$warning = 1; |
} |
} |
} |
} |