version 1.109, 2004/05/06 07:31:32
|
version 1.112, 2004/07/06 14:53:00
|
Line 38 sub start_optionresponse {
|
Line 38 sub start_optionresponse {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my $result=''; |
my $result=''; |
#when in a option response use these |
#when in a option response use these |
&Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup')); |
&Apache::lonxml::register('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist')); |
push (@Apache::lonxml::namespace,'optionresponse'); |
push (@Apache::lonxml::namespace,'optionresponse'); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
my $id = &Apache::response::start_response($parstack,$safeeval); |
%Apache::hint::option=(); |
%Apache::hint::option=(); |
Line 78 sub end_optionresponse {
|
Line 78 sub end_optionresponse {
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
&Apache::response::end_response; |
&Apache::response::end_response; |
pop @Apache::lonxml::namespace; |
pop @Apache::lonxml::namespace; |
&Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup')); |
&Apache::lonxml::deregister('Apache::optionresponse',('foilgroup','foil','conceptgroup','drawoptionlist')); |
my $result; |
my $result; |
if ($target eq 'edit') { $result=&Apache::edit::end_table(); } |
if ($target eq 'edit') { $result=&Apache::edit::end_table(); } |
undef(%Apache::response::foilnames); |
undef(%Apache::response::foilnames); |
Line 92 sub start_foilgroup {
|
Line 92 sub start_foilgroup {
|
my $result=''; |
my $result=''; |
%Apache::response::foilgroup=(); |
%Apache::response::foilgroup=(); |
$Apache::optionresponse::conceptgroup=0; |
$Apache::optionresponse::conceptgroup=0; |
&Apache::response::setrandomnumber(); |
&Apache::response::pushrandomnumber(); |
if ($target eq 'edit') { |
if ($target eq 'edit') { |
my $optionlist="<option></option>\n"; |
my $optionlist="<option></option>\n"; |
my $option; |
my $option; |
Line 257 sub end_foilgroup {
|
Line 257 sub end_foilgroup {
|
if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') { |
if ($target eq 'tex' and $Apache::lonhomework::type ne 'exam') { |
$result .= '\end{enumerate}'; |
$result .= '\end{enumerate}'; |
} |
} |
|
&Apache::response::poprandomnumber(); |
return $result; |
return $result; |
} |
} |
|
|
Line 337 sub displayfoils {
|
Line 338 sub displayfoils {
|
my $lastopt=$lastresponse{$name}; |
my $lastopt=$lastresponse{$name}; |
if ($text!~/^\s*$/) { $break='<br />'; } |
if ($text!~/^\s*$/) { $break='<br />'; } |
$result.=$break; |
$result.=$break; |
if ($target eq 'web') { |
if ($target eq 'web' || $target eq 'tex') { |
my $value=$Apache::response::foilgroup{$name.'.value'}; |
my $value=$Apache::response::foilgroup{$name.'.value'}; |
if (!($text=~s|<drawoptionlist\s*/>|$value|)) { |
if (!($text=~s|<drawoptionlist\s*/>|$value|)) { |
if ($text=~/^\s*$/) { |
if ($text=~/^\s*$/) { |
Line 349 sub displayfoils {
|
Line 350 sub displayfoils {
|
$text='•'.$text; |
$text='•'.$text; |
} |
} |
$result.=$text."\n"; |
$result.=$text."\n"; |
} |
} |
if ($Apache::lonhomework::type eq 'exam') { |
if ($Apache::lonhomework::type eq 'exam') { |
$result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt); |
$result.=&webbubbles(\@opt,\@alphabet,$temp,$lastopt); |
} |
} |
Line 478 sub webbubbles {
|
Line 479 sub webbubbles {
|
} |
} |
$result.='<td><input type="radio" name="HWVAL_'. |
$result.='<td><input type="radio" name="HWVAL_'. |
$Apache::inputtags::response['-1'].':'.$temp. |
$Apache::inputtags::response['-1'].':'.$temp. |
'" value="'.$opt[$ind].'" '.$checked.' />'.$alphabet[$ind].': '. |
'" value="'.$opt[$ind].'" '.$checked.' />'; |
$opt[$ind].'</td>'; |
if ($alphabet[$ind]) { |
|
$result.=$alphabet[$ind].': '; |
|
} |
|
$result.=$opt[$ind].'</td>'; |
} |
} |
$result.='</tr></table>'; |
$result.='</tr></table>'; |
return $result; |
return $result; |
Line 599 sub end_foil {
|
Line 603 sub end_foil {
|
my $result = ''; |
my $result = ''; |
if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { |
if ($target eq 'web' || $target eq 'tex' || $target eq 'analyze') { |
$text=&Apache::lonxml::endredirection; |
$text=&Apache::lonxml::endredirection; |
$text=~/(\w)/; |
|
if (($target eq 'tex') and ($Apache::lonhomework::type ne 'exam') and ($text=~/\S/)) {$text = '\vspace*{-2 mm}\item '.$text;} |
if (($target eq 'tex') and ($Apache::lonhomework::type ne 'exam') and ($text=~/\S/)) {$text = '\vspace*{-2 mm}\item '.$text;} |
} |
} |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' |
Line 643 sub end_foil {
|
Line 646 sub end_foil {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub start_drawoptionlist { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
return $token->[4]; |
|
} |
|
|
|
sub end_drawoptionlist { |
|
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; |
|
return $token->[2]; |
|
} |
|
|
sub insert_foil { |
sub insert_foil { |
return ' |
return ' |
<foil name="" value="unused"> |
<foil name="" value="unused"> |