--- loncom/homework/bridgetask.pm 2007/01/10 21:46:24 1.216 +++ loncom/homework/bridgetask.pm 2007/03/26 23:33:26 1.224.2.2 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.216 2007/01/10 21:46:24 albertel Exp $ +# $Id: bridgetask.pm,v 1.224.2.2 2007/03/26 23:33:26 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -98,7 +98,7 @@ sub check_in { &check_in_sequence($user,$domain,$slot_name); } else { &create_new_version($type,$user,$domain,$slot_name); - &Apache::structuretags::finalize_storage($res->symb); + &Apache::structuretags::finalize_storage(); } return 1; } @@ -591,7 +591,6 @@ sub start_Task { &Apache::structuretags::page_start($target,$token,$tagstack, $parstack,$parser,$safeeval, $name,&style($target)); - $result .= '
'."\n"; } if ($target eq 'web' && $env{'request.state'} ne 'construct') { @@ -640,6 +639,11 @@ sub start_Task { 'slot' => $slot_name}); ($version,$previous)=&get_version(); } + + my $status_id = + ($previous || $status eq 'SHOW_ANSWER') ? 'LC_task_feedback' + : 'LC_task_take'; + $result .= '
'."\n"; push(@Apache::inputtags::status,$status); $Apache::inputtags::slot_name=$slot_name; @@ -707,6 +711,7 @@ sub start_Task { $target eq 'webgrade') { my $webgrade='yes'; if ($target eq 'webgrade') { + $result .= '
'."\n"; $result.= "\n".'
'."\n". ''; @@ -863,8 +868,8 @@ sub get_key_todo { my ($symb,$cid)=&Apache::lonnet::whichuser(); my $cnum = $env{'course.'.$cid.'.num'}; my $cdom = $env{'course.'.$cid.'.domain'}; - my $uname = $env{'form.gradinguser'}; - my $udom = $env{'form.gradingdomain'}; + my $uname = &LONCAPA::clean_username($env{'form.gradinguser'}); + my $udom = &LONCAPA::clean_domain($env{'form.gradingdomain'}); my $gradingkey=&encode_queue_key($symb,$udom,$uname); @@ -1579,17 +1584,16 @@ sub show_queue { my $ekey=&escape($key); my ($action,$description,$status)=('select',&mt('Select')); if (exists($queue{"$key\0locked"})) { - my $locker = $queue{"$key\0locked"}; - my $time; - if (ref($queue{"$key\0locked"}) eq 'ARRAY') { - ($locker, $time) = @{$queue{"$key\0locked"}}; + my ($locker,$time) = + &get_lock_info($queue{"$key\0locked"}); + if ($time) { $time = &Apache::lonnavmaps::timeToHumanString($time, 'start'); } my $me=$env{'user.name'}.':'.$env{'user.domain'}; $status=&mt('Locked by [_1] [_2]',$locker,$time); - if ($me eq $queue{"$key\0locked"}) { + if ($me eq $locker) { ($action,$description)=('resume',&mt('Resume')); } else { ($action,$description)=('unlock',&mt('Unlock')); @@ -1699,7 +1703,7 @@ sub queue_key_locked { my ($key_locked,$value)= &Apache::lonnet::get($queue,["$key\0locked"],$cdom,$cnum); if ($key_locked eq "$key\0locked") { - return $value; + return &get_lock_info($value); } return undef; } @@ -1780,6 +1784,24 @@ sub pick_from_queue_data { return undef; } +sub get_lock_info { + my ($lock_info) = @_; + if (wantarray) { + if (ref($lock_info) eq 'ARRAY') { + return @{$lock_info}; + } else { + return ($lock_info); + } + } else { + if (ref($lock_info) eq 'ARRAY') { + return $lock_info->[0]; + } else { + return $lock_info; + } + } + return; +} + sub find_mid_grade { my ($queue,$symb,$cdom,$cnum)=@_; my $todo=&unescape($env{'form.gradingkey'}); @@ -1791,7 +1813,7 @@ sub find_mid_grade { my $regexp="^$symb\0.*\0locked\$"; my %locks=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp); foreach my $key (keys(%locks)) { - my $who=$locks{$key}; + my $who= &get_lock_info($locks{$key}); if ($who eq $me) { $todo=$key; $todo=~s/\0locked$//; @@ -2223,7 +2245,6 @@ sub end_Dimension { my $result=&Apache::lonxml::endredirection(); my $dim=&get_id($parstack,$safeeval); if (&skip_dimension_parsing($dim)) { - &disable_dimension_parsing($dim); pop(@Apache::bridgetask::dimension); return; } @@ -2268,10 +2289,10 @@ sub end_Dimension { ('sub' x $dimension{$dim}{'depth'}).'question'; $ucquestion =~ s/^(.)/uc($1)/e; if ($dim_status eq 'pass') { - $dim_info.='

'.$ucquestion.' : you passed the above '.$mandatory.' '.$question.'

'; + $dim_info.='

'.$ucquestion.' : you passed this '.$mandatory.' '.$question.'

'; } if ($dim_status eq 'fail') { - $dim_info.='

'.$ucquestion.' : you did not pass the above '.$mandatory.' '.$question.'

'; + $dim_info.='

'.$ucquestion.' : you did not pass this '.$mandatory.' '.$question.'

'; } my %counts = &get_counts($dim,$instance,$parstack, $safeeval); @@ -2301,8 +2322,11 @@ sub end_Dimension { } } # puts the results at the end of the dimension - $result .= $dim_info; - + if ($result =~m{}) { + $result=~s{}{$dim_info}; + } else { + $result .= $dim_info; + } # puts the results at the beginning of the dimension # my $internal_location=&internal_location($dim); # $result=~s/\Q$internal_location\E/$dim_info/; @@ -2464,7 +2488,15 @@ sub question_status_message { $status .= '.'; if ($counts->{'opt'}) { $status .= ' You were required to pass '.$counts->{'opt_req'}. - ' optional component'.($counts->{'opt_req'} == 1?'':'s'); + ' optional '; + if ($counts->{'opt_dim'} + $counts->{'man_dim'} < 1) { + $status .= + ($counts->{'opt_req'} == 1?'criterion':'criteria'); + } else { + $status .= + 'component'.($counts->{'opt_req'} == 1?'':'s'); + } + $status .= '.'; } return $status; } @@ -2804,11 +2836,13 @@ sub proctor_validation_screen { .'

'; } if (!$env{'form.proctordomain'}) { $env{'form.proctordomain'}=$domain; } + my $uri = &Apache::lonenc::check_encrypt($env{'request.uri'}); + $uri = &HTML::Entities::encode($uri,'<>&"'); my $result= (<Proctor Validation

Your room's proctor needs to validate your access to this resource.

$msg -
+