File:  [LON-CAPA] / loncom / homework / simpleproblem.problem
Revision 1.1: download - view: text, annotated - select for diffs
Sun Jul 6 10:40:35 2003 UTC (20 years, 9 months ago) by www
Branches: MAIN
CVS tags: HEAD
Trying to make the Simple Problem button in DOCS do something.

All simple problems will have the same "published" source code, not need
for cross-machine loading.

Also no need for special treatment of these problems anywhere else in LON-CAPA.

Problem type, question text, values, etc, are stored in course's resource
data, along with the deadlines, etc. These are already nicely cached.

Will write little "editor" which sets these parameters,
lonsimpleproblemedit.pm.

Modification should have minimal impact:

* one new handler
* two new files with the source code and metadata for the problem
* one new command in structuretags to generate the Edit button for this
* removal of easter egg in londocs.pm and pointing to the right URL

<problem>

<script type="loncapa/perl">
$questiontype=&EXT('resource.0.questiontype');
unless ($questiontype) { $questiontype='radio'; }
$max=&EXT('resource.0.maxfoils');
unless ($max) { $max=10; }
$randomize=&EXT('resource.0.randomize');
unless ($randomize) { $randomize='yes'; }
$options=&EXT('resource.0.options');
unless ($options) { $options='("true","false")'; }
for ($i=1;$i<=10;$i++) {
    $value[$i]=&EXT('resource.0.value'.$i);
    unless ($value[$i]) { $value[$i]='unused'; }
    $position[$i]=&EXT('resource.0.position'.$i);
    unless ($position[$i]) { $position[$i]='random'; }
}
</script>

<startouttext />&EXT('resource.0.questiontext')<endouttext />

<block condition="&EXT('resource.0.questiontype') eq 'radio'"> 
<radiobuttonresponse max="$max" id="radiosegment" randomize="$randomize">
<foilgroup>
<foil location="$position[1]" value="$value[1]" name="radiofoil1">
<startouttext />&EXT('resource.0.text1')<endouttext />
</foil>
<foil location="$position[2]" value="$value[2]" name="radiofoil2">
<startouttext />&EXT('resource.0.text2')<endouttext />
</foil>
<foil location="$position[3]" value="$value[3]" name="radiofoil3">
<startouttext />&EXT('resource.0.text3')<endouttext />
</foil>
<foil location="$position[4]" value="$value[4]" name="radiofoil4">
<startouttext />&EXT('resource.0.text4')<endouttext />
</foil>
<foil location="$position[5]" value="$value[5]" name="radiofoil5">
<startouttext />&EXT('resource.0.text5')<endouttext />
</foil>
<foil location="$position[6]" value="$value[6]" name="radiofoil6">
<startouttext />&EXT('resource.0.text6')<endouttext />
</foil>
</foilgroup>
<foil location="$position[7]" value="$value[7]" name="radiofoil7">
<startouttext />&EXT('resource.0.text7')<endouttext />
</foil>
<foil location="$position[8]" value="$value[8]" name="radiofoil8">
<startouttext />&EXT('resource.0.text8')<endouttext />
</foil>
<foil location="$position[9]" value="$value[9]" name="radiofoil9">
<startouttext />&EXT('resource.0.text9')<endouttext />
</foil>
<foil location="$position[10]" value="$value[10]" name="radiofoil10">
<startouttext />&EXT('resource.0.text10')<endouttext />
</foil>
<hintgroup>
<startouttext />&EXT('resource.0.hinttext')<endouttext />
</hintgroup>
</radiobuttonresponse>
</block>

<block condition="&EXT('resource.0.questiontype') eq 'option'"> 
<optionresponse max="$max" id="radiosegment" randomize="$randomize">
<foilgroup options="$options">
<foil location="$position[1]" value="$value[1]" name="optionfoil1">
<startouttext />&EXT('resource.0.text1')<endouttext />
</foil>
<foil location="$position[2]" value="$value[2]" name="optionfoil2">
<startouttext />&EXT('resource.0.text2')<endouttext />
</foil>
<foil location="$position[3]" value="$value[3]" name="optionfoil3">
<startouttext />&EXT('resource.0.text3')<endouttext />
</foil>
<foil location="$position[4]" value="$value[4]" name="optionfoil4">
<startouttext />&EXT('resource.0.text4')<endouttext />
</foil>
<foil location="$position[5]" value="$value[5]" name="optionfoil5">
<startouttext />&EXT('resource.0.text5')<endouttext />
</foil>
<foil location="$position[6]" value="$value[6]" name="optionfoil6">
<startouttext />&EXT('resource.0.text6')<endouttext />
</foil>
</foilgroup>
<foil location="$position[7]" value="$value[7]" name="optionfoil7">
<startouttext />&EXT('resource.0.text7')<endouttext />
</foil>
<foil location="$position[8]" value="$value[8]" name="optionfoil8">
<startouttext />&EXT('resource.0.text8')<endouttext />
</foil>
<foil location="$position[9]" value="$value[9]" name="optionfoil9">
<startouttext />&EXT('resource.0.text9')<endouttext />
</foil>
<foil location="$position[10]" value="$value[10]" name="optionfoil10">
<startouttext />&EXT('resource.0.text10')<endouttext />
</foil>
<hintgroup>
<startouttext />&EXT('resource.0.hinttext')<endouttext />
</hintgroup>
</optionresponse>
</block>

</problem>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>