From c86c0eea293de6d8fd72d8bb6b2a0ac8a8111232 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Sat, 10 Nov 2007 13:02:46 +0000 Subject: [PATCH] ebl Update Location.Enabled to be like Media.Enabled Fix Mysql log output git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5887 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/lang/es/tpl/location_edit.tpl | 19 +++++++++++++++--- gui/bweb/lang/fr/tpl/location_edit.tpl | 23 +++++++++++++++++----- gui/bweb/lib/Bweb.pm | 27 ++++++++++++++++++++------ gui/bweb/tpl/location_edit.tpl | 24 ++++++++++++++++++----- 4 files changed, 74 insertions(+), 19 deletions(-) diff --git a/gui/bweb/lang/es/tpl/location_edit.tpl b/gui/bweb/lang/es/tpl/location_edit.tpl index 11856be10c..16cdde2ef3 100644 --- a/gui/bweb/lang/es/tpl/location_edit.tpl +++ b/gui/bweb/lang/es/tpl/location_edit.tpl @@ -3,7 +3,7 @@

UbicaciĆ³n :

-
+ @@ -16,11 +16,24 @@ - +
UbicaciĆ³n :
Activado : checked > - +
+ diff --git a/gui/bweb/lang/fr/tpl/location_edit.tpl b/gui/bweb/lang/fr/tpl/location_edit.tpl index ef196866c6..117359e6b5 100644 --- a/gui/bweb/lang/fr/tpl/location_edit.tpl +++ b/gui/bweb/lang/fr/tpl/location_edit.tpl @@ -3,7 +3,7 @@

Localisation :

-
+ @@ -15,12 +15,25 @@ - - - + + +
Localisation :
Enabled : checked > -
Enabled: +
+ diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 3e29c34438..aae48d00a3 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -1208,15 +1208,29 @@ sub human_enabled { my $val = shift || 0; - if ($val == 1 or $val eq "yes") { + if ($val eq '1' or $val eq "yes") { return "yes"; - } elsif ($val == 2 or $val eq "archived") { + } elsif ($val eq '2' or $val eq "archived") { return "archived"; } else { return "no"; } } +# display Enabled +sub from_human_enabled +{ + my $val = shift || 0; + + if ($val == 1 or $val eq "yes") { + return 1; + } elsif ($val == 2 or $val eq "archived") { + return 2; + } else { + return 0; + } +} + # get Day, Hour, Year sub from_human_sec { @@ -1255,6 +1269,8 @@ sub connect_db if ($self->{info}->{dbi} =~ /^dbi:Pg/i) { $self->{dbh}->do("SET datestyle TO 'ISO, YMD'"); + } else { + $self->{dbh}->do("SET group_concat_max_len=1000000"); } } } @@ -2372,7 +2388,7 @@ WHERE Location.Location = $loc->{qlocation} "; my $row = $self->dbh_selectrow_hashref($query); - + $row->{enabled} = human_enabled($row->{enabled}); $self->display({ ID => $cur_id++, %$row }, "location_edit.tpl") ; } @@ -2382,7 +2398,7 @@ sub location_save my ($self) = @_ ; $self->can_do('r_location_mgnt'); - my $arg = $self->get_form(qw/qlocation qnewlocation cost/) ; + my $arg = $self->get_form(qw/qlocation qnewlocation cost enabled/) ; unless ($arg->{qlocation}) { return $self->error("Can't get location"); } @@ -2393,8 +2409,7 @@ sub location_save return $self->error("Can't get new cost"); } - my $enabled = CGI::param('enabled') || ''; - $enabled = $enabled?1:0; + my $enabled = from_human_enabled($arg->{enabled}); my $query = " UPDATE Location SET Cost = $arg->{cost}, diff --git a/gui/bweb/tpl/location_edit.tpl b/gui/bweb/tpl/location_edit.tpl index 75ad5b6e12..c7f28afe57 100644 --- a/gui/bweb/tpl/location_edit.tpl +++ b/gui/bweb/tpl/location_edit.tpl @@ -3,7 +3,7 @@

Location :

-
+ @@ -15,12 +15,26 @@ - - - + + +
Location :
Enabled : checked > -
Enabled: +
+ + -- 2.39.5