--- loncom/homework/bridgetask.pm	2006/10/31 21:29:38	1.188
+++ loncom/homework/bridgetask.pm	2006/11/06 17:53:06	1.193
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: bridgetask.pm,v 1.188 2006/10/31 21:29:38 albertel Exp $
+# $Id: bridgetask.pm,v 1.193 2006/11/06 17:53:06 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -326,9 +326,22 @@ sub style {
     my ($target) = @_;
     if ($target eq 'web'
 	|| $target eq 'webgrade') {
-	return (<<STYLE);
+	my $style = (<<STYLE);
 <link rel="stylesheet" type="text/css" href="/res/adm/includes/task.css" />
 STYLE
+        if ($env{'browser.type'} eq 'explorer'
+	    && $env{'browser.os'} eq 'win' ) {
+	    if ($env{'browser.version'} < 7) {
+		$style .= (<<STYLE);
+<link rel="stylesheet" type="text/css" href="/res/adm/includes/task_ie.css" />
+STYLE
+            } else {
+		$style .= (<<STYLE);
+<link rel="stylesheet" type="text/css" href="/res/adm/includes/task_ie7.css" />
+STYLE
+	    }
+	}
+	return $style;
     }
     return;
 }
@@ -2164,7 +2177,7 @@ sub get_criteria {
 		} else {
 		    my $dim_status=$Apache::lonhomework::history{"resource.$version.0.$dim.status"};
 		    my $mandatory='Mandatory';
-		    if ($Apache::bridgetask::dimensionmandatory{$dim} eq 'N') {
+		    if (&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval) eq 'N') {
 			$mandatory='Optional';
 		    }
 		    my $dim_info="<div class='LC_$dim_status LC_question_grade'>\n";
@@ -2211,33 +2224,6 @@ sub get_criteria {
 			    $result.=$dimension{$id}{'result'};
 			    next;
 			}
-			my $status= &get_criteria('status', $version,$dim,$id);
-			my $comment=&get_criteria('comment',$version,$dim,$id);
-			my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
-			if ($mandatory) {
-			    $mandatory='Mandatory';
-			} else {
-			    $mandatory='Optional';
-			}
-			if ($status eq 'fail') {
-			} elsif ($status eq 'pass') {
-			} else {
-			    &Apache::lonxml::error("Student viewing a graded bridgetask was shown a status of $status");
-			}
-			my $status_display=$status;
-			$status_display=~s/^([a-z])/uc($1)/e;
-			$result.=
-			    '<div class="LC_'.$status.' LC_criteria"><h4>'
-			    .$mandatory.' Criteria</h4><p>';
-			$result.=
-			    &nested_parse(\$dimension{$dim}{'criteria.'.$id},
-					  [@_],{'set_dim_id' => $id});
-			$result.='</p><p class="LC_grade">'.$status_display.'</p>';
-			if ($comment) {
-			    $result.='<p class="LC_comment">'.
-				&mt('Comment: [_1]',$comment).'</p>';
-			}
-			$result.='</div>';
 		    }
 		}
 	    }
@@ -2495,6 +2481,7 @@ sub end_InstanceText {
 sub start_Criteria {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $criteria=&Apache::lonxml::get_all_text('/criteria',$parser,$style);
+    my $result = '';
     if ($target eq 'web' || $target eq 'webgrade' || $target eq 'grade') {
 	my $dim = &get_dim_id();
 	my $id=&get_id($parstack,$safeeval);
@@ -2512,9 +2499,37 @@ sub start_Criteria {
 	    $dimension{$dim}{'criteria.'.$id.'.mandatory'}=
 		&Apache::lonxml::get_param('Mandatory',$parstack,$safeeval);
 	    push(@{$dimension{$dim}{'criterias'}},$id);
+
+	    my $version=&get_version();
+	    my $task_status = 
+		$Apache::lonhomework::history{"resource.$version.0.status"};
+	    if ($target eq 'web' 
+		&& ($task_status eq 'pass' || $task_status eq 'fail')) {
+		my $status= &get_criteria('status', $version,$dim,$id);
+		my $comment=&get_criteria('comment',$version,$dim,$id);
+		my $mandatory=($dimension{$dim}{'criteria.'.$id.'.mandatory'} ne 'N');
+		if ($mandatory) {
+		    $mandatory='Mandatory';
+		} else {
+		    $mandatory='Optional';
+		}
+		my $status_display=$status;
+		$status_display=~s/^([a-z])/uc($1)/e;
+		$result.=
+		    '<div class="LC_'.$status.' LC_criteria"><h4>'
+		    .$mandatory.' Criteria</h4><p>';
+		$result.=
+		    &nested_parse(\$dimension{$dim}{'criteria.'.$id},[@_]);
+		$result.='</p><p class="LC_grade">'.$status_display.'</p>';
+		if ($comment =~ /\w/) {
+		    $result.='<p class="LC_comment">'.
+			&mt('Comment: [_1]',$comment).'</p>';
+		}
+		$result.='</div>';
+	    }
 	}
     }
-    return '';
+    return $result;
 }
 
 sub end_Criteria {