--- loncom/homework/structuretags.pm 2004/05/20 23:11:12 1.249
+++ loncom/homework/structuretags.pm 2004/08/25 19:16:25 1.265
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.249 2004/05/20 23:11:12 albertel Exp $
+# $Id: structuretags.pm,v 1.265 2004/08/25 19:16:25 sakharuk Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -25,9 +25,7 @@
#
# http://www.lon-capa.org/
#
-# 2/19 Guy
-# 6/26/2001 fixed extra web display at end of
'. - &Apache::loncommon::help_open_topic('Problem_Editor_XML_Index', - 'Problem Editing Help').' | '. - &Apache::loncommon::help_open_faq(5). - &Apache::loncommon::help_open_bug('Authoring').' |
'; } sub problem_edit_footer { return ' |
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at root@localhost to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
\n";
+ $result.="";
+ $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields);
+ $result.="\n";
}
if ($target eq 'web') {
$result.=&Apache::lonxml::xmlend();
@@ -624,11 +645,16 @@ sub end_problem {
if (not $ENV{'form.problem_split'}=~/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 .= $endminipage.'\end{document} ';
+ if ($ENV{'form.print_discussions'} eq 'yes') {
+ $result.=&Apache::lonxml::xmlend($target,$parser);
+ $result=~s/<\/html>//;
} else {
- $result .= '';
+ $result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
+ if (not $ENV{'request.symb'} =~ m/\.page_/) {
+ $result .= $endminipage.'\end{document} ';
+ } else {
+ $result .= '';
+ }
}
}
}
@@ -647,6 +673,7 @@ sub end_problem {
$result=&Apache::response::mandatory_part_meta;
}
$result.=&Apache::response::meta_part_order();
+ $result.=&Apache::response::meta_response_order();
} elsif ($target eq 'edit') {
&Apache::lonxml::debug("in end_problem with $target, edit");
$result = &problem_edit_footer();
@@ -983,12 +1010,13 @@ sub shuffle {
my $a=shift;
my $i;
if (defined(@$a)) {
- &Apache::response::setrandomnumber();
+ &Apache::response::pushrandomnumber();
for($i=@$a;--$i;) {
my $j=int(&Math::Random::random_uniform() * ($i+1));
next if $i == $j;
@$a[$i,$j] = @$a[$j,$i];
}
+ &Apache::response::poprandomnumber();
}
}
@@ -1014,7 +1042,11 @@ sub start_part {
@Apache::inputtags::previous_version=();
$Apache::lonhomework::problemstatus=&get_problem_status($id);
my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
+ my $newtype=&Apache::lonnet::EXT("resource.$id.type");
+ if ($newtype) { $Apache::lonhomework::type=$newtype; }
+
my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
+ $expression.='$external::type=\''.$Apache::lonhomework::type.'\';';
&Apache::run::run($expression,$safeeval);
if ($target eq 'meta') {
@@ -1036,6 +1068,7 @@ sub start_part {
}
if (( $status eq 'CLOSED' ) ||
( $status eq 'UNCHECKEDOUT') ||
+ ( $status eq 'NOT_YET_VIEWED') ||
( $status eq 'BANNED') ||
( $status eq 'UNAVAILABLE') ||
( $status eq 'INVALID_ACCESS')) {
@@ -1052,7 +1085,11 @@ sub start_part {
} else {
if ($target eq 'tex') {
if (not $ENV{'form.problem_split'}=~/yes/) {
- $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
+ if ($$tagstack[-2] eq 'td') {
+ $result.='\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
+ } else {
+ $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
+ }
}
my $weight = &Apache::lonnet::EXT("resource.$id.weight");
my $allkeys=&Apache::lonnet::metadata($ENV{'request.uri'},'packages');
@@ -1112,6 +1149,7 @@ sub end_part {
$gradestatus='';
}
$result=$gradestatus;
+ if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';}
} elsif ($target eq 'edit') {
$result=&Apache::edit::end_table();
}
@@ -1254,7 +1292,7 @@ sub end_startouttext {
&Apache::edit::end_row().
&Apache::edit::start_spanning_row()."\n"
. &Apache::loncommon::helpLatexCheatsheet () .
- &Apache::edit::editfield($token->[1],$text,"",80,4);
+ &Apache::edit::editfield($token->[1],$text,"",80,8,1);
}
if ($target eq 'modified') {
$result='