--- loncom/homework/bridgetask.pm 2005/04/04 18:14:58 1.9
+++ loncom/homework/bridgetask.pm 2005/05/10 16:44:35 1.21
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# definition of tags that give a structure to a document
#
-# $Id: bridgetask.pm,v 1.9 2005/04/04 18:14:58 albertel Exp $
+# $Id: bridgetask.pm,v 1.21 2005/05/10 16:44:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -48,22 +48,26 @@ sub initialize_bridgetask {
$Apache::bridgetask::dimension='';
# list of all Dimension ids seen
@Apache::bridgetask::dimensionlist=();
+ # mandatory attribute of all Dimensions seen
+ %Apache::bridgetask::dimensionmandatory=();
# list of all current Instance ids
@Apache::bridgetask::instance=();
# list of all Instance ids seen in this problem
@Apache::bridgetask::instancelist=();
+ # key of queud user data that we are currently grading
+ $Apache::bridgetask::queue_key='';
}
sub proctor_check_auth {
my ($slot)=@_;
- my $user=$ENV{'form.proctorname'};
- my $domain=$ENV{'form.proctordomain'};
+ my $user=$env{'form.proctorname'};
+ my $domain=$env{'form.proctordomain'};
my @allowed=split(",",$slot->{'proctor'});
foreach my $possible (@allowed) {
my ($puser,$pdom)=(split('@',$possible));
if ($puser eq $user && $pdom eq $domain) {
- my $authhost=&Apache::lonnet::authenticate($puser,$ENV{'form.proctorpassword'},$pdom);
+ my $authhost=&Apache::lonnet::authenticate($puser,$env{'form.proctorpassword'},$pdom);
if ($authhost ne 'no_host') {
$Apache::lonhomework::results{'resource.checkedin'}=
$user.'@'.$domain;
@@ -82,26 +86,43 @@ sub add_previous_version_button {
return $result;
}
+sub add_grading_button {
+ my $result;
+ $result.=' ';
+ $result.='';
+ return $result;
+}
+
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) {
+ $body_tag_start.='
";
+ }
}
- if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
+ if ($target eq 'web' || ($target eq 'grade' && !$env{'form.webgrade'}) || $target eq 'answer' ||
$target eq 'tex') {
- ($status,$accessmsg,$slot) =
+ ($status,$accessmsg,my $slot_name,$slot) =
&Apache::lonhomework::check_task_access('0');
push(@Apache::inputtags::status,$status);
+ $Apache::inputtags::slot_name=$slot_name;
my $expression='$external::datestatus="'.$status.'";';
$expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
&Apache::run::run($expression,$safeeval);
@@ -152,13 +173,39 @@ sub start_Task {
$body_tag_start \n $form_tag_start".
'';
# if we are viewing someone else preserve that info
- if (defined $ENV{'form.grade_symb'}) {
+ if (defined $env{'form.grade_symb'}) {
foreach my $field ('symb','courseid','domain','username') {
$result .= ''."\n";
+ '" value="'.$env{"form.grade_$field"}.'" />'."\n";
}
}
}
+ } elsif ( ($target eq 'grade' && $env{'form.webgrade'}) ||
+ $target eq 'webgrade') {
+ if ($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 '.
+ &Apache::lonnet::gettitle($symb).' for '.$uname.' at '.$udom.'