version 1.82.2.1, 2003/09/23 01:52:57
|
version 1.86, 2003/10/06 21:57:54
|
Line 180 sub mandatory_part_meta {
|
Line 180 sub mandatory_part_meta {
|
# |
# |
} |
} |
|
|
|
sub meta_part_order { |
|
if (@Apache::inputtags::partlist) { |
|
my @parts=@Apache::inputtags::partlist; |
|
shift(@parts); |
|
return '<partorder>'.join(',',@parts).'</partorder>'; |
|
} else { |
|
return '<partorder>0</partorder>'; |
|
} |
|
} |
|
|
sub check_for_previous { |
sub check_for_previous { |
my ($curresponse,$partid,$id) = @_; |
my ($curresponse,$partid,$id) = @_; |
my %previous; |
my %previous; |
Line 278 sub end_dataresponse {
|
Line 288 sub end_dataresponse {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub decide_package { |
|
my ($tagstack)=@_; |
|
my $package; |
|
if ($$tagstack[-1] eq 'parameter') { |
|
$package='part'; |
|
} else { |
|
my $i=-1; |
|
while (defined($$tagstack[$i])) { |
|
if ($$tagstack[$i] =~ /(response|hint)$/) { |
|
$package=$$tagstack[$i]; |
|
last; |
|
} |
|
$i--; |
|
} |
|
} |
|
return $package; |
|
} |
|
|
sub start_responseparam { |
sub start_responseparam { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result=''; |
my $result=''; |
Line 288 sub start_responseparam {
|
Line 316 sub start_responseparam {
|
$token->[2]->{'description'}); |
$token->[2]->{'description'}); |
} elsif ($target eq 'edit') { |
} elsif ($target eq 'edit') { |
$result.=&Apache::edit::tag_start($target,$token); |
$result.=&Apache::edit::tag_start($target,$token); |
|
my $optionlist; |
|
my $package=&decide_package($tagstack); |
|
foreach my $key (sort(keys(%Apache::lonnet::packagetab))) { |
|
if ($key =~ /^\Q$package\E&(.*)&display$/) { |
|
$optionlist.='<option value="'.$1.'">'. |
|
$Apache::lonnet::packagetab{$key}.'</option>'; |
|
} |
|
} |
|
if (defined($optionlist)) { |
|
$result.='Use template: <select name="'. |
|
&Apache::edit::html_element_name('parameter_package').'">'. |
|
'<option value=""></option>'.$optionlist.'</select><br />'; |
|
} |
$result.=&Apache::edit::text_arg('Name:','name',$token). |
$result.=&Apache::edit::text_arg('Name:','name',$token). |
&Apache::edit::text_arg('Type:','type',$token). |
&Apache::edit::text_arg('Type:','type',$token). |
&Apache::edit::text_arg('Description:','description',$token). |
&Apache::edit::text_arg('Description:','description',$token). |
Line 295 sub start_responseparam {
|
Line 336 sub start_responseparam {
|
"</td></tr>"; |
"</td></tr>"; |
$result.=&Apache::edit::end_table; |
$result.=&Apache::edit::end_table; |
} elsif ($target eq 'modified') { |
} elsif ($target eq 'modified') { |
my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval, |
my $constructtag=&Apache::edit::get_new_args($token,$parstack, |
'name','type','description', |
$safeeval,'name','type', |
'default'); |
'description','default'); |
|
my $element=&Apache::edit::html_element_name('parameter_package'); |
|
if (defined($ENV{"form.$element"}) && $ENV{"form.$element"} ne '') { |
|
my $name=$ENV{"form.$element"}; |
|
my $tag=&decide_package($tagstack); |
|
$token->[2]->{'name'}=$name; |
|
$token->[2]->{'type'}= |
|
$Apache::lonnet::packagetab{"$tag&$name&type"}; |
|
$token->[2]->{'description'}= |
|
$Apache::lonnet::packagetab{"$tag&$name&display"}; |
|
$token->[2]->{'default'}= |
|
$Apache::lonnet::packagetab{"$tag&$name&default"}; |
|
$constructtag=1; |
|
} |
if ($constructtag) { |
if ($constructtag) { |
$result = &Apache::edit::rebuild_tag($token); |
$result = &Apache::edit::rebuild_tag($token); |
$result.=&Apache::edit::handle_insert(); |
$result.=&Apache::edit::handle_insert(); |
Line 368 sub answer_header {
|
Line 422 sub answer_header {
|
my ($type) = @_; |
my ($type) = @_; |
my $result; |
my $result; |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
if ($ENV{'form.answer_output_mode'} eq 'tex') { |
$result = ' \vskip 0 mm \begin{tabular}{|c|}\hline Answer for Part: '. |
$result = ' \vskip 0 mm \begin{tabular}{|c|}\hline Answer for Part: \verb|'. |
$Apache::inputtags::part.' \\\\ \hline '; |
$Apache::inputtags::part.'| \\\\ \hline '; |
} else { |
} else { |
$result = '<table border="1"><tr><td>Answer for Part:'. |
$result = '<table border="1"><tr><td>Answer for Part:'. |
$Apache::inputtags::part. '</td>'."\n"; |
$Apache::inputtags::part. '</td>'."\n"; |