From: Eric Bollengier Date: Tue, 5 Dec 2006 18:02:31 +0000 (+0000) Subject: ebl add media filter to display_media X-Git-Tag: Release-2.0.0~161 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=969c8169e63cd9003eaa7e293b2925e6441a8227;p=bacula%2Fbacula ebl add media filter to display_media git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3756 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/gui/bweb/cgi/bweb.pl b/gui/bweb/cgi/bweb.pl index d0173dc32c..8e35eb40a3 100755 --- a/gui/bweb/cgi/bweb.pl +++ b/gui/bweb/cgi/bweb.pl @@ -99,7 +99,15 @@ if ($action eq 'begin') { # main display $bweb->location_del(); } elsif ($action eq 'media') { + print "
\n"; + my $fields = $bweb->get_form(qw/db_locations db_pools + qlocations qpools volstatus qre_media + limit qmediatypes db_mediatypes/); + $bweb->display($fields, "display_form_media.tpl"); + + print ""; $bweb->display_media(); + print "
"; } elsif ($action eq 'medias') { $bweb->display_medias(); diff --git a/gui/bweb/lang/fr/tpl/display_form_media.tpl b/gui/bweb/lang/fr/tpl/display_form_media.tpl new file mode 100644 index 0000000000..33d519ef31 --- /dev/null +++ b/gui/bweb/lang/fr/tpl/display_form_media.tpl @@ -0,0 +1,91 @@ +
+ Filtre   +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+

Type de Média

+ +
+

Localisation

+ +
+

Statut

+ +
+

Pool

+ +
+

Label

+ value= + class='formulaire' size='8'> +
+

Nombre d'éléments

+ +
+ + +
+
+ + diff --git a/gui/bweb/lib/Bweb.pm b/gui/bweb/lib/Bweb.pm index 0d7feaa40b..9f83c7b657 100644 --- a/gui/bweb/lib/Bweb.pm +++ b/gui/bweb/lib/Bweb.pm @@ -1389,7 +1389,7 @@ sub get_form $ret{$i} = $1; } } elsif ($i =~ /^j(\w+)s$/) { # quote join args - my @value = CGI::param($1) ; + my @value = grep { ! /^\s*$/ } CGI::param($1) ; if (@value) { $ret{$i} = $self->dbh_join(@value) ; } @@ -1402,7 +1402,7 @@ sub get_form } elsif ($i =~ /^q(\w+)s$/) { #[ 'arg1', 'arg2'] $ret{$i} = [ map { { name => $self->dbh_quote($_) } } - CGI::param($1) ]; + grep { ! /^\s*$/ } CGI::param($1) ]; } elsif (exists $opt_p{$i}) { my $value = CGI::param($i) || ''; if ($value =~ /^([\w\d\.\/\s:\@\-]+)$/) { @@ -1757,7 +1757,7 @@ sub get_param my $limit = ''; if ($elt{clients}) { - my @clients = CGI::param('client'); + my @clients = grep { ! /^\s*$/ } CGI::param('client'); if (@clients) { $ret{clients} = \@clients; my $str = $self->dbh_join(@clients); @@ -1766,7 +1766,7 @@ sub get_param } if ($elt{filesets}) { - my @filesets = CGI::param('fileset'); + my @filesets = grep { ! /^\s*$/ } CGI::param('fileset'); if (@filesets) { $ret{filesets} = \@filesets; my $str = $self->dbh_join(@filesets); @@ -1775,7 +1775,7 @@ sub get_param } if ($elt{mediatypes}) { - my @medias = CGI::param('mediatype'); + my @medias = grep { ! /^\s*$/ } CGI::param('mediatype'); if (@medias) { $ret{mediatypes} = \@medias; my $str = $self->dbh_join(@medias); @@ -1819,8 +1819,16 @@ sub get_param } } + if ($elt{volstatus}) { + my $status = CGI::param('volstatus') || ''; + if ($status =~ /^(\w)$/) { + $ret{status} = $1; + $limit .= "AND Media.VolStatus = '$1' "; + } + } + if ($elt{locations}) { - my @location = CGI::param('location') ; + my @location = grep { ! /^\s*$/ } CGI::param('location') ; if (@location) { $ret{locations} = \@location; my $str = $self->dbh_join(@location); @@ -1829,7 +1837,7 @@ sub get_param } if ($elt{pools}) { - my @pool = CGI::param('pool') ; + my @pool = grep { ! /^\s*$/ } CGI::param('pool') ; if (@pool) { $ret{pools} = \@pool; my $str = $self->dbh_join(@pool); @@ -1978,6 +1986,7 @@ sub display_media my ($where, %elt) = $self->get_param('pools', 'mediatypes', + 'volstatus', 'locations'); my $arg = $self->get_form('jmedias', 'qre_media'); diff --git a/gui/bweb/tpl/display_form_media.tpl b/gui/bweb/tpl/display_form_media.tpl new file mode 100644 index 0000000000..4cea050965 --- /dev/null +++ b/gui/bweb/tpl/display_form_media.tpl @@ -0,0 +1,91 @@ +
+ Filter   +
+
+
+ + + + + + + + + + + + + + + + + + + + +
+

Media Type

+ +
+

Location

+ +
+

Status

+ +
+

Pool

+ +
+

Name

+ value= + class='formulaire' size='8'> +
+

Number of items

+ +
+ + +
+
+ + diff --git a/gui/bweb/tpl/display_media.tpl b/gui/bweb/tpl/display_media.tpl index 0258ed69f7..2ebbc35e6d 100644 --- a/gui/bweb/tpl/display_media.tpl +++ b/gui/bweb/tpl/display_media.tpl @@ -1,4 +1,3 @@ -

Media