[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm /html/adm/help/tex Problem_LON-CAPA_Functions.tex all_functions_table.tex
bisitz
bisitz at source.lon-capa.org
Mon Jun 16 12:52:54 EDT 2014
bisitz Mon Jun 16 16:52:54 2014 EDT
Modified files:
/loncom/homework default_homework.lcpm
/loncom/html/adm/help/tex all_functions_table.tex
Problem_LON-CAPA_Functions.tex
Log:
Bug #6693: New optional parameter to allow the author to encode the student's submission provided by the function &submission().
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.163 loncom/homework/default_homework.lcpm:1.164
--- loncom/homework/default_homework.lcpm:1.163 Mon Jan 21 06:16:50 2013
+++ loncom/homework/default_homework.lcpm Mon Jun 16 16:52:50 2014
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
#
-# $Id: default_homework.lcpm,v 1.163 2013/01/21 06:16:50 raeburn Exp $
+# $Id: default_homework.lcpm,v 1.164 2014/06/16 16:52:50 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1208,10 +1208,18 @@
}
sub submission {
- my ($partid,$responseid,$subnumber)=@_;
+ my ($partid,$responseid,$subnumber,$encode)=@_;
my $sub='';
if ($subnumber) { $sub=$subnumber.':'; }
- return &EXT('user.resource.'.$sub.'resource.'.$partid.'.'.$responseid.'.submission');
+ my $output =
+ &EXT('user.resource.'.$sub.'resource.'.$partid.'.'.$responseid.'.submission');
+ if ($encode) {
+ $output =~ s/&/&/g;
+ $output =~ s/</</g;
+ $output =~ s/>/>/g;
+ $output =~ s/"/"/g;
+ };
+ return $output;
}
sub currentpart {
Index: loncom/html/adm/help/tex/all_functions_table.tex
diff -u loncom/html/adm/help/tex/all_functions_table.tex:1.14 loncom/html/adm/help/tex/all_functions_table.tex:1.15
--- loncom/html/adm/help/tex/all_functions_table.tex:1.14 Thu Jun 12 14:44:27 2014
+++ loncom/html/adm/help/tex/all_functions_table.tex Mon Jun 16 16:52:54 2014
@@ -106,7 +106,8 @@
\hline
&\&open\_date\_epoch(\$partid), \&due\_date\_epoch(\$partid), \&answer\_date\_epoch(\$partid) &Problem open date, due date and answer date in seconds after the epoch. These numbers can be used in calculations.&\\
\hline
-&\&submission(\$partid,\$responseid,\$version) & Returns what the student submitted for response \$responseid in part \$part. 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 ommitted, the latest submission is returned.&\\
+&\&submission(\$partid,\$responseid,\$version,\$encode) & Returns what the student submitted for response \$responseid in part \$part. 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 ommitted, 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.&\\
\hline
&\¤tpart() & Returns the ID of the current part.&\\ \hline
Index: loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex
diff -u loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.28 loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.29
--- loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.28 Thu Jun 12 14:44:27 2014
+++ loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex Mon Jun 16 16:52:54 2014
@@ -141,7 +141,8 @@
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. 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 ommitted, the latest submission is returned.\\
+\&submission(\$partid,\$responseid,\$version,\$encode) & 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 ommitted, 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.\\
\hline
\¶meter\_setting(\$name,\$partid) & Returns the parameter setting \$name. Partid is optional.\\
More information about the LON-CAPA-cvs
mailing list