[LON-CAPA-cvs] cvs: loncom /homework bridgetask.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Thu, 22 Sep 2005 22:25:37 -0000
albertel Thu Sep 22 18:25:37 2005 EDT
Modified files:
/loncom/homework bridgetask.pm
Log:
- modfying the result output to include manadatory/optional info
Index: loncom/homework/bridgetask.pm
diff -u loncom/homework/bridgetask.pm:1.52 loncom/homework/bridgetask.pm:1.53
--- loncom/homework/bridgetask.pm:1.52 Wed Sep 21 17:54:20 2005
+++ loncom/homework/bridgetask.pm Thu Sep 22 18:25:35 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.52 2005/09/21 21:54:20 albertel Exp $
+# $Id: bridgetask.pm,v 1.53 2005/09/22 22:25:35 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -204,6 +204,67 @@
return $result;
}
+sub style {
+ return (<<STYLE);
+<style type="text/css">
+.fail, .pass, .neutral {
+ position: relative;
+ margin : 5px;
+ margin-bottom :10px;
+ padding : 4px;
+ padding-left : 75px;
+ border : thin solid;
+ font-weight : bolder;
+ font-size: smaller;
+ font-family: Arial;
+ background-color : rgb(255,240,225);
+}
+
+.fail h4, .pass h4 {
+ position:absolute;
+ left: -4px;
+ top: -8px;
+ padding:2px;
+ margin:0;
+ background-color : rgb(255,240,225);
+ border : thin solid;
+}
+
+.fail {
+ color: red;
+}
+
+.pass {
+ color : green;
+}
+
+.neutral {
+ color : blue;
+}
+
+.question {
+ border : thin solid black;
+ padding : 4px;
+ margin-bottom : 1em;
+}
+
+.grade {
+ font-size: x-large;
+ font-family: Arial;
+ position:absolute;
+ left: 5px;
+ top: -5px;
+ width: 70px;
+}
+
+div#feedback h1 {
+ color : inherit;
+}
+</style>
+STYLE
+
+}
+
sub start_Task {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
@@ -291,7 +352,7 @@
} elsif ($target eq 'web') {
my $name= &Apache::structuretags::get_resource_name($parstack,$safeeval);
$result.="$head_tag_start<title>$name</title></head>
- $body_tag_start \n";
+ $body_tag_start \n".&style();
my ($version,$previous)=&get_version();
if ($Apache::lonhomework::history{"resource.$version.status"} eq 'fail') {
@@ -1145,20 +1206,27 @@
foreach my $id (@{$dimension{$instance.'.criterias'}}) {
my $status=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.status"};
my $comment=$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"};
- $result.='<table border="1"><tr><td>';
+ my $mandatory=($dimension{$instance.'.criteria.'.$id.'.mandatory'} ne 'N');
+ if ($mandatory) {
+ $mandatory='Mandatory';
+ } else {
+ $mandatory='Optional';
+ }
if ($status eq 'fail') {
- $result.='<font color="red">'.&mt('Did not pass').'</font>';
} elsif ($status eq 'pass') {
- $result.='<font color="green">'.&mt('Passed').'</font>';
} else {
&Apache::lonxml::error("Student viewing a graded bridgetask was shown a status of $status");
}
- $result.='</td></tr><tr><td>';
+ my $status_display=$status;
+ $status_display=~s/^([a-z])/uc($1)/e;
+ $result.='<div class="'.$status.'"><h4>'.$mandatory.
+ ' Criteria</h4><p>'.
+ $dimension{$instance.'.criteria.'.$id}.
+ '</p><p class="grade">'.$status_display.'</p>';
if ($Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}) {
- $result.=&mt('Comment from grader: ').$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}.'</td></tr><tr><td>';
+ $result.='<p class="comment">'.$Apache::lonhomework::history{"resource.$version.$dim.$instance.$id.comment"}.'</p>';
}
- $result.=$dimension{$instance.'.criteria.'.$id}.
- '</td></tr></table>';
+ $result.='</div>';
}
}
} elsif ($target eq 'webgrade') {