";
+ $result.= &Apache::loncommon::start_data_table_row();
my ($end_time,$slot_text);
if (my $slot=&slotted_access($queue{$key})) {
my %slot_data=&Apache::lonnet::get_slot($slot);
@@ -1286,7 +1500,7 @@ sub show_queue {
$slot_text = '';
}
if ($with_selects) {
- my $ekey=&Apache::lonnet::escape($key);
+ my $ekey=&escape($key);
my ($action,$description,$status)=('select',&mt('Select'));
if (exists($queue{"$key\0locked"})) {
my $me=$env{'user.name'}.':'.$env{'user.domain'};
@@ -1327,21 +1541,21 @@ FORM
" ($uname:$udom) ";
$result.='
'.$slot_text.' End time: '.
&Apache::lonlocal::locallocaltime($end_time).
- "
\n";
+ $result.= &Apache::loncommon::end_data_table()."\n";
return $result;
}
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'};
- my $classlist=&Apache::loncoursedata::get_classlist();
+ my $classlist=&get_limited_classlist();
my $regexp="^$symb\0";
my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
@@ -1354,7 +1568,6 @@ sub get_queue_counts {
foreach my $key (sort(keys(%queue))) {
my ($symb,$uname,$udom) = &decode_queue_key($key);
if (!defined($classlist->{$uname.':'.$udom})) { next; }
-
if ($key=~/locked$/) {
$locks++;
} elsif ($key=~/timestamp$/) {
@@ -1395,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'};
}
@@ -1485,7 +1698,7 @@ sub pick_from_queue_data {
sub find_mid_grade {
my ($queue,$symb,$cdom,$cnum)=@_;
- my $todo=&Apache::lonnet::unescape($env{'form.gradingkey'});
+ my $todo=&unescape($env{'form.gradingkey'});
my $me=$env{'user.name'}.':'.$env{'user.domain'};
if ($todo) {
my $who=&queue_key_locked($queue,$todo,$cdom,$cnum);
@@ -1507,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},
@@ -1522,11 +1735,11 @@ 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'};
}
- my $classlist=&Apache::loncoursedata::get_classlist();
+ my $classlist=&get_limited_classlist();
my $regexp="^$symb\0";
my %queue=&Apache::lonnet::dump($queue,$cdom,$cnum,$regexp);
@@ -1546,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);
@@ -1554,7 +1767,7 @@ sub get_from_queue {
if ($todo) { return $todo; }
my $attempts=0;
- my $classlist=&Apache::loncoursedata::get_classlist();
+ my $classlist=&get_limited_classlist();
while (1) {
if ($attempts > 2) {
@@ -1622,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');
@@ -1634,7 +1847,7 @@ sub select_user {
$result.='
Showing only sections '.join(', ',@chosen_sections).
'.
'."\n";
}
- $result.='
';
+ $result.=&Apache::loncommon::start_data_table();
foreach my $student (sort {lc($classlist->{$a}[&Apache::loncoursedata::CL_FULLNAME()]) cmp lc($classlist->{$b}[&Apache::loncoursedata::CL_FULLNAME()]) } (keys(%$classlist))) {
my ($uname,$udom) = split(/:/,$student);
@@ -1657,9 +1870,10 @@ sub select_user {
}
}
my $todo =
- &Apache::lonnet::escape(&encode_queue_key($symb,$udom,$uname));
+ &escape(&encode_queue_key($symb,$udom,$uname));
if ($cannot_grade) {
- $result.='
'."\n".
@@ -1960,22 +2285,40 @@ sub get_instance {
$result.=&grading_history($version,$dim,$id);
$last_link=$link;
}
+ if (&nest()) {
+ &Apache::lonxml::debug(" for $dim stashing results into ".$dimension{$dim}{'nested'});
+ $dimension{$dimension{$dim}{'nested'}}{'result'}.=$result;
+ undef($result);
+ }
} elsif ($target eq 'grade' && $env{'form.webgrade'}) {
my $optional_passed=0;
my $mandatory_failed=0;
my $ungraded=0;
my $review=0;
- @Apache::scripttag::parser_env = @_;
- $result.=&Apache::scripttag::xmlparse($dimension{'intro'});
- foreach my $id (@{$dimension{$instance.'.criterias'}},
- @{$dimension{'criterias'}}) {
+ $result .= &nested_parse(\$dimension{$dim}{'intro'},[@_]);
+ $result .= &nested_parse(\$dimension{$dim}{$instance.'.text'},
+ [@_]);
+ $result .= &nested_parse(\$dimension{$dim}{'questiontext'},
+ [@_],{'set_dim_id' => undef});
+
+ foreach my $id (@{$dimension{$dim}{$instance.'.criterias'}},
+ @{$dimension{$dim}{'criterias'}}) {
my $link=&link($id);
- @Apache::scripttag::parser_env = @_;
- $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.text'});
- my $status=$Apache::lonhomework::results{"resource.$version.0.$dim.$id.status"}=$env{'form.HWVAL_'.$link};
- $Apache::lonhomework::results{"resource.$version.0.$dim.$id.comment"}=$env{'form.HWVAL_comment_'.$link};
- my $mandatory=($dimension{'criteria.'.$id.'.mandatory'} ne 'N');
+
+ my $type = $dimension{$dim}{'criteria.'.$id.'.type'};
+ if ($type eq 'criteria') {
+ # dimensional 'criteria' don't get assigned grades
+ $Apache::lonhomework::results{"resource.$version.0.$dim.$id.status"}=$env{'form.HWVAL_'.$link};
+ $Apache::lonhomework::results{"resource.$version.0.$dim.$id.comment"}=$env{'form.HWVAL_comment_'.$link};
+ } else {
+ $result .=
+ &nested_parse(\$dimension{$dim}{'criteria.'.$id},
+ [@_],{'set_dim_id' => $id});
+ }
+ my $status= &get_criteria('status',$version,$dim,$id);
+
+ my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
if ($status eq 'pass') {
if (!$mandatory) { $optional_passed++; }
} elsif ($status eq 'fail') {
@@ -1989,7 +2332,7 @@ sub get_instance {
}
}
# FIXME optional required can apply to only right now...
- my $opt_req=$dimension{$instance.'.optionalrequired'};
+ my $opt_req=$dimension{$dim}{$instance.'.optionalrequired'};
if ($opt_req !~ /\S/) {
$opt_req=
&Apache::lonxml::get_param('OptionalRequired',
@@ -1999,7 +2342,7 @@ sub get_instance {
if ($optional_passed < $opt_req) {
$mandatory_failed++;
}
- &Apache::lonxml::debug("all instance ".join(':',@{$dimension{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");
+ &Apache::lonxml::debug("all instance ".join(':',@{$dimension{$dim}{$instance.'.criterias'}})." results -> m_f $mandatory_failed o_p $optional_passed u $ungraded r $review");
if ($review) {
$Apache::lonhomework::results{"resource.$version.0.$dim.status"}=
'review';
@@ -2017,6 +2360,44 @@ sub get_instance {
# any other targets no output
undef($result);
}
+ &disable_dimension_parsing();
+ pop(@Apache::bridgetask::dimension);
+ return $result;
+ }
+
+ sub end_Setup {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $result=&Apache::lonxml::endredirection();
+ my $dim=&get_id($parstack,$safeeval);
+ my $instance=&get_instance($dim);
+ my $version=&get_version();
+ if ($target eq 'web') {
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{$dim}{'intro'});
+ my @instances = $instance;
+ if (&Apache::response::showallfoils()) {
+ @instances = @{$dimension{$dim}{'instances'}};
+ }
+ foreach my $instance (@instances) {
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{$dim}{$instance.'.text'});
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{$dim}{'questiontext'});
+ }
+ } elsif ($target eq 'webgrade'
+ || $target eq 'grade' && $env{'form.webgrade'}) {
+ # in case of any side effects that we need
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{$dim}{'intro'});
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{$dim}{$instance.'.text'});
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{$dim}{'questiontext'});
+ } else {
+ # any other targets no output
+ undef($result);
+ }
+ pop(@Apache::bridgetask::dimension);
return $result;
}
}
@@ -2056,9 +2437,10 @@ sub grading_history {
sub start_IntroParagraph {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result;
+ my $dim = &get_dim_id();
if ($target eq 'grade' || $target eq 'web' || $target eq 'webgrade') {
if ($tagstack->[-2] eq 'Dimension' || $tagstack->[-2] eq 'Question' ) {
- $dimension{'intro'}=
+ $dimension{$dim}{'intro'}=
&Apache::lonxml::get_all_text('/introparagraph',
$parser,$style);
} elsif ($tagstack->[-2] eq 'Task' && $target eq 'webgrade') {
@@ -2078,15 +2460,16 @@ sub end_IntroParagraph {
sub start_Instance {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $id=&get_id($parstack,$safeeval);
- push(@{$dimension{'instances'}},$id);
- push(@Apache::bridgetask::instance,$id);
+ my $dim = &get_dim_id();
+ my $id = &get_id($parstack,$safeeval);
+ push(@{$dimension{$dim}{'instances'}},$id);
+ push(@{$Apache::bridgetask::instance{$dim}},$id);
push(@Apache::bridgetask::instancelist,$id);
- $dimension{$id.'.optionalrequired'}=
+ $dimension{$dim}{$id.'.optionalrequired'}=
&Apache::lonxml::get_param('OptionalRequired',$parstack,$safeeval);
my $disabled = &Apache::lonxml::get_param('Disabled',$parstack,$safeeval);
if (lc($disabled) eq 'yes') {
- $dimension{$id.'.disabled'}='1';
+ $dimension{$dim}{$id.'.disabled'}='1';
}
return '';
}
@@ -2096,10 +2479,11 @@ sub end_Instance {
sub start_InstanceText {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
- my $instance_id=$Apache::bridgetask::instance[-1];
+ my $dim = &get_dim_id();
+ my $instance_id=$Apache::bridgetask::instance{$dim}[-1];
my $text=&Apache::lonxml::get_all_text('/instancetext',$parser,$style);
if ($target eq 'grade' || $target eq 'web' || $target eq 'webgrade') {
- $dimension{$instance_id.'.text'}=$text;
+ $dimension{$dim}{$instance_id.'.text'}=$text;
}
return '';
}
@@ -2112,18 +2496,22 @@ sub start_Criteria {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $criteria=&Apache::lonxml::get_all_text('/criteria',$parser,$style);
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') {
+ my $dim = &get_dim_id();
my $id=&get_id($parstack,$safeeval);
+ &Apache::lonxml::debug("Criteria $id with $dim");
if (&Apache::londefdef::is_inside_of($tagstack,'Instance')) {
- my $instance_id=$Apache::bridgetask::instance[-1];
- $dimension{"criteria.$instance_id.$id"}=$criteria;
- $dimension{"criteria.$instance_id.$id.mandatory"}=
+ my $instance_id=$Apache::bridgetask::instance{$dim}[-1];
+ $dimension{$dim}{"criteria.$instance_id.$id"}=$criteria;
+ $dimension{$dim}{"criteria.$instance_id.$id.type"}='criteria';
+ $dimension{$dim}{"criteria.$instance_id.$id.mandatory"}=
&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
- push(@{$dimension{$instance_id.'.criterias'}},"$instance_id.$id");
+ push(@{$dimension{$dim}{$instance_id.'.criterias'}},"$instance_id.$id");
} else {
- $dimension{'criteria.'.$id}=$criteria;
- $dimension{'criteria.'.$id.'.mandatory'}=
+ $dimension{$dim}{'criteria.'.$id}=$criteria;
+ $dimension{$dim}{'criteria.'.$id.'.type'}='criteria';
+ $dimension{$dim}{'criteria.'.$id.'.mandatory'}=
&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
- push(@{$dimension{'criterias'}},$id);
+ push(@{$dimension{$dim}{'criterias'}},$id);
}
}
return '';
@@ -2132,9 +2520,31 @@ sub start_Criteria {
sub end_Criteria {
}
+sub start_GraderNote {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+
+ if ($target eq 'webgrade') {
+ return '
'.
+ &mt('Note to graders:').'';
+ }
+ my $note=&Apache::lonxml::get_all_text('/gradernote',$parser,$style);
+ return;
+}
+
+sub end_GraderNote {
+ my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
+
+ if ($target eq 'webgrade') {
+ return '
';
+ }
+ return;
+}
+
+
+
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);