--- loncom/homework/lonsimpleproblemedit.pm	2009/08/17 19:46:49	1.25
+++ loncom/homework/lonsimpleproblemedit.pm	2009/09/24 00:50:03	1.26
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.25 2009/08/17 19:46:49 www Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.26 2009/09/24 00:50:03 truskell Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -40,6 +40,7 @@ use LONCAPA;
 
 my %qparms;
 my $prefix;
+my $weightprefix;
 my $qtype;
 
 sub evaloptionhash {
@@ -191,6 +192,9 @@ sub handler {
 
 # ------------------------------------------------ Prefix for everything stored
     $prefix=$env{'request.course.id'}.'.'.$symb.'.0.';
+#------------------------------------------------- Prefix for storing weight of Problem Parts
+    $weightprefix=$env{'request.course.id'}.'.'.$symb.'.';
+    
 # ---------------------------------------------------------- Anything to store?
 
     if (($symb) && (defined($env{'form.questiontype'}))) {
@@ -216,11 +220,21 @@ sub handler {
 		$storecontent{$prefix.$parm}=~s/\s+$//s;
 	    }
 	}
+# ---------------------------------------------------- Set weights of hidden parts to zero
+# ------------------------------------------------------ and used part to 1
+	$storecontent{$weightprefix.'essay.weight'}=0;
+	$storecontent{$weightprefix.'numerical.weight'}=0;
+	$storecontent{$weightprefix.'option.weight'}=0;
+	$storecontent{$weightprefix.'radio.weight'}=0;
+	$storecontent{$weightprefix.'string.weight'}=0;
+	$storecontent{$weightprefix.$env{'form.questiontype'}.'.weight'}=1;
+
+
 	my $reply=&Apache::lonnet::cput
 	    ('resourcedata',\%storecontent,
 	     $env{'course.'.$env{'request.course.id'}.'.domain'},
 	     $env{'course.'.$env{'request.course.id'}.'.num'});
-        
+
         &Apache::lonnet::devalidatecourseresdata(
                             $env{'course.'.$env{'request.course.id'}.'.num'},
                             $env{'course.'.$env{'request.course.id'}.'.domain'});