[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm /xml scripttag.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 14 Sep 2005 18:25:42 -0000
This is a MIME encoded message
--albertel1126722342
Content-Type: text/plain
albertel Wed Sep 14 14:25:42 2005 EDT
Modified files:
/loncom/homework bridgetask.pm
/loncom/xml scripttag.pm
Log:
- <script> and <display> run during target 'webgrade'
- now delays evaluation of the <InstanceText> of an instance until after we have picked which one to do, and only evaluates that one.
- invalid status submissions are now counted as 'ungraded' rather than correct
--albertel1126722342
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20050914142542.txt"
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.46 loncom/homework/bridgetask.pm:1.47
--- loncom/homework/bridgetask.pm:1.46 Fri Sep 9 14:45:56 2005
+++ loncom/homework/bridgetask.pm Wed Sep 14 14:25:40 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.46 2005/09/09 18:45:56 albertel Exp $
+# $Id: bridgetask.pm,v 1.47 2005/09/14 18:25:40 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -987,7 +987,10 @@
my $instance=&get_instance();
my $version=&get_version();
if ($target eq 'web') {
- $result=$dimension{'intro'}.$dimension{$instance.'.text'};
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{'intro'});
+ @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') {
foreach my $id (@{$dimension{$instance.'.criterias'}}) {
@@ -1010,20 +1013,28 @@
}
}
} elsif ($target eq 'webgrade') {
+ # in case of any side effects that we need
+ @Apache::scripttag::parser_env = @_;
+ &Apache::scripttag::xmlparse($dimension{'intro'});
+ @Apache::scripttag::parser_env = @_;
+ &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.='<tr><td width="100%" valign="top">'.
'<a name="'.$link.'" />'.
'<a name="next_'.$last_link.'" />'.
- '<br /><textarea enabled="false" style="width:100%" rows="8" width="25" wrap="hard">'.$dimension{$instance.'.criteria.'.$id}.'</textarea>'.
+ '<br /><textarea enabled="false" style="width:100%" rows="8" width="25" wrap="hard">';
+ @Apache::scripttag::parser_env = @_;
+ $result.=&Apache::scripttag::xmlparse($dimension{$instance.'.criteria.'.$id});
+ $result.='</textarea>'.
#$dimension{$instance.'.criteria.'.$id}.
'</td>'.
'<td><nobr>Additional Comment for Student</nobr> <br />'.
'<textarea style="width:100%" rows="8" width="25" wrap="hard" name="HWVAL_comment_'.$link.'">'.&HTML::Entities::encode($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}).'</textarea>'.
'</td>'.
'<td>'.
- '<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').'/>'.&mt('Ungraded').'</label></nobr><br />'.
+ '<nobr><label><input type="radio" name="HWVAL_'.$link.'" value="ungraded" '.($status eq 'ungraded' || !$status ? 'checked="checked"':'').' />'.&mt('Ungraded').'</label></nobr><br />'.
'<label><input type="radio" name="HWVAL_'.$link.'" value="pass" '.($status eq 'pass' ? 'checked="checked"':'').' />'.&mt('Pass').'</label><br />'.
'<label><input type="radio" name="HWVAL_'.$link.'" value="fail" '.($status eq 'fail' ? 'checked="checked"':'').' />'.&mt('Fail').'</label><br />'.
'<label><input type="radio" name="HWVAL_'.$link.'" value="review" '.($status eq 'review' ? 'checked="checked"':'').' />'.&mt('Review').'</label><br />'.
@@ -1067,7 +1078,7 @@
} elsif ($status eq 'ungraded') {
$ungraded++;
} else {
- &Apache::lonxml::error("got weird status --$status--");
+ $ungraded++;
}
}
if ($optional_passed < $dimension{$instance.'.optionalrequired'}) {
@@ -1096,22 +1107,18 @@
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $result;
if ($target eq 'web' || $target eq 'webgrade') {
- if ($tagstack->[-2] eq 'Dimension' || $target eq 'webgrade') {
- &Apache::lonxml::startredirection();
+ if ($tagstack->[-2] eq 'Dimension') {
+ $dimension{'intro'}=&Apache::lonxml::get_all_text('/introparagraph',$parser);
+
+ } elsif ($target eq 'webgrade') {
+ &Apache::lonxml::get_all_text('/introparagraph',$parser);
}
+
}
return $result;
}
sub end_IntroParagraph {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $result;
- if ($target eq 'web' || $target eq 'webgrade') {
- if ($tagstack->[-2] eq 'Dimension' || $target eq 'webgrade') {
- $dimension{'intro'}=&Apache::lonxml::endredirection();
- }
- }
- return $result;
}
sub start_Instance {
@@ -1126,40 +1133,27 @@
}
sub end_Instance {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- return '';
}
sub start_InstanceText {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
+ my $instance_id=$Apache::bridgetask::instance[-1];
+ my $text=&Apache::lonxml::get_all_text('/instancetext',$parser);
if ($target eq 'web' || $target eq 'webgrade') {
- &Apache::lonxml::startredirection();
+ $dimension{$instance_id.'.text'}=$text;
}
return '';
}
sub end_InstanceText {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- my $instance_id=$Apache::bridgetask::instance[-1];
- if ($target eq 'web' || $target eq 'webgrade') {
- $dimension{$instance_id.'.text'}=&Apache::lonxml::endredirection();
- }
return '';
}
sub start_Criteria {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
- if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') {
- &Apache::lonxml::startredirection();
- }
- return '';
-}
-
-sub end_Criteria {
- my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
my $instance_id=$Apache::bridgetask::instance[-1];
+ my $criteria=&Apache::lonxml::get_all_text('/criteria',$parser);
if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') {
- my $criteria=&Apache::lonxml::endredirection();
my $id=&get_id($parstack,$safeeval);
$dimension{$instance_id.'.criteria.'.$id}=$criteria;
$dimension{$instance_id.'.criteria.'.$id.'.mandatory'}=
@@ -1169,6 +1163,9 @@
return '';
}
+sub end_Criteria {
+}
+
sub proctor_validation_screen {
my ($slot) = @_;
my (undef,undef,$domain,$user) = &Apache::lonxml::whichuser();
@@ -1180,6 +1177,7 @@
$msg='<p><font color="red">'.&mt("Failed to authenticate the proctor.")
.'</font></p>';
}
+ if (!$env{'form.proctordomain'}) { $env{'form.proctordomain'}=$domain; }
my $result= (<<ENDCHECKOUT);
<h2>Proctor Validation</h2>
<p>Your room's proctor needs to validate your access to this resource.</p>
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.129 loncom/xml/scripttag.pm:1.130
--- loncom/xml/scripttag.pm:1.129 Mon Jun 27 17:01:58 2005
+++ loncom/xml/scripttag.pm Wed Sep 14 14:25:40 2005
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# <script> definiton
#
-# $Id: scripttag.pm,v 1.129 2005/06/27 21:01:58 raeburn Exp $
+# $Id: scripttag.pm,v 1.130 2005/09/14 18:25:40 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -105,8 +105,8 @@
if ( $target eq "modified" ) {
$result=$token->[4].&Apache::edit::modifiedfield('/script',$parser);
} elsif ( $target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer' ||
- $target eq 'analyze' ) {
+ $target eq 'grade' || $target eq 'webgrade' ||
+ $target eq 'answer' || $target eq 'analyze' ) {
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/script",$parser);
if (!$Apache::lonxml::default_homework_loaded) {
&Apache::lonxml::default_homework_load($safeeval);
@@ -172,8 +172,8 @@
if ( $target eq "modified" ) {
$result=$token->[4].&Apache::edit::modifiedfield("/display",$parser);
} elsif ( $target eq 'web' || $target eq 'tex' ||
- $target eq 'grade' || $target eq 'answer' ||
- $target eq 'analyze') {
+ $target eq 'grade' || $target eq 'webgrade' ||
+ $target eq 'answer' || $target eq 'analyze') {
my $bodytext=&Apache::lonxml::get_all_text_unbalanced("/display",$parser);
if (!$Apache::lonxml::default_homework_loaded) {
&Apache::lonxml::default_homework_load($safeeval);
--albertel1126722342--