--- loncom/interface/lonquickgrades.pm 2011/03/12 02:58:44 1.75
+++ loncom/interface/lonquickgrades.pm 2011/03/19 02:22:18 1.76
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.75 2011/03/12 02:58:44 www Exp $
+# $Id: lonquickgrades.pm,v 1.76 2011/03/19 02:22:18 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -607,12 +607,23 @@ ENDMOVE
}
$r->print('');
# Calculation
-# FIXME: just placeholders
+ $r->print('
');
+ foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) {
+ $r->print('- ');
+ $r->print(&pretty_prt_rule($calcrule));
+ if ($cangrade) {
+ $r->print(' '.&mt('Delete').'');
+ }
+ $r->print('
');
+ }
+ $r->print(' ');
if ($cangrade) {
- $r->print(" | Calculation Edit | ");
- } else {
- $r->print("Calculation | ");
+ $r->print('
'.&mt('Add Calculation Rule').'
'.
+ &new_calc_rule_form('addcalc_'.$id.'_','this.form.cmd.value="addcalc_'.$id.'";this.form.submit();'));
}
+ $r->print('');
+
+
# Total
if ($cangrade) {
$r->print(''.
@@ -674,6 +685,52 @@ sub make_new_category {
return %categories;
}
+
+# === Calculation Rule Editing
+
+sub pretty_prt_rule {
+ my ($rule)=@_;
+ return $rule;
+}
+
+sub new_calc_rule_form {
+ return "New Rule";
+}
+
+#
+# Add a calculation rule
+#
+
+sub add_calculation_rule {
+ my ($id,$cangrade,$newcontent,%categories)=@_;
+ unless ($cangrade) { return %categories; }
+ my %newcontent=($newcontent => 1);
+ foreach my $current (split(/\,/,$categories{$id.'_calculations'})) {
+ $newcontent{$current}=1;
+ }
+ $categories{$id.'_calculations'}=join(',',sort(keys(%newcontent)));
+ return %categories;
+}
+
+#
+# Delete a calculation rule
+#
+
+sub del_calculation_rule {
+ my ($id,$cangrade,$delcontent,%categories)=@_;
+ unless ($cangrade) { return %categories; }
+ my @newcontent=();
+ foreach my $current (split(/\,/,$categories{$id.'_calculations'})) {
+ unless ($current eq $delcontent) {
+ push(@newcontent,$current);
+ }
+ }
+ $categories{$id.'_calculations'}=join(',',@newcontent);
+ return %categories;
+}
+
+# === Category Editing
+
#
# Add to category content
#
|