--- loncom/homework/structuretags.pm 2004/10/12 22:55:22 1.270 +++ loncom/homework/structuretags.pm 2005/03/01 03:21:58 1.281 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.270 2004/10/12 22:55:22 albertel Exp $ +# $Id: structuretags.pm,v 1.281 2005/03/01 03:21:58 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -88,7 +88,11 @@ sub page_start { &Apache::lonxml::fontsettings(); } my $body_tag_start; - if (!defined($found{'body'})) { + if (!defined($found{'body'}) && $ENV{'request.state'} eq 'construct' + && $ENV{'environment.remote'} eq 'off') { + $body_tag_start=&Apache::loncommon::bodytag(); + $body_tag_start.=&Apache::lonxml::message_location(); + } elsif (!defined($found{'body'})) { $body_tag_start=''."\n"; + } if ($target eq 'web' && $ENV{'request.state'} ne 'construct') { my ($symb,undef,undef,undef,$publicuser)= &Apache::lonxml::whichuser(); @@ -124,8 +134,10 @@ sub page_start { } my $form_tag_start; if (!defined($found{'form'})) { - $form_tag_start='
'; + $form_tag_start=''; } return ($result,$head_tag_start,$body_tag_start,$form_tag_start); } @@ -136,7 +148,8 @@ sub get_resource_name { if (defined($Apache::lonhomework::name)) { return $Apache::lonhomework::name; } - my $name=&Apache::lonnet::gettitle(); + my ($symb)=&Apache::lonxml::whichuser(); + my $name=&Apache::lonnet::gettitle($symb); if ($name eq '') { $name=&Apache::lonnet::EXT('resource.title'); if ($name eq 'con_lost') { $name = ''; } @@ -210,7 +223,7 @@ sub problem_edit_footer { return '
'. &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields). - "\n
\n\n"; + "\n\n".&Apache::loncommon::endbodytag()."\n"; } sub option { @@ -234,11 +247,11 @@ sub problem_web_to_edit_header { - '; + '
'; $result.=" Problem Status: @@ -336,7 +349,7 @@ sub checkout_msg {

$lt{'warning'}

-
+
@@ -350,7 +363,7 @@ sub firstaccess_msg { &Apache::lonxml::debug("map is $map title is $foldertitle"); return (<The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle". -
+
@@ -575,6 +588,8 @@ sub start_problem { $allow_print_points=1; } } + my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); + if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; } my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); $duedate = POSIX::strftime("%c",localtime($duedate)); my $temp_file; @@ -657,10 +672,9 @@ sub end_problem { $ENV{'form.answer_output_mode'} ne 'tex') { $result.=""; $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields); - $result.="\n"; } if ($target eq 'web') { - $result.=&Apache::lonxml::xmlend(); + $result.=&Apache::lonxml::xmlend().''; } elsif ($target eq 'tex') { my $endminipage = ''; if (not $ENV{'form.problem_split'}=~/yes/) { @@ -748,7 +762,8 @@ sub end_library { $result=&problem_edit_footer(); } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' && $ENV{'request.state'} eq "construct") { - $result.=''.&Apache::lonxml::xmlend(); + $result.=''.&Apache::loncommon::endbodytag(). + &Apache::lonxml::xmlend(); } if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') }; return $result; @@ -1121,6 +1136,10 @@ sub start_part { if ($1 ne '0') {$allow_print_points=1;} } } + my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries"); + if (defined($maxtries) && $maxtries < 0) { + $allow_print_points=0; + } if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';} } elsif ($target eq 'web') { $result.=''; @@ -1358,12 +1377,14 @@ sub delete_startouttext { sub start_simpleeditbutton { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=''; - if (($target eq 'web') && + if (($ENV{'form.simple_edit_button'} ne 'off') && + ($target eq 'web') && (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { my $url=$ENV{'request.noversionuri'}; $url=~s/\?.*$//; + my ($symb) = &Apache::lonxml::whichuser(); $result='
'. - ''.&mt('Simple Problem Editor').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). + ''.&mt('Edit').' - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.'). &Apache::loncommon::help_open_topic('Caching').'

'; } return $result;