--- loncom/homework/bridgetask.pm 2005/10/01 03:27:44 1.59 +++ loncom/homework/bridgetask.pm 2005/10/01 04:14:51 1.63 @@ -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.63 2005/10/01 04:14:51 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -302,6 +302,38 @@ sub internal_location { return ''; } +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='

'. + &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'}))). + '

'; + } + return $result; +} + sub start_Task { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; @@ -446,6 +478,9 @@ sub start_Task { my $bodytext=&Apache::lonxml::get_all_text("/task",$parser); } if ($target eq 'webgrade' && defined($env{'form.queue'})) { + if ($webgrade eq 'yes') { + $result.=&submission_time_stamp(); + } $result.=$form_tag_start; $result.=''; @@ -455,6 +490,14 @@ sub start_Task { $result.=''; } + if ($env{'form.chosensections'}) { + my @chosen_sections= + &Apache::loncommon::get_env_multiple('form.chosensections'); + foreach my $sec (@chosen_sections) { + $result.=''; + } + } } } else { # page_start returned a starting result, delete it if we don't need it @@ -885,6 +928,10 @@ sub show_queue { &Apache::grades::init_perm(); my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,); &Apache::grades::reset_perm(); + if (!(grep(/^all$/,@chosen_sections))) { + $result.='

Showing only sections '.join(', ',@chosen_sections). + '.

'."\n"; + } my $regexp="^$symb\0"; my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp); @@ -924,6 +971,11 @@ sub show_queue { ($action,$description)=('unlock',&mt('Unlock')); } } + my $seclist; + foreach my $sec (@chosen_sections) { + $seclist.=''; + } if (time > $slot_data{'endtime'}) { $result.=(< @@ -934,6 +986,7 @@ sub show_queue { + $seclist FORM @@ -1138,13 +1191,19 @@ sub get_from_queue { sub select_user { my ($symb,$cid)=&Apache::lonxml::whichuser(); - my $result.=''; my @chosen_sections= &Apache::loncommon::get_env_multiple('form.chosensections'); &Apache::grades::init_perm(); my ($classlist,$section,$fullname)=&Apache::grades::getclasslist(\@chosen_sections,); &Apache::grades::reset_perm(); + + my $result; + if (!(grep(/^all$/,@chosen_sections))) { + $result.='

Showing only sections '.join(', ',@chosen_sections). + '.

'."\n"; + } + $result.='
'; foreach my $student (sort {lc($$fullname{$a}) cmp lc($$fullname{$b}) } keys %$fullname) { my ($uname,$udom) = split(/:/,$student); @@ -1169,6 +1228,11 @@ sub select_user { $result.='
 '.$fullname->{$student}. ''; } else { + my $seclist; + foreach my $sec (@chosen_sections) { + $seclist.=''; + } $result.=< @@ -1177,7 +1241,8 @@ sub select_user { - + + $seclist $fullname->{$student}