![]() ![]() | ![]() |
Saving my work: "simple" numerical problem.
1: <problem> 2: <simpleeditbutton /> 3: <script type="loncapa/perl"> 4: $questiontype=&EXT('resource.0.hiddenparts'); 5: $max=&EXT('resource.0.maxfoils'); 6: unless ($max) { $max=10; } 7: $randomize=&EXT('resource.0.randomize'); 8: unless ($randomize) { $randomize='yes'; } 9: $options=&EXT('resource.0.options'); 10: unless ($options) { $options='("true","false")'; } 11: for ($i=1;$i<=10;$i++) { 12: $value[$i]=&EXT('resource.0.value'.$i); 13: unless ($value[$i]) { $value[$i]='unused'; } 14: $position[$i]=&EXT('resource.0.position'.$i); 15: unless ($position[$i]) { $position[$i]='random'; } 16: } 17: $stringanswer=&EXT('resource.0.stringanswer'); 18: unless ($stringanswer) { $stringanswer=''; } 19: $stringtype=&EXT('resource.0.stringtype'); 20: unless ($stringtype) { $stringtype='cs'; } 21: $numericalanswer=&EXT('resource.0.numericalanswer'); 22: unless ($numericalanswer) { $numericalanswer=''; } 23: $numericaltolerance=&EXT('resource.0.numericaltolerance'); 24: unless ($numericaltolerance) { $numericaltolerance='5%'; } 25: $numericalsigfigs=&EXT('resource.0.numericalsigfigs'); 26: unless ($numericalsigfigs) { $numericalsigfigs='1,15'; } 27: $numericalunits=&EXT('resource.0.numericalunits'); 28: unless ($numericalunits) { $numericalunits=''; } 29: $numericalformat=&EXT('resource.0.numericalformat'); 30: unless ($numericalformat) { $numericalformat=''; } 31: </script> 32: 33: <block condition="!$questiontype"> 34: 35: <startouttext /> 36: <h1>Simple Problem Placeholder</h1> 37: <endouttext /> 38: </block> 39: 40: <block condition="$questiontype"> 41: 42: <part id="radio"> 43: <startouttext /><parse>&EXT('resource.0.questiontext')</parse><br /><endouttext /> 44: 45: <radiobuttonresponse max="$max" id="radiosegment" randomize="$randomize"> 46: <foilgroup> 47: <foil location="$position[1]" value="$value[1]" name="radiofoil1"> 48: <startouttext /><parse>&EXT('resource.0.text1')</parse><endouttext /> 49: </foil> 50: <foil location="$position[2]" value="$value[2]" name="radiofoil2"> 51: <startouttext /><parse>&EXT('resource.0.text2')</parse><endouttext /> 52: </foil> 53: <foil location="$position[3]" value="$value[3]" name="radiofoil3"> 54: <startouttext /><parse>&EXT('resource.0.text3')</parse><endouttext /> 55: </foil> 56: <foil location="$position[4]" value="$value[4]" name="radiofoil4"> 57: <startouttext /><parse>&EXT('resource.0.text4')</parse><endouttext /> 58: </foil> 59: <foil location="$position[5]" value="$value[5]" name="radiofoil5"> 60: <startouttext /><parse>&EXT('resource.0.text5')</parse><endouttext /> 61: </foil> 62: <foil location="$position[6]" value="$value[6]" name="radiofoil6"> 63: <startouttext /><parse>&EXT('resource.0.text6')</parse><endouttext /> 64: </foil> 65: <foil location="$position[7]" value="$value[7]" name="radiofoil7"> 66: <startouttext /><parse>&EXT('resource.0.text7')</parse><endouttext /> 67: </foil> 68: <foil location="$position[8]" value="$value[8]" name="radiofoil8"> 69: <startouttext /><parse>&EXT('resource.0.text8')</parse><endouttext /> 70: </foil> 71: <foil location="$position[9]" value="$value[9]" name="radiofoil9"> 72: <startouttext /><parse>&EXT('resource.0.text9')</parse><endouttext /> 73: </foil> 74: <foil location="$position[10]" value="$value[10]" name="radiofoil10"> 75: <startouttext /><parse>&EXT('resource.0.text10')</parse><endouttext /> 76: </foil> 77: </foilgroup> 78: <hintgroup> 79: <startouttext /><parse>&EXT('resource.0.hinttext')</parse><endouttext /> 80: </hintgroup> 81: </radiobuttonresponse> 82: </part> 83: 84: <part id="option"> 85: <startouttext /><parse>&EXT('resource.0.questiontext')</parse><br /><endouttext /> 86: <optionresponse max="$max" id="optionsegment" randomize="$randomize"> 87: <foilgroup options="$options"> 88: <foil location="$position[1]" value="$value[1]" name="optionfoil1"> 89: <startouttext /><parse>&EXT('resource.0.text1')</parse><endouttext /> 90: </foil> 91: <foil location="$position[2]" value="$value[2]" name="optionfoil2"> 92: <startouttext /><parse>&EXT('resource.0.text2')</parse><endouttext /> 93: </foil> 94: <foil location="$position[3]" value="$value[3]" name="optionfoil3"> 95: <startouttext /><parse>&EXT('resource.0.text3')</parse><endouttext /> 96: </foil> 97: <foil location="$position[4]" value="$value[4]" name="optionfoil4"> 98: <startouttext /><parse>&EXT('resource.0.text4')</parse><endouttext /> 99: </foil> 100: <foil location="$position[5]" value="$value[5]" name="optionfoil5"> 101: <startouttext /><parse>&EXT('resource.0.text5')</parse><endouttext /> 102: </foil> 103: <foil location="$position[6]" value="$value[6]" name="optionfoil6"> 104: <startouttext /><parse>&EXT('resource.0.text6')</parse><endouttext /> 105: </foil> 106: <foil location="$position[7]" value="$value[7]" name="optionfoil7"> 107: <startouttext /><parse>&EXT('resource.0.text7')</parse><endouttext /> 108: </foil> 109: <foil location="$position[8]" value="$value[8]" name="optionfoil8"> 110: <startouttext /><parse>&EXT('resource.0.text8')</parse><endouttext /> 111: </foil> 112: <foil location="$position[9]" value="$value[9]" name="optionfoil9"> 113: <startouttext /><parse>&EXT('resource.0.text9')</parse><endouttext /> 114: </foil> 115: <foil location="$position[10]" value="$value[10]" name="optionfoil10"> 116: <startouttext /><parse>&EXT('resource.0.text10')</parse><endouttext /> 117: </foil> 118: </foilgroup> 119: <hintgroup> 120: <startouttext /><parse>&EXT('resource.0.hinttext')</parse><endouttext /> 121: </hintgroup> 122: </optionresponse> 123: </part> 124: 125: <part id="essay"> 126: <startouttext /><parse>&EXT('resource.0.questiontext')</parse><br /><endouttext /> 127: <essayresponse id="essaysegment"> 128: <textfield></textfield> 129: </essayresponse> 130: </part> 131: 132: <part id="string"> 133: <startouttext /><parse>&EXT('resource.0.questiontext')</parse><br /><endouttext /> 134: <stringresponse id="stringsegment" answer="$stringanswer" type="$stringtype"> 135: <textline> 136: </textline> 137: <hintgroup> 138: <startouttext /><parse>&EXT('resource.0.hinttext')</parse><endouttext /> 139: </hintgroup> 140: </stringresponse> 141: </part> 142: 143: <part id="numerical"> 144: <script type="loncapa/perl"> 145: $numericalscript 146: </script> 147: <startouttext /><parse>&EXT('resource.0.questiontext')</parse><br /><endouttext /> 148: <numericalresponse id="numericalsegment" answer="$numericalanswer" unit="$numericalunit" format="$numericalformat"> 149: <responseparam type="tolerance" default="$numericaltolerance" name="tol" description="Numerical Tolerance" /> 150: <responseparam name="sig" type="int_range,0-16" default="$numericalsigfigs" description="Significant Figures" /> 151: <textline> 152: </textline> 153: <hintgroup> 154: <startouttext /><parse>&EXT('resource.0.hinttext')</parse><endouttext /> 155: </hintgroup> 156: </numericalresponse> 157: </part> 158: 159: </block> 160: 161: </problem>