[LON-CAPA-cvs] cvs: loncom /homework lonhomework.pm structuretags.pm /interface lonnavmaps.pm
albertel
lon-capa-cvs-allow@mail.lon-capa.org
Tue, 20 Nov 2007 17:53:47 -0000
albertel Tue Nov 20 12:53:47 2007 EDT
Modified files:
/loncom/homework structuretags.pm lonhomework.pm
/loncom/interface lonnavmaps.pm
Log:
- BUG#5513 make use of the new level information to control what level gets checked for first access information
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.413 loncom/homework/structuretags.pm:1.414
--- loncom/homework/structuretags.pm:1.413 Tue Nov 13 18:33:01 2007
+++ loncom/homework/structuretags.pm Tue Nov 20 12:53:22 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.413 2007/11/13 23:33:01 albertel Exp $
+# $Id: structuretags.pm,v 1.414 2007/11/20 17:53:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -620,17 +620,36 @@
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 (<<ENDCHECKOUT);
+ 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 .= (<<ENDCHECKOUT);
<h2>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".</h2>
+ENDCHECKOUT
+ } elsif ($interval[1] eq 'course') {
+ my $course = $env{'course.'.$env{'request.course.id'}.'.description'};
+ $result .= (<<ENDCHECKOUT);
+<h2>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".</h2>
+ENDCHECKOUT
+ } else {
+ my $title=&Apache::lonnet::gettitle($symb);
+ $result .= (<<ENDCHECKOUT);
+<h2>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".</h2>
+ENDCHECKOUT
+
+ }
+ my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ $result .= (<<ENDCHECKOUT);
<form name="markaccess" method="POST" action="$uri">
<input type="hidden" name="markaccess" value="yes" />
<input type="button" name="accessbutton" value="Show Resource" onClick="javascript:if (confirm('Start Timer?')) { document.markaccess.submit(); }" />
</form>
ENDCHECKOUT
+ return $result;
}
sub init_problem_globals {
@@ -798,7 +817,8 @@
$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);
Index: loncom/homework/lonhomework.pm
diff -u loncom/homework/lonhomework.pm:1.285 loncom/homework/lonhomework.pm:1.286
--- loncom/homework/lonhomework.pm:1.285 Fri Nov 16 21:51:29 2007
+++ loncom/homework/lonhomework.pm Tue Nov 20 12:53:22 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# The LON-CAPA Homework handler
#
-# $Id: lonhomework.pm,v 1.285 2007/11/17 02:51:29 albertel Exp $
+# $Id: lonhomework.pm,v 1.286 2007/11/20 17:53:22 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -500,17 +500,17 @@
}
}
if ($status eq 'CAN_ANSWER' || $status eq 'CANNOT_ANSWER') {
- my $interval=&Apache::lonnet::EXT("resource.$id.interval");
- &Apache::lonxml::debug("looking for interval $interval");
- if ($interval) {
- my $first_access=&Apache::lonnet::get_first_access('map');
+ my @interval=&Apache::lonnet::EXT("resource.$id.interval");
+ &Apache::lonxml::debug("looking for interval @interval");
+ if ($interval[0]) {
+ my $first_access=&Apache::lonnet::get_first_access($interval[1]);
&Apache::lonxml::debug("looking for accesstime $first_access");
if (!$first_access) {
$status='NOT_YET_VIEWED';
my $due_date = &due_date($id);
my $seconds_left = $due_date - time;
- if ($seconds_left > $interval || $due_date eq '') {
- $seconds_left = $interval;
+ if ($seconds_left > $interval[0] || $due_date eq '') {
+ $seconds_left = $interval[0];
}
$datemsg=&seconds_to_human_length($seconds_left);
}
@@ -536,17 +536,17 @@
sub due_date {
my ($part_id,$symb,$udom,$uname)=@_;
my $date;
- my $interval= &Apache::lonnet::EXT("resource.$part_id.interval",$symb,
+ my @interval= &Apache::lonnet::EXT("resource.$part_id.interval",$symb,
$udom,$uname);
- &Apache::lonxml::debug("looking for interval $part_id $symb $interval");
+ &Apache::lonxml::debug("looking for interval $part_id $symb @interval");
my $due_date= &Apache::lonnet::EXT("resource.$part_id.duedate",$symb,
$udom,$uname);
&Apache::lonxml::debug("looking for due_date $part_id $symb $due_date");
- if ($interval =~ /\d+/) {
- my $first_access=&Apache::lonnet::get_first_access('map',$symb);
- &Apache::lonxml::debug("looking for first_access $first_access");
+ if ($interval[0] =~ /\d+/) {
+ my $first_access=&Apache::lonnet::get_first_access($interval[1],$symb);
+ &Apache::lonxml::debug("looking for first_access $first_access ($interval[1])");
if (defined($first_access)) {
- $interval = $first_access+$interval;
+ my $interval = $first_access+$interval[0];
$date = (!$due_date || $interval < $due_date) ? $interval
: $due_date;
} else {
Index: loncom/interface/lonnavmaps.pm
diff -u loncom/interface/lonnavmaps.pm:1.405 loncom/interface/lonnavmaps.pm:1.406
--- loncom/interface/lonnavmaps.pm:1.405 Mon Nov 19 19:26:17 2007
+++ loncom/interface/lonnavmaps.pm Tue Nov 20 12:53:46 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Navigate Maps Handler
#
-# $Id: lonnavmaps.pm,v 1.405 2007/11/20 00:26:17 albertel Exp $
+# $Id: lonnavmaps.pm,v 1.406 2007/11/20 17:53:46 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -3819,12 +3819,13 @@
sub duedate {
(my $self, my $part) = @_;
my $date;
- my $interval=$self->parmval("interval", $part);
+ my @interval=$self->parmval("interval", $part);
my $due_date=$self->parmval("duedate", $part);
- if ($interval =~ /\d+/) {
- my $first_access=&Apache::lonnet::get_first_access('map',$self->symb);
+ if ($interval[0] =~ /\d+/) {
+ my $first_access=&Apache::lonnet::get_first_access($interval[1],
+ $self->symb);
if (defined($first_access)) {
- $interval = $first_access+$interval;
+ my $interval = $first_access+$interval[0];
$date = (!$due_date || $interval < $due_date) ? $interval
: $due_date;
} else {