[LON-CAPA-cvs] cvs: loncom /homework lonsimpleproblemedit.pm simpleproblem.problem
www
www@source.lon-capa.org
Mon, 17 Aug 2009 18:18:35 -0000
www Mon Aug 17 18:18:35 2009 EDT
Modified files:
/loncom/homework lonsimpleproblemedit.pm simpleproblem.problem
Log:
Saving my work: simple numerical response
Index: loncom/homework/lonsimpleproblemedit.pm
diff -u loncom/homework/lonsimpleproblemedit.pm:1.23 loncom/homework/lonsimpleproblemedit.pm:1.24
--- loncom/homework/lonsimpleproblemedit.pm:1.23 Thu Jun 11 16:48:28 2009
+++ loncom/homework/lonsimpleproblemedit.pm Mon Aug 17 18:18:35 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Simple Problem Parameter Setting "Editor"
#
-# $Id: lonsimpleproblemedit.pm,v 1.23 2009/06/11 16:48:28 bisitz Exp $
+# $Id: lonsimpleproblemedit.pm,v 1.24 2009/08/17 18:18:35 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -95,6 +95,19 @@
ENDHINT
}
+sub script {
+ my $text=$qparms{$prefix.'numericalscript'};
+ my $ht=&mt('Scripting (optional)');
+ return (<<ENDSCRIPT);
+<table bgcolor="#ccccaa" cellspacing="4" cellpadding="2">
+<tr><td><b>$ht</b><br />
+<textarea style="width:100%" name="numericalscript" cols="80" rows="4">$text</textarea>
+</td></tr>
+</table>
+<br />
+ENDSCRIPT
+}
+
sub foil {
my $number=shift;
my %values='';
@@ -254,7 +267,8 @@
'1 out of N multiple choice (radio button)',
'option' => 'Option response',
'string' => 'Short string response',
- 'essay' => 'Essay, open end');
+ 'essay' => 'Essay, open end',
+ 'numerical' => 'Numerical response');
$qtype=$qparms{$prefix.'questiontype'};
unless (defined($qtype)) { $qtype='radio'; }
unless ($questiontypes{$qtype}) { $qtype='radio'; }
@@ -263,6 +277,10 @@
($qtype,'questiontype',%questiontypes).
'</b><br /><input type="submit" value="'.&mt('Save and Edit').
'" /><p> </p>');
+# Script
+ if ($qtype eq 'numerical') {
+ $r->print(&script());
+ }
# Question Text
$r->print(&questiontext());
# Radio, Option ===
@@ -331,6 +349,16 @@
# Hint
$r->print(&hint());
}
+ if ($qtype eq 'numerical') {
+ my $numericalanswer=$qparms{$prefix.'numericalanswer'};
+ unless (defined($numericalanswer)) { $numericalanswer=''; }
+
+ $r->print(
+ '<table bgcolor="#00ee44" cellspacing="4" cellpadding="2">'.
+ '<tr><td>'.&mt('Correct answer').': <input type="text" size="20" name="numericalanswer" value="'.$numericalanswer.'" />'.
+ '</td></tr></table><br />');
+ $r->print(&hint());
+ }
# Store Button
$r->print(
'<input type="submit" value="'.&mt('Save and Edit').'" /></form>');
Index: loncom/homework/simpleproblem.problem
diff -u loncom/homework/simpleproblem.problem:1.9 loncom/homework/simpleproblem.problem:1.10
--- loncom/homework/simpleproblem.problem:1.9 Mon Aug 17 14:19:56 2009
+++ loncom/homework/simpleproblem.problem Mon Aug 17 18:18:35 2009
@@ -28,6 +28,8 @@
unless ($numericalunits) { $numericalunits=''; }
$numericalformat=&EXT('resource.0.numericalformat');
unless ($numericalformat) { $numericalformat=''; }
+$numericalscript=&EXT('resource.0.numericalscript');
+unless ($numericalscript) { $numericalscript=''; }
</script>
<block condition="!$questiontype">