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

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



Revision: 4874
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=4874&view=rev
Author:   einhverfr
Date:     2012-06-09 06:56:43 +0000 (Sat, 09 Jun 2012)
Log Message:
-----------
Added filesystem css directory handling

Modified Paths:
--------------
    branches/1.3/Changelog
    branches/1.3/LedgerSMB/AM.pm
    branches/1.3/LedgerSMB/Sysconfig.pm
    branches/1.3/bin/am.pl
    branches/1.3/ledgersmb.conf.default

Modified: branches/1.3/Changelog
===================================================================
--- branches/1.3/Changelog	2012-06-09 06:39:47 UTC (rev 4873)
+++ branches/1.3/Changelog	2012-06-09 06:56:43 UTC (rev 4874)
@@ -12,6 +12,7 @@
 * Fixed error editing non-existent localized template (Chris T, 3531738)
 * Fixed show/hide logic on nav bar on Contacts screen (Chris T)
 * Fixed "Post as Shown" button not showing properly on AR/AP drafts (Chris T)
+* Added fs_cssdir config option for easier packaging (Chris T, h/t Robert C)
 
 Changelog for 1.3.18
 * Fixed missing template for CSV pricelists (Chris T)

Modified: branches/1.3/LedgerSMB/AM.pm
===================================================================
--- branches/1.3/LedgerSMB/AM.pm	2012-06-09 06:39:47 UTC (rev 4873)
+++ branches/1.3/LedgerSMB/AM.pm	2012-06-09 06:56:43 UTC (rev 4874)
@@ -1524,7 +1524,7 @@
 
     if ( $form->{file} !~ /^$myconfig->{templates}\// ) {
         $form->error("Not in a whitelisted directory: $form->{file}")
-          unless $form->{file} =~ /^css\//;
+          unless $form->{file} =~ /^$LedgerSMB::Sysconfig::fs_cssdir\//;
     }
 }
 
@@ -1544,7 +1544,7 @@
     open( TEMPLATE, '<', "$form->{file}" ) || ($testval = 1);
     if ($testval == 1 && ($! eq 'No such file or directory')){
       my $file = $form->{file};
-      $file =~ s|$form->{code}/||;
+      $file =~ s|$form->{code}/|| if $form->{code};
       open( TEMPLATE, '<', "$file" ) ||  $form->error(
                     "Template not found: $file"
       );

Modified: branches/1.3/LedgerSMB/Sysconfig.pm
===================================================================
--- branches/1.3/LedgerSMB/Sysconfig.pm	2012-06-09 06:39:47 UTC (rev 4873)
+++ branches/1.3/LedgerSMB/Sysconfig.pm	2012-06-09 06:56:43 UTC (rev 4874)
@@ -21,6 +21,7 @@
 our $logging = 0;      # No logging on by default
 our $images = getcwd() . '/images'; 
 our $cssdir = 'css/';
+our $fs_cssdir = 'css/';
 
 our $force_username_case = undef; # don't force case
 
@@ -106,7 +107,7 @@
 for my $var (
     qw(pathsep logging log_level DBI_TRACE check_max_invoices language auth latex
     db_autoupdate force_username_case max_post_size decimal_places cookie_name
-    return_accno no_db_str tempdir cache_templates cssdir)
+    return_accno no_db_str tempdir cache_templates cssdir fs_cssdir)
   )
 {
     ${$var} = $config{''}{$var} if $config{''}{$var};

Modified: branches/1.3/bin/am.pl
===================================================================
--- branches/1.3/bin/am.pl	2012-06-09 06:39:47 UTC (rev 4873)
+++ branches/1.3/bin/am.pl	2012-06-09 06:56:43 UTC (rev 4874)
@@ -39,6 +39,7 @@
 use LedgerSMB::RP;
 use LedgerSMB::GL;
 use LedgerSMB::Template;
+use LedgerSMB::Sysconfig;
 
 1;
 
@@ -1272,7 +1273,7 @@
 
 sub display_stylesheet {
 
-    $form->{file} = "css/$myconfig{stylesheet}";
+    $form->{file} = "$LedgerSMB::Sysconfig::fs_cssdir/$myconfig{stylesheet}";
     &display_form;
 
 }
@@ -1715,7 +1716,7 @@
             };
     }
 
-    opendir CSS, "css/.";
+    opendir CSS, $LedgerSMB::Sysconfig::fs_cssdir;
     @all = grep /.*\.css$/, readdir CSS;
     closedir CSS;
 

Modified: branches/1.3/ledgersmb.conf.default
===================================================================
--- branches/1.3/ledgersmb.conf.default	2012-06-09 06:39:47 UTC (rev 4873)
+++ branches/1.3/ledgersmb.conf.default	2012-06-09 06:56:43 UTC (rev 4874)
@@ -3,10 +3,17 @@
 #Be aware of tempdir setting.If client_browser and server_apache on same machine, sharing tmp-dir , problems 'Permission denied' if server tries to write temp-file wich already exists as client-owned
 tempdir : /tmp/ledgersmb
 
+# This is the logical CSS directory.  I.e. it is what comes before the 
+# ledgersmb.css in the url.  Example might be /my_css_dir/ or 
+# http://localhost/other_css_dir/
 cssdir = css/
 
+# THis is the location on the file system where the css files are, for editing 
+# and selection.  An example might be /var/www/ledgersmb_css/
+fs_cssdir = css/
+
 # Set language for login and admin pages
-language : 
+language : en
 
 log_level : ERROR
 #DBI_TRACE : 1=/tmp/dbi.trace

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