--- loncom/homework/bridgetask.pm 2006/03/29 13:24:43 1.128
+++ loncom/homework/bridgetask.pm 2010/11/01 16:32:32 1.256
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.128 2006/03/29 13:24:43 albertel Exp $
+# $Id: bridgetask.pm,v 1.256 2010/11/01 16:32:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,26 +37,29 @@ use Apache::lonmenu;
use Apache::lonlocal;
use Apache::lonxml;
use Apache::slotrequest();
+use Apache::structuretags();
use Time::HiRes qw( gettimeofday tv_interval );
+use LONCAPA;
+
BEGIN {
- &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Instance','InstanceText','Criteria','ClosingParagraph'));
+ &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Setup','Instance','InstanceText','Criteria','CriteriaText','GraderNote','ClosingParagraph'));
}
+my %dimension;
+my $top = 'top';
+
sub initialize_bridgetask {
# id of current Dimension, 0 means that no dimension is current
# (inside '."\n";
- $result.='';
+ $entries,$ready,$locks).''."\n\t\t".''."\n";
+ $result.="\n\t\t".' '.
+ "\n\t\t".'';
+ $result.= "\n\t\t".'';
$result.=&Apache::loncommon::select_dom_form($env{'user.domain'},
'gradingdomain');
$result.=' '.
@@ -213,36 +297,44 @@ sub add_grading_button {
'gradinguser',
'gradingdomain');
$result.=&Apache::loncommon::studentbrowser_javascript();
- $result.= '
'."\n";
- $result.='';
- $result.=' Specify a section: '.$sec_select.' ';
- $result.=''.' '."\n\t\t".' ';
+ if ($see_all || (!§ion_restricted())) {
+ $result.="\n\t\t\t".' '."\n";
+ $result.= "\n\t\t\t\t".&mt("[_1] entries, [_2] ready, [_3] being graded",$entries,$ready,$locks).''."\n\t\t".''."\n";
($entries,$ready,$locks)=&get_queue_counts('reviewqueue');
- $result.=''.&mt('Specify a section:').' '.
+ "\n\t\t\t".''.$sec_select."\n\t\t\t".' ';
+ } else {
+ $result.="\n\t\t\t".''.&mt('Grading section:').' '.
+ "\n\t\t\t".''.$env{'request.course.sec'}."\n\t\t\t".' ';
+ }
+ $result.="\n\t\t\t".''.' ';
- $result.= &mt("[_1] entries, [_2] ready, [_3] being graded",$entries,$ready,$locks).' '."\n";
- $result.=''.
- ' '.
+ "\n\t\t\t".' '.
+ "\n\t\t\t\t".' ';
$result.=&mt("[_1] entries, [_2] ready, [_3] being graded",
- $entries,$ready,$locks).' '.
+ "\n\t\t\t".' '
+ ."\n\t".''."\n";
+ $result.="\n\t".''.
+ "\n\t\t\t\t".' '
+ ."\n\t\t".'
' + .&mt('Will be next available:') + .' '.$description + .'
'; } if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); } - $symb=&Apache::lonnet::escape($symb); - $result.=''; + $text.'" />'."\n\t". + ''."\n"; return $result; } @@ -262,9 +354,22 @@ sub style { my ($target) = @_; if ($target eq 'web' || $target eq 'webgrade') { - return (< STYLE + if ($env{'browser.type'} eq 'explorer' + && $env{'browser.os'} eq 'win' ) { + if ($env{'browser.version'} < 7) { + $style .= (< +STYLE + } else { + $style .= (< +STYLE + } + } + return $style; } return; } @@ -276,27 +381,70 @@ sub show_task { ( $status eq 'BANNED') || ( $status eq 'UNAVAILABLE') || ( $status eq 'NOT_IN_A_SLOT') || + ( $status eq 'NOT_YET_VIEWED') || ( $status eq 'NEEDS_CHECKIN') || ( $status eq 'WAITING_FOR_GRADE') || - ( $status eq 'INVALID_ACCESS') )) { + ( $status eq 'INVALID_ACCESS') || + ( &get_version() eq ''))) { return 0; } if ($env{'form.donescreen'}) { return 0; } return 1; } +my @delay; +sub nest { + if (@delay) { + return $delay[-1]; + } else { + return; + } +} + +sub start_delay { + push(@delay,1); +} +sub end_delay { + pop(@delay); +} + +sub nested_parse { + my ($str,$env,$args) = @_; + my @old_env = @Apache::scripttag::parser_env; + @Apache::scripttag::parser_env = @$env; + if (exists($args->{'set_dim_id'})) { + &enable_dimension_parsing($args->{'set_dim_id'}); + } + push(@delay,(($args->{'delayed_dim_results'})? 1 : 0)); + my $result = &Apache::scripttag::xmlparse($$str); + pop(@delay); + if (exists($args->{'set_dim_id'})) { + &disable_dimension_parsing(); + } + @Apache::scripttag::parser_env = @old_env; + if ($args->{'delayed_dim_results'}) { + my $dim = &get_dim_id(); + &Apache::lonxml::debug(" tossing out $result "); + &Apache::lonxml::debug(" usining out $dim 's ". $dimension{$dim}{'result'}); + return $dimension{$dim}{'result'}; + } + return $result; +} + sub internal_location { my ($id)=@_; return ''; } sub submission_time_stamp { - my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser(); my $submissiontime; my $version=$Apache::lonhomework::history{'resource.0.version'}; for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) { - if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) { + if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'}) + && defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.tries'})) { $submissiontime=$Apache::lonhomework::history{$v.':timestamp'}; + last; } } my $result; @@ -307,16 +455,18 @@ sub submission_time_stamp { my ($color,$when)=('#FF6666','after'); if ($diff > 0) { ($color,$when)=('#336600','before'); } my $info; + $diff = abs($diff); 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'}))). + &mt('Student submitted [_1] [_2] the deadline. '. + '(Submission was at [_3], end of period was [_4].)', + $info,$when, + &Apache::lonlocal::locallocaltime($submissiontime), + &Apache::lonlocal::locallocaltime($slot{'endtime'})). '
'; } return $result; @@ -325,7 +475,7 @@ sub submission_time_stamp { sub file_list { my ($files,$uname,$udom) = @_; if (!defined($uname) || !defined($udom)) { - (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser(); + (undef,undef,$udom,$uname) = &Apache::lonnet::whichuser(); } my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/'; @@ -334,39 +484,130 @@ sub file_list { my $file=$file_url.$partial_file; $file=~s|/+|/|g; &Apache::lonnet::allowuploaded('/adm/bridgetask',$file); - $file_list.='".&mt('Submitted non-existent file [_1]',$file)."
\n"; + } else { + $file = ''.$file.''; + $msg .= "".&mt('Submitted file [_1]',$file)."
\n"; + } + $files .= ''.&mt('Files submitted: [_1]',$files).'
' + .''.&mt('You are now done with this Bridge Task').'
' + .''.&mt('Change to a different course').'
'; + } else { + $msg = &mt("Submission status: no files currently submitted, when 'Done' was indicated."); + $shown = ''. + &mt('You did not submit any files. Please try again.').''. + '
'.&mt('Back to Bridge Task').'
'.&mt('Message sent to user: [_1]', + $message_status).'
'; + } + if ($setting eq 'student_and_user_notes_screen') { + $comment_status = + &Apache::lonmsg::store_instructor_comment($subject.''.&mt('Message sent to instructor: [_1]', + $comment_status).'
'; + } + + return "Files submitted: $files
-You are now done with this Bridge Task
-Found '. - &Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.' |
'. + &mt('Grading [_1] for [_2] at [_3]', + &Apache::lonnet::gettitle($symb),$uname,$udom).'
'; $form_tag_start.= ''; + &escape($todo).'" />'; $Apache::bridgetask::queue_key=$todo; &Apache::structuretags::initialize_storage(); &Apache::lonhomework::showhash(%Apache::lonhomework::history); @@ -547,6 +803,22 @@ DONESCREEN &mt('Return to resource').''; if ($status_code eq 'stop') { $result.=''.&mt("Stopped grading.").''.$back; + } elsif ($status_code eq 'cancel') { + $result.=''.&mt("Cancelled grading.").''.$back; + } elsif ($status_code eq 'terminated') { + $result.= ''.&mt('Terminated grading').'". + &question_status_message(\%counts,-1). + "
\n"; + if ($bt_status eq 'pass') { - $status.='".&mt('You needed to pass all of the [_1] mandatory components and [_2] of the [_3] optional components, of which you passed [_4].',$man_count,$opt_req,$opt_count,$opt_passed)."