[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Sat, 01 Oct 2005 03:55:08 -0000
albertel Fri Sep 30 23:55:08 2005 EDT
Modified files:
/loncom/homework bridgetask.pm
Log:
- put in information about when the submission actually occured
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.59 loncom/homework/bridgetask.pm:1.60
--- loncom/homework/bridgetask.pm:1.59 Fri Sep 30 23:27:44 2005
+++ loncom/homework/bridgetask.pm Fri Sep 30 23:55:06 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.59 2005/10/01 03:27:44 albertel Exp $
+# $Id: bridgetask.pm,v 1.60 2005/10/01 03:55:06 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -302,6 +302,38 @@
return '<!-- LONCAPA_INTERNAL_ADD_TASK_STATUS'.$id.' -->';
}
+sub submission_time_stamp {
+ my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser();
+ my $submissiontime;
+ my $version=$Apache::lonhomework::history{'resource.version'};
+ for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) {
+ if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) {
+ $submissiontime=$Apache::lonhomework::history{$v.':timestamp'};
+ }
+ }
+ my $result;
+ if ($submissiontime) {
+ my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'};
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+ my $diff = $slot{'endtime'} - $submissiontime;
+ my ($color,$when)=('red','after');
+ if ($diff > 0) { ($color,$when)=('green','before'); }
+ my $info;
+ if ($diff%60) { $info=($diff%60).' seconds'; }
+ $diff=int($diff/60);
+ if ($diff%60) { $info=($diff%60).' minutes '.$info; }
+ $diff=int($diff/60);
+ if ($diff) { $info=$diff.' hours '.$info; }
+ $result='<p><font color="'.$color.'">'.
+ &mt('Student submitted [_1] [_2] the deadline.
+ (Submission was at [_3], end of period was [_4].)',
+ $info,$when,scalar(localtime($submissiontime)),
+ scalar(localtime($slot{'endtime'}))).
+ '</font></p>';
+ }
+ return $result;
+}
+
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
@@ -446,6 +478,7 @@
my $bodytext=&Apache::lonxml::get_all_text("/task",$parser);
}
if ($target eq 'webgrade' && defined($env{'form.queue'})) {
+ $result.=&submission_time_stamp();
$result.=$form_tag_start;
$result.='<input type="hidden" name="webgrade" value="'.
$webgrade.'" />';