--- loncom/homework/structuretags.pm 2005/11/04 15:34:32 1.315
+++ loncom/homework/structuretags.pm 2011/12/10 17:53:45 1.498
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.315 2005/11/04 15:34:32 albertel Exp $
+# $Id: structuretags.pm,v 1.498 2011/12/10 17:53:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,6 +27,29 @@
#
###
+=pod
+
+=head1 NAME
+
+Apache::structuretags
+
+=head1 SYNOPSIS
+
+
+This is part of the LearningOnline Network with CAPA project
+described at http://www.lon-capa.org.
+
+
+=head1 NOTABLE SUBROUTINES
+
+=over
+
+=item
+
+=back
+
+=cut
+
package Apache::structuretags;
@@ -36,16 +59,31 @@ use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
+use Apache::londefdef;
+use Apache::lonenc();
use Time::HiRes qw( gettimeofday tv_interval );
+use lib '/home/httpd/lib/perl/';
+use LONCAPA;
+
BEGIN {
- &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
+ &Apache::lonxml::register('Apache::structuretags',('block','languageblock','translated','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startpartmarker','startouttext','endpartmarker','endouttext','simpleeditbutton','definetag'));
}
sub start_web {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $bodytext=&Apache::lonxml::get_all_text("/web",$parser);
- if ($target eq 'web') {
- return $bodytext;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+ if ($target ne 'edit' && $target ne 'modified') {
+ my $bodytext=&Apache::lonxml::get_all_text("/web",$parser,$style);
+ if ($target eq 'web' || $target eq 'webgrade') {
+ return $bodytext;
+ }
+ } elsif ($target eq "edit" ) {
+ my $bodytext =
+ &Apache::lonxml::get_all_text_unbalanced("/web",$parser);
+ my $result = &Apache::edit::tag_start($target,$token);
+ $result .= &Apache::edit::editfield($token->[1],$bodytext,'',80,1);
+ return $result;
+ } elsif ( $target eq "modified" ) {
+ return $token->[4].&Apache::edit::modifiedfield("/web",$parser);
}
return '';
}
@@ -55,11 +93,28 @@ sub end_web {
}
sub start_tex {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
- my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser);
- if ($target eq 'tex') {
- return $bodytext.' ';
+ if ($target ne 'edit' && $target ne 'modified') {
+ my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser,$style);
+ if ($target eq 'tex') {
+
+ # If inside a table, occurrences of \\ must be removed;
+ # else the table blows up.
+
+ if (&Apache::londefdef::is_inside_of($tagstack, "table")) {
+ $bodytext =~ s/\\\\//g;
+ }
+ return $bodytext.'{}';
+ }
+ } elsif ($target eq "edit" ) {
+ my $bodytext =
+ &Apache::lonxml::get_all_text_unbalanced("/tex",$parser);
+ my $result = &Apache::edit::tag_start($target,$token);
+ $result .= &Apache::edit::editfield($token->[1],$bodytext,'',80,1);
+ return $result;
+ } elsif ( $target eq "modified" ) {
+ return $token->[4].&Apache::edit::modifiedfield("/tex",$parser);
}
return $result;;
}
@@ -68,35 +123,58 @@ sub end_tex {
return '';
}
-sub body_tag_start {
- my ($target,$background,$bgcolor)=@_;
- my $body_tag_start='
+// '.&Apache::lonmenu::menubuttons(undef,$target,1);
-
- &Apache::lontexconvert::jsMath_reset();
- if ($env{'environment.texengine'} eq 'jsMath') {
- $body_tag_start.=&Apache::lontexconvert::jsMath_header();
+ for (var i=0;i
+
+JS
+}
+
+sub setmode_javascript {
+ return <<"ENDSCRIPT";
+
+ENDSCRIPT
}
sub page_start {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$name,
+ $extra_head)=@_;
my %found;
foreach my $taginside (@$tagstack) {
foreach my $taglookedfor ('html','body','form') {
@@ -104,77 +182,231 @@ sub page_start {
}
}
- my $result;
- my $head_tag_start;
- if (!defined($found{'html'})) {
- $result=&Apache::londefdef::start_html($target,$token,$tagstack,
- $parstack,$parser,$safeeval);
- $head_tag_start=''.&Apache::lonmenu::registerurl(undef,$target).
- &Apache::lonhtmlcommon::htmlareaheaders().
- &Apache::lonhtmlcommon::spellheader().
- &Apache::lonxml::fontsettings();
- }
- my $body_tag_start;
- if (!defined($found{'body'}) && $env{'request.state'} eq 'construct'
- && $env{'environment.remote'} eq 'off') {
+ if ($target eq 'tex') {
+ return
+ &Apache::londefdef::start_html($target,$token,$tagstack,
+ $parstack,$parser,$safeeval);
+ }
+
+ $extra_head .= &homework_js().
+ &Apache::lonhtmlcommon::dragmath_js("EditMathPopup");
+ if (&Apache::lonhtmlcommon::htmlareabrowser()) {
+ my %textarea_args = (
+ dragmath => 'math',
+ );
+ $extra_head .= &Apache::lonhtmlcommon::htmlareaselectactive(\%textarea_args);
+ }
+ my $is_task = ($env{'request.uri'} =~ /\.task$/);
+ my $needs_upload;
+ my ($symb)= &Apache::lonnet::whichuser();
+ my ($map,$resid,$resurl)=&Apache::lonnet::decode_symb($symb);
+ if ($is_task) {
+ $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js();
+ } else {
+ if (&Apache::lonnet::EXT("resource.$Apache::inputtags::part.uploadedfiletypes") ne '') {
+ unless ($env{'request.state'} eq 'construct') {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ my $mapres = $navmap->getResourceByUrl($map);
+ my $is_page;
+ if (ref($mapres)) {
+ $is_page = $mapres->is_page();
+ }
+ unless ($is_page) {
+ $needs_upload = 1;
+ }
+ }
+ }
+ } else {
+ unless ($env{'request.state'} eq 'construct') {
+ my $navmap = Apache::lonnavmaps::navmap->new();
+ if (ref($navmap)) {
+ my $mapres = $navmap->getResourceByUrl($map);
+ my $is_page;
+ if (ref($mapres)) {
+ $is_page = $mapres->is_page();
+ }
+ unless ($is_page) {
+ my $res = $navmap->getBySymb($symb);
+ if (ref($res)) {
+ my $partlist = $res->parts();
+ if (ref($partlist) eq 'ARRAY') {
+ foreach my $part (@{$partlist}) {
+ my @types = $res->responseType($part);
+ my @ids = $res->responseIds($part);
+ for (my $i=0; $i < scalar(@ids); $i++) {
+ if ($types[$i] eq 'essay') {
+ my $partid = $part.'_'.$ids[$i];
+ if (&Apache::lonnet::EXT("resource.$partid.uploadedfiletypes") ne '') {
+ $needs_upload = 1;
+ last;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if ($needs_upload) {
+ $extra_head .= &Apache::lonhtmlcommon::file_submissionchk_js();
+ }
+ }
+
+ my %body_args;
+ if (defined($found{'html'})) {
+ $body_args{'skip_phases'}{'head'}=1;
+ } else {
+
+ $extra_head .= &Apache::lonhtmlcommon::spellheader();
+
+ $extra_head .= &Apache::londefdef::generate_css_links();
+
+ if ($env{'request.state'} eq 'construct') {
+ $extra_head.=&Apache::edit::js_change_detection().
+ "\n";
+ }
+ }
+
+ my $pageheader = '';
+ if (defined($found{'body'})) {
+ $body_args{'skip_phases'}{'body'}=1;
+ } elsif (!defined($found{'body'})
+ && $env{'request.state'} eq 'construct') {
if ($target eq 'web' || $target eq 'edit') {
- $body_tag_start=&Apache::loncommon::bodytag();
- $body_tag_start.=&Apache::lonxml::message_location();
+ # Breadcrumbs for Construction Space
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ 'text' => 'Construction Space',
+ 'href' => &Apache::loncommon::authorspace($env{'request.uri'}),
+ });
+ # breadcrumbs (and tools) will be created
+ # in start_page->bodytag->innerregister
+
+# FIXME Where are we?
+# &Apache::lonhtmlcommon::add_breadcrumb({
+# 'text' => 'Problem Editing', # 'Problem Testing'
+# 'href' => '',
+# });
+ $pageheader =&Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader());
}
} elsif (!defined($found{'body'})) {
+ my %add_entries;
my $background=&Apache::lonxml::get_param('background',$parstack,
$safeeval);
+ if ($background ne '' ) {
+ $add_entries{'background'} = $background;
+ }
+
my $bgcolor=&Apache::lonxml::get_param('bgcolor',$parstack,
$safeeval);
- $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)=
- &Apache::lonxml::whichuser();
- if ($symb eq '' && !$publicuser) {
- my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
- $help=&mt("Browsing resource, all submissions are temporary.")." ";
- $body_tag_start.=$help;
- }
- }
- $body_tag_start.=&Apache::lonxml::message_location();
+ if ($bgcolor eq '' ) { $bgcolor = '#FFFFFF'; }
+
+ $body_args{'bgcolor'} = $bgcolor;
+ # $body_args{'no_title'} = 1;
+ $body_args{'force_register'} = 1;
+ $body_args{'add_entries'} = \%add_entries;
+ if ( $env{'request.state'} eq 'construct') {
+ $body_args{'only_body'} = 1;
+ }
+ }
+ $body_args{'no_auto_mt_title'} = 1;
+ my $page_start = &Apache::loncommon::start_page($name,$extra_head,
+ \%body_args);
+ $page_start .= $pageheader;
+ if (!defined($found{'body'})
+ && $env{'request.state'} ne 'construct'
+ && ($target eq 'web' || $target eq 'webgrade')) {
+
+ my ($symb,undef,undef,undef,$publicuser)= &Apache::lonnet::whichuser();
+ if ($symb eq '' && !$publicuser) {
+ $page_start .= '
'
+ .&mt('Browsing resource, all submissions are temporary.')
+ .'
';
+ }
+ }
+
+ if (!defined($found{'body'}) && $env{'request.state'} ne 'construct') {
+ $page_start .= &Apache::lonxml::message_location();
}
my $form_tag_start;
if (!defined($found{'form'})) {
- $form_tag_start='\n".&Apache::loncommon::end_page();
}
sub option {
@@ -245,31 +564,40 @@ sub option {
sub problem_web_to_edit_header {
my ($rndseed)=@_;
- my $result.='';
+ my $result .= '
'.&mt('You are not currently signed up to work at this time and/or place.').'
';
} elsif ($status ne 'NOT_YET_VIEWED') {
$msg.='
'.&mt('Not open to be viewed').'
';
}
if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
- $msg.='The problem '.$accessmsg;
+ $msg.=&mt('The problem ').$accessmsg;
} elsif ($status eq 'UNCHECKEDOUT') {
- $msg.=&checkout_msg;
+ $msg.=&checkout_msg();
} elsif ($status eq 'NOT_YET_VIEWED') {
$msg.=&firstaccess_msg($accessmsg,$symb);
+ } elsif ($status eq 'NOT_IN_A_SLOT') {
+ $msg.=&Apache::bridgetask::add_request_another_attempt_button("Sign up for time to work");
}
$result.=$msg.' ';
} elsif ($target eq 'tex') {
- $result.='\begin{document}\noindent \vskip 1 mm \begin{minipage}{\textwidth}\vskip 0 mm';
+ my $startminipage = ($env{'form.problem_split'}=~/yes/i)? ''
+ : '\begin{minipage}{\textwidth}';
+ $result.='\noindent \vskip 1 mm '.
+ $startminipage.'\vskip 0 mm';
if ($status eq 'UNAVAILABLE') {
$result.=&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'\vskip 0 mm ';
} else {
$result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
}
}
+ } elsif ($status eq 'NEEDS_CHECKIN') {
+ my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser,
+ $style);
+ if ($target eq 'web') {
+ $result .=
+ &Apache::bridgetask::proctor_validation_screen($slot);
+ } elsif ($target eq 'grade') {
+ &Apache::bridgetask::proctor_check_auth($slot_name,$slot,
+ 'problem');
+ }
} elsif ($target eq 'web') {
- my $name= &get_resource_name($parstack,$safeeval);
- $result.="$head_tag_start$name
- $body_tag_start \n $form_tag_start".
+ if ($status eq 'CAN_ANSWER'
+ && $slot_name ne ''
+ && $Apache::lonhomework::history{'resource.0.checkedin'} eq '') {
+ # unproctored slot access, self checkin
+ &Apache::bridgetask::check_in('problem',undef,undef,
+ $slot_name);
+ }
+ $result.="\n $form_tag_start \t".
'';
# create a page header and exit
if ($env{'request.state'} eq "construct") {
$result.= &problem_web_to_edit_header($env{'form.rndseed'});
+ if ($Apache::lonhomework::type eq 'practice') {
+ $result.= ''.
+ &practice_problem_header().'';
+ }
}
# if we are viewing someone else preserve that info
if (defined $env{'form.grade_symb'}) {
@@ -651,87 +1200,28 @@ sub start_problem {
$result .= ''."\n";
}
+ foreach my $field ('trial','questiontype') {
+ if ($env{"form.grade_$field"} ne '') {
+ $result .= ''."\n";
+ }
+ }
}
+ if ($env{'form.grade_imsexport'}) {
+ $result = '';
+ }
} elsif ($target eq 'tex') {
- my $startminipage = '';
- if (not $env{'form.problem_split'}=~/yes/) {
- $startminipage = '\begin{minipage}{\textwidth}';
- }
- my $id = $Apache::inputtags::part;
- my $weight = &Apache::lonnet::EXT("resource.$id.weight");
- my $packages=&Apache::lonnet::metadata($env{'request.uri'},'packages');
- my @packages = split /,/,$packages;
- my $allow_print_points = 0;
- foreach my $partial_key (@packages) {
- if ($partial_key=~m/^part_0$/) {
- $allow_print_points=1;
- }
- }
- 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 $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.'}';
-
- # Figure out what the due date is and if we need to print
- # it in the problem header. We have been logging the
- # last due date written to file.
-
- my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
- my $duedate = POSIX::strftime("%c",localtime($duetime));
- my $temp_file;
- my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
-
- # Figure out what the last printed due date is or set it
- # to the epoch if no duedates have been printed.
-
- my $due_file_content = 0; # If the file does not yet exist, time is the epoch.
- if (-e $filename) {
- $temp_file = Apache::File->new($filename);
- my @due_file = <$temp_file>;
- $due_file_content = $due_file[$#due_file];
- chomp $due_file_content;
- }
-
- # comparisons of the absolute times
- if ($due_file_content != $duetime) {
- $temp_file = Apache::File->new('>'.$filename);
- print $temp_file "$duetime\n";
- if (not $env{'request.symb'} =~ m/\.page_/) {
- if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
- $result .= $begin_doc.
- '\textit{Due date: '.$duedate.'} '.$toc_line;
- } else {
- $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\textit{Due date: '.$duedate.'} \\\\\\\\';
- }
- } else {
- if (not $env{'request.symb'} =~ m/\.page_/) {
- $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 \\\\\\\\';
- }
- }
+ $result .= 'INSERTTEXFRONTMATTERHERE';
+
}
} elsif ($target eq 'edit') {
- $result.=$head_tag_start."".$body_tag_start.$form_tag_start.
- &problem_edit_header();
+ $result .= $form_tag_start.&problem_edit_header();
$Apache::lonxml::warnings_error_header=
&mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")." ";
my $temp=&Apache::edit::insertlist($target,$token);
$result.=$temp;
} elsif ($target eq 'modified') {
$result=$token->[4];
- $result.=&Apache::edit::handle_insert();
} else {
# page_start returned a starting result, delete it if we don't need it
$result = '';
@@ -741,7 +1231,107 @@ sub start_problem {
sub end_problem {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $result= &Apache::lonxml::endredirection(); # started in &start_problem
+ my $result;
+
+ if (!$Apache::lonxml::metamode) {
+ $result = &Apache::lonxml::endredirection(); #started in &start_problem
+ $Apache::lonxml::post_evaluate=0;
+ }
+
+ 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
+ # dates depends on whether due dates have already been
+ # displayed in the problem parts.
+
+ my $frontmatter = '';
+ my $startminipage = '';
+ if (not $env{'form.problem_split'}=~/yes/) {
+ $startminipage = '\begin{minipage}{\textwidth}';
+ }
+ my $id = $Apache::inputtags::part;
+ my $weight = &Apache::lonnet::EXT("resource.$id.weight");
+ my $packages=&Apache::lonnet::metadata($env{'request.uri'},'packages');
+ my @packages = split /,/,$packages;
+ my $allow_print_points = 0;
+ foreach my $partial_key (@packages) {
+ if ($partial_key=~m/^part_0$/) {
+ $allow_print_points=1;
+ }
+ }
+ 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 $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
+ my $begin_doc=' \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.'}';
+
+ # Figure out what the due date is and if we need to print
+ # it in the problem header. We have been logging the
+ # last due date written to file.
+
+ my $duetime = &Apache::lonnet::EXT("resource.$id.duedate");
+ my $duedate = POSIX::strftime("%c",localtime($duetime));
+ my $duedate_text = &mt('Due date: [_1]'
+ ,&Apache::lonlocal::locallocaltime($duetime));
+ my $temp_file;
+ my $filename = "/home/httpd/prtspool/$env{'user.name'}_$env{'user.domain'}_printout.due";
+
+ # Figure out what the last printed due date is or set it
+ # to the epoch if no duedates have been printed.
+
+ my $due_file_content = 0; # If the file does not yet exist, time is the epoch.
+ if (-e $filename) {
+ $temp_file = Apache::File->new($filename);
+ my @due_file = <$temp_file>;
+ $due_file_content = $due_file[$#due_file];
+ chomp $due_file_content;
+ }
+
+ # We display the due date iff it is not the same as the last
+ # duedate in problem header ($due_file_content), and
+ # none of our parts displayed a duedate.
+ #
+ my $parts_with_displayduedate;
+ if (defined $Apache::outputtags::showonce{'displayduedate'}) {
+ $parts_with_displayduedate =
+ scalar(@{$Apache::outputtags::showonce{'displayduedate'}});
+ } else {
+ $parts_with_displayduedate = 0;
+ }
+ if (($due_file_content != $duetime) && ($parts_with_displayduedate == 0) ) {
+ $temp_file = Apache::File->new('>'.$filename);
+ print $temp_file "$duetime\n";
+ if (not $env{'request.symb'} =~ m/\.page_/) {
+ if(not $duedate=~m/1969/ and $Apache::lonhomework::type ne 'exam') {
+ $frontmatter .= $begin_doc.
+ '\textit{'.$duedate_text.'} '.$toc_line;
+ } else {
+ $frontmatter.= $begin_doc.$toc_line;
+ if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) {
+ $frontmatter .= '\fbox{\textit{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
+ }
+ }
+ } else {
+ $frontmatter .= '\vskip 1mm\textit{'.$duedate_text.'} \\\\\\\\'.$startminipage;
+ }
+ } else {
+ if (not $env{'request.symb'} =~ m/\.page_/) {
+ $frontmatter .= $begin_doc.$toc_line;
+ if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) {
+ $frontmatter .= '\fbox{\textit{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
+ }
+ } else {
+ $frontmatter .= '\vskip 1mm \\\\\\\\'.$startminipage;
+ }
+ }
+ $result =~ s/INSERTTEXFRONTMATTERHERE/$frontmatter/;
+ }
my $status=$Apache::inputtags::status['-1'];
if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
@@ -750,13 +1340,16 @@ sub end_problem {
# if part is zero, no s existed, so we need to the grading
if ($status eq 'CAN_ANSWER' ||$Apache::lonhomework::scantronmode) {
&Apache::inputtags::grade;
+ } elsif ($status eq 'NEEDS_CHECKIN') {
+ # no need to grade, and don't want to hide data
} else {
# move any submission data to .hidden
&Apache::inputtags::hidealldata($Apache::inputtags::part);
}
} elsif ( ($target eq 'web' || $target eq 'tex') &&
$Apache::inputtags::part eq '0' &&
- $status ne 'UNCHECKEDOUT' && $status ne 'NOT_YET_VIEWED') {
+ $status ne 'UNCHECKEDOUT' && $status ne 'NOT_YET_VIEWED'
+ && !$env{'form.grade_imsexport'}) {
# if part is zero, no s existed, so we need show the current
# grading status
my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
@@ -766,13 +1359,13 @@ sub end_problem {
(($target eq 'web') && ($env{'request.state'} ne 'construct')) ||
($target eq 'answer') || ($target eq 'tex')
) {
- if ($target ne 'tex' &&
- $env{'form.answer_output_mode'} ne 'tex') {
+ if (($target ne 'tex') &&
+ ($env{'form.answer_output_mode'} ne 'tex') &&
+ (!$env{'form.grade_imsexport'})) {
$result.="";
- $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields);
}
if ($target eq 'web') {
- $result.=&Apache::lonxml::xmlend().'