--- loncom/homework/structuretags.pm 2004/11/30 23:28:57 1.273 +++ loncom/homework/structuretags.pm 2005/04/01 18:08:14 1.283 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: structuretags.pm,v 1.273 2004/11/30 23:28:57 albertel Exp $ +# $Id: structuretags.pm,v 1.283 2005/04/01 18:08:14 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -91,6 +91,7 @@ sub page_start { 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(); @@ -127,7 +134,7 @@ sub page_start { } my $form_tag_start; if (!defined($found{'form'})) { - $form_tag_start='
'; @@ -141,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 = ''; } @@ -208,14 +216,14 @@ sub problem_edit_header {
'. &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"; + "\n\n".&Apache::loncommon::endbodytag()."\n"; } sub option { @@ -239,11 +247,11 @@ sub problem_web_to_edit_header { - '; + '
'; $result.=" Problem Status: @@ -341,7 +349,7 @@ sub checkout_msg {

$lt{'warning'}

-
+
@@ -355,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". -
+
@@ -580,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; @@ -662,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/) { @@ -753,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; @@ -1056,6 +1066,17 @@ sub end_randomlist { return $result; } +sub ordered_show_check { + my $last_part=$Apache::inputtags::partlist[-2]; + my $in_order= + &Apache::lonnet::EXT('resource.'.$Apache::inputtags::part.'.ordered'); + my $in_order_show=1; + if ($last_part ne '0' && lc($in_order) eq 'yes') { + $in_order_show=&Apache::response::check_status($last_part); + } + return $in_order_show; +} + sub start_part { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=''; @@ -1070,7 +1091,7 @@ sub start_part { 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 $in_order_show=&ordered_show_check(); my $expression='$external::part=\''.$Apache::inputtags::part.'\';'; $expression.='$external::type=\''.$Apache::lonhomework::type.'\';'; &Apache::run::run($expression,$safeeval); @@ -1081,7 +1102,7 @@ sub start_part { &Apache::response::meta_parameter_write('display','string',$display,'Part Description'); } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') { - if ($hidden) { + if ($hidden || !$in_order_show) { my $bodytext=&Apache::lonxml::get_all_text("/part",$parser); } else { my ($status,$accessmsg) = &Apache::lonhomework::check_access($id); @@ -1126,6 +1147,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.=''; @@ -1157,18 +1182,20 @@ sub end_part { &Apache::lonxml::debug("in end_part $target "); my $status=$Apache::inputtags::status['-1']; my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part); + my $in_order_show=&ordered_show_check(); my $result=''; if ( $target eq 'meta' ) { $result=''; } elsif ($target eq 'grade') { if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) && - !$hidden) { + !$hidden && $in_order_show) { $result=&Apache::inputtags::grade; } else { # move any submission data to .hidden &Apache::inputtags::hidealldata($Apache::inputtags::part); } - } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) { + } elsif (($target eq 'web' || $target eq 'tex') && + !$hidden && $in_order_show) { my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part, $target); if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') { @@ -1368,8 +1395,9 @@ sub start_simpleeditbutton { (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) { my $url=$ENV{'request.noversionuri'}; $url=~s/\?.*$//; + my ($symb) = &Apache::lonxml::whichuser(); $result='
'. - ''.&mt('Edit').' - '.&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;