[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb:[3834] branches/1.3



Revision: 3834
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=3834&view=rev
Author:   einhverfr
Date:     2011-10-11 22:49:21 +0000 (Tue, 11 Oct 2011)
Log Message:
-----------
Language selection for templates now works.

Modified Paths:
--------------
    branches/1.3/LedgerSMB/Sysconfig.pm
    branches/1.3/LedgerSMB/Template/LaTeX.pm
    branches/1.3/LedgerSMB/Template.pm
    branches/1.3/bin/io.pl
    branches/1.3/bin/is.pl
    branches/1.3/ledgersmb.conf.default

Modified: branches/1.3/LedgerSMB/Sysconfig.pm
===================================================================
--- branches/1.3/LedgerSMB/Sysconfig.pm	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/LedgerSMB/Sysconfig.pm	2011-10-11 22:49:21 UTC (rev 3834)
@@ -114,6 +114,16 @@
     ${$var} = $config{''}{$var} if $config{''}{$var};
 }
 
+if ($latex){
+    eval { require Template::Latex }; # Trap errors loading this optional module
+    if ($!) { # Couldn't load  Template::Latex
+        print STDERR "WARNING: LedgerSMB configured to use LaTeX but module ";
+        print STDERR "Template::Latex did not load: $!\n";
+        print STDERR "Disabling LaTeX support\n";
+        $latex = 0;
+    };
+}
+
 %printer = %{ $config{printers} } if $config{printers};
 
 # ENV Paths
@@ -135,6 +145,14 @@
     ${$var} = $config{programs}{$var} if $config{programs}{$var};
 }
 
+# LaTeX and friends 
+for my $var (qw(pdflatex latex dvips)){
+    if ($latex and $config{programs}{$var}){
+        my $funcname = "${var}_path";
+        Template::Latex->$funcname( { $var => $config{programs}{$var} });
+    }
+}
+
 # mail configuration
 for my $var (qw(sendmail smtphost smtptimeout smtpuser 
              smtppass smtpauthmethod)) 

Modified: branches/1.3/LedgerSMB/Template/LaTeX.pm
===================================================================
--- branches/1.3/LedgerSMB/Template/LaTeX.pm	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/LedgerSMB/Template/LaTeX.pm	2011-10-11 22:49:21 UTC (rev 3834)
@@ -136,7 +136,8 @@
 		START_TAG => quotemeta('<?lsmb'),
 		END_TAG => quotemeta('?>'),
 		DELIMITER => ';',
-		DEBUG => ($parent->{debug})? 'dirs': undef,
+                DEBUG => 1,
+	#	DEBUG => ($parent->{debug})? 'dirs': undef,
 		DEBUG_FORMAT => '',
 		}) || throw Error::Simple Template::Latex->error(); 
 	if (not $template->process(

Modified: branches/1.3/LedgerSMB/Template.pm
===================================================================
--- branches/1.3/LedgerSMB/Template.pm	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/LedgerSMB/Template.pm	2011-10-11 22:49:21 UTC (rev 3834)
@@ -183,7 +183,6 @@
 		throw Error::Simple "Invalid format";
 	}
 	if (!$self->{include_path}){
-## SC: XXX hardcoding due to config migration, will need adjustment
 		$self->{include_path} = $self->{'myconfig'}->{'templates'};
 		$self->{include_path} ||= 'templates/demo';
 		if (defined $self->{language}){
@@ -193,7 +192,9 @@
 			}
 			$self->{include_path} = "$self->{'include_path'}"
 					."/$self->{language}"
-					.";$self->{'include_path'}"
+					.";$self->{'include_path'}";
+                        $self->{locale} 
+                             = LedgerSMB::Locale->get_handle($self->{language});
 		}
 	}
 

Modified: branches/1.3/bin/io.pl
===================================================================
--- branches/1.3/bin/io.pl	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/bin/io.pl	2011-10-11 22:49:21 UTC (rev 3834)
@@ -1843,6 +1843,7 @@
         user => \%myconfig, 
         locale => $locale,
         template => $form->{'formname'},
+        language => $form->{language_code},
         format => uc $form->{format},
         method => $form->{media},
         output_options => \%output_options,

Modified: branches/1.3/bin/is.pl
===================================================================
--- branches/1.3/bin/is.pl	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/bin/is.pl	2011-10-11 22:49:21 UTC (rev 3834)
@@ -879,6 +879,7 @@
                                 ]
                    };
     print_select($form, $formname);
+    print_select($form, $printops->{lang});
     print_select($form, $printops->{format});
     print_select($form, $printops->{media});
     print qq|

Modified: branches/1.3/ledgersmb.conf.default
===================================================================
--- branches/1.3/ledgersmb.conf.default	2011-10-10 23:19:06 UTC (rev 3833)
+++ branches/1.3/ledgersmb.conf.default	2011-10-11 22:49:21 UTC (rev 3834)
@@ -58,6 +58,19 @@
 # program to use for file compression
 gzip       = gzip -S .gz
 
+# For latex and pdflatex, specify  full path.  These will be used to configure
+# Template::Latex so it can find them.  This can be used to specify programs
+# other than vanilla latex and pdflatex, such as the xe varieties of either one,
+# if unicode is required.
+#
+# If these are not set, the package defaults (set when you installed 
+# Template::Latex) will be used
+#
+# pdflatex = /usr/bin/pdflatex
+# latex    = /usr/bin/latex
+# dvips    = /usr/bin/dvips
+#
+
 [mail]
 ### How to send mail.  The sendmail command is used unless smtphost is set.
 sendmail   = /usr/bin/sendmail -t

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.