version 1.20, 2005/05/10 16:03:44
|
version 1.21, 2005/05/10 16:44:35
|
Line 117 sub start_Task {
|
Line 117 sub start_Task {
|
$body_tag_start.=$uri.'">'.&add_grading_button()."</form>"; |
$body_tag_start.=$uri.'">'.&add_grading_button()."</form>"; |
} |
} |
} |
} |
if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || |
if ($target eq 'web' || ($target eq 'grade' && !$env{'form.webgrade'}) || $target eq 'answer' || |
$target eq 'tex') { |
$target eq 'tex') { |
($status,$accessmsg,my $slot_name,$slot) = |
($status,$accessmsg,my $slot_name,$slot) = |
&Apache::lonhomework::check_task_access('0'); |
&Apache::lonhomework::check_task_access('0'); |
Line 180 sub start_Task {
|
Line 180 sub start_Task {
|
} |
} |
} |
} |
} |
} |
} elsif ($target eq 'webgrade') { |
} elsif ( ($target eq 'grade' && $env{'form.webgrade'}) || |
$result.=$head_tag_start.$body_tag_start.$form_tag_start; |
$target eq 'webgrade') { |
$result.='<input type="hidden" name="webgrade" value="yes" />'; |
if ($target eq 'webgrade') { |
$result.=&show_queue(); |
$result.=$head_tag_start.$body_tag_start.$form_tag_start; |
|
$result.='<input type="hidden" name="webgrade" value="yes" />'; |
|
$result.=&show_queue(); |
|
} |
my $todo=&get_from_queue(); |
my $todo=&get_from_queue(); |
if ($todo) { |
if ($todo) { |
&setup_env_for_other_user($todo,$safeeval); |
&setup_env_for_other_user($todo,$safeeval); |
Line 197 sub start_Task {
|
Line 200 sub start_Task {
|
&Apache::lonhomework::showhash(%Apache::lonhomework::history); |
&Apache::lonhomework::showhash(%Apache::lonhomework::history); |
$result.="\n".'<table width="100%" style="width:100%" border="1">'; |
$result.="\n".'<table width="100%" style="width:100%" border="1">'; |
} else { |
} else { |
$result.="\n". |
if ($target eq 'webgrade') { |
'<table><tr><td>No user to be graded.</td></tr></table>'; |
$result.="\n". |
|
'<table><tr><td>No user to be graded.</td></tr></table>'; |
|
} |
my $bodytext=&Apache::lonxml::get_all_text("/task",$parser); |
my $bodytext=&Apache::lonxml::get_all_text("/task",$parser); |
} |
} |
|
|
} 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 |
$result = ''; |
$result = ''; |
Line 256 sub end_Task {
|
Line 260 sub end_Task {
|
my $mandatory_failed=0; |
my $mandatory_failed=0; |
my $ungraded=0; |
my $ungraded=0; |
my $review=0; |
my $review=0; |
|
&Apache::lonhomework::showhash(%Apache::lonhomework::results); |
foreach my $dim_id (@Apache::bridgetask::dimensionlist) { |
foreach my $dim_id (@Apache::bridgetask::dimensionlist) { |
my $status= |
my $status= |
$Apache::lonhomeork::results{"resource.$dim_id.status"}; |
$Apache::lonhomework::results{"resource.$dim_id.status"}; |
my $mandatory= |
my $mandatory= |
($Apache::bridgetask::dimensionmandatory{$dim_id} ne 'N'); |
($Apache::bridgetask::dimensionmandatory{$dim_id} ne 'N'); |
if ($status eq 'pass') { |
if ($status eq 'pass') { |
Line 274 sub end_Task {
|
Line 279 sub end_Task {
|
if ($optional_passed < $optional_required) { |
if ($optional_passed < $optional_required) { |
$mandatory_failed++; |
$mandatory_failed++; |
} |
} |
$Apache::lonhomeork::results{'resource.grader'}= |
&Apache::lonxml::debug("all dim ".join(':',@Apache::bridgetask::dimensionlist)."results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review"); |
|
$Apache::lonhomework::results{'resource.grader'}= |
$env{'user.name'}.'@'.$env{'user.domain'}; |
$env{'user.name'}.'@'.$env{'user.domain'}; |
if ($review) { |
if ($review) { |
$Apache::lonhomeork::results{'resource.status'}='review'; |
$Apache::lonhomework::results{'resource.status'}='review'; |
&move_to_review_queue(); |
&move_to_review_queue(); |
} elsif ($ungraded) { |
} elsif ($ungraded) { |
$Apache::lonhomeork::results{'resource.status'}='ungraded'; |
$Apache::lonhomework::results{'resource.status'}='ungraded'; |
&check_queue_unlock(); |
&check_queue_unlock(); |
} elsif ($mandatory_failed) { |
} elsif ($mandatory_failed) { |
$Apache::lonhomeork::results{'resource.status'}='fail'; |
$Apache::lonhomework::results{'resource.status'}='fail'; |
$Apache::lonhomework::results{"resource.0.award"}='EXACT_ANS'; |
$Apache::lonhomework::results{"resource.0.award"}='EXACT_ANS'; |
&remove_from_queue(); |
&remove_from_queue(); |
} else { |
} else { |
$Apache::lonhomeork::results{'resource.status'}='pass'; |
$Apache::lonhomework::results{'resource.status'}='pass'; |
$Apache::lonhomework::results{"resource.0.award"}='INCORRECT'; |
$Apache::lonhomework::results{"resource.0.award"}='INCORRECT'; |
&remove_from_queue(); |
&remove_from_queue(); |
} |
} |
|
&Apache::structuretags::finalize_storage(); |
} |
} |
} elsif ($target eq 'webgrade') { |
} elsif ($target eq 'webgrade') { |
$result.="</table>\n<hr />"; |
$result.="</table>\n<hr />"; |
Line 312 sub end_Task {
|
Line 319 sub end_Task {
|
return $result; |
return $result; |
} |
} |
|
|
|
sub move_to_review_queue { |
|
&Apache::lonxml::debug("Want to move"); |
|
} |
|
|
|
sub check_queue_unlock { |
|
&Apache::lonxml::debug("Want to unlock?"); |
|
} |
|
|
|
sub remove_from_queue { |
|
&Apache::lonxml::debug("Want to remove. Done?"); |
|
} |
|
|
sub setup_env_for_other_user { |
sub setup_env_for_other_user { |
my ($queue_key,$safeeval)=@_; |
my ($queue_key,$safeeval)=@_; |
my ($symb,$uname,$udom)=&decode_queue_key($queue_key); |
my ($symb,$uname,$udom)=&decode_queue_key($queue_key); |
Line 554 sub get_instance {
|
Line 573 sub get_instance {
|
sub end_Dimension { |
sub end_Dimension { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $result; |
my $result; |
|
my $dim_id=&get_id($parstack,$safeeval); |
my $instance=&get_instance(); |
my $instance=&get_instance(); |
if ($target eq 'web') { |
if ($target eq 'web') { |
$result=$dimension{'intro'}.$dimension{$instance.'.text'}; |
$result=$dimension{'intro'}.$dimension{$instance.'.text'}; |
} elsif ($target eq 'webgrade') { |
} elsif ($target eq 'webgrade') { |
foreach my $id (@{$dimension{$instance.'.criterias'}}) { |
foreach my $id (@{$dimension{$instance.'.criterias'}}) { |
my $link='criteria_'.$instance.'_'.$id; |
my $link='criteria_'.$instance.'_'.$id; |
my $status=$Apache::lonhomeork::history{'resource.'.$instance.'.'.$id.'.status'}; |
my $status=$Apache::lonhomework::history{'resource.'.$instance.'.'.$id.'.status'}; |
$result.='<tr><td width="100%" valign="top">'. |
$result.='<tr><td width="100%" valign="top">'. |
'<a name="'.$link.'" />'. |
'<a name="'.$link.'" />'. |
'<a name="next_'.$last_link.'" />'. |
'<a name="next_'.$last_link.'" />'. |
Line 568 sub get_instance {
|
Line 588 sub get_instance {
|
#$dimension{$instance.'.criteria.'.$id}. |
#$dimension{$instance.'.criteria.'.$id}. |
'</td>'. |
'</td>'. |
'<td><nobr>Additional Comment for Student</nobr> <br />'. |
'<td><nobr>Additional Comment for Student</nobr> <br />'. |
'<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomeork::history{'resource.'.$instance.'.'.$id.'.comment'}).'</textarea>'. |
'<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{'resource.'.$instance.'.'.$id.'.comment'}).'</textarea>'. |
'</td>'. |
'</td>'. |
'<td>'. |
'<td>'. |
'<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').'/>Ungraded</label></nobr><br />'. |
'<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').'/>Ungraded</label></nobr><br />'. |
Line 590 sub get_instance {
|
Line 610 sub get_instance {
|
my $ungraded=0; |
my $ungraded=0; |
my $review=0; |
my $review=0; |
foreach my $id (@{$dimension{$instance.'.criterias'}}) { |
foreach my $id (@{$dimension{$instance.'.criterias'}}) { |
my $status=$Apache::lonhomeork::results{'resource.'.$instance.'.'.$id.'.status'}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id}; |
my $status=$Apache::lonhomework::results{'resource.'.$instance.'.'.$id.'.status'}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id}; |
$Apache::lonhomeork::results{'resource.'.$instance.'.'.$id.'.comment'}=$env{'form.HWVAL_comment_'.$instance.'_'.$id}; |
$Apache::lonhomework::results{'resource.'.$instance.'.'.$id.'.comment'}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id}; |
my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N'); |
my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N'); |
if ($status eq 'pass') { |
if ($status eq 'pass') { |
if (!$mandatory) { $optional_passed++; } |
if (!$mandatory) { $optional_passed++; } |
} elsif ($status eq 'fail') { |
} elsif ($status eq 'fail') { |
if ($mandatory) { $mandatory_failed++; } |
if ($mandatory) { $mandatory_failed++; } |
} elsif ($status eq 'ungraded') { |
|
$ungraded++; |
|
} elsif ($status eq 'review') { |
} elsif ($status eq 'review') { |
$review++; |
$review++; |
|
} elsif ($status eq 'ungraded') { |
|
$ungraded++; |
|
} else { |
|
&Apache::lonxml::error("got wierd status --$status--"); |
} |
} |
} |
} |
if ($optional_passed < $dimension{$instance.'.optionalrequired'}) { |
if ($optional_passed < $dimension{$instance.'.optionalrequired'}) { |
$mandatory_failed++; |
$mandatory_failed++; |
} |
} |
|
&Apache::lonxml::debug("all instance ".join(':',@{$dimension{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review"); |
if ($review) { |
if ($review) { |
$Apache::lonhomeork::results{'resource.'.$instance.'.status'}='review'; |
$Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='review'; |
} elsif ($ungraded) { |
} elsif ($ungraded) { |
$Apache::lonhomeork::results{'resource.'.$instance.'.status'}='ungraded'; |
$Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='ungraded'; |
} elsif ($mandatory_failed) { |
} elsif ($mandatory_failed) { |
$Apache::lonhomeork::results{'resource.'.$instance.'.status'}='fail'; |
$Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='fail'; |
} else { |
} else { |
$Apache::lonhomeork::results{'resource.'.$instance.'.status'}='pass'; |
$Apache::lonhomework::results{'resource.'.$dim_id.'.status'}='pass'; |
} |
} |
} |
} |
return $result; |
return $result; |
Line 677 sub end_InstanceText {
|
Line 700 sub end_InstanceText {
|
|
|
sub start_Criteria { |
sub start_Criteria { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') { |
&Apache::lonxml::startredirection(); |
&Apache::lonxml::startredirection(); |
} |
} |
return ''; |
return ''; |
Line 686 sub start_Criteria {
|
Line 709 sub start_Criteria {
|
sub end_Criteria { |
sub end_Criteria { |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; |
my $instance_id=$Apache::bridgetask::instance[-1]; |
my $instance_id=$Apache::bridgetask::instance[-1]; |
if ($target eq 'web' || $target eq 'webgrade') { |
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') { |
my $criteria=&Apache::lonxml::endredirection(); |
my $criteria=&Apache::lonxml::endredirection(); |
my $id=&get_id($parstack,$safeeval); |
my $id=&get_id($parstack,$safeeval); |
$dimension{$instance_id.'.criteria.'.$id}=$criteria; |
$dimension{$instance_id.'.criteria.'.$id}=$criteria; |