version 1.153.6.1, 2012/01/20 11:41:31
|
version 1.153.6.2, 2012/01/21 20:54:57
|
Line 769 sub whichfoils {
|
Line 769 sub whichfoils {
|
return ( $answer, @whichfalse ); |
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='<label>'; |
|
|
|
$result .= '<input type="radio" |
|
onchange="javascript:setSubmittedPart(' . "'$part');\"" |
|
. 'name="HWVAL_' . $fieldname . '"' |
|
. "value='$value'"; |
|
|
|
if (defined($last_responses->{$name})) { |
|
$result .= ' checked="checked" '; |
|
} |
|
$result .= ' />'; |
|
$result .= $Apache::response::foilgroup{$name . '.text'}; |
|
$result .= '</label>'; |
|
|
|
return $result; |
|
|
|
} |
|
|
|
## |
# Display foils in html rendition: |
# Display foils in html rendition: |
# |
# |
# @param $whichfoils - Set of foils to display. |
# @param $whichfoils - Set of foils to display. |
Line 863 sub displayfoils {
|
Line 896 sub displayfoils {
|
$result = &display_foils_html( |
$result = &display_foils_html( |
$whichfoils, $target, $direction, $part, $solved, 1); |
$whichfoils, $target, $direction, $part, $solved, 1); |
|
|
# if ( $direction eq 'horizontal' ) { |
|
# if ( $target ne 'tex' ) { |
|
# $result .= '<table><tr>'; |
|
# } |
|
# } |
|
# foreach my $name ( @{$whichfoils} ) { |
|
# if ( $direction eq 'horizontal' ) { |
|
# if ( $target ne 'tex' ) { $result .= '<td>'; } |
|
# } |
|
# if ( $target ne 'tex' ) { |
|
# $result .= "<br />"; |
|
# } |
|
# else { |
|
# $result .= '\item \vskip -2 mm '; |
|
# } |
|
# if ( $Apache::response::foilgroup{ $name . '.value' } eq 'true' ) { |
|
# if ( $target ne 'tex' ) { |
|
# $result .= &mt('Correct:') . '<b>'; |
|
# } |
|
# else { |
|
# $result .= &mt('Correct:') . ' \textbf{'; |
|
# } |
|
# } |
|
# else { |
|
# $result .= &mt('Incorrect:'); |
|
# } |
|
# if ( $target eq 'web' ) { $result .= "<label>"; } |
|
# $result .= $Apache::response::foilgroup{ $name . '.text' }; |
|
# if ( $target eq 'web' ) { $result .= "</label>"; } |
|
# if ( $Apache::response::foilgroup{ $name . '.value' } eq 'true' ) { |
|
# if ( $target ne 'tex' ) { $result .= '</b>'; } |
|
# else { $result .= '}'; } |
|
# } |
|
# if ( $direction eq 'horizontal' ) { |
|
# if ( $target ne 'tex' ) { $result .= '</td>'; } |
|
# } |
|
# } |
|
# if ( $direction eq 'horizontal' ) { |
|
# if ( $target ne 'tex' ) { |
|
# $result .= '</tr></table>'; |
|
# } |
|
# } |
|
} |
} |
else { |
else { |
my @alphabet = ( 'A' .. 'Z' ); |
my @alphabet = ( 'A' .. 'Z' ); |
Line 970 sub displayfoils {
|
Line 961 sub displayfoils {
|
$result .= '\item[\textbf{' . $Apache::lonxml::counter . '}.]'; |
$result .= '\item[\textbf{' . $Apache::lonxml::counter . '}.]'; |
} |
} |
} |
} |
|
my $item_pretext; |
|
my $item_posttext; |
|
if ( $target ne 'tex' ) { |
|
if ( $direction eq 'horizontal' ) { |
|
$item_pretext = '<td>'; |
|
$item_posttext = '</td>'; |
|
} |
|
else { |
|
$item_pretext = '<br/>'; |
|
} |
|
} |
foreach my $name ( @{$whichfoils} ) { |
foreach my $name ( @{$whichfoils} ) { |
|
|
if ( $target ne 'tex' ) { |
if ( $target ne 'tex' ) { |
if ( $direction eq 'horizontal' ) { |
$result .= $item_pretext; |
$result .= "<td>"; |
$result .= &html_radiobutton( |
} |
$part, $Apache::inputtags::response[-1], |
else { |
$name, $lastresponse, $temp |
$result .= "<br />"; |
); |
} |
$result .= $item_posttext; |
} |
|
if ( $target ne 'tex' ) { |
|
$result .= '<label>'; |
|
$result .= "<input type=\"radio\" |
|
onchange=\"javascript:setSubmittedPart('$part');\" |
|
name=\"HWVAL_$Apache::inputtags::response['-1']\" |
|
value=\"$temp\""; |
|
if ( defined( $lastresponse{$name} ) ) { |
|
$result .= ' checked="checked"'; |
|
} |
|
$result .= ' />' |
|
. $Apache::response::foilgroup{ $name . '.text' } |
|
. "</label>"; |
|
} |
} |
else { |
else { |
if ( $Apache::lonhomework::type eq 'exam' ) { |
if ( $Apache::lonhomework::type eq 'exam' ) { |
Line 1037 sub displayfoils {
|
Line 1027 sub displayfoils {
|
} |
} |
} |
} |
} |
} |
if ( $target ne 'tex' && $direction eq 'horizontal' ) { |
|
$result .= "</td>"; |
|
} |
|
$temp++; |
$temp++; |
} |
} |
if ( $target ne 'tex' && $direction eq 'horizontal' ) { |
if ( $target ne 'tex' && $direction eq 'horizontal' ) { |
$result .= "</tr></table>"; |
$result .= "</tr></table>"; |
} |
} |
} |
} |
if ( $target ne 'tex' ) { |
if ( $target ne 'tex' |
if ( $direction ne 'horizontal' ) { $result .= "<br />"; } |
&& ( $direction ne 'horizontal' ) |
|
) { |
|
$result .= "<br />"; |
|
} |
|
if ($target eq 'tex') { |
|
$result .= '\vskip 0 mm '; |
} |
} |
else { $result .= '\vskip 0 mm '; } |
|
return $result; |
return $result; |
} |
} |
|
|