Diff for /loncom/homework/bridgetask.pm between versions 1.104 and 1.105

version 1.104, 2006/02/08 22:44:14 version 1.105, 2006/02/09 22:34:35
Line 198  sub add_grading_button { Line 198  sub add_grading_button {
  $result.='<p>'.&mt("Review Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks);   $result.='<p>'.&mt("Review Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks);
  $result.=' <input type="submit" name="reviewasubmission" value="'.   $result.=' <input type="submit" name="reviewasubmission" value="'.
     &mt("Select an entry from the review queue").'" /> </p>'."\n";      &mt("Select an entry from the review queue").'" /> </p>'."\n";
  $result.=' <input type="submit" name="regradeasubmission" value="'.   $result.='<p> <input type="submit" name="regradeasubmission" value="'.
     &mt("Select a user to regrade.").'" /> </p>'."\n";      &mt("Select a user to regrade.").'" /> </p>'."\n";
     }   $result.='<p> <input type="submit" name="regradeaspecificsubmission" value="'.
       &mt("Regrade user:").'" />'."\n";
    $result.='<input type="text" size="12" name="gradinguser" />';
    $result.=&Apache::loncommon::select_dom_form($env{'user.domain'},
        'gradingdomain');
    $result.=' '.
       &Apache::loncommon::selectstudent_link('gradesubmission',
      'gradinguser',
      'gradingdomain');
    $result.=&Apache::loncommon::studentbrowser_javascript();
     }
     return $result;      return $result;
 }  }
   
Line 515  DONESCREEN Line 525  DONESCREEN
         #       Hrrm, vaildation pass should perhaps say 'not_locked'          #       Hrrm, vaildation pass should perhaps say 'not_locked'
         #       perhaps do a search if there is a key that is mine and if          #       perhaps do a search if there is a key that is mine and if
         #       there isn't reshow the queue....          #       there isn't reshow the queue....
  my ($todo,$status_code)=&get_key_todo($target);   my ($todo,$status_code,$msg)=&get_key_todo($target);
   
  if ($todo) {   if ($todo) {
     &setup_env_for_other_user($todo,$safeeval);      &setup_env_for_other_user($todo,$safeeval);
Line 544  DONESCREEN Line 554  DONESCREEN
  if      ($status_code eq 'stop') {   if      ($status_code eq 'stop') {
     $result.='<b>'.&mt("Stopped grading.").'</b>'.$back;      $result.='<b>'.&mt("Stopped grading.").'</b>'.$back;
  } elsif ($status_code eq 'lock_failed') {   } elsif ($status_code eq 'lock_failed') {
     $result.='<b>'.&mt("Failed to lock the request record.")      $result.='<b>'.&mt("Failed to lock the requested record.")
  .'</b>'.$back;   .'</b>'.$back;
  } elsif ($status_code eq 'unlock') {   } elsif ($status_code eq 'unlock') {
     $result.='<b>'.&mt("Unlocked the requested record.")      $result.='<b>'.&mt("Unlocked the requested record.")
Line 556  DONESCREEN Line 566  DONESCREEN
     $result.=&select_user();      $result.=&select_user();
  } elsif ($status_code eq 'unable') {   } elsif ($status_code eq 'unable') {
     $result.='<b>'.&mt("Unable to aqcuire a user to grade.").'</b>'.$back;      $result.='<b>'.&mt("Unable to aqcuire a user to grade.").'</b>'.$back;
    } elsif ($status_code eq 'not_allowed') {
       $result.='<b>'.&mt('Not allowed to grade the requested user.').' '.$msg.'</b>'.$back;
  } else {   } else {
     $result.='<b>'.&mt("No user to be graded.").'</b>'.$back;      $result.='<b>'.&mt("No user to be graded.").'</b>'.$back;
  }   }
Line 622  sub get_key_todo { Line 634  sub get_key_todo {
  return (undef,'select_user');   return (undef,'select_user');
     }      }
   
   
       my $me=$env{'user.name'}.'@'.$env{'user.domain'};
   
       #need to try both queues..
       if (defined($env{'form.regradeaspecificsubmission'}) &&
    defined($env{'form.gradinguser'})               &&
    defined($env{'form.gradingdomain'})               ) {
    my ($symb,$cid)=&Apache::lonxml::whichuser();
    my $cnum  = $env{'course.'.$cid.'.num'};
    my $cdom  = $env{'course.'.$cid.'.domain'};
    my $uname = $env{'form.gradinguser'};
    my $udom  = $env{'form.gradingdomain'};
   
    my $gradingkey=&encode_queue_key($symb,$udom,$uname);
   
    my $queue;
   
    if      (&in_queue('gradingqueue',$symb,$cdom,$cnum,$udom,$uname)) {
       $env{'form.queue'} = $queue = 'gradingqueue';
    } elsif (&in_queue('reviewqueue' ,$symb,$cdom,$cnum,$udom,$uname)) {
       $env{'form.queue'} = $queue = 'reviewqueue';
    }
   
    if (!$queue) {
       $env{'form.queue'} = $queue = 'none';
       #not queued so doing either a re or pre grade
       return ($gradingkey);
    }
   
    my $who=&queue_key_locked($queue,$gradingkey);
    if ($who eq $me) {
       #already have the lock
       $env{'form.gradingkey'}=&Apache::lonnet::escape($gradingkey);
       return ($gradingkey);
    }
   
    if (!defined($who)) {
       if (&lock_key($queue,$gradingkey)) {
    return ($gradingkey);
       } else {
    return (undef,'lock_failed');
       }
    }
   
    #otherwise (defined($who) && $who ne $me) some else has it...
    return (undef,'not_allowed',
    &mt('Another user ([_1]) currently has the record for [_2] locked.',
       $who,$env{'form.gradinguser'}.'@'.$env{'form.gradingdomain'}));
       }
   
   
     my $queue=$env{'form.queue'};      my $queue=$env{'form.queue'};
   
     if (!defined($queue)) {      if (!defined($queue)) {
Line 649  sub get_key_todo { Line 712  sub get_key_todo {
  && $env{'form.queuemode'} eq 'selected') {   && $env{'form.queuemode'} eq 'selected') {
   
  my $who=&queue_key_locked($queue,$gradingkey);   my $who=&queue_key_locked($queue,$gradingkey);
  my $me=$env{'user.name'}.'@'.$env{'user.domain'};  
  if ($who eq $me) {   if ($who eq $me) {
     &Apache::lonxml::debug("Found a key was given to me");      &Apache::lonxml::debug("Found a key was given to me");
     return ($gradingkey,'selected');      return ($gradingkey,'selected');

Removed from v.1.104  
changed lines
  Added in v.1.105


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