Diff for /loncom/homework/bridgetask.pm between versions 1.21 and 1.22

version 1.21, 2005/05/10 16:44:35 version 1.22, 2005/05/10 20:29:26
Line 59  sub initialize_bridgetask { Line 59  sub initialize_bridgetask {
 }  }
   
 sub proctor_check_auth {  sub proctor_check_auth {
     my ($slot)=@_;      my ($slot_name,$slot)=@_;
     my $user=$env{'form.proctorname'};      my $user=$env{'form.proctorname'};
     my $domain=$env{'form.proctordomain'};      my $domain=$env{'form.proctordomain'};
           
Line 71  sub proctor_check_auth { Line 71  sub proctor_check_auth {
     if ($authhost ne 'no_host') {      if ($authhost ne 'no_host') {
  $Apache::lonhomework::results{'resource.checkedin'}=   $Apache::lonhomework::results{'resource.checkedin'}=
     $user.'@'.$domain;      $user.'@'.$domain;
    $Apache::lonhomework::results{'resource.checkedin.slot'}=
       $slot_name;
  return 1;   return 1;
     }      }
  }   }
Line 94  sub add_grading_button { Line 96  sub add_grading_button {
     return $result;      return $result;
 }  }
   
   sub add_request_another_attempt_button {
       
   }
   
 sub start_Task {  sub start_Task {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
Line 132  sub start_Task { Line 138  sub start_Task {
     ( $status eq 'UNAVAILABLE') ||      ( $status eq 'UNAVAILABLE') ||
     ( $status eq 'NOT_IN_A_SLOT') ||      ( $status eq 'NOT_IN_A_SLOT') ||
     ( $status eq 'NEEDS_CHECKIN') ||      ( $status eq 'NEEDS_CHECKIN') ||
       ( $status eq 'WAITING_FOR_GRADE') ||
     ( $status eq 'INVALID_ACCESS')) {      ( $status eq 'INVALID_ACCESS')) {
     my $bodytext=&Apache::lonxml::get_all_text("/task",$parser);      my $bodytext=&Apache::lonxml::get_all_text("/task",$parser);
     if ( $target eq "web" ) {      if ( $target eq "web" ) {
Line 144  sub start_Task { Line 151  sub start_Task {
  } elsif ($status eq 'NEEDS_CHECKIN') {   } elsif ($status eq 'NEEDS_CHECKIN') {
     $msg.='<h1>'.&mt('You need the Proctor to validate you.').      $msg.='<h1>'.&mt('You need the Proctor to validate you.').
  '</h1>'.&proctor_validation_screen($slot);   '</h1>'.&proctor_validation_screen($slot);
    } elsif ($status eq 'WAITING_FOR_GRADE') {
       $msg.='<h1>'.&mt('Your submission is in the grading queue.').'</h1>';
  } elsif ($status ne 'NOT_YET_VIEWED') {   } elsif ($status ne 'NOT_YET_VIEWED') {
     $msg.='<h1>'.&mt('Not open to be viewed').'</h1>';      $msg.='<h1>'.&mt('Not open to be viewed').'</h1>';
  }   }
Line 158  sub start_Task { Line 167  sub start_Task {
  } else {   } else {
     $result.=&mt('Problem is not open to be viewed. It')." $accessmsg \\vskip 0 mm ";      $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 ($status eq 'NEEDS_CHECKIN') {
     if (&proctor_check_auth($slot)) {      if (&proctor_check_auth($slot_name,$slot)) {
  #FIXME immeadiatly add this to the grading queue   #FIXME immeadiatly add this to the grading queue
                         #      with slot->{'endtime'} for when grading can                           #      with slot->{'endtime'} for when grading can 
                         #      begin on this resource                          #      begin on this resource
    # FIXME I think the above is done by default,
                           #        need to check that
                           #        failure doesn't do this.
      }       }
  }   }
     }      }
Line 179  sub start_Task { Line 191  sub start_Task {
  '" value="'.$env{"form.grade_$field"}.'" />'."\n";   '" value="'.$env{"form.grade_$field"}.'" />'."\n";
  }   }
     }      }
       if ($Apache::lonhomework::history{'resource.status'} eq 'fail') {
    $result.='<h1><font color="red">'.&mt('Did not pass').'</font></h1>';
    $result.=&request_another_attempt_button();
       }
       if ($Apache::lonhomework::history{'resource.status'} eq 'pass') {
    $result.='<h1><font color="green">'.&mt('Passed').'</font></h1>';
       }
  }   }
     } elsif ( ($target eq 'grade' && $env{'form.webgrade'}) ||      } elsif ( ($target eq 'grade' && $env{'form.webgrade'}) ||
       $target eq 'webgrade') {        $target eq 'webgrade') {
Line 577  sub get_instance { Line 596  sub get_instance {
  my $instance=&get_instance();   my $instance=&get_instance();
  if ($target eq 'web') {   if ($target eq 'web') {
     $result=$dimension{'intro'}.$dimension{$instance.'.text'};      $result=$dimension{'intro'}.$dimension{$instance.'.text'};
       if ($Apache::lonhomework::history{'resource.status'} eq 'pass' ||
    $Apache::lonhomework::history{'resource.status'} eq 'fail') {
    foreach my $id (@{$dimension{$instance.'.criterias'}}) {
       my $status=$Apache::lonhomework::history{"resource.$dim_id.$instance.$id.status"};
       my $comment=$Apache::lonhomework::history{"resource.$dim_id.$instance.$id.comment"};
       $result.='<table border="1"><tr><td>';
       if ($status eq 'fail') {
    $result.='<font color="red">'.&mt('Did not pass').'</font>';
       } elsif ($status eq 'pass') {
    $result.='<font color="green">'.&mt('Passed').'</font>';
       } else {
    &Apache::lonxml::error("Student viewing a graded bridgetask was show a status of $status");
       }
       $result.='</td></tr><tr><td>';
       if ($Apache::lonhomework::history{"resource.$dim_id.$instance.$id.comment"}) {
    $result.=&mt('Comment from grader: ').$Apache::lonhomework::history{"resource.$dim_id.$instance.$id.comment"}.'</td></tr><tr><td>';
       }
       $result.=$dimension{$instance.'.criteria.'.$id}.
    '</td></tr></table>';
    }
       }
  } elsif ($target eq 'webgrade') {   } elsif ($target eq 'webgrade') {
     foreach my $id (@{$dimension{$instance.'.criterias'}}) {      foreach my $id (@{$dimension{$instance.'.criterias'}}) {
  my $link='criteria_'.$instance.'_'.$id;   my $link='criteria_'.$instance.'_'.$id;
  my $status=$Apache::lonhomework::history{'resource.'.$instance.'.'.$id.'.status'};   my $status=$Apache::lonhomework::history{"resource.$dim_id.$instance.$id.status"};
  $result.='<tr><td width="100%" valign="top">'.   $result.='<tr><td width="100%" valign="top">'.
     '<a name="'.$link.'" />'.      '<a name="'.$link.'" />'.
     '<a name="next_'.$last_link.'" />'.      '<a name="next_'.$last_link.'" />'.
Line 588  sub get_instance { Line 628  sub get_instance {
     #$dimension{$instance.'.criteria.'.$id}.      #$dimension{$instance.'.criteria.'.$id}.
     '</td>'.      '</td>'.
     '<td><nobr>Additional Comment for Student</nobr> <br />'.      '<td><nobr>Additional Comment for Student</nobr> <br />'.
     '<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{'resource.'.$instance.'.'.$id.'.comment'}).'</textarea>'.      '<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{"resource.$dim_id.$instance.$id.comment"}).'</textarea>'.
     '</td>'.      '</td>'.
     '<td>'.      '<td>'.
     '<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').'/>Ungraded</label></nobr><br />'.      '<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').'/>Ungraded</label></nobr><br />'.
Line 602  sub get_instance { Line 642  sub get_instance {
     '<input type="submit" name="next" value="'.      '<input type="submit" name="next" value="'.
     &mt('Done').'" /> '.      &mt('Done').'" /> '.
     '</td></tr>';      '</td></tr>';
    $result.='<tr><td colspan="4">';
    my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
    my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio';
    foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.0.bridgetask.portfiles"})) {
       my $file=$file_url.$partial_file;
       &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
       $result.='<a href="'.$file.'" target="lonGRDs"><img src="'.
    &Apache::loncommon::icon($file).'" border=0"> '.$file.
    '</a>';
    }
    $result.='</td></tr>';
  $last_link=$link;   $last_link=$link;
     }      }
  } elsif ($target eq 'grade') {   } elsif ($target eq 'grade' && $env{'form.webgrade'}) {
     my $optional_passed=0;      my $optional_passed=0;
     my $mandatory_failed=0;      my $mandatory_failed=0;
     my $ungraded=0;      my $ungraded=0;
     my $review=0;      my $review=0;
     foreach my $id (@{$dimension{$instance.'.criterias'}}) {      foreach my $id (@{$dimension{$instance.'.criterias'}}) {
  my $status=$Apache::lonhomework::results{'resource.'.$instance.'.'.$id.'.status'}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id};   my $status=$Apache::lonhomework::results{"resource.$dim_id.$instance.$id.status"}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id};
  $Apache::lonhomework::results{'resource.'.$instance.'.'.$id.'.comment'}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id};   $Apache::lonhomework::results{"resource.$dim_id.$instance.$id.comment"}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id};
  my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');   my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');
  if ($status eq 'pass') {   if ($status eq 'pass') {
     if (!$mandatory) { $optional_passed++; }      if (!$mandatory) { $optional_passed++; }
Line 622  sub get_instance { Line 673  sub get_instance {
  } elsif ($status eq 'ungraded') {   } elsif ($status eq 'ungraded') {
     $ungraded++;      $ungraded++;
  } else {   } else {
     &Apache::lonxml::error("got wierd status --$status--");      &Apache::lonxml::error("got weird status --$status--");
  }   }
     }      }
     if ($optional_passed < $dimension{$instance.'.optionalrequired'}) {      if ($optional_passed < $dimension{$instance.'.optionalrequired'}) {
Line 630  sub get_instance { Line 681  sub get_instance {
     }      }
     &Apache::lonxml::debug("all instance ".join(':',@{$dimension{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");      &Apache::lonxml::debug("all instance ".join(':',@{$dimension{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");
     if ($review) {      if ($review) {
  $Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='review';   $Apache::lonhomework::results{"resource.$dim_id.status"}=
       'review';
     } elsif ($ungraded) {      } elsif ($ungraded) {
  $Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='ungraded';   $Apache::lonhomework::results{"resource.$dim_id.status"}=
       'ungraded';
     } elsif ($mandatory_failed) {      } elsif ($mandatory_failed) {
  $Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='fail';   $Apache::lonhomework::results{"resource.$dim_id.status"}=
       'fail';
     } else {      } else {
  $Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='pass';   $Apache::lonhomework::results{"resource.$dim_id.status"}=
       'pass';
     }      }
  }   }
  return $result;   return $result;

Removed from v.1.21  
changed lines
  Added in v.1.22


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>