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

SF.net SVN: ledger-smb:[6672] trunk



Revision: 6672
          http://sourceforge.net/p/ledger-smb/code/6672
Author:   einhverfr
Date:     2014-01-28 03:18:25 +0000 (Tue, 28 Jan 2014)
Log Message:
-----------
Allowing back-button to be disabled as per bug 1002, which is a regression against 1.3.36

Modified Paths:
--------------
    trunk/LedgerSMB/Form.pm
    trunk/LedgerSMB/Scripts/configuration.pm
    trunk/LedgerSMB/Template.pm
    trunk/sql/modules/Fixes.sql

Modified: trunk/LedgerSMB/Form.pm
===================================================================
--- trunk/LedgerSMB/Form.pm	2014-01-28 03:00:14 UTC (rev 6671)
+++ trunk/LedgerSMB/Form.pm	2014-01-28 03:18:25 UTC (rev 6672)
@@ -68,6 +68,7 @@
 use Log::Log4perl;
 use LedgerSMB::App_State;
 use LedgerSMB::Setting::Sequence;
+use LedgerSMB::Setting;
 use Try::Tiny;
 use Carp;
 use DBI;
@@ -577,6 +578,11 @@
     my ( $self, $init, $headeradd ) = @_;
 
     return if $self->{header} or $ENV{LSMB_NOHEAD};
+    my $cache = 1; # default
+    if ($LedgerSMB::App_State::DBH){
+        # we have a db connection, so are logged in.  Let's see about caching.
+        $cache = 0 if LedgerSMB::Setting->get('disable_back');
+    }
 
     $ENV{LSMB_NOHEAD} = 1; # Only run once.
     my ( $stylesheet, $favicon, $charset );
@@ -612,10 +618,14 @@
 		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">
 <head>
-	<title>$self->{titlebar}</title>
+	<title>$self->{titlebar}</title> |;
+        if (!$cache){
+            print qq|
 	<meta http-equiv="Pragma" content="no-cache" />
 	<meta http-equiv="Cache-Control" content="must-revalidate" />
-	<meta http-equiv="Expires" content="-1" />
+	<meta http-equiv="Expires" content="-1" /> |;
+        }
+        print qq|
 	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
 	$stylesheet
 	$charset

Modified: trunk/LedgerSMB/Scripts/configuration.pm
===================================================================
--- trunk/LedgerSMB/Scripts/configuration.pm	2014-01-28 03:00:14 UTC (rev 6671)
+++ trunk/LedgerSMB/Scripts/configuration.pm	2014-01-28 03:18:25 UTC (rev 6672)
@@ -53,6 +53,9 @@
      ] },
    { title => $locale->text('Security Settings'),
      items => [
+       { name => 'disable_back',
+        label => $locale->text('Disable Back Button'),
+         type => 'YES_NO', },
        { name => 'password_duration',
         label => $locale->text('Password Duration') },
        { name => 'session_timeout',

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2014-01-28 03:00:14 UTC (rev 6671)
+++ trunk/LedgerSMB/Template.pm	2014-01-28 03:18:25 UTC (rev 6672)
@@ -405,6 +405,12 @@
 	my ($self, $data) = @_;
         LedgerSMB::App_State::cleanup();
 	$data ||= $self->{output};
+        my $cache = 1; # default
+        if ($LedgerSMB::App_State::DBH){
+            # we have a db connection, so are logged in.  
+            # Let's see about caching.
+            $cache = 0 if LedgerSMB::Setting->get('disable_back');
+        }
         
 	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
 		die "Invalid format";
@@ -431,9 +437,11 @@
 		$disposition .= qq|\nContent-Disposition: attachment; filename="$name"|;
 	}
         if (!$ENV{LSMB_NOHEAD}){
-            print "Cache-Control: no-store, no-cache, must-revalidate\n";
-            print "Cache-Control: post-check=0, pre-check=0, false\n";
-            print "Pragma: no-cache\n";
+            if (!$cache){
+                print "Cache-Control: no-store, no-cache, must-revalidate\n";
+                print "Cache-Control: post-check=0, pre-check=0, false\n";
+                print "Pragma: no-cache\n";
+            }
  	    if ($self->{mimetype} =~ /^text/) {
 		print "Content-Type: $self->{mimetype}; charset=utf-8$disposition\n\n";
 	    } else {

Modified: trunk/sql/modules/Fixes.sql
===================================================================
--- trunk/sql/modules/Fixes.sql	2014-01-28 03:00:14 UTC (rev 6671)
+++ trunk/sql/modules/Fixes.sql	2014-01-28 03:18:25 UTC (rev 6672)
@@ -286,3 +286,7 @@
 BEGIN;
 ALTER TABLE cr_report ADD max_ac_id int references acc_trans(entry_id);
 COMMIT;
+
+BEGIN;
+INSERT INTO defaults VALUES ('disable_back', '0');
+COMMIT;

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


------------------------------------------------------------------------------
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
_______________________________________________
Ledger-smb-commits mailing list
..hidden..
https://lists.sourceforge.net/lists/listinfo/ledger-smb-commits