--- loncom/homework/structuretags.pm 2005/06/04 02:56:44 1.293
+++ loncom/homework/structuretags.pm 2005/10/07 13:56:19 1.304
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.293 2005/06/04 02:56:44 albertel Exp $
+# $Id: structuretags.pm,v 1.304 2005/10/07 13:56:19 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -88,11 +88,10 @@ sub body_tag_start {
$body_tag_start.=' style="font-size: x-large;" ';
}
$body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);
+
+ &Apache::lontexconvert::jsMath_reset();
if ($env{'environment.texengine'} eq 'jsMath') {
- $body_tag_start.=''."\n".
- ''."\n";
+ $body_tag_start.=&Apache::lontexconvert::jsMath_header();
}
return $body_tag_start;
}
@@ -119,14 +118,16 @@ sub page_start {
my $body_tag_start;
if (!defined($found{'body'}) && $env{'request.state'} eq 'construct'
&& $env{'environment.remote'} eq 'off') {
- $body_tag_start=&Apache::loncommon::bodytag();
- $body_tag_start.=&Apache::lonxml::message_location();
+ if ($target eq 'web' || $target eq 'edit') {
+ $body_tag_start=&Apache::loncommon::bodytag();
+ $body_tag_start.=&Apache::lonxml::message_location();
+ }
} elsif (!defined($found{'body'})) {
my $background=&Apache::lonxml::get_param('background',$parstack,
$safeeval);
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
$safeeval);
- $body_tag_start=&body_tag_start($background,$bgcolor);
+ $body_tag_start=&body_tag_start($target,$background,$bgcolor);
if ( ($target eq 'web' || $target eq 'webgrade')
&& $env{'request.state'} ne 'construct') {
my ($symb,undef,undef,undef,$publicuser)=
@@ -435,6 +436,11 @@ sub init_problem_globals {
@Apache::inputtags::partlist=();
$Apache::lonhomework::problemstatus='';
$Apache::lonhomework::ignore_response_errors=1;
+ } elsif ($type eq 'Task') {
+ $Apache::inputtags::part='0';
+ @Apache::inputtags::partlist=('0');
+ $Apache::lonhomework::problemstatus='';
+ $Apache::lonhomework::ignore_response_errors=1;
}
@Apache::inputtags::responselist = ();
@Apache::inputtags::importlist = ();
@@ -522,6 +528,7 @@ sub start_problem {
&Apache::lonxml::debug("Using default type, problem, :$uri:");
}
}
+ $Apache::lonhomework::default_type = $Apache::lonhomework::type;
#added vars to the scripting enviroment
my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
@@ -564,11 +571,12 @@ sub start_problem {
value="'.$env{'form.username'}.'" />';
if ($env{'user.adv'}) {
$form_tag_start.=
- ' '.&mt(' Show All Foils');
+ $form_tag_start.= ' />'.&mt(' Show All Foils').
+ '';
}
$form_tag_start.='
';
}
@@ -642,6 +650,10 @@ sub start_problem {
}
my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; }
+ if (lc($env{'course.'.$env{'request.course.id'}.
+ '.disableexampointprint'}) eq 'yes') {
+ $allow_print_points=0;
+ }
my $duedate = &Apache::lonnet::EXT("resource.$id.duedate");
$duedate = POSIX::strftime("%c",localtime($duedate));
my $temp_file;
@@ -655,14 +667,18 @@ sub start_problem {
my $due_file_content = $due_file_content[$#due_file_content];
chomp $due_file_content;
my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
+ my $begin_doc='\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$env{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent ';
+ my $toc_line='\vskip 1 mm\noindent '.$startminipage.
+ '\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
if ($due_file_content ne $duedate) {
$temp_file = Apache::File->new('>'.$filename);
print $temp_file "$duedate\n";
if (not $env{'request.symb'} =~ m/\.page_/) {
if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
- $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$env{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent\textit{Due date: '.$duedate.'} \vskip 1 mm\noindent '.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
+ $result .= $begin_doc.
+ '\textit{Due date: '.$duedate.'} '.$toc_line;
} else {
- $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$env{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
+ $result .= $begin_doc.$toc_line;
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
}
} else {
@@ -670,7 +686,7 @@ sub start_problem {
}
} else {
if (not $env{'request.symb'} =~ m/\.page_/) {
- $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$env{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage.'\addcontentsline{toc}{subsection}{'.$name_of_resourse.'}';
+ $result .= $begin_doc.$toc_line;
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
} else {
$result .= '\vskip 1mm \\\\\\\\';
@@ -751,7 +767,8 @@ sub end_problem {
}
if ($target eq 'answer' && ($env{'request.state'} eq 'construct')
&& $env{'form.answer_output_mode'} ne 'tex') {
- $result.='