Diff for /loncom/homework/bridgetask.pm between versions 1.138 and 1.142

version 1.138, 2006/04/10 07:37:39 version 1.142, 2006/04/15 01:06:59
Line 375  sub start_Task { Line 375  sub start_Task {
     }       } 
   
     $Apache::lonhomework::parsing_a_task=1;      $Apache::lonhomework::parsing_a_task=1;
     #should get back a <html> or the neccesary stuff to start XML/MathML  
     my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=  
  &Apache::structuretags::page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);  
       
     $head_tag_start .= &style($target);  
     $body_tag_start .= '<div class="LC_task">'."\n";  
   
       my $name;
     if ($target eq 'web' || $target eq 'webgrade') {      if ($target eq 'web' || $target eq 'webgrade') {
  $head_tag_start.='<title>'.   $name = &Apache::structuretags::get_resource_name($parstack,$safeeval);
     &Apache::structuretags::get_resource_name($parstack,$safeeval).  
     '</title>';  
     }      }
   
       my ($result,$form_tag_start)=
    &Apache::structuretags::page_start($target,$token,$tagstack,$parstack,
      $parser,$safeeval,$name,&style());
       
       $result .= '<div class="LC_task">'."\n";
   
   
     if ($target eq 'web' && $env{'request.state'} ne 'construct') {      if ($target eq 'web' && $env{'request.state'} ne 'construct') {
  if ($Apache::lonhomework::modifygrades) {   if ($Apache::lonhomework::modifygrades) {
     $body_tag_start.='<form name="gradesubmission" method="post" action="';      $result.='<form name="gradesubmission" method="post" action="';
     my $uri=$env{'request.uri'};      my $uri=$env{'request.uri'};
     if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }      if ($env{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
     $body_tag_start.=$uri.'">'.&add_grading_button()."</form>";      $result.=$uri.'">'.&add_grading_button()."</form>";
     my $symb=&Apache::lonnet::symbread();      my $symb=&Apache::lonnet::symbread();
     if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {      if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) {
  $body_tag_start.='<form method="post" name="slotrequest" action="/adm/slotrequest">'.   $result.='<form method="post" name="slotrequest" action="/adm/slotrequest">'.
     '<input type="hidden" name="symb" value="'.$symb.'" />'.      '<input type="hidden" name="symb" value="'.$symb.'" />'.
     '<input type="hidden" name="command" value="showslots" />'.      '<input type="hidden" name="command" value="showslots" />'.
     '<input type="submit" name="requestattempt" value="'.      '<input type="submit" name="requestattempt" value="'.
Line 405  sub start_Task { Line 405  sub start_Task {
  my $target_id =    my $target_id = 
     &Apache::lonstathelpers::make_target_id({symb => $symb,      &Apache::lonstathelpers::make_target_id({symb => $symb,
      part => '0'});       part => '0'});
  $body_tag_start.='<form method="post" name="gradingstatus" action="/adm/statistics">'.   $result.='<form method="post" name="gradingstatus" action="/adm/statistics">'.
     '<input type="hidden" name="problemchoice" value="'.$target_id.'" />'.      '<input type="hidden" name="problemchoice" value="'.$target_id.'" />'.
     '<input type="hidden" name="reportSelected" value="grading_analysis" />'.      '<input type="hidden" name="reportSelected" value="grading_analysis" />'.
     '<input type="submit" name="grading" value="'.      '<input type="submit" name="grading" value="'.
Line 428  sub start_Task { Line 428  sub start_Task {
  $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.0.solved"}.'";';   $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$version.0.solved"}.'";';
  &Apache::run::run($expression,$safeeval);   &Apache::run::run($expression,$safeeval);
  &Apache::lonxml::debug("Got $status");   &Apache::lonxml::debug("Got $status");
  $body_tag_start.=&add_previous_version_button($status);   $result.=&add_previous_version_button($status);
  if (!&show_task($status,$previous)) {   if (!&show_task($status,$previous)) {
     my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style);      my $bodytext=&Apache::lonxml::get_all_text("/task",$parser,$style);
     if ( $target eq "web" ) {      if ( $target eq "web" ) {
  $result.= $head_tag_start.'</head>'.$body_tag_start;  
  if ($env{'request.state'} eq 'construct') {   if ($env{'request.state'} eq 'construct') {
     $result.=$form_tag_start;      $result.=$form_tag_start;
  }   }
Line 497  DONESCREEN Line 496  DONESCREEN
  }   }
     }      }
  } elsif ($target eq 'web') {   } elsif ($target eq 'web') {
     $result.="$head_tag_start</head>  
               $body_tag_start \n";  
       
     $result.=&preserve_grade_info();      $result.=&preserve_grade_info();
     $result.=&internal_location();      $result.=&internal_location();
     $result.=$form_tag_start.      $result.=$form_tag_start.
Line 510  DONESCREEN Line 507  DONESCREEN
       $target eq 'webgrade') {        $target eq 'webgrade') {
  my $webgrade='yes';   my $webgrade='yes';
  if ($target eq 'webgrade') {   if ($target eq 'webgrade') {
     $result.=$head_tag_start.      $result.= "\n".'<div class="LC_GRADING_task">'."\n".
  '</head>'.$body_tag_start.  
  "\n".'<div class="LC_GRADING_task">'."\n".  
  '<script type="text/javascript"    '<script type="text/javascript" 
                          src="/res/adm/includes/task_grading.js"></script>';                           src="/res/adm/includes/task_grading.js"></script>';
     #$result.='<br />Review'.&show_queue('reviewqueue');      #$result.='<br />Review'.&show_queue('reviewqueue');
Line 596  DONESCREEN Line 591  DONESCREEN
     $result.="\n".'<div id="LC_GRADING_criterialist">';      $result.="\n".'<div id="LC_GRADING_criterialist">';
  }   }
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result.=$head_tag_start."</head>".$body_tag_start.$form_tag_start.   $result.=$form_tag_start.
     &Apache::structuretags::problem_edit_header();      &Apache::structuretags::problem_edit_header();
  $Apache::lonxml::warnings_error_header=   $Apache::lonxml::warnings_error_header=
     &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."<br />";      &mt("Editor Errors - these errors might not effect the running of the problem, but they will likely cause problems with further use of the Edit mode. Please use the EditXML mode to fix these errors.")."<br />";
Line 844  DONEBUTTON Line 839  DONEBUTTON
  }   }
     }       } 
     if ($target eq 'web') {      if ($target eq 'web') {
  $result.="\n</div>\n".&Apache::lonxml::xmlend().'</html>';   $result.="\n</div>\n".
       &Apache::loncommon::end_page({'discussion' => 1});
     }      }
  }   }
  if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) {   if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) {
Line 984  DONEBUTTON Line 980  DONEBUTTON
  #$result.='<input type="submit" name="save" value="'.   #$result.='<input type="submit" name="save" value="'.
  #    &mt('Save Partial Grade and Continue Grading').'" /> ';   #    &mt('Save Partial Grade and Continue Grading').'" /> ';
  $result.='</form>'."\n</div>\n</div>\n".   $result.='</form>'."\n</div>\n</div>\n".
     &Apache::loncommon::endbodytag().'</html>';      &Apache::loncommon::end_page();
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  $result.=&Apache::response::meta_package_write('Task');   $result.=&Apache::response::meta_package_write('Task');
         $result.=&Apache::response::meta_stores_write('solved','string',          $result.=&Apache::response::meta_stores_write('solved','string',
Line 1321  sub pick_from_queue_data { Line 1317  sub pick_from_queue_data {
  @possible = sort { $a->[1] <=> $b->[1] } @possible;   @possible = sort { $a->[1] <=> $b->[1] } @possible;
  # pick one of the entries in the top 10% in small queues and one   # pick one of the entries in the top 10% in small queues and one
  # of the first ten entries in large queues   # of the first ten entries in large queues
  my $ten_percent = int($#possible * 0.1);   #my $ten_percent = int($#possible * 0.1);
  if ($ten_percent < 1 ) { $ten_percent = 1;  }   #if ($ten_percent < 1 ) { $ten_percent = 1;  }
  if ($ten_percent > 10) { $ten_percent = 10; }   #if ($ten_percent > 10) { $ten_percent = 10; }
  my $max=($#possible < $ten_percent) ? $#possible : $ten_percent;   #my $max=($#possible < $ten_percent) ? $#possible : $ten_percent;
   
  return $possible[int(rand($max))][0];   #return $possible[int(rand($max))][0];
    return $possible[0][0];
     }      }
     return undef;      return undef;
 }  }

Removed from v.1.138  
changed lines
  Added in v.1.142


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