[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

onken lon-capa-cvs-allow@mail.lon-capa.org
Fri, 05 Sep 2008 12:11:47 -0000


onken		Fri Sep  5 08:11:47 2008 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  Add several Methodes to generate LaTeX-Code for PDF-formfields
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.484 loncom/xml/lonxml.pm:1.485
--- loncom/xml/lonxml.pm:1.484	Fri Aug  8 12:50:39 2008
+++ loncom/xml/lonxml.pm	Fri Sep  5 08:11:45 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.484 2008/08/08 16:50:39 bisitz Exp $
+# $Id: lonxml.pm,v 1.485 2008/09/05 12:11:45 onken Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2137,7 +2137,109 @@
     return $insertlist{"$tagnum.tag"};
 }
 
+############################################################
+#                                           PDF-FORM-METHODS
+
+=pod
+
+=item &print_pdf_radiobutton(fieldname, value,  text)
+
+Returns a latexline to generate a PDF-Form-Radiobutton with Text.
+
+$fieldname: PDF internalname of the radiobutton
+$value:     Value of radiobutton (read when dumping the PDF data)
+$text:      Text on the rightside of the radiobutton
+
+=cut
+sub print_pdf_radiobutton {
+    my $result = '';
+    my ($fieldName, $value, $text) = @_;
+    $result .= '\begin{tabularx}{\textwidth}{p{0cm}X}'."\n";
+    $result .= '\radioButton[\symbolchoice{circle}]{'. 
+               $fieldName.'}{10bp}{10bp}{'.$value.'}&'.$text."\n";
+    $result .= '\end{tabularx}' . "\n";
+    $result .= '\hspace{2mm}' . "\n";
+    return $result;
+}
+
+
+=pod
+
+=item &print_pdf_start_combobox(fieldname)
+
+Starts a latexline to generate a PDF-Form-Combobox with text.
+
+$fieldname: PDF internal name of the Combobox
+
+=cut
+sub print_pdf_start_combobox {
+    my $result;
+    my ($fieldName) = @_;
+    $result .= '\begin{tabularx}{\textwidth}{p{2.5cm}X}'."\n";
+    $result .= '\comboBox[]{'.$fieldName.'}{2.3cm}{14bp}{'; # 
+
+    return $result;
+}
+
+
+=pod
+
+=item &print_pdf_add_combobox_option(options)
+
+Generates a latexline to add Options to a PDF-Form-ComboBox.
+
+$option: PDF internal name of the Combobox-Option
+
+=cut
+sub print_pdf_add_combobox_option {
+
+    my $result;
+    my ($option) = @_;  
+
+    $result .= '('.$option.')';
+    
+    return $result;
+}
+
+
+=pod
+
+=item &print_pdf_end_combobox(text) {
+
+Returns latexcode to end a PDF-Form-Combobox with text.
+
+=cut
+sub print_pdf_end_combobox {
+    my $result;
+    my ($text) = @_;
+
+    $result .= '}&'.$text."\\\\\n";
+    $result .= '\end{tabularx}' . "\n";
+    $result .= '\hspace{2mm}' . "\n";
+    return $result;
+}
+
+
+=pod
+
+=item &print_pdf_hiddenField(fieldname, user, domain)
+
+Returns a latexline to generate a PDF-Form-hiddenField with userdata.
+
+$fieldname label for hiddentextfield
+$user:    name of user
+$domain:  domain of user
+
+=cut
+sub print_pdf_hiddenfield {
+    my $result;
+    my ($fieldname, $user, $domain) = @_;
+
+    $result .= '\textField [\F{\FHidden}\F{-\FPrint}\V{'.$domain.'&'.$user.'}]{'.$fieldname.'}{0in}{0in}'."\n";
+
+    return $result;
+}
+
 1;
 __END__
 
-