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

www www@source.lon-capa.org
Sun, 20 Feb 2011 22:48:26 -0000


www		Sun Feb 20 22:48:26 2011 EDT

  Modified files:              
    /loncom/interface	lonquickgrades.pm 
  Log:
  Set the category name
  
  
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.68 loncom/interface/lonquickgrades.pm:1.69
--- loncom/interface/lonquickgrades.pm:1.68	Sun Feb 20 21:56:25 2011
+++ loncom/interface/lonquickgrades.pm	Sun Feb 20 22:48:26 2011
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Quick Student Grades Display
 #
-# $Id: lonquickgrades.pm,v 1.68 2011/02/20 21:56:25 www Exp $
+# $Id: lonquickgrades.pm,v 1.69 2011/02/20 22:48:26 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -455,15 +455,16 @@
     unless ($cangrade) { return %categories; }
     my $cmd=$env{'form.cmd'};
     if ($cmd eq 'createnewcat') {
-       %categories=&make_new_category($r,$cangrade,undef,%categories);
+        %categories=&make_new_category($r,$cangrade,undef,%categories);
+    } elsif ($cmd=~/^delcat\_(.+)$/) {
+        %categories=&del_category($1,$cangrade,%categories);
+    } else {
+# Simply store the rest of the stuff
+        foreach my $id (split(/\,/,$categories{'order'})) {
+            %categories=&set_category_name($cangrade,$id,$env{'form.name_'.$id},%categories);
+# More changes here
+        }
     }
-    if ($cmd=~/^delcat\_(.+)$/) {
-       my $id=$1;
-       %categories=&del_category($id,$cangrade,%categories);
-    } 
-#
-# Business logic here
-#
     return %categories;
 }
 
@@ -548,7 +549,10 @@
         }
         $r->print("\n</select>\n</td>\n");
         $r->print('<td><a href="/adm/quickgrades?cmd=delcat_'.$id.'&storechanges=1">'.&mt('Delete').'</a></td>');
-
+        $r->print('<td><input type="text" name="name_'.$id.
+                  '" value="'.&Apache::lonhtmlcommon::entity_encode($categories{$id.'_name'}).'" /></td>');
+    } else {
+        $r->print('<td>'.$categories{$id.'_name'}.'</td>');
     }
     $r->print(&Apache::loncommon::end_data_table_row()."\n");
     return ($value,$weight);
@@ -657,8 +661,8 @@
 # Set name of a category
 #
 sub set_category_name {
-    my ($canedit,$id,$name,%categories)=@_;
-    unless ($canedit) { return %categories; }
+    my ($cangrade,$id,$name,%categories)=@_;
+    unless ($cangrade) { return %categories; }
     $categories{$id.'_name'}=$name;
     return %categories;
 }