--- loncom/homework/bridgetask.pm 2006/03/30 22:39:17 1.134
+++ loncom/homework/bridgetask.pm 2017/06/21 19:55:00 1.264.4.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.134 2006/03/30 22:39:17 albertel Exp $
+# $Id: bridgetask.pm,v 1.264.4.1 2017/06/21 19:55:00 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
' + .&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 +400,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 +427,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 +501,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 +521,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 +530,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 "'.&mt('Unable to determine if this resource is open due to network problems. Please try again later.').'
'; } elsif ($status eq 'NOT_IN_A_SLOT') { - $msg.=''.&mt('You are not currently signed up to work at this time and/or place.').'
'; + $msg.=&add_request_another_attempt_button("Sign up for time to work"); } elsif ($status eq 'NEEDS_CHECKIN') { - $msg.=''.&mt('You need the Proctor to validate you.'). + '
'.&proctor_validation_screen($slot); } elsif ($status eq 'WAITING_FOR_GRADE') { - $msg.=''.&mt('Your submission is in the grading queue.').'
'; } elsif ($env{'form.donescreen'}) { - my $title=&Apache::lonnet::gettitle(); - my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'}); - my (undef,undef,$domain,$user)= - &Apache::lonxml::whichuser(); - my $files = 'Files submitted: $files
-You are now done with this Bridge Task
-'.&mt('Not open to be viewed').'
'; } if ($status eq 'CLOSED' || $status eq 'INVALID_ACCESS') { $msg.='The problem '.$accessmsg; } $result.=$msg.'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 +842,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)."