';
+ }
return $result;
}
sub add_request_another_attempt_button {
+ my ($text)=@_;
+ if (!$text) { $text="Request another attempt"; }
+ my $result;
+ my $symb=&Apache::lonnet::symbread();
+ # not a slot access based resource
+ my $useslots = &Apache::lonnet::EXT("resource.0.useslots",$symb);
+ if ($useslots =~ /^\s*no\s*$/i) {
+ return '';
+ }
+
+ my ($slot_name,$slot)=&Apache::slotrequest::check_for_reservation($symb);
+ my $action='get_reservation';
+ if ($slot_name) {
+ $text="Change reservation.";
+ $action='change_reservation';
+ my $description=&Apache::slotrequest::get_description($slot_name,
+ $slot);
+ $result.=(< Will be next available: $description
+STUFF
+ }
+
+ if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); }
+ $symb=&escape($symb);
+ $result.='';
+ return $result;
+}
+
+sub preserve_grade_info {
+ my $result;
+ # if we are viewing someone else preserve that info
+ if (defined $env{'form.grade_symb'}) {
+ foreach my $field ('symb','courseid','domain','username') {
+ $result .= ''."\n";
+ }
+ }
+ return $result;
+}
+
+sub style {
+ my ($target) = @_;
+ if ($target eq 'web'
+ || $target eq 'webgrade') {
+ return (<
+STYLE
+ }
+ return;
+}
+
+sub show_task {
+ my ($status,$previous)=@_;
+ if (!$previous && (
+ ( $status eq 'CLOSED' ) ||
+ ( $status eq 'BANNED') ||
+ ( $status eq 'UNAVAILABLE') ||
+ ( $status eq 'NOT_IN_A_SLOT') ||
+ ( $status eq 'NEEDS_CHECKIN') ||
+ ( $status eq 'WAITING_FOR_GRADE') ||
+ ( $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 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 $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'})) {
+ $submissiontime=$Apache::lonhomework::history{$v.':timestamp'};
+ last;
+ }
+ }
my $result;
- $result.=' ';
+ if ($submissiontime) {
+ my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.0.checkedin.slot'};
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+ my $diff = $slot{'endtime'} - $submissiontime;
+ 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,
+ &Apache::lonlocal::locallocaltime($submissiontime),
+ &Apache::lonlocal::locallocaltime($slot{'endtime'})).
+ '
';
+ }
return $result;
}
+sub file_list {
+ my ($files,$uname,$udom) = @_;
+ if (!defined($uname) || !defined($udom)) {
+ (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
+ }
+ my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
+
+ my $file_list="
\n";
+ foreach my $partial_file (split(',',$files)) {
+ my $file=$file_url.$partial_file;
+ $file=~s|/+|/|g;
+ &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
+ $file_list.='
';
}
@@ -193,63 +653,133 @@ sub start_Task {
}
} elsif ($target eq 'grade' && !$env{'form.webgrade'}) {
if ($status eq 'NEEDS_CHECKIN') {
- if (&proctor_check_auth($slot_name,$slot)) {
- #FIXME immeadiatly add this to the grading queue
- # with slot->{'endtime'} for when grading can
- # begin on this resource
- # FIXME I think the above is done by default,
- # need to check that
- # failure doesn't do this.
- }
+ if(&proctor_check_auth($slot_name,$slot,'Task')
+ && defined($Apache::inputtags::slot_name)) {
+ my $result=
+ &add_to_queue('gradingqueue',
+ {'type' => 'Task',
+ 'time' => time,
+ 'slot' =>
+ $Apache::inputtags::slot_name});
+ &Apache::lonxml::debug("add_to_queue said $result");
+ }
}
}
} elsif ($target eq 'web') {
- my $name= &Apache::structuretags::get_resource_name($parstack,$safeeval);
- $result.="$head_tag_start$name
- $body_tag_start \n $form_tag_start".
- '';
- # if we are viewing someone else preserve that info
- if (defined $env{'form.grade_symb'}) {
- foreach my $field ('symb','courseid','domain','username') {
- $result .= ''."\n";
- }
- }
- my $version=&get_version();
- if ($Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
- $result.='
'."\n".
+ '';
+ #$result.=' Review'.&show_queue('reviewqueue');
+ #$result.=' Grade'.&show_queue('gradingqueue');
}
- my $todo=&get_from_queue();
+ # FIXME Blast! still need to reorg this, need to reshow the
+ # queue being reviewed once done with the grade pass...
+ # Hrrm, vaildation pass should perhaps say 'not_locked'
+ # perhaps do a search if there is a key that is mine and if
+ # there isn't reshow the queue....
+ my ($todo,$status_code,$msg)=&get_key_todo($target);
+
if ($todo) {
&setup_env_for_other_user($todo,$safeeval);
my ($symb,$uname,$udom)=&decode_queue_key($todo);
$result.="\n".'
Found '.
&Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.'
'.&mt('Indicate the files from your portfolio to be evaluated in grading this task.').'
').
"
";
+ }
+ if (!$previous && $status ne 'SHOW_ANSWER' &&
+ &show_task($status,$previous)) {
$result.=&Apache::inputtags::gradestatus('0');
+ $result.='';
+ my $action = &Apache::lonenc::check_encrypt($env{'request.uri'});
+ $result.=<
+
+
+
+DONEBUTTON
+ }
+ if (&show_task($status,$previous) &&
+ $Apache::lonhomework::history{"resource.$version.0.status"} =~ /^(pass|fail)$/) {
+ my $bt_status=$Apache::lonhomework::history{"resource.$version.0.status"};
+ my $title=&Apache::lonnet::gettitle();
+
+ my $start_time;
+
+ my $slot_name=
+ $Apache::lonhomework::history{"resource.$version.0.checkedin.slot"};
+ if ($slot_name) {
+ my %slot=&Apache::lonnet::get_slot($slot_name);
+
+ $start_time=$slot{'starttime'}
+ } else {
+ $start_time=
+ &Apache::lonnet::EXT('resource.0.opendate');
+ }
+ $start_time=&Apache::lonlocal::locallocaltime($start_time);
+
+ my $status = "\n
\n";
+
+ if ($bt_status eq 'pass') {
+ $status.='
You passed the '.$title.' given on '.
+ $start_time.'
';
+ }
+ if ($bt_status eq 'fail') {
+ $status.='
You did not pass the '.$title.' given on '.
+ $start_time.'
';
+ if (!$previous) {
+ $status.=&add_request_another_attempt_button();
+ }
+ }
+ my $man_count=0;
+ my $opt_count=0;
+ my $opt_passed=0;
+ foreach my $dim (keys(%Apache::bridgetask::top_dimensionlist)) {
+ if ($Apache::bridgetask::top_dimensionlist{$dim}{'manadatory'}
+ eq 'N') {
+ $opt_count++;
+ if ($Apache::lonhomework::history{"resource.$version.0.$dim.status"} eq 'pass') {
+ $opt_passed++;
+ }
+ } else {
+ $man_count++;
+ }
+ }
+
+ my $opt_req=&Apache::lonxml::get_param('OptionalRequired',
+ $parstack,$safeeval);
+ if ($opt_req !~ /\S/) { $opt_req='0'; }
+ $status.="\n
".&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)."