[LON-CAPA-cvs] cvs: loncom /homework response.pm structuretags.pm /homework/caparesponse caparesponse.pm /xml scripttag.pm

albertel lon-capa-cvs@mail.lon-capa.org
Wed, 14 May 2003 13:33:00 -0000


albertel		Wed May 14 09:33:00 2003 EDT

  Modified files:              
    /loncom/homework/caparesponse	caparesponse.pm 
    /loncom/xml	scripttag.pm 
    /loncom/homework	structuretags.pm response.pm 
  Log:
  - propagating print_answer -> answer_output_mode shift
  
  
Index: loncom/homework/caparesponse/caparesponse.pm
diff -u loncom/homework/caparesponse/caparesponse.pm:1.100 loncom/homework/caparesponse/caparesponse.pm:1.101
--- loncom/homework/caparesponse/caparesponse.pm:1.100	Tue May 13 16:39:58 2003
+++ loncom/homework/caparesponse/caparesponse.pm	Wed May 14 09:33:00 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # caparesponse definition
 #
-# $Id: caparesponse.pm,v 1.100 2003/05/13 20:39:58 sakharuk Exp $
+# $Id: caparesponse.pm,v 1.101 2003/05/14 13:33:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -318,11 +318,11 @@
 	    }
 	    if ($target eq 'answer') {
 		if ($high) { $ans.=' ['.$low.','.$high.']'; }
-		if ($sighigh) { 
-		    if ($ENV{'form.print_answer'} eq 'yes') {
-			$ans.= " Sig \\textit{$siglow - $sighigh}"; 
+		if ($sighigh) {
+		    if ($ENV{'form.answer_output_mode'} eq 'tex') {
+			$ans.= " Sig \\textit{$siglow - $sighigh}";
 		    } else {
-			$ans.= " Sig <i>$siglow - $sighigh</i>"; 
+			$ans.= " Sig <i>$siglow - $sighigh</i>";
 		    }
 		}
 		$result.=&Apache::response::answer_part($$tagstack[-1],$ans);
@@ -336,7 +336,7 @@
 	}
 	if ($unit) {
 	    if ($target eq 'answer') {
-		if ($ENV{'form.print_answer'} eq 'yes') {
+		if ($ENV{'form.answer_output_mode'} eq 'tex') {
 		    $result.=&Apache::response::answer_part($$tagstack[-1],
 							    "Unit: \\verb|$unit|");
 		} else {
@@ -360,8 +360,13 @@
 		$string='Formula';
 	    }
 	    if ($target eq 'answer') {
-		$result.=&Apache::response::answer_part($$tagstack[-1],
-							'<b>'.$string.'</b>');
+		if ($ENV{'form.answer_output_mode'} eq 'tex') {
+		    $result.=&Apache::response::answer_part($$tagstack[-1],
+							  "\\textbf{$string}");
+		} else {
+		    $result.=&Apache::response::answer_part($$tagstack[-1],
+							    "<b>$string</b>");
+		}
 	    } elsif ($target eq 'analyze') {
 		push (@{ $Apache::lonhomework::analyze{"$part_id.type"} },
 		      $type);
Index: loncom/xml/scripttag.pm
diff -u loncom/xml/scripttag.pm:1.87 loncom/xml/scripttag.pm:1.88
--- loncom/xml/scripttag.pm:1.87	Tue May 13 16:41:08 2003
+++ loncom/xml/scripttag.pm	Wed May 14 09:33:00 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # <script> definiton
 #
-# $Id: scripttag.pm,v 1.87 2003/05/13 20:41:08 sakharuk Exp $
+# $Id: scripttag.pm,v 1.88 2003/05/14 13:33:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -89,14 +89,15 @@
 	    &Apache::lonxml::default_homework_load($safeeval);
 	}
 	&Apache::run::run($bodytext,$safeeval);
-	if (($target eq 'answer') && ($Apache::lonhomework::viewgrades == 'F')) {
+	if (($target eq 'answer') &&
+	    ($ENV{'form.answer_output_mode'} ne 'tex') &&
+	    ($Apache::lonhomework::viewgrades == 'F')) {
 	    $Apache::lonxml::evaluate--;
 	    $result.="<a href=\"javascript:newWindow=open(\'\',\'new_W\',\'width=500,height=200,scrollbars=1\');newWindow.document.open(\'text/html\',\'replace\');newWindow.document.writeln(\'&lt;html&gt;&lt;head&gt;&lt;title&gt;newwindow&lt;/title&gt;&lt;/head&gt;&lt;body bgcolor=&quot;#FFFFFF&quot;&gt;&lt;pre&gt;";
 	    my $listing= &HTML::Entities::encode(&Apache::run::dump($target,$safeeval));
 
 	    $result.=$listing;
 	    $result.= "&lt;/pre&gt;&lt;/body&gt;&lt;/html&gt;\');newWindow.document.close();void(0);\">Script Vars</a><br />";
-	    if ($ENV{'form.print_answer'} eq 'yes') {$result='';}
 	}
     } elsif ($target eq "edit" ) {
       #&Apache::run::run($bodytext,$safeeval);
@@ -430,7 +431,7 @@
 
 sub xmlparse {
   my ($string) = @_;
-  &Apache::lonxml::debug("Got $string");
+#  &Apache::lonxml::debug("Got $string");
   my ($target,$token,$tagstack,$parstack,$oldparser,$safeeval,$style)=
     @Apache::scripttag::parser_env;
   my @parser;
Index: loncom/homework/structuretags.pm
diff -u loncom/homework/structuretags.pm:1.171 loncom/homework/structuretags.pm:1.172
--- loncom/homework/structuretags.pm:1.171	Tue May 13 16:38:55 2003
+++ loncom/homework/structuretags.pm	Wed May 14 09:33:00 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # definition of tags that give a structure to a document
 #
-# $Id: structuretags.pm,v 1.171 2003/05/13 20:38:55 sakharuk Exp $
+# $Id: structuretags.pm,v 1.172 2003/05/14 13:33:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -480,8 +480,9 @@
 	    ($target eq 'answer') || ($target eq 'tex')
 	   ) {
 	    if ($status eq 'CAN_ANSWER') {
-		if ($target ne 'tex') {
-		    if ($ENV{'form.print_answer'} ne 'yes') {$result.="</form></body>\n";}
+		if ($target ne 'tex' &&
+		    $ENV{'form.answer_output_mode'} ne 'tex') {
+		    $result.="</form></body>\n";
 		}
 	    } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' ||
 		     $status eq 'UNCHECKEDOUT' ) {
@@ -504,11 +505,10 @@
 	    &Apache::lonhomework::showhash(%Apache::lonhomework::results);
 	    &finalize_storage();
 	}
-	if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) {
-	    if ($ENV{'form.print_answer'} ne 'yes') {
-		$result.='</html>'; #normally we get it from xmlend, but in CSTR
-		                    # we always show answer mode too.
-	    }
+	if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct')
+	    && $ENV{'form.answer_mode_output'} ne 'tex') {
+	    $result.='</html>'; # normally we get it from xmlend, but in CSTR
+	                        # we always show answer mode too.
 	}
     } elsif ($target eq 'meta') {
 	if ($Apache::inputtags::part eq '0') {
Index: loncom/homework/response.pm
diff -u loncom/homework/response.pm:1.76 loncom/homework/response.pm:1.77
--- loncom/homework/response.pm:1.76	Tue May 13 11:44:39 2003
+++ loncom/homework/response.pm	Wed May 14 09:33:00 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # various response type definitons response definition
 #
-# $Id: response.pm,v 1.76 2003/05/13 15:44:39 sakharuk Exp $
+# $Id: response.pm,v 1.77 2003/05/14 13:33:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -363,7 +363,7 @@
 sub answer_header {
     my ($type) = @_;
     my $result;
-    if (($ENV{'form.print_answer'} eq 'yes') && ($ENV{'form.grade_target'} eq 'answer')) {
+    if ($ENV{'form.answer_output_mode'} eq 'tex') {
 	$result = ' \vskip 0 mm \begin{tabular}{|c|}\hline Answer for Part: '.
                   $Apache::inputtags::part.' \\\\ \hline ';
     } else {
@@ -381,7 +381,7 @@
 sub answer_part {
     my ($type,$answer) = @_;
     my $result;
-    if (($ENV{'form.print_answer'} eq 'yes') && ($ENV{'form.grade_target'} eq 'answer')) {
+    if ($ENV{'form.answer_output_mode'} eq 'tex') {
 	$result = ' '.$answer.'\\\\ \hline ';
     } else {
 	if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') {
@@ -396,7 +396,7 @@
 sub answer_footer {
     my ($type) = @_;
     my $result;
-    if (($ENV{'form.print_answer'} eq 'yes') && ($ENV{'form.grade_target'} eq 'answer')) {
+    if ($ENV{'form.answer_output_mode'} eq 'tex') {
 	$result = ' \end{tabular} \vskip 0 mm ';
     } else {
 	if ($type eq 'optionresponse' || $type eq 'radiobuttonresponse') {