Return to simpleproblem.problem CVS log | Up to [LON-CAPA] / loncom / homework |
Simple DOCS problems now work for * radio * option * essay * string - this is probably going to be it. No need/intention to replace real problems.
1: <problem> 2: <simpleeditbutton /> 3: <script type="loncapa/perl"> 4: $questiontype=&EXT('resource.0.questiontype'); 5: unless ($questiontype) { $questiontype='radio'; } 6: $max=&EXT('resource.0.maxfoils'); 7: unless ($max) { $max=10; } 8: $randomize=&EXT('resource.0.randomize'); 9: unless ($randomize) { $randomize='yes'; } 10: $options=&EXT('resource.0.options'); 11: unless ($options) { $options='("true","false")'; } 12: for ($i=1;$i<=10;$i++) { 13: $value[$i]=&EXT('resource.0.value'.$i); 14: unless ($value[$i]) { $value[$i]='unused'; } 15: $position[$i]=&EXT('resource.0.position'.$i); 16: unless ($position[$i]) { $position[$i]='random'; } 17: } 18: $stringanswer=&EXT('resource.0.stringanswer'); 19: unless ($stringanswer) { $stringanswer=''; } 20: $stringtype=&EXT('resource.0.stringtype'); 21: unless ($stringtype) { $stringtype='cs'; } 22: </script> 23: 24: <startouttext />&EXT('resource.0.questiontext')<endouttext /> 25: 26: <block condition="&EXT('resource.0.questiontype') eq 'radio'"> 27: <radiobuttonresponse max="$max" id="radiosegment" randomize="$randomize"> 28: <foilgroup> 29: <foil location="$position[1]" value="$value[1]" name="radiofoil1"> 30: <startouttext />&EXT('resource.0.text1')<endouttext /> 31: </foil> 32: <foil location="$position[2]" value="$value[2]" name="radiofoil2"> 33: <startouttext />&EXT('resource.0.text2')<endouttext /> 34: </foil> 35: <foil location="$position[3]" value="$value[3]" name="radiofoil3"> 36: <startouttext />&EXT('resource.0.text3')<endouttext /> 37: </foil> 38: <foil location="$position[4]" value="$value[4]" name="radiofoil4"> 39: <startouttext />&EXT('resource.0.text4')<endouttext /> 40: </foil> 41: <foil location="$position[5]" value="$value[5]" name="radiofoil5"> 42: <startouttext />&EXT('resource.0.text5')<endouttext /> 43: </foil> 44: <foil location="$position[6]" value="$value[6]" name="radiofoil6"> 45: <startouttext />&EXT('resource.0.text6')<endouttext /> 46: </foil> 47: <foil location="$position[7]" value="$value[7]" name="radiofoil7"> 48: <startouttext />&EXT('resource.0.text7')<endouttext /> 49: </foil> 50: <foil location="$position[8]" value="$value[8]" name="radiofoil8"> 51: <startouttext />&EXT('resource.0.text8')<endouttext /> 52: </foil> 53: <foil location="$position[9]" value="$value[9]" name="radiofoil9"> 54: <startouttext />&EXT('resource.0.text9')<endouttext /> 55: </foil> 56: <foil location="$position[10]" value="$value[10]" name="radiofoil10"> 57: <startouttext />&EXT('resource.0.text10')<endouttext /> 58: </foil> 59: </foilgroup> 60: <hintgroup> 61: <startouttext />&EXT('resource.0.hinttext')<endouttext /> 62: </hintgroup> 63: </radiobuttonresponse> 64: </block> 65: 66: <block condition="&EXT('resource.0.questiontype') eq 'option'"> 67: <optionresponse max="$max" id="optionsegment" randomize="$randomize"> 68: <foilgroup options="$options"> 69: <foil location="$position[1]" value="$value[1]" name="optionfoil1"> 70: <startouttext />&EXT('resource.0.text1')<endouttext /> 71: </foil> 72: <foil location="$position[2]" value="$value[2]" name="optionfoil2"> 73: <startouttext />&EXT('resource.0.text2')<endouttext /> 74: </foil> 75: <foil location="$position[3]" value="$value[3]" name="optionfoil3"> 76: <startouttext />&EXT('resource.0.text3')<endouttext /> 77: </foil> 78: <foil location="$position[4]" value="$value[4]" name="optionfoil4"> 79: <startouttext />&EXT('resource.0.text4')<endouttext /> 80: </foil> 81: <foil location="$position[5]" value="$value[5]" name="optionfoil5"> 82: <startouttext />&EXT('resource.0.text5')<endouttext /> 83: </foil> 84: <foil location="$position[6]" value="$value[6]" name="optionfoil6"> 85: <startouttext />&EXT('resource.0.text6')<endouttext /> 86: </foil> 87: <foil location="$position[7]" value="$value[7]" name="optionfoil7"> 88: <startouttext />&EXT('resource.0.text7')<endouttext /> 89: </foil> 90: <foil location="$position[8]" value="$value[8]" name="optionfoil8"> 91: <startouttext />&EXT('resource.0.text8')<endouttext /> 92: </foil> 93: <foil location="$position[9]" value="$value[9]" name="optionfoil9"> 94: <startouttext />&EXT('resource.0.text9')<endouttext /> 95: </foil> 96: <foil location="$position[10]" value="$value[10]" name="optionfoil10"> 97: <startouttext />&EXT('resource.0.text10')<endouttext /> 98: </foil> 99: </foilgroup> 100: <hintgroup> 101: <startouttext />&EXT('resource.0.hinttext')<endouttext /> 102: </hintgroup> 103: </optionresponse> 104: </block> 105: 106: <block condition="&EXT('resource.0.questiontype') eq 'essay'"> 107: <essayresponse id="essaysegment"> 108: <textfield></textfield> 109: </essayresponse> 110: </block> 111: 112: <block condition="&EXT('resource.0.questiontype') eq 'string'"> 113: <stringresponse id="stringsegment" answer="$stringanswer" type="$stringtype"> 114: <textline> 115: </textline> 116: <hintgroup> 117: <startouttext />&EXT('resource.0.hinttext')<endouttext /> 118: </hintgroup> 119: </stringresponse> 120: </block> 121: 122: 123: </problem>