Diff for /loncom/homework/bridgetask.pm between versions 1.158 and 1.160

version 1.158, 2006/05/30 12:45:36 version 1.160, 2006/06/01 19:22:29
Line 43  use LONCAPA; Line 43  use LONCAPA;
     
   
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','Instance','InstanceText','Criteria','ClosingParagraph'));      &Apache::lonxml::register('Apache::bridgetask',('Task','IntroParagraph','Dimension','Question','QuestionText','Instance','InstanceText','Criteria','ClosingParagraph'));
 }  }
   
 sub initialize_bridgetask {  sub initialize_bridgetask {
Line 1257  sub show_queue { Line 1257  sub show_queue {
     my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);      my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
     my ($tmp)=%queue;      my ($tmp)=%queue;
     if ($tmp=~/^error: 2 /) {      if ($tmp=~/^error: 2 /) {
  return "\n<h3>Current Queue - $queue</h3><table border='1'><tr><td>Empty</td></tr></table>";   return "\n<h3>Current Queue - $queue</h3>".
       &Apache::loncommon::start_data_table().
       &Apache::loncommon::start_data_table_row().
       '<td>'.&mt('Empty').'</td>'.
       &Apache::loncommon::end_data_table_row().
       &Apache::loncommon::end_data_table();
     }      }
     my $title=&Apache::lonnet::gettitle($symb);      my $title=&Apache::lonnet::gettitle($symb);
     $result.="\n<h3>Current Queue - $title $queue </h3><table border='1'><tr>";      $result.="\n<h3>Current Queue - $title $queue </h3>".
    &Apache::loncommon::start_data_table().
    &Apache::loncommon::start_data_table_header_row();
     if ($with_selects) { $result.="<th>Status</th><th></th>"; }      if ($with_selects) { $result.="<th>Status</th><th></th>"; }
     $result.="<th>user</th><th>data</th></tr>";      $result.="<th>user</th><th>data</th>".
    &Apache::loncommon::end_data_table_header_row();
     foreach my $key (sort(keys(%queue))) {      foreach my $key (sort(keys(%queue))) {
  my ($symb,$uname,$udom) = &decode_queue_key($key);   my ($symb,$uname,$udom) = &decode_queue_key($key);
  if (!defined($classlist->{$uname.':'.$udom})) { next; }   if (!defined($classlist->{$uname.':'.$udom})) { next; }
Line 1277  sub show_queue { Line 1285  sub show_queue {
  }   }
   
  if ($key=~/locked$/ && !$with_selects) {   if ($key=~/locked$/ && !$with_selects) {
     $result.="<tr><td>$uname</td>";      $result.= &Apache::loncommon::start_data_table_row().
    "<td>$uname</td>";
     $result.='<td>'.$queue{$key}.'</td></tr>';      $result.='<td>'.$queue{$key}.'</td></tr>';
  } elsif ($key=~/timestamp$/ && !$with_selects) {   } elsif ($key=~/timestamp$/ && !$with_selects) {
     $result.="<tr><td></td>";      $result.=&Apache::loncommon::start_data_table_row()."<td></td>";
     $result.='<td>'.      $result.='<td>'.
  &Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>";   &Apache::lonlocal::locallocaltime($queue{$key})."</td></tr>";
  } elsif ($key!~/(timestamp|locked)$/) {   } elsif ($key!~/(timestamp|locked)$/) {
     $result.="<tr>";      $result.= &Apache::loncommon::start_data_table_row();
     my ($end_time,$slot_text);      my ($end_time,$slot_text);
     if (my $slot=&slotted_access($queue{$key})) {      if (my $slot=&slotted_access($queue{$key})) {
  my %slot_data=&Apache::lonnet::get_slot($slot);   my %slot_data=&Apache::lonnet::get_slot($slot);
Line 1336  FORM Line 1345  FORM
  " <tt>($uname:$udom)</tt> </td>";   " <tt>($uname:$udom)</tt> </td>";
     $result.='<td>'.$slot_text.' End time: '.      $result.='<td>'.$slot_text.' End time: '.
  &Apache::lonlocal::locallocaltime($end_time).   &Apache::lonlocal::locallocaltime($end_time).
  "</td></tr>";   "</td>".&Apache::loncommon::end_data_table_row();
  }   }
     }      }
     $result.="</table><hr />\n";      $result.= &Apache::loncommon::end_data_table()."<hr />\n";
     return $result;      return $result;
 }  }
   
Line 1643  sub select_user { Line 1652  sub select_user {
  $result.='<p> Showing only sections <tt>'.join(', ',@chosen_sections).   $result.='<p> Showing only sections <tt>'.join(', ',@chosen_sections).
     '</tt>.</p> '."\n";      '</tt>.</p> '."\n";
     }      }
     $result.='<table border="1">';      $result.=&Apache::loncommon::start_data_table();
   
     foreach my $student (sort {lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]) cmp lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]) } (keys(%$classlist))) {      foreach my $student (sort {lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]) cmp lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]) } (keys(%$classlist))) {
  my ($uname,$udom) = split(/:/,$student);   my ($uname,$udom) = split(/:/,$student);
Line 1668  sub select_user { Line 1677  sub select_user {
  my $todo =    my $todo = 
     &escape(&encode_queue_key($symb,$udom,$uname));      &escape(&encode_queue_key($symb,$udom,$uname));
  if ($cannot_grade) {   if ($cannot_grade) {
     $result.='<tr><td>&nbsp;</td><td>'.$classlist->{$student}[&Apache::loncoursedata::CL_FULLNAME()].      $result.=&Apache::loncommon::start_data_table_row().
    '<td>&nbsp;</td><td>'.$classlist->{$student}[&Apache::loncoursedata::CL_FULLNAME()].
  '</td><td>';   '</td><td>';
  } else {   } else {
     my $seclist;      my $seclist;
Line 1676  sub select_user { Line 1686  sub select_user {
  $seclist.='<input type="hidden" name="chosensections"    $seclist.='<input type="hidden" name="chosensections" 
                                value="'.$sec.'" />';                                 value="'.$sec.'" />';
     }      }
       $result.=&Apache::loncommon::start_data_table_row();
     $result.=<<RESULT;      $result.=<<RESULT;
 <tr>  
   <td>    <td>
     <form style="display: inline" method="post">      <form style="display: inline" method="post">
       <input type="hidden" name="gradingkey" value="$todo" />        <input type="hidden" name="gradingkey" value="$todo" />
Line 1726  RESULT Line 1736  RESULT
  } else {   } else {
     $result.="&nbsp;";      $result.="&nbsp;";
  }   }
  $result.= '</td></tr>';   $result.= '</td>'.&Apache::loncommon::end_data_table_row();
     }      }
     $result.='</table>';      $result.=&Apache::loncommon::end_data_table();
     return $result;      return $result;
 }  }
   
Line 1795  sub start_Dimension { Line 1805  sub start_Dimension {
     return &internal_location($dim_id);      return &internal_location($dim_id);
 }  }
   
   sub start_QuestionText {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
       my $dim_id=$Apache::bridgetask::dimension;
       my $text=&Apache::lonxml::get_all_text('/questiontext',$parser,$style);
       if ($target eq 'grade' || $target eq 'web' || $target eq 'webgrade') {
    $dimension{'questiontext'}=$text;
       }
       return '';
   }
   
   sub end_QuestionText {
       return '';
   }
   
 sub get_instance {  sub get_instance {
     my ($dim)=@_;      my ($dim)=@_;
     my $rand_alg=&Apache::lonnet::get_rand_alg();      my $rand_alg=&Apache::lonnet::get_rand_alg();
Line 1855  sub get_instance { Line 1879  sub get_instance {
     if (&Apache::response::showallfoils()) {      if (&Apache::response::showallfoils()) {
  @instances = @{$dimension{'instances'}};   @instances = @{$dimension{'instances'}};
     }      }
       my $shown_question_text;
     foreach my $instance (@instances) {      foreach my $instance (@instances) {
  @Apache::scripttag::parser_env = @_;   @Apache::scripttag::parser_env = @_;
  $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});   $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
    @Apache::scripttag::parser_env = @_;
    $result.=&Apache::scripttag::xmlparse($dimension{'questiontext'});
  if ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' ||   if ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' ||
     $Apache::lonhomework::history{"resource.$version.0.status"} eq 'fail') {      $Apache::lonhomework::history{"resource.$version.0.status"} eq 'fail') {
   
Line 1942  sub get_instance { Line 1969  sub get_instance {
     &Apache::scripttag::xmlparse($dimension{'intro'});      &Apache::scripttag::xmlparse($dimension{'intro'});
     @Apache::scripttag::parser_env = @_;      @Apache::scripttag::parser_env = @_;
     &Apache::scripttag::xmlparse($dimension{$instance.'.text'});      &Apache::scripttag::xmlparse($dimension{$instance.'.text'});
       @Apache::scripttag::parser_env = @_;
       &Apache::scripttag::xmlparse($dimension{'questiontext'});
     foreach my $id (@{$dimension{$instance.'.criterias'}},      foreach my $id (@{$dimension{$instance.'.criterias'}},
     @{$dimension{'criterias'}} ) {      @{$dimension{'criterias'}} ) {
  my $link=&link($id);   my $link=&link($id);
Line 1977  sub get_instance { Line 2006  sub get_instance {
   
     @Apache::scripttag::parser_env = @_;      @Apache::scripttag::parser_env = @_;
     $result.=&Apache::scripttag::xmlparse($dimension{'intro'});      $result.=&Apache::scripttag::xmlparse($dimension{'intro'});
       @Apache::scripttag::parser_env = @_;
       $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
       @Apache::scripttag::parser_env = @_;
       &Apache::scripttag::xmlparse($dimension{'questiontext'});
   
     foreach my $id (@{$dimension{$instance.'.criterias'}},      foreach my $id (@{$dimension{$instance.'.criterias'}},
     @{$dimension{'criterias'}}) {      @{$dimension{'criterias'}}) {
  my $link=&link($id);   my $link=&link($id);
  @Apache::scripttag::parser_env = @_;  
  $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});  
  my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$id.status"}=$env{'form.HWVAL_'.$link};   my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$id.status"}=$env{'form.HWVAL_'.$link};
  $Apache::lonhomework::results{"resource.$version.0.$dim.$id.comment"}=$env{'form.HWVAL_comment_'.$link};   $Apache::lonhomework::results{"resource.$version.0.$dim.$id.comment"}=$env{'form.HWVAL_comment_'.$link};
  my $mandatory=($dimension{'criteria.'.$id.'.mandatory'} ne 'N');   my $mandatory=($dimension{'criteria.'.$id.'.mandatory'} ne 'N');

Removed from v.1.158  
changed lines
  Added in v.1.160


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