[LON-CAPA-cvs] cvs: loncom /homework inputtags.pm /interface lonpdfupload.pm

goltermann goltermann at source.lon-capa.org
Fri Sep 14 07:24:06 EDT 2012


goltermann		Fri Sep 14 11:24:06 2012 EDT

  Modified files:              
    /loncom/homework	inputtags.pm 
    /loncom/interface	lonpdfupload.pm 
  Log:
  added essay response to pdf form functionality.
  students can now print and upload a pdf with essay problems with form fields in it. after uploading they will get a notice that their essay is saved as a draft but not yet submitted.
  fixed a missing <span> tag.
  special thanks to jeconia kapitako who helped with inplementing textareas into lon capa pdf forms.
  
  
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.308 loncom/homework/inputtags.pm:1.309
--- loncom/homework/inputtags.pm:1.308	Mon Sep 10 09:50:57 2012
+++ loncom/homework/inputtags.pm	Fri Sep 14 11:23:58 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # input  definitons
 #
-# $Id: inputtags.pm,v 1.308 2012/09/10 09:50:57 foxr Exp $
+# $Id: inputtags.pm,v 1.309 2012/09/14 11:23:58 goltermann Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -253,10 +253,12 @@
 	    for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
 	    $result.='\strut \\\\\strut \\\\\strut \\\\\strut \\\\}}}';
 	} else {
-	    my $TeXwidth=$width_of_box/80;
-	    $result = '\vskip 1 mm \fbox{\fbox{\parbox{'.$TeXwidth.'\textwidth-5mm}{';
-	    for (my $i=0;$i<int $number_of_lines*2;$i++) {$result.='\strut \\\\ ';}
-	    $result.='}}}\vskip 2 mm ';
+	    my $fieldname = $env{'request.symb'}.
+                    '&part_'. $Apache::inputtags::part.
+                    '&textresponse'.
+                    '&HWVAL_' . $Apache::inputtags::response['-1'];
+            $result.='\TextField[name='.$fieldname.',multiline=true,height=6\baselineskip,width=270,borderwidth=0,backgroundcolor={.85
+                .85 .85}]\\';
 	}
     }
     return $result;
Index: loncom/interface/lonpdfupload.pm
diff -u loncom/interface/lonpdfupload.pm:1.21 loncom/interface/lonpdfupload.pm:1.22
--- loncom/interface/lonpdfupload.pm:1.21	Wed Nov  2 15:14:21 2011
+++ loncom/interface/lonpdfupload.pm	Fri Sep 14 11:24:06 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # PDF Form Upload Handler
 #
-# $Id: lonpdfupload.pm,v 1.21 2011/11/02 15:14:21 bisitz Exp $
+# $Id: lonpdfupload.pm,v 1.22 2012/09/14 11:24:06 goltermann Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -299,10 +299,12 @@
             $result .= '<td><a href="/res/'.$problem{'resource'}.
                        '?symb='.
                        &HTML::Entities::encode($problem{'symb'},'"&<>').
-                       '">'.$problemname.'</a></td><td class="';
+                       '">'.$problemname.'</a></td><td><span class="';
             if ($grade eq "EXACT_ANS" || $grade eq "APPROX_ANS") {
                 $result .= 'LC_answer_correct';
-            } else { 
+            } elsif ($grade eq "DRAFT") {
+                $result .= 'LC_answer_not_charged_try';
+            } else {
                 $result .= 'LC_answer_charged_try';
             }
             $result .= '">';
@@ -375,6 +377,7 @@
      my %answerhash = ('EXACT_ANS' => &mt('You are correct.'),
                        'APPROX_ANS' => &mt('You are correct.'),
                        'INCORRECT' => &mt('You are incorrect'),
+                       'DRAFT' => &mt('Copy saved but not submitted.'),
      );
 
     foreach my $key (keys %answerhash) {




More information about the LON-CAPA-cvs mailing list