X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FEditConfig.pm;h=f8f0addb84e458b1f3b9d5b8e53daed492696da8;hp=11ac9894d6e2b913e84cd35bf82e9e4df9f099d0;hb=ee969a9445a5439cf94a516c7d882e12b1bdf945;hpb=27f513f89d885d24bf1a01242fba676c7a840fd5 diff --git a/lib/BackupPC/CGI/EditConfig.pm b/lib/BackupPC/CGI/EditConfig.pm index 11ac989..f8f0add 100644 --- a/lib/BackupPC/CGI/EditConfig.pm +++ b/lib/BackupPC/CGI/EditConfig.pm @@ -10,7 +10,7 @@ # Craig Barratt # # COPYRIGHT -# Copyright (C) 2004 Craig Barratt +# Copyright (C) 2005 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.0alpha, released 23 Jan 2006. +# Version 3.0.0beta2, released 18 Nov 2006. # # See http://backuppc.sourceforge.net. # @@ -41,6 +41,7 @@ use BackupPC::CGI::Lib qw(:all); use BackupPC::Config::Meta qw(:all); use BackupPC::Storage; use Data::Dumper; +use Encode; our %ConfigMenu = ( server => { @@ -181,6 +182,8 @@ our %ConfigMenu = ( visible => sub { return $_[0]->{XferMethod} eq "rsyncd"; } }, {name => "RsyncShareName", visible => sub { return $_[0]->{XferMethod} =~ /rsync/; } }, + {name => "RsyncdUserName", + visible => sub { return $_[0]->{XferMethod} eq "rsyncd"; } }, {name => "RsyncdPasswd", visible => sub { return $_[0]->{XferMethod} eq "rsyncd"; } }, {name => "RsyncdAuthRequired", @@ -188,6 +191,17 @@ our %ConfigMenu = ( {name => "RsyncCsumCacheVerifyProb", visible => sub { return $_[0]->{XferMethod} =~ /rsync/; } }, + {text => "CfgEdit_Title_BackupPCd_Settings", + visible => sub { return $_[0]->{XferMethod} eq "backuppcd"; } }, + {name => "BackupPCdShareName", + visible => sub { return $_[0]->{XferMethod} eq "backuppcd"; } }, + {name => "BackupPCdPath", + visible => sub { return $_[0]->{XferMethod} eq "backuppcd"; } }, + {name => "BackupPCdCmd", + visible => sub { return $_[0]->{XferMethod} eq "backuppcd"; } }, + {name => "BackupPCdRestoreCmd", + visible => sub { return $_[0]->{XferMethod} eq "backuppcd"; } }, + {text => "CfgEdit_Title_Archive_Settings", visible => sub { return $_[0]->{XferMethod} eq "archive"; } }, {name => "ArchiveDest", @@ -268,9 +282,11 @@ our %ConfigMenu = ( {name => "IncrKeepCnt"}, {name => "IncrKeepCntMin"}, {name => "IncrAgeMax"}, + {name => "IncrLevels"}, {name => "IncrFill"}, {text => "CfgEdit_Title_Blackouts"}, + {name => "BackupsDisable"}, {name => "BlackoutBadPingLimit"}, {name => "BlackoutGoodCnt"}, {name => "BlackoutPeriods"}, @@ -307,6 +323,7 @@ our %ConfigMenu = ( {name => "RestorePostUserCmd"}, {name => "ArchivePreUserCmd"}, {name => "ArchivePostUserCmd"}, + {name => "UserCmdCheckStatus"}, ], }, hosts => { @@ -340,14 +357,14 @@ sub action ErrorExit(eval("qq{$Lang->{Only_privileged_users_can_edit_config_files}}")); } - if ( defined($In{menu}) || $In{editAction} eq $Lang->{CfgEdit_Button_Save} ) { + if ( defined($In{menu}) || $In{saveAction} eq "Save" ) { $errors = errorCheck(); if ( %$errors ) { # # If there are errors, then go back to the same menu # - $In{editAction} = ""; - $In{newMenu} = ""; + $In{saveAction} = ""; + #$In{newMenu} = ""; } if ( (my $var = $In{overrideUncheck}) ne "" ) { # @@ -384,7 +401,7 @@ sub action $newConf = { %$mainConf, %$hostConf }; } - if ( $In{editAction} ne $Lang->{CfgEdit_Button_Save} && $In{newMenu} ne "" + if ( $In{saveAction} ne "Save" && $In{newMenu} ne "" && defined($ConfigMenu{$In{newMenu}}) ) { $menu = $In{newMenu}; } @@ -458,9 +475,15 @@ EOF $content .= eval("qq($Lang->{CfgEdit_Header_Host})"); } - my $saveDisplay = "block"; - $saveDisplay = "none" if ( !$In{modified} - || $In{editAction} eq $Lang->{CfgEdit_Button_Save} ); + my $saveStyle = ""; + my $saveColor = "#ff0000"; + + if ( $In{modified} && $In{saveAction} ne "Save" && !%$errors ) { + $saveStyle = "style=\"color:$saveColor\""; + } else { + $In{modified} = 0; + } + # # Add action and host to the URL so the nav bar link is # highlighted @@ -471,7 +494,7 @@ EOF $groupText - + @@ -481,65 +504,78 @@ EOF - + + +