[LON-CAPA-cvs] cvs: loncom /homework radiobuttonresponse.pm

onken onken@source.lon-capa.org
Mon, 03 May 2010 14:43:50 -0000


onken		Mon May  3 14:43:50 2010 EDT

  Modified files:              
    /loncom/homework	radiobuttonresponse.pm 
  Log:
  - remove metadate PDF-Formfield (finding a better place for it)
  - printing radiobutton-PDF-Formfields in a itemize-environment
  
  see also changes in lonxml::print_pdf_radiobutton(v1.507 to v1.508)
  
  
  
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.144 loncom/homework/radiobuttonresponse.pm:1.145
--- loncom/homework/radiobuttonresponse.pm:1.144	Sun Feb 28 23:42:24 2010
+++ loncom/homework/radiobuttonresponse.pm	Mon May  3 14:43:50 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # mutliple choice style responses
 #
-# $Id: radiobuttonresponse.pm,v 1.144 2010/02/28 23:42:24 raeburn Exp $
+# $Id: radiobuttonresponse.pm,v 1.145 2010/05/03 14:43:50 onken Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -105,8 +105,7 @@
 	    $result .= ' \renewcommand{\labelenumi}{\Alph{enumi}.}';
 	}
         if($env{'form.pdfFormFields'} eq 'yes' && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
-            $result .= &Apache::lonxml::print_pdf_hiddenfield('meta', $env{'user.name'}, $env{'user.domain'});
-            $result .= "\n\\\\\n\\\\\n";
+            $result .= '\begin{itemize}';
         } else {
             $result .= '\begin{enumerate}';
         }
@@ -122,8 +121,12 @@
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
     my $result;
     if ($target eq 'edit') { $result=&Apache::edit::end_table(); }
-    if ($target eq 'tex' and ($env{'form.pdfFormFields'} ne 'yes' or $Apache::inputtags::status[-1] ne 'CAN_ANSWER')) {
-        $result .= '\end{enumerate}'; 
+    if ($target eq 'tex' ) {
+        if($env{'form.pdfFormFields'} eq 'yes' and $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+            $result .= '\end{itemize}';
+        } else {
+            $result .= '\end{enumerate}';
+        }
     }
     &Apache::response::end_response;
     pop @Apache::lonxml::namespace;
@@ -374,15 +377,10 @@
 		} else {
 		    if ($target eq 'tex') {
 		        if($env{'form.pdfFormFields'} eq 'yes' && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
-                            my $fieldname = $env{'request.symb'}.
-                                           '&part_'. $Apache::inputtags::part.
-                                           '&radiobuttonresponse'.
-                                           '&HWVAL_' . $Apache::inputtags::response['-1'];
-                            my $value = $temp;
-                            my $text = $Apache::response::foilgroup{$name.'.text'};
-                            $result .= &Apache::lonxml::print_pdf_radiobutton($fieldname,
-                                                                             $value,
-                                                                             $text)."\n";
+                            my $fieldname = $env{'request.symb'}.'&part_'. $Apache::inputtags::part
+                                            .'&radiobuttonresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'];
+                            $result .= '\item[{'.&Apache::lonxml::print_pdf_radiobutton($fieldname,$temp).'}]'
+                                       .$Apache::response::foilgroup{$name.'.text'}."\n";
                         } else {
                             $result .= '\item \vskip -2mm ';
                         }
@@ -653,18 +651,14 @@
 		    $i++;
 		    $bubble_number++;
 		} else {
-		      if($env{'form.pdfFormFields'} eq 'yes' && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
-
-                         my $fieldname = $env{'request.symb'}.
-                                         '&part_'. $Apache::inputtags::part.
-                                         '&radiobuttonresponse'.
-                                         '&HWVAL_' . $Apache::inputtags::response['-1'];
-                         my $value = $temp;
-                         my $text = $Apache::response::foilgroup{$name.'.text'};
-                         $result .= &Apache::lonxml::print_pdf_radiobutton($fieldname, $value, $text).'\newline'."\n";
-                     } else { 
-                         $result .= '\vspace*{-2 mm}\item '.$Apache::response::foilgroup{$name.'.text'};
-                     }
+                    if($env{'form.pdfFormFields'} eq 'yes' && $Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
+                        my $fieldname = $env{'request.symb'}.'&part_'. $Apache::inputtags::part
+                                        .'&radiobuttonresponse'.'&HWVAL_'.$Apache::inputtags::response['-1'];
+                        $result .= '\item[{'.&Apache::lonxml::print_pdf_radiobutton($fieldname,$temp).'}]'
+                                   .$Apache::response::foilgroup{$name.'.text'}."\n";
+                    } else { 
+                        $result .= '\vspace*{-2 mm}\item '.$Apache::response::foilgroup{$name.'.text'};
+                    }
                 }
 	    }
 	    if ($target ne 'tex' && $direction eq 'horizontal') {