[LON-CAPA-users] Using Custom response

Guy Albertelli II lon-capa-users@mail.lon-capa.org
Wed, 17 Oct 2007 21:13:17 -0400


Hi Brew,

> I would like to do the following: Have the student upload a file, then use
> a customresponse tag to use code (perl, javascript, java, C++, standalone
> Visual Basic program)

Currently <customresponse> can only be a perl script.

There is <externalresponse> which can be used to submit the students
response and associated information to a remote server which can then
do whatever it wants however it wants.


> to analyze the file and return the appropriate return
> code. Typically I would expect to return something like EXACT_ANS or
> INCORRECT. The student would then fix the file and resubmit it until it is
> correct.
> 
> In the sample code for customresponse, the <customresponse> tag includes a
> <textline />; the contents of the textline show up as the variable
> $submission in the <answer> code.
> 
> I want to (in essence) replace the <textline> with an <essayresponse>,

You can use <textfield> to get the larger type input area
(<textarea>), but there isn't a way currently to get the file
submission style entry in anything but an essayresponse.

> where I get the functionality of the file upload process. Is customresponse
> limited to textlines, or can I use other types of responses? Does anyone
> have sample code that does non-textline uses of <customresponse>? I notice
> that one of the available return codes from <customresponse> is
> INVALID_FILETYPE, which leads me to hope the <answer> code should be able
> to find the uploaded file:)
> 
> 
> Hmmm, another potential problem: when the file is uploaded, I can retrieve
> the url for the file on the LonCapa server. I assume the code would be able
> to read the file from this url? For security, LonCapa perl has been
> restricted to remove the file access functions - can javascript or other
> languages access the file somehow?

If the file type input was exteneded to work with <customresponse> the
file contents would be made available automagically to the authoring
of the problem.

-- 
guy@albertelli.com   0-7-0-6-27,137