--- loncom/homework/bridgetask.pm 2006/02/21 22:41:29 1.114 +++ loncom/homework/bridgetask.pm 2006/06/05 17:15:37 1.128.2.10 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.114 2006/02/21 22:41:29 albertel Exp $ +# $Id: bridgetask.pm,v 1.128.2.10 2006/06/05 17:15:37 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -155,7 +155,7 @@ sub add_previous_version_button { join("\n\n"; $list.=''; - $result.='
'. @@ -176,10 +176,10 @@ sub add_grading_button { if (scalar(keys(%sections)) < 3) { $size=scalar(keys(%sections))+2; } - my $sec_select = ''."\n"; $sec_select .= "\n"; foreach my $sec (sort {lc($a) cmp lc($b)} (keys(%sections))) { - $sec_select .= "\n"; + $sec_select .= "\n"; } $sec_select .= "\n"; @@ -213,6 +213,7 @@ sub add_grading_button { 'gradinguser', 'gradingdomain'); $result.=&Apache::loncommon::studentbrowser_javascript(); + $result.= '

'; } return $result; } @@ -236,7 +237,7 @@ STUFF if ($env{'request.enc'}) { $symb=&Apache::lonenc::encrypted($symb); } $symb=&Apache::lonnet::escape($symb); - $result.=''. + $result.=''. ''. ''. ' -.fail, .pass, .neutral { - position: relative; - margin : 5px; - margin-bottom :10px; - padding : 4px; - padding-left : 75px; - border : thin solid; - font-weight : bolder; - font-size: smaller; - font-family: Arial; - background-color : rgb(255,240,225); -} - -.fail h4, .pass h4 { - position:absolute; - left: -4px; - top: -8px; - padding:2px; - margin:0; - background-color : rgb(255,240,225); - border : thin solid; -} - -.fail { - color: red; -} - -.pass { - color : green; -} - -.neutral { - color : blue; -} - -.question { - border : thin solid black; - padding : 4px; - margin-bottom : 1em; -} - -.grade { - font-size: x-large; - font-family: Arial; - position:absolute; - left: 5px; - top: -5px; - width: 70px; -} - -div#feedback h1 { - color : inherit; -} - + my ($target) = @_; + if ($target eq 'web' + || $target eq 'webgrade') { + return (< STYLE - + } + return; } sub show_task { @@ -371,12 +322,15 @@ sub submission_time_stamp { return $result; } -sub webgrade_standard_info { - my ($version)=&get_version(); - my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser(); +sub file_list { + my ($files,$uname,$udom) = @_; + if (!defined($uname) || !defined($udom)) { + (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser(); + } my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/'; - my $file_list="'; @@ -527,9 +496,8 @@ DONESCREEN } } } elsif ($target eq 'web') { - my $name= &Apache::structuretags::get_resource_name($parstack,$safeeval); - $result.="$head_tag_start$name - $body_tag_start \n".&style(); + $result.="$head_tag_start + $body_tag_start \n"; $result.=&preserve_grade_info(); $result.=&internal_location(); @@ -541,7 +509,11 @@ DONESCREEN $target eq 'webgrade') { my $webgrade='yes'; if ($target eq 'webgrade') { - $result.=$head_tag_start.''.$body_tag_start; + $result.=$head_tag_start. + ''.$body_tag_start. + "\n".'
'."\n". + ''; #$result.='
Review'.&show_queue('reviewqueue'); #$result.='
Grade'.&show_queue('gradingqueue'); } @@ -620,7 +592,7 @@ DONESCREEN if ($webgrade eq 'yes') { $result.=&webgrade_standard_info(); } } if ($target eq 'webgrade') { - $result.="\n".'
'; + $result.="\n".'
'; } } elsif ($target eq 'edit') { $result.=$head_tag_start."".$body_tag_start.$form_tag_start. @@ -815,8 +787,9 @@ sub end_Task { &show_task($status,$previous)) { $result.=&Apache::inputtags::gradestatus('0'); $result.=''; + my $action = &Apache::lonenc::check_encrypt($env{'request.uri'}); $result.=< +
@@ -833,7 +806,7 @@ DONEBUTTON my $start_time= &Apache::lonlocal::locallocaltime($slot{'starttime'}); - my $status = "\n
\n"; + my $status = "\n
\n"; if ($bt_status eq 'pass') { $status.='

You passed the '.$title.' given on '. @@ -869,8 +842,8 @@ DONEBUTTON $result=~s/\Q$internal_location\E/$status/; } } - if ($target eq 'web' || $target eq 'webgrade') { - $result.=&Apache::lonxml::xmlend().''; + if ($target eq 'web') { + $result.="\n

\n".&Apache::lonxml::xmlend().''; } } if ($target eq 'grade' && !$env{'form.webgrade'} && !$previous) { @@ -1000,7 +973,7 @@ DONEBUTTON &Apache::structuretags::finalize_storage(); } } elsif ($target eq 'webgrade') { - $result.="
\n
"; + $result.="
"; #$result.=' '; #$result.=' '; #$result.=' '; - $result.=''.&Apache::loncommon::endbodytag().''; + $result.=''."\n
\n
\n". + &Apache::loncommon::endbodytag().''; } elsif ($target eq 'meta') { $result.=&Apache::response::meta_package_write('Task'); $result.=&Apache::response::meta_stores_write('solved','string', @@ -1226,7 +1200,7 @@ sub show_queue { $result.=(<$status -
+ @@ -1344,9 +1318,15 @@ sub pick_from_queue_data { if (@possible) { # sort entries in order by slot end time @possible = sort { $a->[1] <=> $b->[1] } @possible; - # pick one of the first ten entries - my $max=($#possible < 10) ? $#possible : 10; - return $possible[int(rand($max))][0]; + # 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; + + #return $possible[int(rand($max))][0]; + return $possible[0][0]; } return undef; } @@ -1534,7 +1514,7 @@ sub select_user { $result.=< - + @@ -1688,6 +1668,10 @@ sub get_instance { { my $last_link; + sub link { + my ($instance,$id) = @_; + return 'LC_GRADING_criteria_'.$instance.'_'.$id; + } sub end_Dimension { my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_; my $result=&Apache::lonxml::endredirection(); @@ -1712,7 +1696,7 @@ sub get_instance { if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') { $mandatory='Optional'; } - my $dim_info="
\n"; + my $dim_info="
\n"; if ($dim_status eq 'pass') { $dim_info.='

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

'; } @@ -1762,13 +1746,14 @@ sub get_instance { my $status_display=$status; $status_display=~s/^([a-z])/uc($1)/e; @Apache::scripttag::parser_env = @_; - $result.='

'.$mandatory. - ' Criteria

'; + $result.= + '

' + .$mandatory.' Criteria

'; @Apache::scripttag::parser_env = @_; $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.criteria.'.$id}); - $result.='

'.$status_display.'

'; + $result.='

'.$status_display.'

'; if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}) { - $result.='

'.&mt('Comment: [_1]',$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}).'

'; + $result.='

'.&mt('Comment: [_1]',$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"}).'

'; } $result.='
'; } @@ -1781,26 +1766,24 @@ sub get_instance { @Apache::scripttag::parser_env = @_; &Apache::scripttag::xmlparse($dimension{$instance.'.text'}); foreach my $id (@{$dimension{$instance.'.criterias'}}) { - my $link='criteria_'.$instance.'_'.$id; + my $link=&link($instance,$id); my $status=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"}; - $result.='
'."\n". - ''."\n". - ''."\n". - '
'."\n"; + $result.='
'."\n". + '
'."\n"; @Apache::scripttag::parser_env = @_; $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.criteria.'.$id}); $result.='
'."\n". #$dimension{$instance.'.criteria.'.$id}. - '
'."\n". - ''."\n". - ''."\n". - ''."\n". - ''."\n". + '
'."\n". + ''."\n". + ''."\n". + ''."\n". + ''."\n". '
'."\n". - '