';
return $result;
}
@@ -533,17 +620,36 @@ ENDCHECKOUT
sub firstaccess_msg {
my ($time,$symb)=@_;
- my ($map)=&Apache::lonnet::decode_symb($symb);
- my $foldertitle=&Apache::lonnet::gettitle($map);
- &Apache::lonxml::debug("map is $map title is $foldertitle");
- my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
- 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".
+ENDCHECKOUT
+ } elsif ($interval[1] eq 'course') {
+ my $course = $env{'course.'.$env{'request.course.id'}.'.description'};
+ $result .= (<The resources in "$course" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources in "$course".
+ENDCHECKOUT
+ } else {
+ my $title=&Apache::lonnet::gettitle($symb);
+ $result .= (<This resource "$title" is open for a limited time. Once you click the 'Show Resource' button below you have $time to complete this resource "$title".
+ENDCHECKOUT
+
+ }
+ my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ $result .= (<
ENDCHECKOUT
+ return $result;
}
sub init_problem_globals {
@@ -555,19 +661,19 @@ sub init_problem_globals {
if ($type eq 'problem') {
$Apache::inputtags::part='0';
@Apache::inputtags::partlist=('0');
- $Apache::lonhomework::problemstatus=&get_problem_status('0');
+ &Apache::lonhomework::set_show_problem_status(&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::reset_show_problem_status();
$Apache::lonhomework::ignore_response_errors=1;
} elsif ($type eq 'Task') {
$Apache::inputtags::part='0';
@Apache::inputtags::partlist=('0');
- $Apache::lonhomework::problemstatus='';
+ &Apache::lonhomework::reset_show_problem_status();
$Apache::lonhomework::ignore_response_errors=1;
}
@Apache::inputtags::responselist = ();
@@ -596,8 +702,8 @@ sub reset_problem_globals {
undef($Apache::lonhomework::default_type);
undef($Apache::lonhomework::type);
undef($Apache::lonhomework::scantronmode);
- undef($Apache::lonhomework::problemstatus);
undef($Apache::lonhomework::ignore_response_errors);
+ &Apache::lonhomework::reset_show_problem_status();
}
sub set_problem_state {
@@ -650,7 +756,7 @@ sub start_problem {
if ($target ne 'analyze') {
$Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
if (($env{'request.state'} eq 'construct') &&
- defined($env{'form.problemtype'})) {
+ $env{'form.problemtype'} =~ /\S/) {
$Apache::lonhomework::type=$env{'form.problemtype'};
}
&Apache::lonxml::debug("Found this to be of type :$Apache::lonhomework::type:");
@@ -711,7 +817,8 @@ sub start_problem {
$result.=&Apache::lonxml::printtokenheader($target,$token);
}
if ($env{'form.markaccess'}) {
- &Apache::lonnet::set_first_access('map');
+ my @interval=&Apache::lonnet::EXT("resource.0.interval");
+ &Apache::lonnet::set_first_access($interval[1]);
}
#handle rand seed in construction space
my $rndseed=&setup_rndseed($safeeval);
@@ -1467,7 +1574,9 @@ sub start_part {
@Apache::inputtags::response=();
@Apache::inputtags::previous=();
@Apache::inputtags::previous_version=();
- $Apache::lonhomework::problemstatus=&get_problem_status($id);
+ &Apache::lonhomework::set_show_problem_status(&get_problem_status($id));
+ &Apache::response::reset_params();
+
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; }
@@ -1724,6 +1833,13 @@ sub start_startouttext {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my @result=(''.'');
if ($target eq 'edit' || $target eq 'modified' ) { @result=('','no'); }
+
+ my $nesting =
+ &Apache::lonxml::set_state('outtext',
+ &Apache::lonxml::get_state('outtext')+1);
+ if ($nesting > 1 && $env{'request.state'} eq 'construct') {
+ &Apache::lonxml::error("Nesting of <startouttext /> not allowed, on line ".$token->[5]);
+ }
return (@result);
}
@@ -1763,6 +1879,14 @@ sub start_endouttext {
$result=''.
&Apache::edit::handle_insertafter('startouttext');
}
+
+ my $nesting =
+ &Apache::lonxml::set_state('outtext',
+ &Apache::lonxml::get_state('outtext')-1);
+ if ($nesting < 0 && $env{'request.state'} eq 'construct') {
+ &Apache::lonxml::error(" Extraneous <endouttext /> not allowed on line ".$token->[5]);
+ &Apache::lonxml::set_state('outtext', 0);
+ }
return $result;
}