--- loncom/homework/structuretags.pm 2001/01/05 20:05:26 1.27
+++ loncom/homework/structuretags.pm 2001/02/19 20:39:00 1.32
@@ -54,7 +54,7 @@ sub start_problem {
if ( $status eq 'CLOSED' ) {
my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);
if ( $target eq "web" ) {
- return "
Problem is not open to be viewed. The problem $datemsg
";
+ return "
Problem is not open to be viewed. The problem $datemsg
";
}
}
}
@@ -62,10 +62,15 @@ sub start_problem {
my $args ='';
if ( $#$parstack > -1 ) { $args=$$parstack[$#$parstack]; }
my $name = &Apache::run::run("{$args;".'return $name}',$safeeval);
+ if ($name eq '') {
+ $name=&Apache::lonnet::EXT('resource.title');
+ if ($name eq 'con_lost') { $name = ''; }
+ }
+ $Apache::lonhomework::name=$name;
if ($status eq 'CAN_ANSWER') {
# create a page header and exit
- return "$name\n\n\n";
- } elsif ($status eq 'SHOW_ANSWER') {
+ } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER') {
$result.="\n";
}
}
@@ -106,7 +112,7 @@ sub start_block {
my $code = @$parstack[$#$parstack];
$code =~ s/\"//g;
$code .=';return $condition;';
-# print "
$code
";
+# print "
$code
";
my $result = &Apache::run::run($code,$safeeval);
&Apache::lonxml::debug("block :$code: returned :$result:");
if ( ! $result ) {
@@ -169,14 +175,14 @@ sub start_randomlist {
$list_item = &Apache::lonxml::get_all_text('/'.$b_tok->[1],$b_parser);
$list_item = "$b_tok->[4]"."$list_item"."$b_tok->[1]>";
push(@randomlist,$list_item);
- # print "
START-TAG $b_tok->[1], $b_tok->[4], $list_item";
+ # print "
START-TAG $b_tok->[1], $b_tok->[4], $list_item";
}
if($b_tok->[0] eq 'T') { # text
# what to do with text in between tags?
- # print "TEXT $b_tok->[1]
";
+ # print "TEXT $b_tok->[1]
";
}
# if($b_tok->[0] eq 'E') { # end tag, should not happen
- # print "END-TAG $b_tok->[1]
";
+ # print "END-TAG $b_tok->[1]
";
# }
}
my @idx_arr = (0 .. $#randomlist);
@@ -221,7 +227,7 @@ sub start_part {
if ( $status eq 'CLOSED' ) {
my $bodytext=&Apache::lonxml::get_all_text("/part",$$parser[$#$parser]);
if ( $target eq "web" ) {
- return "
Part is not open to be viewed. It $datemsg
";
+ return "
Part is not open to be viewed. It $datemsg
";
}
}
}
@@ -231,16 +237,20 @@ sub start_part {
sub end_part {
my ($target,$token,$parstack,$parser,$safeeval)=@_;
&Apache::lonxml::debug("in end_part $target ");
+ my $status=$Apache::inputtags::status['-1'];
pop @Apache::inputtags::status;
if ( $target eq 'meta' ) { return ''; }
- if ( $target eq 'grade' ) { return &Apache::inputtags::grade; }
+ if ( $target eq 'grade' && $status eq 'CAN_ANSWER') {
+ return &Apache::inputtags::grade;
+ }
return &Apache::inputtags::gradestatus($Apache::inputtags::part);
}
sub start_preduedate {
my ($target,$token,$parstack,$parser,$safeeval)=@_;
if ($target ne 'meta') {
- if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER') {
+ if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
+ $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) {
&Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]);
}
}