--- loncom/homework/bridgetask.pm 2006/04/10 07:37:39 1.138 +++ loncom/homework/bridgetask.pm 2006/04/15 01:06:59 1.142 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.138 2006/04/10 07:37:39 albertel Exp $ +# $Id: bridgetask.pm,v 1.142 2006/04/15 01:06:59 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -375,28 +375,28 @@ sub start_Task { } $Apache::lonhomework::parsing_a_task=1; - #should get back a 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 .= '
'."\n"; + my $name; if ($target eq 'web' || $target eq 'webgrade') { - $head_tag_start.=''. - &Apache::structuretags::get_resource_name($parstack,$safeeval). - ''; + $name = &Apache::structuretags::get_resource_name($parstack,$safeeval); } + my ($result,$form_tag_start)= + &Apache::structuretags::page_start($target,$token,$tagstack,$parstack, + $parser,$safeeval,$name,&style()); + + $result .= '
'."\n"; + + if ($target eq 'web' && $env{'request.state'} ne 'construct') { if ($Apache::lonhomework::modifygrades) { - $body_tag_start.='
'.&add_grading_button()."
"; + $result.=$uri.'">'.&add_grading_button().""; my $symb=&Apache::lonnet::symbread(); if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) { - $body_tag_start.='
'. + $result.=''. ''. ''. ''. + $result.=''. ''. ''. ''.$body_tag_start; if ($env{'request.state'} eq 'construct') { $result.=$form_tag_start; } @@ -497,9 +496,7 @@ DONESCREEN } } } elsif ($target eq 'web') { - $result.="$head_tag_start - $body_tag_start \n"; - + $result.=&preserve_grade_info(); $result.=&internal_location(); $result.=$form_tag_start. @@ -510,9 +507,7 @@ DONESCREEN $target eq 'webgrade') { my $webgrade='yes'; if ($target eq 'webgrade') { - $result.=$head_tag_start. - ''.$body_tag_start. - "\n".'
'."\n". + $result.= "\n".'
'."\n". ''; #$result.='
Review'.&show_queue('reviewqueue'); @@ -596,7 +591,7 @@ DONESCREEN $result.="\n".'
'; } } elsif ($target eq 'edit') { - $result.=$head_tag_start."".$body_tag_start.$form_tag_start. + $result.=$form_tag_start. &Apache::structuretags::problem_edit_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.")."
"; @@ -844,7 +839,8 @@ DONEBUTTON } } if ($target eq 'web') { - $result.="\n
\n".&Apache::lonxml::xmlend().''; + $result.="\n
\n". + &Apache::loncommon::end_page({'discussion' => 1}); } } if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) { @@ -984,7 +980,7 @@ DONEBUTTON #$result.=' '; $result.=''."\n
\n
\n". - &Apache::loncommon::endbodytag().''; + &Apache::loncommon::end_page(); } elsif ($target eq 'meta') { $result.=&Apache::response::meta_package_write('Task'); $result.=&Apache::response::meta_stores_write('solved','string', @@ -1321,12 +1317,13 @@ sub pick_from_queue_data { @possible = sort { $a->[1] <=> $b->[1] } @possible; # pick one of the entries in the top 10% in small queues and one # of the first ten entries in large queues - my $ten_percent = int($#possible * 0.1); - if ($ten_percent < 1 ) { $ten_percent = 1; } - if ($ten_percent > 10) { $ten_percent = 10; } - my $max=($#possible < $ten_percent) ? $#possible : $ten_percent; + #my $ten_percent = int($#possible * 0.1); + #if ($ten_percent < 1 ) { $ten_percent = 1; } + #if ($ten_percent > 10) { $ten_percent = 10; } + #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; }