--- loncom/homework/bridgetask.pm 2005/11/21 21:51:29 1.81 +++ loncom/homework/bridgetask.pm 2006/02/21 18:36:30 1.113 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # definition of tags that give a structure to a document # -# $Id: bridgetask.pm,v 1.81 2005/11/21 21:51:29 albertel Exp $ +# $Id: bridgetask.pm,v 1.113 2006/02/21 18:36:30 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,21 +80,28 @@ sub proctor_check_auth { } } if ($authenticated && $type eq 'Task') { + # increment version my $version= - $Apache::lonhomework::results{'resource.version'}= - ++$Apache::lonhomework::history{'resource.version'}; - $Apache::lonhomework::results{"resource.$version.checkedin"}= - $user.'@'.$domain; - $Apache::lonhomework::results{"resource.$version.checkedin.slot"}= - $slot_name; + $Apache::lonhomework::history{'resource.0.version'}; + $version++; + + #clean out all current results foreach my $key (keys(%Apache::lonhomework::history)) { if ($key=~/^resource\.0\./) { $Apache::lonhomework::results{$key}=''; } } + + #setup new version and who did it + $Apache::lonhomework::results{'resource.0.version'}=$version; + $Apache::lonhomework::results{"resource.$version.0.checkedin"}= + $user.'@'.$domain; + $Apache::lonhomework::results{"resource.$version.0.checkedin.slot"}= + $slot_name; + return 1; } elsif ($authenticated && $type eq 'problem') { - &Apache::lonxml::debug("authed #slot_name"); + &Apache::lonxml::debug("authed $slot_name"); $Apache::lonhomework::results{"resource.0.checkedin"}= $user.'@'.$domain; $Apache::lonhomework::results{"resource.0.checkedin.slot"}= @@ -109,11 +116,11 @@ sub get_version { my ($version,$previous); if ($env{'form.previousversion'} && $env{'form.previousversion'} ne 'current' && - defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.status'})) { + defined($Apache::lonhomework::history{'resource.'.$env{'form.previousversion'}.'.0.status'})) { $version=$env{'form.previousversion'}; $previous=1; } else { - $version=$Apache::lonhomework::history{'resource.version'}; + $version=$Apache::lonhomework::history{'resource.0.version'}; $previous=0; } if (wantarray) { @@ -125,10 +132,10 @@ sub get_version { sub add_previous_version_button { my ($status)=@_; my $result; - if ($Apache::lonhomework::history{'resource.version'} eq '') { + if ($Apache::lonhomework::history{'resource.0.version'} eq '') { return ''; } - if ($Apache::lonhomework::history{'resource.version'} < 2 && + if ($Apache::lonhomework::history{'resource.0.version'} < 2 && $status ne 'NEEDS_CHECKIN') { return ''; } @@ -139,8 +146,8 @@ sub add_previous_version_button { "\n"; } my @to_show; - foreach my $test_version (1..$Apache::lonhomework::history{'resource.version'}) { - if (defined($Apache::lonhomework::history{'resource.'.$test_version.'.status'})) { + foreach my $test_version (1..$Apache::lonhomework::history{'resource.0.version'}) { + if (defined($Apache::lonhomework::history{'resource.'.$test_version.'.0.status'})) { push(@to_show,$test_version); } } @@ -181,19 +188,32 @@ sub add_grading_button { $result.=''; if (&Apache::lonnet::allowed('mgq',$env{'request.course.id'})) { my ($entries,$ready,$locks)=&get_queue_counts('gradingqueue'); - $result.='
Specify a section: '.$sec_select.'
'; - $result.=''.&mt("Grading Queue has [_1] entries. [_2] of them are ready to be graded and [_3] of them are currently being graded",$entries,$ready,$locks); + $result.='
Specify a section: | '.$sec_select.' | '; + $result.=''.' '; - $result.=' '."\n"; + $result.= &mt("[_1] entries, [_2] ready, [_3] being graded",$entries,$ready,$locks).' |
'. + ' '; + $result.=&mt("[_1] entries, [_2] ready, [_3] being graded", + $entries,$ready,$locks).' | ||
'."\n"; + $result.=''; + $result.=&Apache::loncommon::select_dom_form($env{'user.domain'}, + 'gradingdomain'); + $result.=' '. + &Apache::loncommon::selectstudent_link('gradesubmission', + 'gradinguser', + 'gradingdomain'); + $result.=&Apache::loncommon::studentbrowser_javascript(); + } return $result; } @@ -322,7 +342,7 @@ sub internal_location { sub submission_time_stamp { my ($symb,$courseid,$udom,$uname)=&Apache::lonxml::whichuser(); my $submissiontime; - my $version=$Apache::lonhomework::history{'resource.version'}; + my $version=$Apache::lonhomework::history{'resource.0.version'}; for (my $v=$Apache::lonhomework::history{'version'};$v>0;$v--) { if (defined($Apache::lonhomework::history{$v.':resource.'.$version.'.0.bridgetask.portfiles'})) { $submissiontime=$Apache::lonhomework::history{$v.':timestamp'}; @@ -330,7 +350,7 @@ sub submission_time_stamp { } my $result; if ($submissiontime) { - my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.checkedin.slot'}; + my $slot_name=$Apache::lonhomework::history{'resource.'.$version.'.0.checkedin.slot'}; my %slot=&Apache::lonnet::get_slot($slot_name); my $diff = $slot{'endtime'} - $submissiontime; my ($color,$when)=('#FF6666','after'); @@ -355,13 +375,13 @@ sub webgrade_standard_info { my ($version)=&get_version(); my (undef,undef,$udom,$uname) = &Apache::lonxml::whichuser(); my $file_url = '/uploaded/'.$udom.'/'.$uname.'/portfolio/'; - my $file_list="
Empty |
"; } - $result.=" | resource | user | type | data |
---|
Status | "; } + $result.=" | user | data |
---|---|---|---|
$title | $uname | "; - $result.='lock | '.$queue{$key}.' |
$uname | "; + $result.=''.$queue{$key}.' | ||
$title | "; - $result.=' | last queue modification time | '. + $result.=" |
"; + $result.=' | '. &Apache::lonlocal::locallocaltime($queue{$key})." | ||
- | $fullname->{$student} | +$fullname->{$student} ($studentdis) | RESULT } @@ -1370,6 +1549,9 @@ RESULT if ($status{'version'}) { $result .= ' '.&mt('Version').' '.$status{'version'}; } + if ($status{'grader'}) { + $result .= ' '.&mt('(Graded by [_1])',$status{'grader'}).' '; + } $result.= ' | ';
if ($status{'reviewqueue'} eq 'enqueued') {
$result .= &mt('Awaiting Review');
@@ -1393,17 +1575,23 @@ RESULT
}
sub get_student_status {
- my ($symb,$cid,$udom,$uname)=@_;
- my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},
- $udom,$uname);
+ my ($symb,$cdom,$cnum,$udom,$uname,$type)=@_;
+
my %status;
- $status{'status'}=$record{'resource.status'};
- $status{'version'}=$record{'resource.version'};
- $status{'grader'}=$record{'resource.grader'};
- $status{'reviewqueue'}=&check_queue_for_key($cid,'reviewqueue',
- &encode_queue_key($symb,$udom,$uname));
- $status{'gradingqueue'}=&check_queue_for_key($cid,'gradingqueue',
- &encode_queue_key($symb,$udom,$uname));
+
+ if ($type eq 'Task') {
+ my %record = &Apache::lonnet::restore($symb,$env{'request.course.id'},
+ $udom,$uname);
+ $status{'status'}=$record{'resource.0.status'};
+ $status{'version'}=$record{'resource.0.version'};
+ $status{'grader'}=$record{'resource.0.regrader'};
+ }
+ $status{'reviewqueue'}=
+ &check_queue_for_key($cdom,$cnum,'reviewqueue',
+ &encode_queue_key($symb,$udom,$uname));
+ $status{'gradingqueue'}=
+ &check_queue_for_key($cdom,$cnum,'gradingqueue',
+ &encode_queue_key($symb,$udom,$uname));
return %status;
}
@@ -1503,10 +1691,10 @@ sub get_instance {
foreach my $instance (@instances) {
@Apache::scripttag::parser_env = @_;
$result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
- if ($Apache::lonhomework::history{"resource.$version.status"} eq 'pass' ||
- $Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
+ if ($Apache::lonhomework::history{"resource.$version.0.status"} eq 'pass' ||
+ $Apache::lonhomework::history{"resource.$version.0.status"} eq 'fail') {
- my $dim_status=$Apache::lonhomework::history{"resource.$version.$dim.status"};
+ my $dim_status=$Apache::lonhomework::history{"resource.$version.0.$dim.status"};
my $mandatory='Mandatory';
if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') {
$mandatory='Optional';
@@ -1526,12 +1714,12 @@ sub get_instance {
if ($dimension{$instance.'.criteria.'.$id.'.mandatory'}
eq 'N') {
$opt_count++;
- if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"} eq 'pass') {
+ if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"} eq 'pass') {
$opt_passed++;
}
} else {
$man_count++;
- if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"} eq 'pass') {
+ if ($Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"} eq 'pass') {
$man_passed++;
}
}
@@ -1545,8 +1733,8 @@ sub get_instance {
$result=~s/\Q$internal_location\E/$dim_info/;
foreach my $id (@{$dimension{$instance.'.criterias'}}) {
- my $status=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"};
- my $comment=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"};
+ my $status=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.status"};
+ my $comment=$Apache::lonhomework::history{"resource.$version.0.$dim.$instance.$id.comment"};
my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');
if ($mandatory) {
$mandatory='Mandatory';
@@ -1566,8 +1754,8 @@ sub get_instance {
@Apache::scripttag::parser_env = @_;
$result.=&Apache::scripttag::xmlparse($dimension{$instance.'.criteria.'.$id});
$result.=' '.$status_display.' '; - if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}) { - $result.=''.$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}.' '; + 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.=''; } @@ -1581,29 +1769,30 @@ sub get_instance { &Apache::scripttag::xmlparse($dimension{$instance.'.text'}); foreach my $id (@{$dimension{$instance.'.criterias'}}) { my $link='criteria_'.$instance.'_'.$id; - my $status=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"}; - $result.=' |
'.
- ''.
- ''.
- ' | '.
- ''. - ''. - ' | '.
- ''.
- ' '. - ' '. - ' '. - ' '. - ' | '.
- ''.
- 'Prev '. - 'Next '. - ' |