Diff for /loncom/homework/bridgetask.pm between versions 1.68 and 1.71

version 1.68, 2005/10/05 20:24:59 version 1.71, 2005/10/14 17:27:23
Line 317  sub submission_time_stamp { Line 317  sub submission_time_stamp {
  my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'};   my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'};
  my %slot=&Apache::lonnet::get_slot($slot_name);   my %slot=&Apache::lonnet::get_slot($slot_name);
  my $diff = $slot{'endtime'} - $submissiontime;   my $diff = $slot{'endtime'} - $submissiontime;
  my ($color,$when)=('red','after');   my ($color,$when)=('#FF6666','after');
  if ($diff > 0) { ($color,$when)=('green','before'); }   if ($diff > 0) { ($color,$when)=('#336600','before'); }
  my $info;   my $info;
  if ($diff%60) { $info=($diff%60).' seconds'; }   if ($diff%60) { $info=($diff%60).' seconds'; }
  $diff=int($diff/60);   $diff=int($diff/60);
Line 335  sub submission_time_stamp { Line 335  sub submission_time_stamp {
     return $result;      return $result;
 }  }
   
   sub webgrade_standard_info {
       my ($version)=&get_version();
       my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser();
       my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/';
       my $file_list="<ul>\n";
       foreach my $partial_file (split(',',$Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"})) {
    my $file=$file_url.$partial_file;
    $file=~s|/+|/|g;
    &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);
    $file_list.='<li><nobr><a href="'.$file.'" target="lonGRDs"><img src="'.
       &Apache::loncommon::icon($file).'" border=0"> '.$file.
       '</a></nobr></li>'."\n";
       }
       $file_list.="</ul>\n";
   
       my %lt=&Apache::lonlocal::texthash('done' => 'Done',
          'stop' => 'Stop',
          );
          
       my $result=<<INFO;
   <div class="handininfo">
     <input type="submit" name="next" value="$lt{'done'}" />
     <input type="submit" name="stop" value="$lt{'stop'}" />
     $file_list
   </div>
   INFO
       return $result;
   }
   
 sub start_Task {  sub start_Task {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
     my ($status,$accessmsg,$slot);      my ($status,$accessmsg,$slot);
     if ($target ne 'webgrade') {      if ($target ne 'webgrade') {
    &Apache::structuretags::init_problem_globals('Task');
  &Apache::structuretags::initialize_storage();   &Apache::structuretags::initialize_storage();
  &Apache::lonhomework::showhash(%Apache::lonhomework::history);   &Apache::lonhomework::showhash(%Apache::lonhomework::history);
     }       } 
Line 511  DONESCREEN Line 541  DONESCREEN
                                value="'.$sec.'" />';                                 value="'.$sec.'" />';
  }   }
     }      }
       if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); }
  }   }
     } else {      } else {
  # page_start returned a starting result, delete it if we don't need it   # page_start returned a starting result, delete it if we don't need it
Line 618  sub end_Task { Line 649  sub end_Task {
     my ($version,$previous)=&get_version();      my ($version,$previous)=&get_version();
     if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||      if ($target eq 'grade' || $target eq 'web' || $target eq 'answer' ||
  $target eq 'tex') {   $target eq 'tex') {
  if (   if ($target eq 'web' || $target eq 'answer' || $target eq 'tex') {
     (($target eq 'web') && ($env{'request.state'} ne 'construct')) ||  
     ($target eq 'answer') || ($target eq 'tex')  
    ) {  
     if ($target eq 'web') {      if ($target eq 'web') {
  if (&show_task($status,$previous)) {   if (&show_task($status,$previous)) {
     $result.=&Apache::lonxml::endredirection();      $result.=&Apache::lonxml::endredirection();
Line 827  DONEBUTTON Line 855  DONEBUTTON
  #    &mt('Save Partial Grade and Continue Grading').'" /> ';   #    &mt('Save Partial Grade and Continue Grading').'" /> ';
  $result.='</form>'.&Apache::loncommon::endbodytag().'</html>';   $result.='</form>'.&Apache::loncommon::endbodytag().'</html>';
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  $result.='<parameter part="0" package="Task"></parameter>'."\n";   $result.=&Apache::response::meta_package_write('Task');
  #$result.=&Apache::response::meta_part_order();          $result.=&meta_stores_write('solved','string','Problem Status');
  #$result.=&Apache::response::meta_response_order();   $result.=&meta_stores_write('tries','int_zeropos',
       'Number of Attempts');
    $result.=&meta_stores_write('awarded','float',
       'Partial Credit Factor');
    $result.=&meta_stores_write('status','string',
       'Bridge Task Status');
     }      }
     undef($Apache::lonhomework::parsing_a_task);      undef($Apache::lonhomework::parsing_a_task);
     return $result;      return $result;
Line 1488  sub get_instance { Line 1521  sub get_instance {
     '<td>'.      '<td>'.
     '<a href="#'.$last_link.'">Prev</a><br />'.      '<a href="#'.$last_link.'">Prev</a><br />'.
     '<a href="#next_'.$link.'">Next</a><br /><br /><br />'.      '<a href="#next_'.$link.'">Next</a><br /><br /><br />'.
     '<input type="submit" name="next" value="'.  
     &mt('Done').'" /> '.  
     '<input type="submit" name="stop" value="'.  
     &mt('Stop').'" /> '.  
     '</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.$version.0.bridgetask.portfiles"})) {  
     my $file=$file_url.$partial_file;  
     $file=~s|/+|/|g;  
     &Apache::lonnet::allowuploaded('/adm/bridgetask',$file);  
     $result.='<nobr><a href="'.$file.'" target="lonGRDs"><img src="'.  
  &Apache::loncommon::icon($file).'" border=0"> '.$file.  
  '</a></nobr> ';  
  }  
  $result.='</td></tr>';  
  $last_link=$link;   $last_link=$link;
     }      }
  } elsif ($target eq 'grade' && $env{'form.webgrade'}) {   } elsif ($target eq 'grade' && $env{'form.webgrade'}) {
Line 1545  sub get_instance { Line 1562  sub get_instance {
  $Apache::lonhomework::results{"resource.$version.$dim.status"}=   $Apache::lonhomework::results{"resource.$version.$dim.status"}=
     'pass';      'pass';
     }      }
    } else {
       # any other targets no output
       undef($result);
  }   }
  return $result;   return $result;
     }      }

Removed from v.1.68  
changed lines
  Added in v.1.71


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