--- loncom/homework/structuretags.pm 2003/05/19 21:05:23 1.176
+++ loncom/homework/structuretags.pm 2003/06/04 14:49:20 1.179
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.176 2003/05/19 21:05:23 albertel Exp $
+# $Id: structuretags.pm,v 1.179 2003/06/04 14:49:20 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -274,7 +274,9 @@ sub start_problem {
}
#initialize globals
$Apache::inputtags::part='0';
+ @Apache::inputtags::partlist=('0');
@Apache::inputtags::responselist = ();
+ @Apache::inputtags::importlist = ();
@Apache::inputtags::previous=();
@Apache::inputtags::previous_version=();
$Apache::structuretags::printanswer='No';
@@ -401,6 +403,10 @@ sub start_problem {
"
$name\n$body_tag_start\n";
}
} elsif ($target eq 'tex') {
+ my $startminipage = '';
+ if ($ENV{'form.problem_split'} ne 'yes') {
+ $startminipage = '\begin{minipage}{\textwidth}';
+ }
my $name= &Apache::lonxml::get_param('name',$parstack,$safeeval);
if ($name eq '') {
$name=&Apache::lonnet::EXT('resource.title');
@@ -435,9 +441,9 @@ sub start_problem {
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 \begin{minipage}{\textwidth}';
+ $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;
} else {
- $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$ENV{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent\begin{minipage}{\textwidth}';
+ $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$ENV{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm \noindent'.$startminipage;
if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
}
} else {
@@ -445,7 +451,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\begin{minipage}{\textwidth}';
+ $result .= '\begin{document} \typeout{STAMPOFPASSEDRESOURCESTART Resource "'.$name_of_resourse.'"
located in
'.$ENV{'request.uri'}.'
STAMPOFPASSEDRESOURCEEND} \noindent \vskip 1 mm\noindent'.$startminipage;
if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
} else {
$result .= '\vskip 1mm \\\\\\\\';
@@ -503,9 +509,13 @@ sub end_problem {
if ($target eq 'web') {
$result.=&Apache::lonxml::xmlend();
} elsif ($target eq 'tex') {
+ my $endminipage = '';
+ if ($ENV{'form.problem_split'} ne 'yes') {
+ $endminipage = '\end{minipage}';
+ }
$result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
if (not $ENV{'request.symb'} =~ m/\.page_/) {
- $result .= '\end{minipage}\end{document} ';
+ $result .= $endminipage.'\end{document} ';
} else {
$result .= '';
}
@@ -522,6 +532,7 @@ sub end_problem {
}
} elsif ($target eq 'meta') {
if ($Apache::inputtags::part eq '0') {
+ @Apache::inputtags::response=();
$result=&Apache::response::mandatory_part_meta;
}
} elsif ($target eq 'edit') {
@@ -529,6 +540,9 @@ sub end_problem {
$result = &problem_edit_footer();
}
+ if ($ENV{'request.state'} eq 'construct' && $target eq 'web') {
+ &Apache::inputtags::check_for_duplicate_ids();
+ }
undef(%Apache::lonhomework::history);
undef(%Apache::lonhomework::results);
undef($Apache::inputtags::part);
@@ -854,7 +868,8 @@ sub start_part {
my $id= &Apache::lonxml::get_param('id',$parstack,$safeeval);
if ($id eq '') { $id = $Apache::lonxml::curdepth; }
$Apache::inputtags::part=$id;
- @Apache::inputtags::responselist = ();
+ push(@Apache::inputtags::partlist,$id);
+ @Apache::inputtags::response=();
@Apache::inputtags::previous=();
@Apache::inputtags::previous_version=();
$Apache::lonhomework::problemstatus=