[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm structuretags.pm /interface lonmenu.pm
raeburn
raeburn at source.lon-capa.org
Wed Sep 12 01:14:17 EDT 2012
raeburn Wed Sep 12 05:14:17 2012 EDT
Modified files:
/loncom/homework bridgetask.pm structuretags.pm
/loncom/interface lonmenu.pm
Log:
- Countdown timer available (leftmost item in icons of right side of inline
menu in course context) for items with slot access control.
- For a .Task (automatically uses slot access control), time remaining shown
by default.
- For .problems using slot access control, arrow to left of clock icon needs
to be clicked to expand disply to show active countdown.
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.259 loncom/homework/bridgetask.pm:1.260
--- loncom/homework/bridgetask.pm:1.259 Wed Apr 11 11:40:00 2012
+++ loncom/homework/bridgetask.pm Wed Sep 12 05:14:09 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.259 2012/04/11 11:40:00 goltermann Exp $
+# $Id: bridgetask.pm,v 1.260 2012/09/12 05:14:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -719,7 +719,15 @@
'slot' => $slot_name});
($version,$previous)=&get_version();
}
-
+ if (($target eq 'web') && ($version ne '') && ($slot_name ne '')) {
+ if (ref($slot) eq 'HASH') {
+ if ($slot->{'endtime'} > time()) {
+ $result .=
+ &Apache::lonhtmlcommon::set_due_date($slot->{'endtime'});
+ }
+ }
+ }
+
my $status_id = 'LC_task_take';
if ($previous && $target eq 'answer') {
$status_id = 'LC_task_answer';
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.507 loncom/homework/structuretags.pm:1.508
--- loncom/homework/structuretags.pm:1.507 Mon May 28 20:31:11 2012
+++ loncom/homework/structuretags.pm Wed Sep 12 05:14:09 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: structuretags.pm,v 1.507 2012/05/28 20:31:11 raeburn Exp $
+# $Id: structuretags.pm,v 1.508 2012/09/12 05:14:09 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1160,6 +1160,7 @@
&Apache::run::run($expression,$safeeval);
my $status;
my $accessmsg;
+ my $resource_due;
my $name= &get_resource_name($parstack,$safeeval);
my ($result,$form_tag_start,$slot_name,$slot);
@@ -1189,14 +1190,6 @@
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
$target eq 'tex') {
- if ($status eq 'CAN_ANSWER') {
- my $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
- my $time_left = $resource_due - time();
- if ($resource_due && ($time_left > 0) && ($target eq 'web')) {
- $result .= &Apache::lonhtmlcommon::set_due_date($resource_due);
- }
- }
-
#handle rand seed in construction space
my $rndseed=&setup_rndseed($safeeval,$target);
my ($symb)=&Apache::lonnet::whichuser();
@@ -1305,13 +1298,35 @@
'problem');
}
} elsif ($target eq 'web') {
- if ($status eq 'CAN_ANSWER'
- && $slot_name ne ''
- && $Apache::lonhomework::history{'resource.0.checkedin'} eq '') {
- # unproctored slot access, self checkin
- &Apache::bridgetask::check_in('problem',undef,undef,
- $slot_name);
- }
+ if ($status eq 'CAN_ANSWER') {
+ $resource_due = &Apache::lonhomework::due_date(0, $env{'request.symb'});
+ if ($slot_name ne '') {
+ my $checked_in =
+ $Apache::lonhomework::history{'resource.0.checkedin'};
+ if ($checked_in eq '') {
+ # unproctored slot access, self checkin
+ &Apache::bridgetask::check_in('problem',undef,undef,
+ $slot_name);
+ $checked_in =
+ $Apache::lonhomework::results{"resource.0.checkedin"};
+ }
+ if ((ref($slot) eq 'HASH') && ($checked_in ne '')) {
+ if ($slot->{'starttime'} < time()) {
+ if (!$resource_due) {
+ $resource_due = $slot->{'endtime'};
+ } elsif ($slot->{'endtime'} < $resource_due) {
+ $resource_due = $slot->{'endtime'};
+ }
+ }
+ }
+ }
+ if ($resource_due) {
+ my $time_left = $resource_due - time();
+ if ($resource_due && ($time_left > 0) && ($target eq 'web')) {
+ $result .= &Apache::lonhtmlcommon::set_due_date($resource_due);
+ }
+ }
+ }
$result.="\n $form_tag_start \t".
'<input type="hidden" name="submitted" value="yes" />';
# create a page header and exit
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.386 loncom/interface/lonmenu.pm:1.387
--- loncom/interface/lonmenu.pm:1.386 Tue Sep 4 20:47:56 2012
+++ loncom/interface/lonmenu.pm Wed Sep 12 05:14:17 2012
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.386 2012/09/04 20:47:56 raeburn Exp $
+# $Id: lonmenu.pm,v 1.387 2012/09/12 05:14:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1843,8 +1843,27 @@
sub countdown_timer {
if (($env{'request.course.id'}) && ($env{'request.symb'} ne '') &&
- ($env{'request.filename'}=~/$LONCAPA::assess_re/) &&
- ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) {
+ ($env{'request.filename'}=~/$LONCAPA::assess_re/)) {
+ my ($type,$hastimeleft,$slothastime);
+ my $now = time;
+ if ($env{'request.filename'} =~ /\.task$/) {
+ $type = 'Task';
+ } else {
+ $type = 'problem';
+ }
+ my ($status,$accessmsg,$slot_name,$slot) =
+ &Apache::lonhomework::check_slot_access('0',$type);
+ if ($slot_name ne '') {
+ if (ref($slot) eq 'HASH') {
+ if (($slot->{'starttime'} < $now) &&
+ ($slot->{'endtime'} > $now)) {
+ $slothastime = 1;
+ }
+ }
+ }
+ if ($status ne 'CAN_ANSWER') {
+ return;
+ }
my $duedate = &Apache::lonnet::EXT("resource.0.duedate");
my @interval=&Apache::lonnet::EXT("resource.0.interval");
my $hastimeleft;
@@ -1857,9 +1876,11 @@
}
}
if (($duedate && $duedate > time) ||
- (!$duedate && $hastimeleft)) {
+ (!$duedate && $hastimeleft) ||
+ ($slot_name ne '' && $slothastime)) {
my ($collapse,$expand,$alttxt,$title,$currdisp);
- if (@interval > 1 && $hastimeleft) {
+ if ((@interval > 1 && $hastimeleft) ||
+ ($type eq 'Task' && $slothastime)) {
$currdisp = 'inline';
$collapse = '► ';
} else {
More information about the LON-CAPA-cvs
mailing list