--- loncom/homework/bridgetask.pm 2005/05/03 05:31:51 1.15
+++ loncom/homework/bridgetask.pm 2005/05/09 21:55:01 1.19
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.15 2005/05/03 05:31:51 albertel Exp $
+# $Id: bridgetask.pm,v 1.19 2005/05/09 21:55:01 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -95,14 +95,17 @@ sub add_grading_button {
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- &Apache::structuretags::initialize_storage();
- &Apache::lonhomework::showhash(%Apache::lonhomework::history);
my ($status,$accessmsg,$slot);
+ if ($target ne 'webgrade') {
+ &Apache::structuretags::initialize_storage();
+ &Apache::lonhomework::showhash(%Apache::lonhomework::history);
+ }
+
$Apache::lonhomework::parsing_a_task=1;
#should get back a or the neccesary stuff to start XML/MathML
my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
&Apache::structuretags::page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
-
+
if ($target eq 'web') {
$body_tag_start.=&add_previous_version_button();
if ($Apache::lonhomework::modifygrades) {
@@ -177,15 +180,21 @@ sub start_Task {
}
} elsif ($target eq 'webgrade') {
$result.=$head_tag_start.$body_tag_start.$form_tag_start;
+ $result.=
+ '';
$result.=&show_queue();
my $todo=&get_from_queue();
if ($todo) {
+ &setup_env_for_other_user($todo,$safeeval);
my ($symb,$uname,$udom)=&decode_queue_key($todo);
- $result.="\n".'
Found'.
- $symb.':'.$uname.':'.$udom.'
';
+ $result.="\n".'
Found '.
+ &Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.'
";
+ } else {
+ my ($symb,$uname,$udom) = &decode_queue_key($key);
+ my $title=&Apache::lonnet::gettitle($symb);
+ $result.="
$title
$uname
";
+ my $slot=$queue{$key}->[0];
+ my %slot_data=&Apache::lonnet::get_slot($slot);
+ $result.='
queue entry
End time: '.&Apache::lonlocal::locallocaltime($slot_data{'endtime'})."
";
+ }
}
$result.="
\n";
return $result;
@@ -305,12 +335,12 @@ sub queue_key_locked {
sub pick_from_queue_data {
my ($check_section,$queue,$cdom,$cnum)=@_;
- foreach my $key (sort(keys(%$queue))) {
+ foreach my $key (keys(%$queue)) {
my ($symb,$uname,$udom)=&decode_queue_key($key);
if ($check_section) {
my $section=&Apache::lonnet::getsection($uname,$udom);
- if ($section ne $check_section) {
- &Apache::lonnet::logthis("not my sec");
+ if ($section eq $check_section) {
+ &Apache::lonnet::logthis("my sec");
next;
}
}
@@ -331,7 +361,7 @@ sub pick_from_queue_data {
sub find_mid_grade {
my ($symb,$cdom,$cnum)=@_;
- my $todo=$env{'form.gradingkey'};
+ my $todo=&Apache::lonnet::unescape($env{'form.gradingkey'});
my $me=$env{'user.name'}.'@'.$env{'user.domain'};
if ($todo) {
my $who=&queue_key_locked($todo,$cdom,$cnum);
@@ -359,6 +389,7 @@ sub get_from_queue {
# FIXME need to find if I am 'mid grading'
$todo=&find_mid_grade($symb,$cdom,$cnum);
&Apache::lonnet::logthis("found ".join(':',&decode_queue_key($todo)));
+ if ($todo) { return $todo; }
while (1) {
my $starttime=time;
&Apache::lonnet::put('gradingqueue',{"$symb\0timestamp"=>$starttime},
@@ -438,11 +469,18 @@ sub end_ClosingParagraph {
return $result;
}
+sub get_id {
+ my ($parstack,$safeeval)=@_;
+ my $id=&Apache::lonxml::get_param('id',$parstack,$safeeval);
+ if (!$id) { $id=$Apache::lonxml::curdepth; }
+ return $id;
+}
+
my %dimension;
sub start_Dimension {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
undef(%dimension);
- my $dim_id=$Apache::lonxml::curdepth;
+ my $dim_id=&get_id($parstack,$safeeval);
$Apache::bridgetask::dimension=$dim_id;
push(@Apache::bridgetask::dimensionlist,$dim_id);
undef(@Apache::bridgetask::instance);
@@ -458,22 +496,50 @@ sub get_instance {
return $order[0];
}
-sub end_Dimension {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $result;
- if ($target eq 'web') {
- my $instance=&get_instance();
- $result=$dimension{'intro'}.$dimension{$instance.'.text'};
- } elsif ($target eq 'webgrade') {
+{
+ my $last_link;
+ sub end_Dimension {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result;
my $instance=&get_instance();
- $result.="\n".'
';
- foreach my $id (@{$dimension{$instance.'.criterias'}}) {
- $result.='
'.
- $dimension{$instance.'.criteria.'.$id}.'
';
+ if ($target eq 'web') {
+ $result=$dimension{'intro'}.$dimension{$instance.'.text'};
+ } elsif ($target eq 'webgrade') {
+ foreach my $id (@{$dimension{$instance.'.criterias'}}) {
+ my $link='criteria_'.$instance.'_'.$id;
+ $result.='