[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm

www www@source.lon-capa.org
Mon, 21 Mar 2011 00:56:58 -0000


www		Mon Mar 21 00:56:58 2011 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
  Log:
  Add calculation rule
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.76 loncom/interface/lonquickgrades.pm:1.77
--- loncom/interface/lonquickgrades.pm:1.76	Sat Mar 19 02:22:18 2011
+++ loncom/interface/lonquickgrades.pm	Mon Mar 21 00:56:58 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.76 2011/03/19 02:22:18 www Exp $
+# $Id: lonquickgrades.pm,v 1.77 2011/03/21 00:56:58 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -495,6 +495,8 @@
         %categories=&add_category_content($1,$cangrade,$env{'form.addcont_'.$1.'_symb'},%categories);
     } elsif ($cmd=~/^delcont\_(.+)\_\_\_\_\_\_(.+)$/) {
         %categories=&del_category_content($1,$cangrade,$2,%categories);
+    } elsif ($cmd=~/^newrule\_(.+)$/) {
+        %categories=&add_calculation_rule($1,$cangrade,':',%categories);
     }
 # Move to a new position
     my $moveid=$env{'form.storemove'};
@@ -618,8 +620,7 @@
     }
     $r->print('</ul>');
     if ($cangrade) {
-        $r->print('<br />'.&mt('Add Calculation Rule').'<br />'.
-                  &new_calc_rule_form('addcalc_'.$id.'_','this.form.cmd.value="addcalc_'.$id.'";this.form.submit();'));
+        $r->print('<br />'.&new_calc_rule_form($id));
     }
     $r->print('</td>');
 
@@ -694,7 +695,8 @@
 }
 
 sub new_calc_rule_form {
-    return "New Rule";
+    my ($id)=@_;
+    return '<a href="javascript:storecmd(\'newrule_'.$id.'\');">'.&mt('New Calculation Rule').'</a>';
 }
 
 #