[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm simpleproblem.problem simpleproblem.problem.meta

www lon-capa-cvs@mail.lon-capa.org
Tue, 04 Nov 2003 16:44:50 -0000


www		Tue Nov  4 11:44:50 2003 EDT

  Modified files:              
    /loncom/homework	lonsimpleproblemedit.pm simpleproblem.problem 
                    	simpleproblem.problem.meta 
  Log:
  Switching simpleproblems over to using the hiddenparts mechanism.
  
  Just saving my work for now. "!radio" does not appear to be respected.
  
  
Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.6 loncom/homework/lonsimpleproblemedit.pm:1.7
--- loncom/homework/lonsimpleproblemedit.pm:1.6	Sun Sep 21 17:40:06 2003
+++ loncom/homework/lonsimpleproblemedit.pm	Tue Nov  4 11:44:50 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Problem Parameter Setting "Editor"
 #
-# $Id: lonsimpleproblemedit.pm,v 1.6 2003/09/21 21:40:06 www Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.7 2003/11/04 16:44:50 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -168,6 +168,7 @@
 	    }
             $ENV{'form.options'}="('".join("','",keys %curoptions)."')";
 	}
+	$ENV{'form.hiddenparts'}='!'.$ENV{'form.questiontype'};
         foreach (keys %ENV) {
 	    if ($_=~/^form\.(\w+)$/) {
                 my $parm=$1;
Index: loncom/homework/simpleproblem.problem
diff -u loncom/homework/simpleproblem.problem:1.5 loncom/homework/simpleproblem.problem:1.6
--- loncom/homework/simpleproblem.problem:1.5	Thu Jul 10 02:17:41 2003
+++ loncom/homework/simpleproblem.problem	Tue Nov  4 11:44:50 2003
@@ -1,8 +1,7 @@
 <problem>
 <simpleeditbutton />
 <script type="loncapa/perl">
-$questiontype=&EXT('resource.0.questiontype');
-unless ($questiontype) { $questiontype='radio'; }
+$questiontype=&EXT('resource.0.hiddenparts');
 $max=&EXT('resource.0.maxfoils');
 unless ($max) { $max=10; }
 $randomize=&EXT('resource.0.randomize');
@@ -21,9 +20,18 @@
 unless ($stringtype) { $stringtype='cs'; }
 </script>
 
+<block condition="!$questiontype"> 
+
+<startouttext />
+<h1>Simple Problem Placeholder</h1>
+<endouttext />
+</block>
+
+<block condition="$questiontype"> 
+
 <startouttext />&EXT('resource.0.questiontext')<br /><endouttext />
 
-<block condition="&EXT('resource.0.questiontype') eq 'radio'"> 
+<part id="radio">
 <radiobuttonresponse max="$max" id="radiosegment" randomize="$randomize">
 <foilgroup>
 <foil location="$position[1]" value="$value[1]" name="radiofoil1">
@@ -61,9 +69,9 @@
 <startouttext />&EXT('resource.0.hinttext')<endouttext />
 </hintgroup>
 </radiobuttonresponse>
-</block>
+</part>
 
-<block condition="&EXT('resource.0.questiontype') eq 'option'"> 
+<part id="option"> 
 <optionresponse max="$max" id="optionsegment" randomize="$randomize">
 <foilgroup options="$options">
 <foil location="$position[1]" value="$value[1]" name="optionfoil1">
@@ -101,15 +109,15 @@
 <startouttext />&EXT('resource.0.hinttext')<endouttext />
 </hintgroup>
 </optionresponse>
-</block>
+</part>
 
-<block condition="&EXT('resource.0.questiontype') eq 'essay'"> 
+<part id="essay"> 
 <essayresponse id="essaysegment">
 <textfield></textfield>
 </essayresponse>
-</block>
+</part>
 
-<block condition="&EXT('resource.0.questiontype') eq 'string'"> 
+<part id="string"> 
 <stringresponse id="stringsegment" answer="$stringanswer" type="$stringtype">
 <textline>
 </textline>
@@ -117,7 +125,8 @@
 <startouttext />&EXT('resource.0.hinttext')<endouttext />
 </hintgroup>
 </stringresponse>
-</block>
+</part>
 
+</block>
 
 </problem>
Index: loncom/homework/simpleproblem.problem.meta
diff -u loncom/homework/simpleproblem.problem.meta:1.4 loncom/homework/simpleproblem.problem.meta:1.5
--- loncom/homework/simpleproblem.problem.meta:1.4	Wed Jul 16 15:25:17 2003
+++ loncom/homework/simpleproblem.problem.meta	Tue Nov  4 11:44:50 2003
@@ -1,28 +1,36 @@
-
-<abstract></abstract>
+<title>Simple Problem Template</title>
 <author>LON-CAPA</author>
 <copyright>default</copyright>
 <creationdate>1057430792</creationdate>
 <customdistributionfile></customdistributionfile>
-<dependencies></dependencies>
-<keywords></keywords>
-<language>notset </language>
-<lastrevisiondate>1057435470</lastrevisiondate>
+<language>notset</language>
+<lastrevisiondate>1067958577</lastrevisiondate>
 <mime>problem</mime>
-<notes></notes>
 <owner>templates@lib</owner>
-<parameter part="0" package="part"></parameter>
-<stores part="0" name="awarded" type="float" display="Partial Credit Factor [Part: 0]"></stores>
-<stores part="0" name="solved" type="string" display="Problem Status [Part: 0]"></stores>
-<stores part="0" name="tries" type="int_zeropos" display="Number of Attempts [Part: 0]"></stores>
-<subject></subject>
-<title>Simple Problem Template</title>
 
-<parameter part="0" id="optionsegment" package="optionresponse"></parameter>
-<parameter part="0" id="radiosegment" package="radiobuttonresponse"></parameter>
-<parameter part="0" id="essaysegment" package="essayresponse"></parameter>
-<parameter part="0" id="stringsegment" package="stringresponse"></parameter>
-
-<stores part="0" name="awarded" type="float" display="Partial Credit Factor [Part: 0]"></stores>
-<stores part="0" name="solved" type="string" display="Problem Status [Part: 0]"></stores>
-<stores part="0" name="tries" type="int_zeropos" display="Number of Attempts [Part: 0]"></stores>
+<stores part="option" name="awarded" type="float" display="Partial Credit Factor"></stores>
+<stores part="option" name="solved" type="string" display="Problem Status"></stores>
+<stores part="option" name="tries" type="int_zeropos" display="Number of Attempts"></stores>
+
+<stores part="radio" name="awarded" type="float" display="Partial Credit Factor"></stores>
+<stores part="radio" name="solved" type="string" display="Problem Status"></stores>
+<stores part="radio" name="tries" type="int_zeropos" display="Number of Attempts"></stores>
+
+<stores part="essay" name="awarded" type="float" display="Partial Credit Factor"></stores>
+<stores part="essay" name="solved" type="string" display="Problem Status"></stores>
+<stores part="essay" name="tries" type="int_zeropos" display="Number of Attempts"></stores>
+
+<stores part="string" name="awarded" type="float" display="Partial Credit Factor"></stores>
+<stores part="string" name="solved" type="string" display="Problem Status"></stores>
+<stores part="string" name="tries" type="int_zeropos" display="Number of Attempts"></stores>
+
+<parameter part="option" package="part"></parameter>
+<parameter part="radio" package="part"></parameter>
+<parameter part="essay" package="part"></parameter>
+<parameter part="string" package="part"></parameter>
+
+<parameter part="option" id="optionsegment" package="optionresponse"></parameter>
+<parameter part="radio" id="radiosegment" package="radiobuttonresponse"></parameter>
+<parameter part="essay" id="essaysegment" package="essayresponse"></parameter>
+<parameter part="string" id="stringsegment" package="stringresponse"></parameter>
+