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

www www@source.lon-capa.org
Fri, 25 Mar 2011 01:34:53 -0000


www		Fri Mar 25 01:34:53 2011 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
    /loncom/interface/statistics	lonstathelpers.pm 
  Log:
  Saving my work: calculation rules
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.77 loncom/interface/lonquickgrades.pm:1.78
--- loncom/interface/lonquickgrades.pm:1.77	Mon Mar 21 00:56:58 2011
+++ loncom/interface/lonquickgrades.pm	Fri Mar 25 01:34:49 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.77 2011/03/21 00:56:58 www Exp $
+# $Id: lonquickgrades.pm,v 1.78 2011/03/25 01:34:49 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -612,9 +612,10 @@
     $r->print('<td><ul>');
     foreach my $calcrule (split(/\,/,$categories{$id.'_calculations'})) {
         $r->print('<li>');
-        $r->print(&pretty_prt_rule($calcrule));
+        my ($code,$value)=split(/\:/,$calcrule);
+        $r->print(&pretty_prt_rule($cangrade,$id,$code,$value));
         if ($cangrade) {
-           $r->print(' <a href="javascript:storecmd(\'delcalc_'.$id.'______'.$calcrule.'\');">'.&mt('Delete').'</a>');
+           $r->print(' <a href="javascript:storecmd(\'delcalc_'.$id.'______'.$code.'\');">'.&mt('Delete').'</a>');
         }
         $r->print('</li>');
     }
@@ -690,8 +691,25 @@
 # === Calculation Rule Editing
 
 sub pretty_prt_rule {
-    my ($rule)=@_;
-    return $rule;
+    my ($cangrade,$id,$code,$value)=@_;
+    my $cid=$id.'_'.$code;
+    my %lt=&Apache::lonlocal::texthash(
+                'droplow'  => 'Drop N lowest grade assignments',
+                'drophigh' => 'Drop N highest grade assignments',
+                'capabove' => 'Cap percentage above N percent',
+                'capbelow' => 'Cap percentage below N percent');
+    my $ret='<span class="LC_nobreak">';
+    if ($cangrade) {
+        $ret.='<select name="sel_'.$cid.'">';
+        foreach my $calc (''=>'',sort(keys(%lt))) {
+            $ret.='<option value="'.$calc.'"'.($calc eq $code?' selected="selected"':'').' />'.$lt{$calc}.'</input>';
+        }
+        $ret.='</select> N=<input type="text" size="5" name="val_'.$cid.'" /></span>';
+    } else {
+        $ret.=$lt{$code}.'; N='.$value;
+    }
+    $ret.='</span>';
+    return $ret;
 }
 
 sub new_calc_rule_form {
@@ -723,7 +741,7 @@
     unless ($cangrade) { return %categories; }
     my @newcontent=();
     foreach my $current (split(/\,/,$categories{$id.'_calculations'})) {
-        unless ($current eq $delcontent) {
+        unless ($current=~/^\Q$delcontent\E\:/) {
             push(@newcontent,$current);
         }
     }
Index: loncom/interface/statistics/lonstathelpers.pm
diff -u loncom/interface/statistics/lonstathelpers.pm:1.65 loncom/interface/statistics/lonstathelpers.pm:1.66
--- loncom/interface/statistics/lonstathelpers.pm:1.65	Sat Mar 12 02:58:49 2011
+++ loncom/interface/statistics/lonstathelpers.pm	Fri Mar 25 01:34:53 2011
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lonstathelpers.pm,v 1.65 2011/03/12 02:58:49 www Exp $
+# $Id: lonstathelpers.pm,v 1.66 2011/03/25 01:34:53 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -145,9 +145,9 @@
     if ($onclick) {
         $jsadd="onClick='$onclick'";
     }
-    $Str =  &Apache::loncommon::start_scrollbox(($smallbox?'520px':'620px'),
-                                                ($smallbox?'500px':'600px'),
-                                                ($smallbox?'50px':'300px')).
+    $Str =  &Apache::loncommon::start_scrollbox(($smallbox?'420px':'620px'),
+                                                ($smallbox?'400px':'600px'),
+                                                ($smallbox?'60px':'300px')).
             &Apache::loncommon::start_data_table();
     my $rb_count =0;
     my ($navmap,@sequences) =