[LON-CAPA-cvs] cvs: loncom /interface lonquickgrades.pm
www
www@source.lon-capa.org
Fri, 21 Jan 2011 16:28:32 -0000
www Fri Jan 21 16:28:32 2011 EDT
Modified files:
/loncom/interface lonquickgrades.pm
Log:
Insignificant progress on grading categories.
Index: loncom/interface/lonquickgrades.pm
diff -u loncom/interface/lonquickgrades.pm:1.63 loncom/interface/lonquickgrades.pm:1.64
--- loncom/interface/lonquickgrades.pm:1.63 Mon Jan 17 00:19:38 2011
+++ loncom/interface/lonquickgrades.pm Fri Jan 21 16:28:32 2011
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Quick Student Grades Display
#
-# $Id: lonquickgrades.pm,v 1.63 2011/01/17 00:19:38 www Exp $
+# $Id: lonquickgrades.pm,v 1.64 2011/01/21 16:28:32 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -408,12 +408,31 @@
$navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=@_;
# Take care of storing and retrieving categories
+ my $cangrade=&Apache::lonnet::allowed('mgr');
+
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ my %categories=();
+# Storing
+ if (($cangrade) && ($env{'form.storechanges'})) {
- my %categories=&Apache::lonnet::dump('grading_categories',$cdom,$cnum);
+# Actually store
+ &Apache::lonnet::put('grading_categories',\%categories,$cdom,$cnum);
+ } else {
+# Loading
+ %categories=&Apache::lonnet::dump('grading_categories',$cdom,$cnum);
+ }
# categories loaded now
-
+# Form only generated if user can change the grading categories
+ if ($cangrade) {
+ $r->print('<form method="post">');
+ }
+#
+# Business logic here
+#
+ if ($cangrade) {
+ $r->print('<input type="submit" name="storechanges" value="'.&mt("Save changes to grading categories").'" /></form>');
+ }
}
# Pass this two refs to arrays for the start and end color, and a number