');
-
- if ($command eq 'config') {
- &display_config_box($r,$picker);
+
+ my %threshold_titles = (
+ av_attempts => 'Average number of attempts',
+ degdiff => 'Degree of difficulty',
+ numstudents => 'Total number of students with submissions',
+ );
+ my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
+
+ if ($command eq 'chgthreshold') {
+ &display_config_box($r,$command,$tabbg,\%threshold_titles,$cdom,$crs);
} else {
- &display_actions_box($r,$picker);
+ &display_actions_box($r,$command,\%threshold_titles,$cdom,$crs);
}
$r->print(<
@@ -155,7 +150,7 @@ ENDHEAD
#-------------------------------
sub display_actions_box() {
- my ($r,$picker) = @_;
+ my ($r,$command,$threshold_titles,$cdom,$crs) = @_;
my $rowColor1 = "#ffffff";
my $rowColor2 = "#eeeeee";
@@ -164,11 +159,14 @@ sub display_actions_box() {
my %unread = ();
my %ungraded = ();
my %bombed = ();
+ my %triggered = ();
my @newmsgs = ();
my @critmsgs = ();
my @newdiscussions = ();
my @tograde = ();
my @bombs = ();
+ my @warnings = ();
+ my %res_title = ();
my $domain=&Apache::loncommon::determinedomain();
my $function;
@@ -179,59 +177,40 @@ sub display_actions_box() {
$function='admin';
}
+ my %threshold = (
+ av_attempts => 0,
+ degdiff => 0.01,
+ numstudents => 0,
+ );
+
my $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain);
my $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain);
- &getitems(\%unread,\%ungraded,\%bombed,\@newdiscussions,\@tograde,\@bombs);
- my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);
-
unless ($env{'request.course.id'}) {
- $r->print(' You are accessing an invalid course
');
+ $r->print(' You are accessing an invalid course.
');
return;
}
- $r->print(''.$picker.'
');
+ my ($furl,$ferr)=
+ &Apache::lonuserstate::readmap($cdom.'/'.$crs);
+ $r->print('Go to first resource Change your preferences to suppress display of this screen when accessing courses as Course Coordinator in the future.
');
-## UNREAD COURSE DISCUSSION POSTS ##
- $r->print(<<"END");
-
-
-
-
- Unread course discussion posts: |
-
-
-
-
-END
+ my $result;
- if (@newdiscussions > 0) {
- $r->print('Location | Type | Number of new posts | ');
-# @newdiscussions = sort { &cmp_title($a,$b) } @newdiscussions;
- my $rowNum = 0;
- foreach my $ressymb (@newdiscussions) {
- my $forum_title = $unread{$ressymb}{'title'};
- my $type = 'Resource';
- my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
- if ($feedurl =~ /bulletinboard/) {
- $type = 'Bulletin Board';
- }
- my $unreadnum = keys(%{$unread{$ressymb}});
- $unreadnum = $unreadnum - 2;
- if ($unreadnum > 0) {
- if ($rowNum %2 == 1) {
- $rowColor = $rowColor1;
- } else {
- $rowColor = $rowColor2;
- }
- $r->print(''.$forum_title.': | '.$type.' | '.$unreadnum.' | ');
- $rowNum ++;
- }
- }
- } else {
- $r->print(' No unread posts in course discussions
| ');
+ if ($command eq 'reset') {
+ $result = &process_reset($cdom,$crs);
+ } elsif ($command eq 'update') {
+ $result = &process_update($cdom,$crs,$threshold_titles);
}
- $r->print(' | | ');
+ if ($result) {
+ $r->print($result.' ');
+ }
+
+ &get_curr_thresholds(\%threshold,$cdom,$crs);
+ &getitems(\%unread,\%ungraded,\%bombed,\%triggered,\@newdiscussions,\@tograde,\@bombs,\@warnings,$rowColor1,$rowColor2,\%threshold,$cdom,$crs,%res_title);
+ my ($msgcount,$critmsgcount) = &getmail(\@newmsgs,\@critmsgs);
+
+ $r->print('
');
## UNGRADED ITEMS ##
$r->print(<
- Problems requiring handgrading: |
+ Problems requiring handgrading |
@@ -281,14 +260,15 @@ END
END
my $bombnum = 0;
if (@bombs > 0) {
-# @bombs = sort { &cmp_title($a,$b) } @bombs;
+ $r->print('Resource | Number of errors | ');
+ @bombs = sort { &cmp_title($a,$b,\%res_title) } @bombs;
foreach my $bomb (@bombs) {
if ($bombnum %2 == 1) {
$rowColor = $rowColor1;
} else {
$rowColor = $rowColor2;
}
- $r->print(''.$bombed{$bomb}{errorlink}.' | ');
+ $r->print(''.$bombed{$bomb}{errorlink}.' | '.$bombed{$bomb}{errorcount}.' | ');
$bombnum ++;
}
} else {
@@ -296,8 +276,93 @@ END
}
$r->print(' | | |
');
+# DEGDIFF AND AV. TRIES TRIGGERS
+ $r->print(<<"END");
+
+
+
+
+
+ Problems with av. attempts ≥ $threshold{'av_attempts'} or deg. difficulty ≥ $threshold{'degdiff'} and total number of students with submissions ≥ $threshold{'numstudents'} |
+
+
+ Change thresholds? |
+
+
+
+
+END
+ my $warningnum = 0;
+ if (@warnings > 0) {
+ @warnings = sort { &cmp_title($a,$b,\%res_title) } @warnings;
+ $r->print(' | | ');
+
$r->print(' | | ');
+## UNREAD COURSE DISCUSSION POSTS ##
+ $r->print(<<"END");
+
+
+
+
+ Unread course discussion posts |
+
+
+
+
+END
+
+ if (@newdiscussions > 0) {
+ $r->print('Location | Type | Number of new posts | ');
+ @newdiscussions = sort { &cmp_title($a,$b,\%res_title) } @newdiscussions;
+ my $rowNum = 0;
+ foreach my $ressymb (@newdiscussions) {
+ my $forum_title = $unread{$ressymb}{'title'};
+ my $type = 'Resource';
+ my $feedurl=&Apache::lonfeedback::get_feedurl($ressymb);
+ if ($feedurl =~ /bulletinboard/) {
+ $type = 'Bulletin Board';
+ }
+ my $unreadnum = keys(%{$unread{$ressymb}});
+ $unreadnum = $unreadnum - 2;
+ if ($unreadnum > 0) {
+ if ($rowNum %2 == 1) {
+ $rowColor = $rowColor1;
+ } else {
+ $rowColor = $rowColor2;
+ }
+ $r->print(''.$forum_title.' | '.$type.' | '.$unreadnum.' | ');
+ $rowNum ++;
+ }
+ }
+ } else {
+ $r->print(' No unread posts in course discussions
| ');
+ }
+ $r->print(' | | ');
+
## MESSAGES ##
$r->print(<
@@ -321,7 +386,7 @@ END
} else {
$rowColor = $rowColor2;
}
- $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
+ $r->print(''.$mailcount.'. | '.$msg->{'shortsub'}.' | '.$msg->{'from'}.'@'.$msg->{'fromdom'}.' | '.$msg->{'sendtime'}.' | ');
$rowNum ++;
$mailcount ++;
}
@@ -371,18 +436,85 @@ END
$r->print(' | ');
}
+#-------------------------------
+# display_config_box
+#
+# Display the threshold setting screen
+#
+#-------------------------------
+
+sub display_config_box() {
+ my ($r,$command,$tabbg,$threshold_titles,$cdom,$crs) = @_;
+ my %threshold = ();
+ my $rowColor1 = "#ffffff";
+ my $rowColor2 = "#eeeeee";
+ my $rowColor;
+
+ my @thresholditems = ("av_attempts","degdiff","numstudents");
+ my %threshold_titles = (
+ av_attempts => 'Average number of attempts',
+ degdiff => 'Degree of difficulty',
+ numstudents => 'Total number of students with submissions',
+ );
+ &get_curr_thresholds(\%threshold,$cdom,$crs);
+
+ $r->print('
|