';
return $result;
}
@@ -458,7 +556,6 @@ sub finalize_storage {
}
return $result;
}
-use Data::Dumper;
# -------------------------------------------------------------store_aggregates
# Sends hash of values to be incremented in nohist_resourcetracker.db
@@ -523,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 {
@@ -545,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 = ();
@@ -586,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 {
@@ -638,10 +754,9 @@ sub start_problem {
}
if ($target ne 'analyze') {
- if ($env{'request.state'} eq 'construct') { &set_problem_state('0'); }
$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:");
@@ -659,6 +774,11 @@ sub start_problem {
$Apache::lonhomework::default_type = $Apache::lonhomework::type;
&initialize_storage();
+ if ($target ne 'analyze'
+ && $env{'request.state'} eq 'construct') {
+ &set_problem_state('0');
+ }
+
if ($target eq 'web') {
&Apache::lonxml::debug(" grading history ");
&Apache::lonhomework::showhash(%Apache::lonhomework::history);
@@ -697,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);
@@ -751,7 +872,7 @@ sub start_problem {
$msg.='
'.&mt('Not open to be viewed').'
';
}
if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') {
- $msg.='The problem '.$accessmsg;
+ $msg.=&mt('The problem ').$accessmsg;
} elsif ($status eq 'UNCHECKEDOUT') {
$msg.=&checkout_msg();
} elsif ($status eq 'NOT_YET_VIEWED') {
@@ -1056,16 +1177,19 @@ sub start_definetag {
my $name = $token->[2]->{'name'};
my $skip=&Apache::lonxml::get_all_text("/definetag",$parser,$style);
- if ($name=~/^\//) {
- $result=
- '
END '.$name.'
';
- } else {
- $result=
- '
BEGIN '.$name.'
';
+ if ($target eq 'web') {
+ if ($name=~/^\//) {
+ $result=
+ '