[LON-CAPA-cvs] cvs: loncom /homework/templates sampleexternal.problem
www
www at source.lon-capa.org
Thu Feb 9 19:13:35 EST 2012
www Fri Feb 10 00:13:35 2012 EDT
Modified files:
/loncom/homework/templates sampleexternal.problem
Log:
Make is so that the URL can controlled from the outside if needed
Index: loncom/homework/templates/sampleexternal.problem
diff -u loncom/homework/templates/sampleexternal.problem:1.4 loncom/homework/templates/sampleexternal.problem:1.5
--- loncom/homework/templates/sampleexternal.problem:1.4 Sat Feb 4 15:12:40 2012
+++ loncom/homework/templates/sampleexternal.problem Fri Feb 10 00:13:35 2012
@@ -1,4 +1,5 @@
<problem>
+<parameter name="externalurl" type="string" description="URL for external testing" />
<script type="loncapa/perl">
sub fact {
my $n=shift;
@@ -15,6 +16,10 @@
$testvalues.=','.$rand.'='.&fact($rand);
}
+#
+# Set anything else you want to pass in this hash.
+# Name-value pairs will be passed as posted form parameters.
+#
%args=('somecode' => (<<'ENDCODE')
sub negative {
my ($number)=@_;
@@ -22,8 +27,13 @@
}
ENDCODE
);
-
-
+# Get a URL if it is externally set
+$externalurl=¶meter_setting('externalurl');
+#
+# Important: set your default URL here
+#
+unless ($externalurl=~/\w/) { $externalurl='http://localhost/cgi-bin/sampleexternal.pl'; }
+#
</script>
@@ -32,7 +42,7 @@
<instructorcomment>
Sample code for an evaluation script can be found <a href="/res/adm/includes/templates/sampleexternal.pl">here.</a></instructorcomment>
<endouttext />
-<externalresponse url="http://localhost/cgi-bin/sampleexternal.pl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive.">
+<externalresponse url="$externalurl" answer="$testvalues" form="%args" answerdisplay="The most elegant (and dangerous) solution is recursive.">
<textfield />
</externalresponse>
More information about the LON-CAPA-cvs
mailing list