--- loncom/interface/lonquickgrades.pm 2011/03/26 16:09:33 1.80
+++ loncom/interface/lonquickgrades.pm 2011/03/26 22:37:47 1.82
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.80 2011/03/26 16:09:33 www Exp $
+# $Id: lonquickgrades.pm,v 1.82 2011/03/26 22:37:47 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -464,6 +464,39 @@ sub outputCategories {
''.
'');
}
+#
+# Debug
+#
+# my %data=&dumpdata($navmap);
+# foreach (keys(%data)) {
+# $r->print("\n
".$_.'='.$data{$_});
+# }
+}
+
+#
+# Get data for all symbs
+#
+
+sub dumpdata {
+ my ($navmap)=@_;
+ my %returndata=();
+
+# Run through the map and get all data
+
+ my $iterator = $navmap->getIterator(undef, undef, undef, 1);
+ my $depth = 1;
+ $iterator->next(); # ignore first BEGIN_MAP
+ my $curRes = $iterator->next();
+
+ while ($depth > 0) {
+ if ($curRes == $iterator->BEGIN_MAP()) {$depth++;}
+ if ($curRes == $iterator->END_MAP()) { $depth--; }
+ if (ref($curRes) && $curRes->is_map()) {
+ $returndata{$curRes->symb()}=$curRes->{DATA}->{CHILD_PARTS}.':'.$curRes->{DATA}->{CHILD_ATTEMPTED}.':'.$curRes->{DATA}->{CHILD_CORRECT};
+ }
+ $curRes = $iterator->next();
+ }
+ return %returndata;
}
#
@@ -479,6 +512,7 @@ sub process_category_edits {
%categories=&set_category_name($cangrade,$id,$env{'form.name_'.$id},%categories);
%categories=&set_category_total($cangrade,$id,$env{'form.totaltype_'.$id},$env{'form.total_'.$id},%categories);
%categories=&set_category_weight($cangrade,$id,$env{'form.weight_'.$id},%categories);
+ %categories=&set_category_displayachieved($cangrade,$id,$env{'form.displayachieved_'.$id},%categories);
# Set values for category rules (before names may change)
%categories=&set_category_rules($cangrade,$id,%categories);
}
@@ -545,9 +579,10 @@ sub output_category_table_header {
}
$r->print('
'.&mt('Category').' | '.
''.&mt('Contents').' | '.
- ''.&mt('Calculation').' | '.
''.&mt('Total Points').' | '.
- ''.&mt('Relative Weight').' | ');
+ ''.&mt('Calculation').' | '.
+ ''.&mt('Relative Weight').' | '.
+ ''.&mt('Achieved').' | ');
$r->print(&Apache::loncommon::end_data_table_header_row());
}
@@ -608,10 +643,25 @@ ENDMOVE
}
$r->print('');
if ($cangrade) {
- $r->print('
'.&mt('Add Problem or Sequence').'
'.
+ $r->print('
'.&mt('Add Problem or Folder').'
'.
&Apache::lonstathelpers::problem_selector('.',undef,1,1,'addcont_'.$id.'_',1,'this.form.cmd.value="addcont_'.$id.'";this.form.submit();'));
}
$r->print('');
+
+# Total
+ if ($cangrade) {
+ $r->print(''.
+ ''.
+ ' | ');
+ } else {
+ $r->print(''.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).' | ');
+ }
+
+
# Calculation
$r->print('');
foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) {
@@ -629,19 +679,6 @@ ENDMOVE
}
$r->print(' | ');
-
-# Total
- if ($cangrade) {
- $r->print(''.
- ''.
- ' | ');
- } else {
- $r->print(''.($categories{$id.'_totaltype'} eq 'default'?&mt('default'):$categories{$id.'_total'}).' | ');
- }
# Weight
if ($cangrade) {
$r->print(''.
@@ -650,6 +687,21 @@ ENDMOVE
} else {
$r->print(' | '.$categories{$id.'_weight'}.' | ');
}
+# Achieved
+ $r->print('');
+ if ($cangrade) {
+ $r->print('');
+ } else {
+ if ($categories{$id.'_displayachieved'} eq 'percent') {
+ $r->print(&mt('percent'));
+ } else {
+ $r->print(&mt('points'));
+ }
+ }
+ $r->print(' | ');
return ($value,$weight);
}
@@ -664,7 +716,7 @@ sub bottom_line_category {
if ($cangrade) {
$r->print(''.&mt('Create New Category').' | ');
}
- $r->print(''.&mt('Current:').$sum.' '.&mt('Total:').$total.'
| ');
+ $r->print(''.&mt('Current:').$sum.' '.&mt('Total:').$total.'
| ');
}
#
@@ -688,6 +740,7 @@ sub make_new_category {
}
$categories{$id.'_weight'}=0;
$categories{$id.'_totaltype'}='default';
+ $categories{$id.'_displayachieved'}='percent';
return %categories;
}
@@ -933,6 +986,15 @@ sub set_category_weight {
return %categories;
}
+sub set_category_displayachieved {
+ my ($cangrade,$id,$value,%categories)=@_;
+ unless ($cangrade) { return %categories; }
+ unless (($value eq 'percent') || ($value eq 'points')) { $value='percent'; }
+ $categories{$id.'_displayachieved'}=$value;
+ return %categories;
+}
+
+
#
# === end category-related
#