Minor tweaks for 3.1.0beta0 release.
[BackupPC.git] / lib / BackupPC / CGI / EditConfig.pm
index 2e734db..aa48bf9 100644 (file)
@@ -10,7 +10,7 @@
 #   Craig Barratt  <cbarratt@users.sourceforge.net>
 #
 # COPYRIGHT
-#   Copyright (C) 2005  Craig Barratt
+#   Copyright (C) 2005-2007  Craig Barratt
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 #
 #========================================================================
 #
-# Version 3.0.0, released 28 Jan 2007.
+# Version 3.1.0beta0, released 3 Sep 2007.
 #
 # See http://backuppc.sourceforge.net.
 #
@@ -93,11 +93,21 @@ our %ConfigMenu = (
            {name => "Bzip2Path"},
 
             {text => "CfgEdit_Title_Install_Paths"},
-            {name => "TopDir"},
-            {name => "ConfDir"},
-            {name => "LogDir"},
+            #
+            # Can only edit TopDir and LogDir if we are in FHS mode.
+            # Otherwise they are hardcoded in lib/BackupPC/Lib.pm.
+            #
+            {name => "TopDir",
+                    visible => sub { return $_[1]->useFHS(); } },
+            {name => "LogDir",
+                    visible => sub { return $_[1]->useFHS(); } },
            {name => "CgiDir"},
-           {name => "InstallDir"},
+            #
+            # Cannot edit ConfDir or InstallDir, since the real value is hardcoded in
+            # lib/BackupPC/Lib.pm.
+            # {name => "ConfDir"},
+           # {name => "InstallDir"},
+            #
         ],
     },
     email => {
@@ -161,6 +171,7 @@ our %ConfigMenu = (
             {name => "XferMethod", onchangeSubmit => 1},
             {name => "XferLogLevel"},
             {name => "ClientCharset"},
+            {name => "ClientCharsetLegacy"},
 
             {text => "CfgEdit_Title_Smb_Settings",
                 visible => sub { return $_[0]->{XferMethod} eq "smb"; } },
@@ -758,7 +769,7 @@ EOF
 
         next if ( $disabled || $menuDisable{$menu}{top} );
         if ( ref($paramInfo->{visible}) eq "CODE"
-                        && !&{$paramInfo->{visible}}($newConf) ) {
+                        && !&{$paramInfo->{visible}}($newConf, $bpc) ) {
             next;
         }
 
@@ -1466,6 +1477,8 @@ sub fieldInputParse
         } else {
             $$value = decode_utf8($In{"v_zZ_$varName"});
             $$value =~ s/\r\n/\n/g;
+            # remove leading space from exec paths
+            $$value =~ s/^\s+// if ( $type->{type} eq "execPath" );
         }
         $$value = undef if ( $type->{undefIfEmpty} && $$value eq "" );
     }