--- loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex 2013/08/27 21:15:59 1.26 +++ loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex 2017/01/19 21:12:45 1.32 @@ -141,7 +141,20 @@ Option 1 - \&map(\$seed,[$\backslash$\$w epoch (UTC), which can be used in calculations.\\ \hline -\&submission(\$partid,\$responseid,\$version) & Returns what the student submitted for response \$responseid in part \$partid. You can get these IDs from the XML-code of the problem. \$version is optional and returns the \$version-th submission of the student that was graded.\\ +\&submission(\$partid,\$responseid,\$version, +\$encode,\$cleanupnum,\$mapalias) & Returns what the student submitted for response \$responseid in part \$partid. You can get these IDs from the XML-code of the problem. Use 0 as \$partid for problems without parts. \$version is optional and returns the \$version-th submission of the student that was graded. If \$version is 0 or omitted, the latest submission is returned. +\$encode is also optional and allows the author to explicitly encode the returned string. It's up to the author to take care of properly escaping all characters which might be interpreted by the browser. +\$cleanupnum is also optional, and supports clean-up of the retrieved submission. +It is a reference to a hash, with one or more of the following: +exponent =$>$ 1, +comma =$>$ 1, +letterforzero =$>$ 1, +spaces =$>$ 1, +format =$>$ 'ns' +(where n is an integer, i.e., number of significant digits). For example, to convert a student submission of +11,300 to 11300 include \{ comma =$>$ 1, \} as the fifth arg. +\$mapalias is also optional, and supports retrieval of the submission for a response item in a different problem in the course, for which a (unique) mapalias has been set. +The default (mapalias not defined) is to retrieve the submission for the specified part and response IDs in the current problem.\\ \hline \¶meter\_setting(\$name,\$partid) & Returns the parameter setting \$name. Partid is optional.\\ @@ -157,6 +170,10 @@ optional array of wrong answers that sho Returns the ID of the current part.\\ \hline +\&input\_id(part\_id, response\_id, textline\_id) & +Returns the HTML id of the input field. This is useful in Javascript scripts to get a safe reference to a response textline field with \texttt{document.getElementById()}.\\ +\hline + Not implemented & Get and set the random seed. \\ \hline @@ -248,5 +265,5 @@ Some examples can be found by browsing i The \&EXT() function can be used to obtain values for the same parameters as are retrived by some of the other (newer) helper functions summarized in the table above, such as \&firstname() which is equivalent to \&EXT(`environment.firstname'), and \¶meter\_setting(\$name,\$partid) is equivalent to \&EXT(`resource.'.\$partid.`.'.\$name). -In such cases the newer (specialized) functions are preferred to &EXT() on the basis of ease of use. +In such cases the newer (specialized) functions are preferred to \&EXT() on the basis of ease of use.