--- loncom/homework/structuretags.pm 2004/05/28 19:26:05 1.253
+++ loncom/homework/structuretags.pm 2004/09/18 17:29:29 1.268
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.253 2004/05/28 19:26:05 albertel Exp $
+# $Id: structuretags.pm,v 1.268 2004/09/18 17:29:29 albertel 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 tags
-# 8/17,8/18,8/20 Gerd Kortemeyer
+###
package Apache::structuretags;
@@ -38,7 +36,7 @@ use Apache::File();
use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
-
+use Time::HiRes qw( gettimeofday tv_interval );
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'));
}
@@ -84,7 +82,9 @@ sub page_start {
if (!defined($found{'html'})) {
$result=&Apache::londefdef::start_html($target,$token,$tagstack,
$parstack,$parser,$safeeval);
- $head_tag_start='
'.&Apache::lonmenu::registerurl(undef,$target);
+ $head_tag_start=''.&Apache::lonmenu::registerurl(undef,$target).
+ &Apache::lonhtmlcommon::htmlareaheaders().
+ &Apache::lonhtmlcommon::spellheader();
}
my $body_tag_start;
if (!defined($found{'body'})) {
@@ -184,24 +184,32 @@ sub setup_rndseed {
return $rndseed;
}
+sub remember_problem_state {
+ return '
+
+
+ ';
+}
+
sub problem_edit_header {
- return '
+ return ''.
+ &Apache::structuretags::remember_problem_state().'
'.
- &Apache::loncommon::help_open_topic('Problem_Editor_XML_Index',
- 'Problem Editing Help').' | '.
- &Apache::loncommon::help_open_faq(5).
- &Apache::loncommon::help_open_bug('Authoring').' |
'.
+ &Apache::loncommon::help_open_menu('','Problem Editing Help','Problem_Editor_XML_Index','',5,'Authoring',undef,undef,undef,'Problem Editing Help')
+ .''.
'';
}
sub problem_edit_footer {
return ' |
- ';
+ '.
+ &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields).
+ "\n\n\n";
}
sub option {
@@ -354,12 +362,13 @@ sub init_problem_globals {
if ($type eq 'problem') {
$Apache::inputtags::part='0';
@Apache::inputtags::partlist=('0');
-
- $Apache::lonhomework::problemstatus=&get_problem_status('0')
- } else {
+ $Apache::lonhomework::problemstatus=&get_problem_status('0');
+ $Apache::lonhomework::ignore_response_errors=0;
+ } elsif ($type eq 'library') {
$Apache::inputtags::part='';
@Apache::inputtags::partlist=();
$Apache::lonhomework::problemstatus='';
+ $Apache::lonhomework::ignore_response_errors=1;
}
@Apache::inputtags::responselist = ();
@Apache::inputtags::importlist = ();
@@ -395,12 +404,14 @@ sub set_problem_state {
sub get_problem_status {
my ($part)=@_;
- my $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
- &Apache::lonxml::debug("problem status for $part is $problem_status");
- &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
+ my $problem_status;
if ($ENV{'request.state'} eq 'construct' &&
defined($ENV{'form.problemstatus'})) {
$problem_status=$ENV{'form.problemstatus'};
+ } else {
+ $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
+ &Apache::lonxml::debug("problem status for $part is $problem_status");
+ &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
}
return $problem_status;
}
@@ -484,7 +495,16 @@ sub start_problem {
''.
'
';
+ value="'.$ENV{'form.username'}.'" />';
+ if ($ENV{'user.adv'}) {
+ $form_tag_start.=
+ ' '.&mt(' Show All Foils');
+ }
+ $form_tag_start.='
';
}
($status,$accessmsg) = &Apache::lonhomework::check_access('0');
push (@Apache::inputtags::status,$status);
@@ -566,7 +586,7 @@ sub start_problem {
my @due_file_content = <$temp_file>;
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));
+ my $name_of_resourse= &Apache::lonxml::latex_special_symbols(&get_resource_name($parstack,$safeeval),'header');
if ($due_file_content ne $duedate) {
$temp_file = Apache::File->new('>'.$filename);
print $temp_file "$duedate\n";
@@ -634,7 +654,9 @@ sub end_problem {
) {
if ($target ne 'tex' &&
$ENV{'form.answer_output_mode'} ne 'tex') {
- $result.="