';
+ }
+ 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();
+ 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'};
+ }
+ }
+ my $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;
+ 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 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.='
';
}
@@ -113,28 +647,135 @@ sub start_Task {
} else {
$result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";
}
- } elsif ($target eq 'grade') {
+ } elsif ($target eq 'grade' && !$env{'form.webgrade'}) {
if ($status eq 'NEEDS_CHECKIN') {
- if (&proctor_check_auth($slot)) {
- #FIXME immeadiatly add this to the grading queue
- # with slot->{'endtime'} for when grading can
- # begin on this resource
- }
+ 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";
+
+ $result.=&preserve_grade_info();
+ $result.=&internal_location();
+ $result.=$form_tag_start.
+ '';
+ &Apache::lonxml::startredirection();
+ }
+ } elsif ( ($target eq 'grade' && $env{'form.webgrade'}) ||
+ $target eq 'webgrade') {
+ my $webgrade='yes';
+ if ($target eq 'webgrade') {
+ $result.= "\n".'
'."\n".
+ '';
+ #$result.=' Review'.&show_queue('reviewqueue');
+ #$result.=' Grade'.&show_queue('gradingqueue');
+ }
+ # 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.'