X-Git-Url: http://git.rot13.org/?p=BackupPC.git;a=blobdiff_plain;f=lib%2FBackupPC%2FCGI%2FEditConfig.pm;h=3504bc1bffc26304d0bd86c7579858db08da4c78;hp=6633f59badeda8cf956622a8677fe4c04668d656;hb=refs%2Ftags%2Fv3_0_0beta1;hpb=546f9691f118c9ea2d164f377994b4a018a60d02 diff --git a/lib/BackupPC/CGI/EditConfig.pm b/lib/BackupPC/CGI/EditConfig.pm index 6633f59..3504bc1 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 2.1.0beta2pl1, released 30 May 2004. +# Version 3.0.0beta1, released 30 Jul 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 => { @@ -697,9 +714,10 @@ EOF $bpc->ServerConnect(); if ( $mesg ne "" ) { (my $mesgBR = $mesg) =~ s/\n/
\n/g; - $content .= <$mesgBR -EOF + # uncomment this if you want the changes to be displayed +# $content .= <$mesgBR +#EOF foreach my $str ( split(/\n/, $mesg) ) { $bpc->ServerMesg("log $str") if ( $str ne "" ); } @@ -825,8 +843,9 @@ EOF # foreach my $var ( keys(%In) ) { next if ( $var !~ /^orig_z_/ ); + my $val = decode_utf8($In{$var}); $contentHidden .= < + EOF } } @@ -930,7 +949,7 @@ sub fieldEditBuild $size = $type->{size} if ( defined($type->{size}) ); # - # These fragments allow inline conent to be turned on and off + # These fragments allow inline content to be turned on and off # # # $varName @@ -1111,7 +1130,7 @@ EOF if ( !$type->{noKeyEdit} ) { $content .= < -New key: +$Lang->{CfgEdit_Button_New_Key}: EOF @@ -1187,8 +1206,9 @@ EOF $varValue = [$varValue] if ( ref($varValue) ne "ARRAY" ); $varValue = join(", ", @$varValue); } + my $textType = ($varName =~ /Passwd/) ? "password" : "text"; $content .= < + EOF } elsif ( $type->{type} eq "boolean" ) { # checkbox @@ -1210,7 +1230,7 @@ EOF my $rowCnt = $varValue =~ tr/\n//; $rowCnt = 1 if ( $rowCnt < 1 ); $content .= <${EscHTML($varValue)} + EOF } $content .= "\n"; @@ -1395,7 +1415,7 @@ sub fieldInputParse } } } else { - $$value = $In{"v_z_$varName"}; + $$value = decode_utf8($In{"v_z_$varName"}); $$value =~ s/\r\n/\n/g; } $$value = undef if ( $type->{undefIfEmpty} && $$value eq "" ); @@ -1448,12 +1468,15 @@ sub configDiffMesg (my $valueNew2 = $valueNew) =~ s/['\n\r]//g; (my $valueOld2 = $valueOld) =~ s/['\n\r]//g; + + next if ( $valueOld2 eq $valueNew2 ); + $valueNew =~ s/\n/\\n/g; $valueOld =~ s/\n/\\n/g; $valueNew =~ s/\r/\\r/g; $valueOld =~ s/\r/\\r/g; - $mesg .= eval("qq($Lang->{CfgEdit_Log_Change_param_value})") - if ( $valueOld2 ne $valueNew2 ); + + $mesg .= eval("qq($Lang->{CfgEdit_Log_Change_param_value})"); } } return $mesg;