--- loncom/homework/bridgetask.pm 2006/12/07 20:44:55 1.214 +++ loncom/homework/bridgetask.pm 2007/01/13 06:19:00 1.220 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.214 2006/12/07 20:44:55 albertel Exp $ +# $Id: bridgetask.pm,v 1.220 2007/01/13 06:19:00 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -98,6 +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(); } return 1; } @@ -590,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') { @@ -639,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; @@ -706,6 +711,7 @@ sub start_Task { $target eq 'webgrade') { my $webgrade='yes'; if ($target eq 'webgrade') { + $result .= '
'."\n"; $result.= "\n".'
'."\n". ''; @@ -1116,7 +1122,8 @@ DONEBUTTON } - if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) { + if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous + && $status eq 'CAN_ANSWER') { my $award='SUBMITTED'; &Apache::essayresponse::file_submission("$version.0",'bridgetask', 'portfiles',\$award); @@ -1577,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')); @@ -1697,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; } @@ -1778,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'}); @@ -1789,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$//; @@ -2462,7 +2486,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; }