--- loncom/homework/bridgetask.pm 2006/11/06 17:50:17 1.184.2.4 +++ loncom/homework/bridgetask.pm 2006/10/31 21:29:38 1.188 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.184.2.4 2006/11/06 17:50:17 albertel Exp $ +# $Id: bridgetask.pm,v 1.188 2006/10/31 21:29:38 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -105,7 +105,7 @@ sub check_in { sub check_in_sequence { my ($user,$domain,$slot_name) = @_; my $navmap = Apache::lonnavmaps::navmap->new(); - my ($symb) = &Apache::lonxml::whichuser(); + my ($symb) = &Apache::lonnet::whichuser(); my ($map) = &Apache::lonnet::decode_symb($symb); my @resources = $navmap->retrieveResources($map, sub { $_[0]->is_problem() },0,0); @@ -225,7 +225,7 @@ sub add_previous_version_button { } sub add_grading_button { - my (undef,$cid)=&Apache::lonxml::whichuser(); + my (undef,$cid)=&Apache::lonnet::whichuser(); my $cnum=$env{'course.'.$cid.'.num'}; my $cdom=$env{'course.'.$cid.'.domain'}; my %sections = &Apache::loncommon::get_sections($cdom,$cnum); @@ -326,22 +326,9 @@ sub style { my ($target) = @_; if ($target eq 'web' || $target eq 'webgrade') { - my $style = (< STYLE - if ($env{'browser.type'} eq 'explorer' - && $env{'browser.os'} eq 'win' ) { - if ($env{'browser.version'} < 7) { - $style .= (< -STYLE - } else { - $style .= (< -STYLE - } - } - return $style; } return; } @@ -401,7 +388,7 @@ sub internal_location { } sub submission_time_stamp { - my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser(); my $submissiontime; my $version=$Apache::lonhomework::history{'resource.0.version'}; for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) { @@ -439,7 +426,7 @@ sub submission_time_stamp { sub file_list { my ($files,$uname,$udom) = @_; if (!defined($uname) || !defined($udom)) { - (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser(); + (undef,undef,$udom,$uname) = &Apache::lonnet::whichuser(); } my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/'; @@ -500,7 +487,7 @@ sub done_screen { my ($version) = @_; my $title=&Apache::lonnet::gettitle(); my @files=split(',',$Apache::lonhomework::history{'resource.'.$version.'.0.bridgetask.portfiles'}); - my (undef,undef,$domain,$user)= &Apache::lonxml::whichuser(); + my (undef,undef,$domain,$user)= &Apache::lonnet::whichuser(); my $files = '
    '; my $msg; foreach my $file (@files) { @@ -844,7 +831,7 @@ sub get_key_todo { if (defined($env{'form.regradeaspecificsubmission'}) && defined($env{'form.gradinguser'}) && defined($env{'form.gradingdomain'}) ) { - my ($symb,$cid)=&Apache::lonxml::whichuser(); + my ($symb,$cid)=&Apache::lonnet::whichuser(); my $cnum = $env{'course.'.$cid.'.num'}; my $cdom = $env{'course.'.$cid.'.domain'}; my $uname = $env{'form.gradinguser'}; @@ -1162,7 +1149,7 @@ DONEBUTTON $Apache::lonhomework::results{"resource.$version.0.solved"}='incorrect_by_override'; $Apache::lonhomework::results{"resource.$version.0.award"}='INCORRECT'; $Apache::lonhomework::results{"resource.$version.0.awarded"}='0'; - my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser(); if ($env{'form.regrade'} ne 'yes') { $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}= @@ -1178,7 +1165,7 @@ DONEBUTTON $Apache::lonhomework::results{"resource.$version.0.solved"}='correct_by_override'; $Apache::lonhomework::results{"resource.$version.0.award"}='EXACT_ANS'; $Apache::lonhomework::results{"resource.$version.0.awarded"}='1'; - my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$courseid,$udom,$uname)=&Apache::lonnet::whichuser(); if ($env{'form.regrade'} ne 'yes') { $Apache::lonhomework::results{"resource.$version.0.bridgetask.portfiles"}= $Apache::lonhomework::history{"resource.$version.0.bridgetask.portfiles"}; @@ -1286,7 +1273,7 @@ sub move_between_queues { sub check_queue_unlock { my ($queue,$key,$allow_not_me)=@_; if ($queue eq 'none') { return 'ok'; } - my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$udom,$uname)=&Apache::lonnet::whichuser(); if (!defined($key)) { $key="$symb\0queue\0$uname:$udom"; } @@ -1309,7 +1296,7 @@ sub in_queue { if ($queue eq 'none') { return 0; } if (!defined($symb) || !defined($cdom) || !defined($cnum) || !defined($udom) || !defined($uname)) { - ($symb,my $cid,$udom,$uname)=&Apache::lonxml::whichuser(); + ($symb,my $cid,$udom,$uname)=&Apache::lonnet::whichuser(); $cnum=$env{'course.'.$cid.'.num'}; $cdom=$env{'course.'.$cid.'.domain'}; } @@ -1328,7 +1315,7 @@ sub remove_from_queue { if ($queue eq 'none') { return 'ok'; } if (!defined($symb) || !defined($cdom) || !defined($cnum) || !defined($udom) || !defined($uname)) { - ($symb,my $cid,$udom,$uname)=&Apache::lonxml::whichuser(); + ($symb,my $cid,$udom,$uname)=&Apache::lonnet::whichuser(); $cnum=$env{'course.'.$cid.'.num'}; $cdom=$env{'course.'.$cid.'.domain'}; } @@ -1353,7 +1340,7 @@ sub setup_env_for_other_user { sub get_queue_data { my ($queue,$udom,$uname)=@_; - my ($symb,$cid,$other_udom,$other_uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$other_udom,$other_uname)=&Apache::lonnet::whichuser(); if (!$uname || !$udom) { $uname=$other_uname; $udom =$other_udom; @@ -1399,7 +1386,7 @@ sub check_queue_for_key { sub add_to_queue { my ($queue,$user_data)=@_; if ($queue eq 'none') { return 'ok'; } - my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$udom,$uname)=&Apache::lonnet::whichuser(); if (!$cid || $env{'request.state'} eq 'construct') { return 'no_queue'; } @@ -1437,7 +1424,7 @@ sub get_limited_classlist { sub show_queue { my ($queue,$with_selects)=@_; my $result; - my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$udom,$uname)=&Apache::lonnet::whichuser(); my $cnum=$env{'course.'.$cid.'.num'}; my $cdom=$env{'course.'.$cid.'.domain'}; @@ -1564,7 +1551,7 @@ FORM sub get_queue_counts { my ($queue)=@_; my $result; - my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$udom,$uname)=&Apache::lonnet::whichuser(); my $cnum=$env{'course.'.$cid.'.num'}; my $cdom=$env{'course.'.$cid.'.domain'}; @@ -1621,7 +1608,7 @@ sub decode_queue_key { sub queue_key_locked { my ($queue,$key,$cdom,$cnum)=@_; if (!defined($cdom) || !defined($cnum)) { - my (undef,$cid)=&Apache::lonxml::whichuser(); + my (undef,$cid)=&Apache::lonnet::whichuser(); $cnum=$env{'course.'.$cid.'.num'}; $cdom=$env{'course.'.$cid.'.domain'}; } @@ -1733,7 +1720,7 @@ sub find_mid_grade { sub lock_key { my ($queue,$todo)=@_; my $me=$env{'user.name'}.':'.$env{'user.domain'}; - my (undef,$cid)=&Apache::lonxml::whichuser(); + my (undef,$cid)=&Apache::lonnet::whichuser(); my $cnum=$env{'course.'.$cid.'.num'}; my $cdom=$env{'course.'.$cid.'.domain'}; my $success=&Apache::lonnet::newput($queue,{"$todo\0locked"=> $me}, @@ -1748,7 +1735,7 @@ sub lock_key { sub get_queue_symb_status { my ($queue,$symb,$cdom,$cnum) = @_; if (!defined($cdom) || !defined($cnum)) { - my (undef,$cid)=&Apache::lonxml::whichuser(); + my (undef,$cid)=&Apache::lonnet::whichuser(); $cnum=$env{'course.'.$cid.'.num'}; $cdom=$env{'course.'.$cid.'.domain'}; } @@ -1772,7 +1759,7 @@ sub get_queue_symb_status { sub get_from_queue { my ($queue)=@_; my $result; - my ($symb,$cid,$udom,$uname)=&Apache::lonxml::whichuser(); + my ($symb,$cid,$udom,$uname)=&Apache::lonnet::whichuser(); my $cnum=$env{'course.'.$cid.'.num'}; my $cdom=$env{'course.'.$cid.'.domain'}; my $todo=&find_mid_grade($queue,$symb,$cdom,$cnum); @@ -1848,7 +1835,7 @@ sub get_from_queue { } sub select_user { - my ($symb,$cid)=&Apache::lonxml::whichuser(); + my ($symb,$cid)=&Apache::lonnet::whichuser(); my @chosen_sections= &Apache::loncommon::get_env_multiple('form.chosensections'); @@ -2177,7 +2164,7 @@ sub get_criteria { } else { my $dim_status=$Apache::lonhomework::history{"resource.$version.0.$dim.status"}; my $mandatory='Mandatory'; - if (&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval) eq 'N') { + if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') { $mandatory='Optional'; } my $dim_info="
    \n"; @@ -2224,6 +2211,33 @@ sub get_criteria { $result.=$dimension{$id}{'result'}; next; } + my $status= &get_criteria('status', $version,$dim,$id); + my $comment=&get_criteria('comment',$version,$dim,$id); + my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N'); + if ($mandatory) { + $mandatory='Mandatory'; + } else { + $mandatory='Optional'; + } + if ($status eq 'fail') { + } elsif ($status eq 'pass') { + } else { + &Apache::lonxml::error("Student viewing a graded bridgetask was shown a status of $status"); + } + my $status_display=$status; + $status_display=~s/^([a-z])/uc($1)/e; + $result.= + '

    ' + .$mandatory.' Criteria

    '; + $result.= + &nested_parse(\$dimension{$dim}{'criteria.'.$id}, + [@_],{'set_dim_id' => $id}); + $result.='

    '.$status_display.'

    '; + if ($comment) { + $result.='

    '. + &mt('Comment: [_1]',$comment).'

    '; + } + $result.='
    '; } } } @@ -2481,7 +2495,6 @@ sub end_InstanceText { sub start_Criteria { my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_; my $criteria=&Apache::lonxml::get_all_text('/criteria',$parser,$style); - my $result = ''; if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') { my $dim = &get_dim_id(); my $id=&get_id($parstack,$safeeval); @@ -2499,37 +2512,9 @@ sub start_Criteria { $dimension{$dim}{'criteria.'.$id.'.mandatory'}= &Apache::lonxml::get_param('Mandatory',$parstack,$safeeval); push(@{$dimension{$dim}{'criterias'}},$id); - - my $version=&get_version(); - my $task_status = - $Apache::lonhomework::history{"resource.$version.0.status"}; - if ($target eq 'web' - && ($task_status eq 'pass' || $task_status eq 'fail')) { - my $status= &get_criteria('status', $version,$dim,$id); - my $comment=&get_criteria('comment',$version,$dim,$id); - my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N'); - if ($mandatory) { - $mandatory='Mandatory'; - } else { - $mandatory='Optional'; - } - my $status_display=$status; - $status_display=~s/^([a-z])/uc($1)/e; - $result.= - '

    ' - .$mandatory.' Criteria

    '; - $result.= - &nested_parse(\$dimension{$dim}{'criteria.'.$id},[@_]); - $result.='

    '.$status_display.'

    '; - if ($comment =~ /\w/) { - $result.='

    '. - &mt('Comment: [_1]',$comment).'

    '; - } - $result.='
    '; - } } } - return $result; + return ''; } sub end_Criteria { @@ -2559,7 +2544,7 @@ sub end_GraderNote { sub proctor_validation_screen { my ($slot) = @_; - my (undef,undef,$domain,$user) = &Apache::lonxml::whichuser(); + my (undef,undef,$domain,$user) = &Apache::lonnet::whichuser(); my $url=&Apache::lonnet::studentphoto($domain,$user,'jpg'); my $name=&Apache::loncommon::plainname($user,$domain);