';
return $result;
}
@@ -554,17 +658,37 @@ 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 $result;
+ my @interval=&Apache::lonnet::EXT("resource.0.interval");
+ if ($interval[1] eq 'map') {
+ my ($map)=&Apache::lonnet::decode_symb($symb);
+ my $foldertitle=&Apache::lonnet::gettitle($map);
+
+ &Apache::lonxml::debug("map is $map title is $foldertitle");
+ $result .= "
".&mt('The resources in "[_1]" are open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
+ ,$foldertitle,$time)."
".&mt('The resources in "[_1]" are open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete all resources "[_1]".'
+ ,$course,$time)."
".&mt('This resource "[_1]" is open for a limited time.'
+ .' Once you click the "Show Resource" button below you have [_2] to complete this resource "[_1]".'
+ ,$title,$time)."
";
+ }
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".
+ my $buttontext = &mt('Show Resource');
+ my $timertext = &mt('Start Timer?');
+ $result .= (<
-
+
ENDCHECKOUT
+ return $result;
}
sub init_problem_globals {
@@ -576,19 +700,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 = ();
@@ -617,8 +741,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 {
@@ -669,9 +793,10 @@ sub start_problem {
}
if ($target ne 'analyze') {
- $Apache::lonhomework::type=&Apache::lonnet::EXT('resource.0.type');
+ my $type = &Apache::lonnet::EXT('resource.0.type');
+ $Apache::lonhomework::type=$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:");
@@ -732,7 +857,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);
@@ -757,6 +883,10 @@ sub start_problem {
$form_tag_start.= ' />'.&mt(' Show All Foils').
'';
}
+ if ($Apache::lonhomework::type eq 'practice') {
+ $form_tag_start.='
'.&mt('Practice Problem').'
'.
+ ''.&mt('Submissions are not permanently recorded').'';
+ }
$form_tag_start.='';
}
@@ -1488,7 +1618,7 @@ 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);
@@ -1747,6 +1877,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);
}
@@ -1786,6 +1923,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;
}