--- loncom/homework/edit.pm 2002/11/03 19:16:19 1.38
+++ loncom/homework/edit.pm 2002/11/14 16:47:41 1.42
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# edit mode helpers
#
-# $Id: edit.pm,v 1.38 2002/11/03 19:16:19 www Exp $
+# $Id: edit.pm,v 1.42 2002/11/14 16:47:41 matthew Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -99,26 +99,31 @@ sub start_table {
}
$Apache::edit::colordepth++;
push(@Apache::edit::inserttag,$token->[1]);
- my $result="
";
+ my $result='';
+ $result.='
';
return $result;
}
sub end_table {
$Apache::edit::colordepth--;
- my $result="
";
- $result.=
- "
".
- &innerinsertlist('edit',
- (defined($Apache::edit::inserttag[-2])?$Apache::edit::inserttag[-2]:'problem')
-,
- (defined($Apache::edit::inserttag[-1])?$Apache::edit::inserttag[-1]:'')).
- " |
";
+ my $result='
';
+ $result.="";
+
+ my ($tagname,$closingtag);
+ if (defined($Apache::edit::inserttag[-2])) {
+ $tagname=$Apache::edit::inserttag[-2];
+ } else {$tagname='problem';}
+ if (defined($Apache::edit::inserttag[-1])) {
+ $closingtag=$Apache::edit::inserttag[-1];
+ }
+ $result.=&innerinsertlist('edit',$tagname,$closingtag).
+ " |
";
pop(@Apache::edit::inserttag);
return $result;
}
-sub start_spanning_row { return '';}
-sub start_row { return ' |
'; }
+sub start_spanning_row { return ' |
';}
+sub start_row { return ' |
'; }
sub end_row { return ' |
'; }
sub movebuttons {
@@ -453,54 +458,75 @@ sub text_arg {
}
sub select_arg {
- my ($description,$name,$list,$token) = @_;
- my $result;
- my $optionlist="";
- my $selected=$token->[2]{$name};
- foreach my $option (@$list) {
- if ( $selected eq $option ) {
- $optionlist.="\n";
- } else {
- $optionlist.="\n";
+ my ($description,$name,$list,$token) = @_;
+ my $result;
+ my $optionlist="";
+ my $selected=$token->[2]{$name};
+ foreach my $option (@$list) {
+ my $value;
+ if ( ref($option) eq 'ARRAY') {
+ $value='value="'.$$option[0].'"';
+ $option=$$option[1];
+ } else {
+ $value='value="'.$option.'"';
+ }
+ if ( $selected eq $option ) {
+ $optionlist.="\n";
+ } else {
+ $optionlist.="\n";
+ }
}
- }
- $result.=$description.'