--- loncom/homework/structuretags.pm 2003/05/14 13:33:00 1.172
+++ loncom/homework/structuretags.pm 2003/05/27 18:58:51 1.178
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.172 2003/05/14 13:33:00 albertel Exp $
+# $Id: structuretags.pm,v 1.178 2003/05/27 18:58:51 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -146,8 +146,13 @@ sub setup_rndseed {
$ENV{'form.rndseed'}=$rndseed;
}
}
- if ($ENV{'form.resetdata'} eq 'New Problem Variation') {
+ if ($ENV{'form.resetdata'} eq 'New Problem Variation' ||
+ $ENV{'form.newrandomization'} eq 'New Randomization') {
$rndseed=time;
+ if ($rndseed eq $ENV{'form.rndseed'}) {
+ srand($rndseed);
+ $rndseed=int(rand(1000000000));
+ }
$ENV{'form.rndseed'}=$rndseed;
}
&Apache::lonxml::debug("Setting rndseed to $rndseed");
@@ -177,19 +182,24 @@ sub problem_web_to_edit_header {
my $result.='
- Random Seed:
-
+
+
+
Show All Foils
';
my $numtoanalyze=$ENV{'form.numtoanalyze'};
- if (!$numtoanalyze) { $numtoanalyze=100; }
- $result.= '
+ if (!$numtoanalyze) { $numtoanalyze=20; }
+ $result.= ' for
';
+ $numtoanalyze.'" size="5" /> versions of this problem.'.
+ &Apache::loncommon::help_open_topic("Analyze_Problem",
+ '',undef,undef,300).
+ '';
return $result;
}
@@ -264,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';
@@ -391,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');
@@ -425,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 {
@@ -435,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 \\\\\\\\';
@@ -493,9 +509,13 @@ sub end_problem {
if ($target eq 'web') {
$result.=&Apache::lonxml::xmlend();
} elsif ($target eq 'tex') {
- $result .= '\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
+ 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 .= '';
}
@@ -506,7 +526,7 @@ sub end_problem {
&finalize_storage();
}
if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct')
- && $ENV{'form.answer_mode_output'} ne 'tex') {
+ && $ENV{'form.answer_output_mode'} ne 'tex') {
$result.='