--- loncom/homework/radiobuttonresponse.pm 2012/01/05 11:56:34 1.153
+++ loncom/homework/radiobuttonresponse.pm 2012/01/21 20:54:57 1.153.6.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.153 2012/01/05 11:56:34 foxr Exp $
+# $Id: radiobuttonresponse.pm,v 1.153.6.2 2012/01/21 20:54:57 foxr Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -387,6 +387,7 @@ sub format_prior_answer {
}
+##
sub displayallfoils {
my ( $direction, $target ) = @_;
my $result;
@@ -767,6 +768,120 @@ sub whichfoils {
&Apache::lonxml::debug("Answer is $answer");
return ( $answer, @whichfalse );
}
+##
+# Generate the HTML for a single html foil.
+# @param $part - The part for which the response is being generated.
+# @param $fieldname - The basename of the radiobutton field
+# @param $name - The foilname.
+# @param $last_responses - Reference to a hash that holds the most recent
+# responses.
+# @param $value - radiobutton value.
+#
+# @return text
+# @retval The generated html.
+#
+sub html_radiobutton {
+ my ($part, $fieldname, $name, $last_responses, $value) = @_;
+
+ my $result='';
+
+ return $result;
+
+}
+
+##
+# Display foils in html rendition:
+#
+# @param $whichfoils - Set of foils to display.
+# @param $target - Rendition target...there are several html targets.
+# @param $direction - 'horizontal' if layout is horizontal.
+# @param $part - Part of the problem that's being displayed.
+# @param $solved - Solution state of the problem.
+# @param $show_answer- True if answers should be shown.
+#
+# @return string
+# @retval generated html.
+#
+sub display_foils_html {
+ my ($whichfoils, $target, $direction, $part, $solved, $show_answer) = @_;
+ my $result;
+
+ # if the answers get shown, we need to label each item as correct or
+ # incorrect.
+
+ if ($show_answer) {
+ my $item_pretext = '
'; # html prior to each item
+ my $item_posttext = ''; # html after each item.
+ my $finalclose = ''; # html to close off the whole shebang
+
+
+ # Horizontal layout is a table with each foil in a cell
+
+ if ($direction eq 'horizontal') {
+ $result = '
' . $item_pretext; + $item_posttext = ' | '; + $finalclose = '
'; }
- }
- if ( $target ne 'tex' ) {
- $result .= " "; - } - else { - $result .= '\item \vskip -2 mm '; - } - if ( $Apache::response::foilgroup{ $name . '.value' } eq 'true' ) { - if ( $target ne 'tex' ) { - $result .= &mt('Correct:') . ''; - } - else { - $result .= &mt('Correct:') . ' \textbf{'; - } - } - else { - $result .= &mt('Incorrect:'); - } - if ( $target eq 'web' ) { $result .= ""; } - if ( $Apache::response::foilgroup{ $name . '.value' } eq 'true' ) { - if ( $target ne 'tex' ) { $result .= ''; } - else { $result .= '}'; } - } - if ( $direction eq 'horizontal' ) { - if ( $target ne 'tex' ) { $result .= ' | '; }
- }
- }
- if ( $direction eq 'horizontal' ) {
- if ( $target ne 'tex' ) {
- $result .= '