--- loncom/homework/bridgetask.pm 2006/02/20 21:43:16 1.111 +++ loncom/homework/bridgetask.pm 2006/03/31 20:31:38 1.128.2.6 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.111 2006/02/20 21:43:16 albertel Exp $ +# $Id: bridgetask.pm,v 1.128.2.6 2006/03/31 20:31:38 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="'; + $result.=<$title

Files submitted: $files

@@ -516,9 +493,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(); @@ -530,7 +506,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'); } @@ -609,7 +589,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. @@ -804,8 +784,9 @@ sub end_Task { &show_task($status,$previous)) { $result.=&Apache::inputtags::gradestatus('0'); $result.=''; + my $action = &Apache::lonenc::check_encrypt($env{'request.uri'}); $result.=< +
@@ -822,7 +803,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 '. @@ -858,8 +839,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) { @@ -989,7 +970,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', @@ -1215,7 +1197,7 @@ sub show_queue { $result.=(<$status -
+ @@ -1523,7 +1505,7 @@ sub select_user { $result.=< - + @@ -1677,6 +1659,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(); @@ -1701,7 +1687,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

'; } @@ -1751,13 +1737,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.='
'; } @@ -1770,30 +1757,29 @@ 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"; + $result.=&grading_history($version,$dim,$instance,$id); $last_link=$link; } } elsif ($target eq 'grade' && $env{'form.webgrade'}) { @@ -1802,8 +1788,9 @@ sub get_instance { my $ungraded=0; my $review=0; foreach my $id (@{$dimension{$instance.'.criterias'}}) { - my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.status"}=$env{'form.HWVAL_criteria_'.$instance.'_'.$id}; - $Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.comment"}=$env{'form.HWVAL_comment_criteria_'.$instance.'_'.$id}; + my $link=&link($instance,$id); + my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.status"}=$env{'form.HWVAL_'.$link}; + $Apache::lonhomework::results{"resource.$version.0.$dim.$instance.$id.comment"}=$env{'form.HWVAL_comment_'.$link}; my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N'); if ($status eq 'pass') { if (!$mandatory) { $optional_passed++; } @@ -1842,6 +1829,38 @@ sub get_instance { } } +sub grading_history { + my ($version,$dim,$instance,$criteria) = @_; + if (!&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) { + return ''; + } + my ($result,$grader); + my $scope="resource.$version.0.$dim.$instance.$criteria"; + foreach my $t (1..$Apache::lonhomework::history{'version'}) { + if (exists($Apache::lonhomework::history{$t.':resource.0.regrader'})) { + my ($gname,$gdom) = + split('@',$Apache::lonhomework::history{$t.':resource.0.regrader'}); + my $fullname = &Apache::loncommon::plainname($gname,$gdom); + $grader = &Apache::loncommon::aboutmewrapper($fullname, + $gname,$gdom); + } + my $entry; + if (exists($Apache::lonhomework::history{"$t:$scope.status"})) { + $entry.="".$Apache::lonhomework::history{"$t:$scope.status"}.''; + } + if (exists($Apache::lonhomework::history{"$t:$scope.comment"})) { + $entry.=' comment: "'.$Apache::lonhomework::history{"$t:$scope.comment"}.'"'; + } + if ($entry) { + $result.= "
  • $grader : $entry
  • "; + } + } + if ($result) { + return '
      '.$result.'
    '; + } + return ''; +} + sub start_IntroParagraph { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $result; @@ -1849,8 +1868,8 @@ sub start_IntroParagraph { if ($tagstack->[-2] eq 'Dimension') { $dimension{'intro'}=&Apache::lonxml::get_all_text('/introparagraph',$parser,$style); - } elsif ($target eq 'webgrade') { - &Apache::lonxml::get_all_text('/introparagraph',$parser,$style); + } elsif ($tagstack->[-2] eq 'Task' && $target eq 'webgrade') { + &Apache::lonxml::startredirection(); } } @@ -1858,6 +1877,10 @@ sub start_IntroParagraph { } sub end_IntroParagraph { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; + if ($tagstack->[-2] eq 'Task' && $target eq 'webgrade') { + my $result = &Apache::lonxml::endredirection(); + } } sub start_Instance { @@ -1925,7 +1948,7 @@ sub proctor_validation_screen {

    Proctor Validation

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

    $msg - +