[LON-CAPA-cvs] cvs: loncom(version_2_10_X) /interface loncommon.pm
raeburn
raeburn@source.lon-capa.org
Sun, 19 Dec 2010 22:34:43 -0000
raeburn Sun Dec 19 22:34:43 2010 EDT
Modified files: (Branch: version_2_10_X)
/loncom/interface loncommon.pm
Log:
- Backport 1.988.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.948.2.13 loncom/interface/loncommon.pm:1.948.2.14
--- loncom/interface/loncommon.pm:1.948.2.13 Wed Nov 17 20:41:53 2010
+++ loncom/interface/loncommon.pm Sun Dec 19 22:34:42 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.948.2.13 2010/11/17 20:41:53 raeburn Exp $
+# $Id: loncommon.pm,v 1.948.2.14 2010/12/19 22:34:42 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3562,6 +3562,29 @@
$value = &Apache::lonlocal::locallocaltime($value);
} elsif (ref($value) eq 'ARRAY') {
$value = '('.join(', ', @{ $value }).')';
+ } elsif ($key =~ /answerstring$/) {
+ my %answers = &Apache::lonnet::str2hash($value);
+ my @anskeys = sort(keys(%answers));
+ if (@anskeys == 1) {
+ my $answer = $answers{$anskeys[0]};
+ if ($answer =~ m{\Q\0\E}) {
+ $answer =~ s{\Q\0\E}{, }g;
+ }
+ my $tag_internal_answer_name = 'INTERNAL';
+ if ($anskeys[0] eq $tag_internal_answer_name) {
+ $value = $answer;
+ } else {
+ $value = $anskeys[0].'='.$answer;
+ }
+ } else {
+ foreach my $ans (@anskeys) {
+ my $answer = $answers{$ans};
+ if ($answer =~ m{\Q\0\E}) {
+ $answer =~ s{\Q\0\E}{, }g;
+ }
+ $value .= $ans.'='.$answer.'<br />';;
+ }
+ }
} else {
$value = &unescape($value);
}