--- loncom/homework/bridgetask.pm 2006/06/01 19:22:29 1.160
+++ loncom/homework/bridgetask.pm 2006/06/06 21:05:56 1.162
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.160 2006/06/01 19:22:29 albertel Exp $
+# $Id: bridgetask.pm,v 1.162 2006/06/06 21:05:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -43,7 +43,7 @@ use LONCAPA;
BEGIN {
- &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Instance','InstanceText','Criteria','ClosingParagraph'));
+ &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','ClosingParagraph'));
}
sub initialize_bridgetask {
@@ -365,9 +365,9 @@ sub file_list {
my $file=$file_url.$partial_file;
$file=~s|/+|/|g;
&Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
- $file_list.='
'.$file.
- ''."\n";
+ $file_list.=' '.$file.
+ ''."\n";
}
$file_list.="\n";
return $file_list;
@@ -1791,6 +1791,15 @@ sub get_id {
}
my %dimension;
+sub start_Setup {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ undef(%dimension);
+ my $dim_id=&get_id($parstack,$safeeval);
+ $Apache::bridgetask::dimension=$dim_id;
+ undef(@Apache::bridgetask::instance);
+ &Apache::lonxml::startredirection();
+ return &internal_location($dim_id);
+}
sub start_Question { return &start_Dimension(@_); }
sub start_Dimension {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
@@ -2057,6 +2066,41 @@ sub get_instance {
} else {
# any other targets no output
undef($result);
+ }
+ return $result;
+ }
+
+ sub end_Setup {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result=&Apache::lonxml::endredirection();
+ my $dim=&get_id($parstack,$safeeval);
+ my $instance=&get_instance($dim);
+ my $version=&get_version();
+ if ($target eq 'web') {
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{'intro'});
+ my @instances = $instance;
+ if (&Apache::response::showallfoils()) {
+ @instances = @{$dimension{'instances'}};
+ }
+ foreach my $instance (@instances) {
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{'questiontext'});
+ }
+ } elsif ($target eq 'webgrade'
+ || $target eq 'grade' && $env{'form.webgrade'}) {
+ # in case of any side effects that we need
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{'intro'});
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{$instance.'.text'});
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{'questiontext'});
+ } else {
+ # any other targets no output
+ undef($result);
}
return $result;
}