]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl add mediatype filter to pool view
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 4 Dec 2006 18:42:32 +0000 (18:42 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 4 Dec 2006 18:42:32 +0000 (18:42 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@3750 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/lang/fr/tpl/display_pool.tpl
gui/bweb/lib/Bweb.pm
gui/bweb/tpl/display_pool.tpl

index f6811979e4c5a7ddf27b1fc15fe7663c8f0a967c..fc5c5e5c99850614b37d5cc9c1fc2839ce324279 100644 (file)
@@ -6,6 +6,9 @@
    <form action='?' method='get'>
     <table id='id<TMPL_VAR ID>'></table>
     <input type="image" type='submit' name='action' value='media' title='Afficher le contenu' src='/bweb/zoom.png'>
+<TMPL_LOOP MediaType>
+    <input type='hidden' name='mediatype' value=<TMPL_VAR name>>
+</TMPL_LOOP>
    </form>
    <br/>
    Tips : Pour modifier les options d'un pool, vous devez éditer la configuration bacula et
index 799653bcf223c112225f54835106ae59045b5c07..336e63e286f98ca700a3bb997e01a063c90e4ff9 100644 (file)
@@ -2441,6 +2441,14 @@ GROUP BY Client.Name
 sub display_pool
 {
     my ($self, $poolname) = @_ ;
+    my $whereA = '';
+    my $whereW = '';
+
+    my $arg = $self->get_form('jmediatypes', 'qmediatypes');
+    if ($arg->{jmediatypes}) {
+       $whereW = "WHERE MediaType IN ($arg->{jmediatypes}) ";
+       $whereA = "AND   MediaType IN ($arg->{jmediatypes}) ";
+    }
     
 # TODO : afficher les tailles et les dates
 
@@ -2473,6 +2481,7 @@ FROM
     GROUP BY Media.MediaType, Media.PoolId, media_avg_size.volavg
   ) AS subq
 LEFT JOIN Pool ON (Pool.PoolId = subq.PoolId)
+$whereW
 ";
 
     my $all = $self->dbh_selectall_hashref($query, 'name') ;
@@ -2482,6 +2491,7 @@ SELECT Pool.Name AS name,
        sum(VolBytes) AS size
 FROM   Media JOIN Pool ON (Media.PoolId = Pool.PoolId)
 WHERE  Media.VolStatus IN ('Recycled', 'Purged')
+       $whereA
 GROUP BY Pool.Name;
 ";
     my $empty = $self->dbh_selectall_hashref($query, 'name');
@@ -2501,6 +2511,7 @@ GROUP BY Pool.Name;
   SELECT VolStatus AS volstatus, count(MediaId) AS nb
     FROM Media 
    WHERE PoolId=$p->{poolid} 
+         $whereA
 GROUP BY VolStatus
 ";
        my $content = $self->dbh_selectall_hashref($query, 'volstatus');
@@ -2511,6 +2522,7 @@ GROUP BY VolStatus
 
     $self->debug($all);
     $self->display({ ID => $cur_id++,
+                    MediaType => $arg->{qmediatypes}, # [ { name => type1 } , { name => type2 } ]
                     Pools => [ values %$all ]},
                   "display_pool.tpl");
 }
index 6285daf9f42b2cb696b9f3f3283bba38b3e87232..3148e0fe7dea917d24efc6032e0db69aebed0e0f 100644 (file)
@@ -6,6 +6,9 @@
    <form action='?' method='get'>
     <table id='id<TMPL_VAR ID>'></table>
     <input type="image" type='submit' name='action' value='media' title='Show content' src='/bweb/zoom.png'>
+<TMPL_LOOP MediaType>
+    <input type='hidden' name='mediatype' value=<TMPL_VAR name>>
+</TMPL_LOOP>
    </form>
    <br/>
    Tips: To modify pool properties, you have to edit your bacula configuration