--- loncom/homework/structuretags.pm 2006/10/17 15:11:12 1.367
+++ loncom/homework/structuretags.pm 2007/02/23 01:04:05 1.373
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.367 2006/10/17 15:11:12 albertel Exp $
+# $Id: structuretags.pm,v 1.373 2007/02/23 01:04:05 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -162,14 +162,14 @@ sub page_start {
if ($target eq 'edit') {
$form_tag_start.=&Apache::edit::form_change_detection();
}
- $form_tag_start.='>';
+ $form_tag_start.='>'."\n";
my $symb=&Apache::lonnet::symbread();
if ($symb =~ /\S/) {
$symb=
&HTML::Entities::encode(&Apache::lonenc::check_encrypt($symb));
$form_tag_start.=
- '';
+ "\t".''."\n";
}
}
return ($page_start,$form_tag_start);
@@ -276,9 +276,7 @@ sub option {
sub problem_web_to_edit_header {
my ($rndseed)=@_;
my $result.='';
- if (!$Apache::lonhomework::parsing_a_task) {
- $result .= '';
- }
+ $result .= '';
$result .= '
@@ -293,9 +291,9 @@ sub problem_web_to_edit_header {
: &mt(' Show All Foils');
if (defined($env{'form.showallfoils'})) { $result.='checked="on"'; }
- $result.= ' />'.$show_all_foils_text.
+ $result.= ' />'.$show_all_foils_text.''.
&Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').
- '
';
+ '
';
if (!$Apache::lonhomework::parsing_a_task) {
$result.="
@@ -744,7 +742,7 @@ sub start_problem {
&Apache::bridgetask::check_in('problem',undef,undef,
$slot_name);
}
- $result.="\n $form_tag_start".
+ $result.="\n $form_tag_start \t".
'';
# create a page header and exit
if ($env{'request.state'} eq "construct") {
@@ -787,7 +785,6 @@ sub end_problem {
}
if ($target eq 'tex') {
-
# Figure out the front matter and replace the
# INSERTTEXFRONTMATTERHERE in result with it. note that we do
# this in end_problem because whether or not we display due
@@ -963,7 +960,7 @@ sub end_problem {
sub start_library {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my ($result,$form_tag_start);
- if ($$tagstack[0] eq 'library') {
+ if ($#$tagstack eq 0 && $$tagstack[0] eq 'library') {
&init_problem_globals('library');
$Apache::lonhomework::type='problem';
}
@@ -978,7 +975,7 @@ sub start_library {
$result=$token->[4];
$result.=&Apache::edit::handle_insert();
} elsif (($target eq 'web' || $target eq 'webgrade')
- && $$tagstack[0] eq 'library'
+ && ($#$tagstack eq 0 && $$tagstack[0] eq 'library')
&& $env{'request.state'} eq "construct" ) {
my $name=&get_resource_name($parstack,$safeeval);
($result,$form_tag_start)=
@@ -997,11 +994,14 @@ sub end_library {
my $result='';
if ($target eq 'edit') {
$result=&problem_edit_footer();
- } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
- $env{'request.state'} eq "construct") {
+ } elsif ($target eq 'web'
+ && ($#$tagstack eq 0 && $$tagstack[0] eq 'library')
+ && $env{'request.state'} eq "construct") {
$result.=''.&Apache::loncommon::end_page({'discussion' => 1});
}
- if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };
+ if ( $#$tagstack eq 0 && $$tagstack[0] eq 'library') {
+ &reset_problem_globals('library');
+ }
return $result;
}
@@ -1485,15 +1485,21 @@ sub end_preduedate {
return '';
}
+# In all the modes where text is
+# displayable, all we do is eat up the text between the start/stop
+# tags if the conditions are not right to display it.
sub start_postanswerdate {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
- if ($target eq 'web' || $target eq 'grade' || $target eq 'webgrade') {
+ my $pav = &Apache::lonnet::allowed('pav', $env{'request.course.id'}) ||
+ &Apache::lonnet::allowed('pav',
+ $env{'request.course.id'}.'/'.$env{'request.course.sec'});
+ if ($target eq 'web' || $target eq 'grade' || $target eq 'webgrade' ||
+ $target eq 'tex' ) {
if ($Apache::lonhomework::scantronmode ||
- $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
+ $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER' ||
+ (($target eq 'tex') && !$pav)) {
&Apache::lonxml::get_all_text("/postanswerdate",$parser,$style);
}
- } elsif ($target eq 'tex') {
- &Apache::lonxml::get_all_text("/postanswerdate",$parser,$style);
}
return '';
}