]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl enable groups
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 31 May 2007 13:43:51 +0000 (13:43 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 31 May 2007 13:43:51 +0000 (13:43 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@4953 91ce42f0-d328-0410-95d8-f526ca767f89

15 files changed:
gui/bweb/INSTALL
gui/bweb/ReleaseNotes
gui/bweb/cgi/bgraph.pl
gui/bweb/cgi/bweb.pl
gui/bweb/lang/es/tpl/begin.tpl
gui/bweb/lang/es/tpl/display_client_stats.tpl
gui/bweb/lang/es/tpl/display_groups.tpl
gui/bweb/lang/fr/tpl/begin.tpl
gui/bweb/lang/fr/tpl/display_client_stats.tpl
gui/bweb/lang/fr/tpl/display_form_job.tpl
gui/bweb/lang/fr/tpl/display_groups.tpl
gui/bweb/lib/Bweb.pm
gui/bweb/tpl/begin.tpl
gui/bweb/tpl/display_client_stats.tpl
gui/bweb/tpl/display_groups.tpl

index d980bc5c3b046c8dd74379b75cf2cc53d8114e60..039f502ab9843c3233bdcc7e85aa3912a03e70fd 100644 (file)
@@ -16,6 +16,7 @@ Bweb works well with 1.39 release or later.
 10) accessing to bweb
 11) setting mysql read-only account
 12) get more statistics
+13) use groups with bweb
 
 ################ FILE COPY #####################################
  # you must get bweb svn files
@@ -100,11 +101,11 @@ Simply use lang/fr/tpl/*.tpl files instead of tpl/*.tpl
 
  That should show you if any of the pre-requisites are missing.
  On SuSE 10.2, I was able to load all the appropriate modules via rpms,
 with the exception of Expect and Time::ParseDate, which I loaded manually
 using perl.
+ with the exception of Expect and Time::ParseDate, which I loaded manually
+ using perl.
 
 If you experience problems, always consult the Apache error_log
 file.
+ If you experience problems, always consult the Apache error_log
+ file.
 
 ################ APACHE CONFIGURATION ##########################
 
@@ -261,8 +262,8 @@ chown www-data /var/spool/bweb
 You have to remove "<!-- Remove this to activate bfileview" and "-->" from
 tpl/display_job_zoom.tpl.
 
-You must use brestore.pl -b to initialize the database, and
-you can use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
+You MUST use brestore.pl -b to initialize the database, and
+you CAN use bfileview.pl mode=batch jobid=xxx where=/ to compute tree size.
 
 At this time, it's a good idea to schedule brestore.pl -b after your 
 BackupCatalog job.
@@ -317,6 +318,11 @@ And run this on crontab when you want :
 INSERT INTO job_old 
   (SELECT * FROM Job WHERE JobId NOT IN (SELECT JobId FROM job_old) );
 
+################ USE GROUPS WITH BWEB ##########################
+
+It works with postgresql and mysql5 (4 not tested).
+To enable group, load bweb/script/bweb_group.sql into your catalog
+
 ################################################################
 
 Enjoy !
index 43e264a5184a3f553d39213ff045074bb3012634..c497d855d5d94b54b86758021e5f728fb0032cfd 100644 (file)
@@ -1,5 +1,8 @@
           Release Notes for bweb 2.2
 
+2007/05/31
+ - add group management (see INSTALL to enable it)
+
 2007/05/23
  - put Bconsole error to stderr (error.log)
 
index 01c2891050eeeac2acec47479d91f75099aa122d..efc0199ee0cbea862302a7efad18cfa860c9c480 100755 (executable)
@@ -65,7 +65,7 @@ my $legend = CGI::param('legend') || 'on' ;
 $legend = ($legend eq 'on')?1:0;
 
 my $arg = $bweb->get_form(qw/width height limit offset age where jobid
-                            jfilesets level status jjobnames jclients/);
+                            jfilesets level status jjobnames jclients jclient_groups/);
 
 my ($limitq, $label) = $bweb->get_limit(age   => $arg->{age},
                                        limit => $arg->{limit},
@@ -102,6 +102,14 @@ if ($arg->{jclients}) {
     $arg->{jclients} = 'all';  # skip warning
 }
 
+my $groupf='';                 # from clause
+my $groupq='';                 # whre clause
+if ($arg->{jclient_groups}) {
+    $groupf = " JOIN client_group_member ON (Client.ClientId = client_group_member.clientid) 
+                JOIN client_group USING (client_group_id)";
+    $groupq = " AND client_group_name IN ($arg->{jclient_groups}) ";
+}
+
 my $gtype = CGI::param('gtype') || 'bars';
 
 print CGI::header('image/png');
@@ -197,7 +205,7 @@ SELECT
        Client.Name                      AS clientname,
        $jobt.Name                       AS jobname,
        $jobt.JobBytes                   AS jobbytes
-FROM $jobt, Client, FileSet
+FROM $jobt, FileSet, Client $groupf
 WHERE $jobt.ClientId = Client.ClientId
   AND $jobt.FileSetId = FileSet.FileSetId
   AND $jobt.Type = 'B'
@@ -206,6 +214,7 @@ WHERE $jobt.ClientId = Client.ClientId
   $filesetq
   $levelq
   $jobnameq
+  $groupq
 $limitq
 ";
 
@@ -234,7 +243,7 @@ SELECT
        Client.Name                      AS clientname,
        $jobt.Name                       AS jobname,
        $jobt.JobFiles                   AS jobfiles
-FROM $jobt, Client, FileSet
+FROM $jobt, FileSet, Client $groupf
 WHERE $jobt.ClientId = Client.ClientId
   AND $jobt.FileSetId = FileSet.FileSetId
   AND $jobt.Type = 'B'
@@ -243,6 +252,7 @@ WHERE $jobt.ClientId = Client.ClientId
   $filesetq
   $levelq
   $jobnameq
+  $groupq
 $limitq
 ";
 
@@ -275,7 +285,7 @@ SELECT UNIX_TIMESTAMP(Job.StartTime)    AS starttime,
        Job.Name                         AS jobname,
        base64_decode_lstat(8,LStat)     AS lstat
 
-FROM Job, Client, FileSet, Filename, Path, File
+FROM Job, FileSet, Filename, Path, File, Client
 WHERE Job.ClientId = Client.ClientId
   AND Job.FileSetId = FileSet.FileSetId
   AND Job.Type = 'B'
@@ -372,7 +382,7 @@ SELECT
                         - $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime)) + 0.01) 
          AS rate
 
-FROM $jobt, Client, FileSet
+FROM $jobt, FileSet, Client $groupf
 WHERE $jobt.ClientId = Client.ClientId
   AND $jobt.FileSetId = FileSet.FileSetId
   AND $jobt.Type = 'B'
@@ -381,6 +391,7 @@ WHERE $jobt.ClientId = Client.ClientId
   $filesetq
   $levelq
   $jobnameq
+  $groupq
 $limitq
 ";
 
@@ -413,7 +424,7 @@ SELECT
   $bweb->{sql}->{SEC_TO_INT}(  $bweb->{sql}->{UNIX_TIMESTAMP}(EndTime)  
                              - $bweb->{sql}->{UNIX_TIMESTAMP}(StartTime)) 
          AS duration
-FROM $jobt, Client, FileSet
+FROM $jobt, FileSet, Client $groupf
 WHERE $jobt.ClientId = Client.ClientId
   AND $jobt.FileSetId = FileSet.FileSetId
   AND $jobt.Type = 'B'
@@ -422,6 +433,7 @@ WHERE $jobt.ClientId = Client.ClientId
   $filesetq
   $levelq
   $jobnameq
+  $groupq
 $limitq
 ";
 
@@ -472,7 +484,7 @@ $limitq
 SELECT
      " . ($per_t?"":"UNIX_TIMESTAMP") . "($stime) AS A,
      $t(JobBytes)                  AS nb
-FROM $jobt, Client, FileSet
+FROM $jobt, FileSet, Client $groupf
 WHERE $jobt.ClientId = Client.ClientId
   AND $jobt.FileSetId = FileSet.FileSetId
   AND $jobt.Type = 'B'
@@ -481,6 +493,7 @@ WHERE $jobt.ClientId = Client.ClientId
   $filesetq
   $levelq
   $jobnameq
+  $groupq
 $limit
 ";
 
index 4cc4b92367badfac11d52d63c0201d0059b3b621..443b82f347d793657ca607c47af089a38bbe3df0 100755 (executable)
@@ -296,8 +296,9 @@ if ($action eq 'begin') {           # main display
     print "<div><table border='0'><tr><td valign='top'>\n";
     my $fields = $bweb->get_form(qw/status level db_clients db_filesets
                                    limit age offset qclients qfilesets
-#                                  db_client_groups qclient_groups
-                                   jobtype qpools db_pools/);
+                                   jobtype qpools db_pools
+                                   db_client_groups qclient_groups/); # drop this to hide 
+
     $bweb->display($fields, "display_form_job.tpl");
 
     print "</td><td valign='top'>";
@@ -314,6 +315,10 @@ if ($action eq 'begin') {          # main display
        }
     }
 
+} elsif ($action eq 'group_stats') {
+
+    $bweb->display_group_stats(age => $arg->{age});
+
 } elsif ($action eq 'running') {
     $bweb->display_running_jobs(1);
 
index 2c63817a60613818062d02e8885f33663884a254..7433be1a4414813c6a1cb541aeeeb1949091e809 100644 (file)
@@ -20,7 +20,12 @@ if (navigator.appName == 'Konqueror') {
 
 <ul id="menu">
  <li><a href="bweb.pl?">Principal</a> </li>
- <li><a href="bweb.pl?action=client">Clientes</a></li>
+ <li><a href="bweb.pl?action=client">Clientes</a>
+     <ul>
+       <li><a href="bweb.pl?action=client">Clientes</a> </li>
+       <li><a href="bweb.pl?action=groups">Groups</a> </li>
+     </ul>
+ </li>
  <li><a href="bweb.pl?action=run_job">Jobs</a>
    <ul> 
      <li><a href="bweb.pl?action=run_job">Jobs Definidos</a>
index da4f445416d38fc24c0671f07bd0cf70931656c7..c8b0b8f3f2e1878213e6e44db2ae0a59f8c142c5 100644 (file)
@@ -1,13 +1,13 @@
 <br/>
  <div class='titlediv'>
-  <h1 class='newstitle'> Cliente : <TMPL_VAR NAME=clientname> (<TMPL_VAR NAME=label>)</h1>
+  <h1 class='newstitle'> Cliente : <TMPL_VAR clientname> (<TMPL_VAR label>)</h1>
  </div>
  <div class='bodydiv'>
 <form action='?'
-     <table id='id<TMPL_VAR NAME=ID>'></table>
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Not enough data' > &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
+     <table id='id<TMPL_VAR ID>'></table>
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Not enough data' > &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
 <!--   <div class="otherboxtitle">
           Actions &nbsp;
         </div>
@@ -28,17 +28,17 @@ var header = new Array("Nombre", "Nb Jobs", "Nb Bytes", "Nb Files", "Nb Errors")
 var data = new Array();
 
 data.push( 
-  new Array( "<TMPL_VAR NAME=clientname>", 
-            "<TMPL_VAR NAME=nb_jobs>",
-            human_size(<TMPL_VAR NAME=nb_bytes>),
-            "<TMPL_VAR NAME=nb_files>",
-            "<TMPL_VAR NAME=nb_err>"
+  new Array( "<TMPL_VAR clientname>", 
+            "<TMPL_VAR nb_jobs>",
+            human_size(<TMPL_VAR nb_bytes>),
+            "<TMPL_VAR nb_files>",
+            "<TMPL_VAR nb_err>"
              )
 ) ; 
 
 nrsTable.setup(
 {
- table_name:     "id<TMPL_VAR NAME=ID>",
+ table_name:     "id<TMPL_VAR ID>",
  table_header: header,
  table_data: data,
  up_icon: up_icon,
index b9ab74ee5eda715e6836f7a7561e6a8e47418b28..5959906f9ec1ebda25607ffdd76e8757ed67b958 100644 (file)
      title='Supprimer' src='/bweb/remove.png'>&nbsp;
     <input type="image" name='action' value='groups_edit' title='Modify' src='/bweb/edit.png'>&nbsp;
 
-    <input type="image" name='action' value='groups' title='View'
-     src='/bweb/zoom.png'>
+    <input type="image" name='action' value='client' title='View members'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='job' title='View jobs'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='group_stats' title='Estadísticas del groups' src='/bweb/chart.png'>&nbsp;
    </form>
  </div>
 
@@ -23,15 +26,15 @@ var header = new Array("Name","Selection");
 var data = new Array();
 var chkbox;
 
-<TMPL_LOOP groups>
+<TMPL_LOOP db_client_groups>
 
 chkbox = document.createElement('INPUT');
 chkbox.type  = 'radio';
 chkbox.name  = 'client_group';
-chkbox.value = '<TMPL_VAR client_group>';
+chkbox.value = '<TMPL_VAR name>';
 
 data.push( new Array(
-"<TMPL_VAR client_group>",
+"<TMPL_VAR name>",
 chkbox
  )
 );
index b604b2827b8aa461b908f0dc552a8530159a8f8d..c1588612124c02fdf5c17f224e66fec06163937d 100644 (file)
@@ -20,7 +20,12 @@ if (navigator.appName == 'Konqueror') {
 
 <ul id="menu">
  <li><a href="bweb.pl?">Accueil</a> </li>
- <li><a href="bweb.pl?action=client">Clients</a></li>
+ <li><a href="bweb.pl?action=client">Clients</a>
+     <ul>
+       <li><a href="bweb.pl?action=client">Clients</a> </li>
+       <li><a href="bweb.pl?action=groups">Groupes</a> </li>
+     </ul>
+ </li>
  <li><a href="bweb.pl?action=run_job">Jobs</a>
    <ul> 
      <li><a href="bweb.pl?action=run_job">Jobs définis</a>
index 4cd2c141ef9f774471306b7d84f72c61fffb1e70..501c2880c3724edca63e3e31dc52c3a18cd34436 100644 (file)
@@ -1,13 +1,13 @@
 <br/>
  <div class='titlediv'>
-  <h1 class='newstitle'> Client : <TMPL_VAR NAME=clientname> (<TMPL_VAR NAME=label>)</h1>
+  <h1 class='newstitle'> Client : <TMPL_VAR clientname> (<TMPL_VAR label>)</h1>
  </div>
  <div class='bodydiv'>
 <form action='?'
-     <table id='id<TMPL_VAR NAME=ID>'></table>
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Données insufisantes' > &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Données insufisantes'> &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Données insufisantes'> &nbsp;
+     <table id='id<TMPL_VAR ID>'></table>
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Données insufisantes' > &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Données insufisantes'> &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Données insufisantes'> &nbsp;
 <!--   <div class="otherboxtitle">
           Actions &nbsp;
         </div>
@@ -28,17 +28,17 @@ var header = new Array("Nom", "Nb Jobs", "Taille", "Nb Fichiers", "Nb Erreurs");
 var data = new Array();
 
 data.push( 
-  new Array( "<TMPL_VAR NAME=clientname>", 
-            "<TMPL_VAR NAME=nb_jobs>",
-            human_size(<TMPL_VAR NAME=nb_bytes>),
-            "<TMPL_VAR NAME=nb_files>",
-            "<TMPL_VAR NAME=nb_err>"
+  new Array( "<TMPL_VAR clientname>", 
+            "<TMPL_VAR nb_jobs>",
+            human_size(<TMPL_VAR nb_bytes>),
+            "<TMPL_VAR nb_files>",
+            "<TMPL_VAR nb_err>"
              )
 ) ; 
 
 nrsTable.setup(
 {
- table_name:     "id<TMPL_VAR NAME=ID>",
+ table_name:     "id<TMPL_VAR ID>",
  table_header: header,
  table_data: data,
  up_icon: up_icon,
index 1a6a5123c5f440bd32e924a1e7fb7d7be2633e9a..a75ba9f584e3d16128393df5ff5a1876af8ccd46 100644 (file)
@@ -11,8 +11,8 @@
     <select name='level' class='formulaire'>
       <option id='level_Any' value='Any'>Tous</option>
       <option id='level_F' value='F'>Full</option>
-      <option id='level_D' value='D'>Différentielle</option>
-      <option id='level_I' value='I'>Incrémentale</option>
+      <option id='level_D' value='D'>Diff&eacute;rentielle</option>
+      <option id='level_I' value='I'>Incr&eacute;mentale</option>
     </select>     
   </td>
 </tr>
@@ -24,7 +24,7 @@
       <option id='status_T'   value='T'>Ok</option>
       <option id='status_W'   value='W'>Warning</option>
       <option id='status_f'   value='f'>Erreur</option>
-      <option id='status_A'   value='A'>Annulé</option>
+      <option id='status_A'   value='A'>Annul&eacute;</option>
     </select>     
   </td>
 </tr>
@@ -41,7 +41,7 @@
 </tr>
 <tr>
   <td valign='top'>
-    <h2>Période</h2>
+    <h2>P&eacute;riode</h2>
     <select name='age' class='formulaire'>
       <option id='age_86400'   value='86400'>Hier</option>
       <option id='age_604800'   value='604800'>Cette semaine</option>
@@ -52,7 +52,7 @@
  </tr>
  <tr>
   <td valign='bottom'> 
-    <h2>Nombre d'éléments</h2>
+    <h2>Nombre d'&eacute;l&eacute;ments</h2>
     <input type='text' name='limit' value='<TMPL_VAR limit>' 
        class='formulaire' size='4'>
   </td>
index 5683e33369c77207a78f509e2832baf8e7bd4337..a214392ae622a5b4027b15d81ae18fc37ea3b3ee 100644 (file)
      title='Supprimer' src='/bweb/remove.png'>&nbsp;
     <input type="image" name='action' value='groups_edit' title='Modifier' src='/bweb/edit.png'>&nbsp;
 
-    <input type="image" name='action' value='groups' title='Voir les groupes'
-     src='/bweb/zoom.png'>
+    <input type="image" name='action' value='client' title='Voir les membres'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='job' title='Voir les jobs'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='group_stats' title='Statistiques sur le groupe' src='/bweb/chart.png'>&nbsp;
    </form>
  </div>
 
@@ -23,15 +26,15 @@ var header = new Array("Nom","Selection");
 var data = new Array();
 var chkbox;
 
-<TMPL_LOOP groups>
+<TMPL_LOOP db_client_groups>
 
 chkbox = document.createElement('INPUT');
 chkbox.type  = 'radio';
 chkbox.name  = 'client_group';
-chkbox.value = '<TMPL_VAR client_group>';
+chkbox.value = '<TMPL_VAR name>';
 
 data.push( new Array(
-"<TMPL_VAR client_group>",
+"<TMPL_VAR name>",
 chkbox
  )
 );
index 1d2b58cb3f84dedd7e91329185242de915a4ce58..867c01600bdefa745e53321c32a31e7958913629 100644 (file)
@@ -1257,12 +1257,16 @@ sub display_clients
     my ($self) = @_;
 
     my $where='';
-    my $arg = $self->get_form("client", "qre_client");
+    my $arg = $self->get_form("client", "qre_client", "jclient_groups");
 
     if ($arg->{qre_client}) {
        $where = "WHERE Name $self->{sql}->{MATCH} $arg->{qre_client} ";
     } elsif ($arg->{client}) {
        $where = "WHERE Name = '$arg->{client}' ";
+    } elsif ($arg->{jclient_groups}) {
+       $where = "JOIN client_group_member ON (Client.ClientId = client_group_member.clientid) 
+                  JOIN client_group USING (client_group_id)
+                  WHERE client_group_name IN ($arg->{jclient_groups})";
     }
 
     my $query = "
@@ -2496,17 +2500,16 @@ sub display_groups
 {
     my ($self) = @_;
 
-    my $query = "
-SELECT client_group_name AS client_group 
-FROM client_group ORDER BY client_group_name;
-";
+    my $arg = $self->get_form(qw/db_client_groups/) ;
 
-    my $groups = $self->dbh_selectall_hashref($query, 'client_group');
+    if ($self->{dbh}->errstr) {
+       return $self->error("Can't use groups with bweb, read INSTALL to enable them");
+    }
 
-    $self->debug($groups);
+    $self->debug($arg);
 
     $self->display({ ID => $cur_id++,
-                    groups => [ values %$groups ] },
+                    %$arg},
                   "display_groups.tpl");
 }
 
@@ -2652,6 +2655,7 @@ sub display_client_stats
     my ($self, %arg) = @_ ;
 
     my $client = $self->dbh_quote($arg{clientname});
+
     my ($limit, $label) = $self->get_limit(%arg);
 
     my $query = "
@@ -2661,7 +2665,7 @@ SELECT
     sum(Job.JobErrors)   AS nb_err,
     sum(Job.JobFiles)    AS nb_files,
     Client.Name          AS clientname
-FROM Job INNER JOIN Client USING (ClientId)
+FROM Job JOIN Client USING (ClientId)
 WHERE 
     Client.Name = $client
     $limit 
@@ -2672,6 +2676,41 @@ GROUP BY Client.Name
 
     $row->{ID} = $cur_id++;
     $row->{label} = $label;
+    $row->{grapharg} = "client";
+
+    $self->display($row, "display_client_stats.tpl");
+}
+
+
+sub display_group_stats
+{
+    my ($self, %arg) = @_ ;
+
+    my $carg = $self->get_form(qw/qclient_group/);
+
+    my ($limit, $label) = $self->get_limit(%arg);
+
+    my $query = "
+SELECT 
+    count(Job.JobId)     AS nb_jobs,
+    sum(Job.JobBytes)    AS nb_bytes,
+    sum(Job.JobErrors)   AS nb_err,
+    sum(Job.JobFiles)    AS nb_files,
+    client_group.client_group_name  AS clientname
+FROM Job JOIN Client USING (ClientId) 
+         JOIN client_group_member ON (Client.ClientId = client_group_member.clientid) 
+         JOIN client_group USING (client_group_id)
+WHERE 
+    client_group.client_group_name = $carg->{qclient_group}
+    $limit 
+GROUP BY client_group.client_group_name
+";
+
+    my $row = $self->dbh_selectrow_hashref($query);
+
+    $row->{ID} = $cur_id++;
+    $row->{label} = $label;
+    $row->{grapharg} = "client_group";
 
     $self->display($row, "display_client_stats.tpl");
 }
@@ -2684,7 +2723,7 @@ sub display_pool
     my $whereW = '';
 
     my $arg = $self->get_form('jmediatypes', 'qmediatypes');
-    if ($arg->{jmediatypes}) {
+    if ($arg->{jmediatypes}) { 
        $whereW = "WHERE MediaType IN ($arg->{jmediatypes}) ";
        $whereA = "AND   MediaType IN ($arg->{jmediatypes}) ";
     }
index 316ea223d658a8cc6e364f45ea7f2a5c8d0038cb..56693de47ea2dffaf2b591e035fc789a57be8f40 100644 (file)
@@ -20,7 +20,12 @@ if (navigator.appName == 'Konqueror') {
 
 <ul id="menu">
  <li><a href="bweb.pl?">Main</a> </li>
- <li><a href="bweb.pl?action=client">Clients</a></li>
+ <li><a href="bweb.pl?action=client">Clients</a>
+     <ul>
+       <li><a href="bweb.pl?action=client">Clients</a> </li>
+       <li><a href="bweb.pl?action=groups">Groups</a> </li>
+     </ul>
+ </li>
  <li><a href="bweb.pl?action=run_job">Jobs</a>
    <ul> 
      <li><a href="bweb.pl?action=run_job">Defined Jobs</a>
index d93cd8e24233377d4fb808fb6b585b3261da9708..bbd11b88d14ed380cd81ba3d7f1d5956ee8e809d 100644 (file)
@@ -1,13 +1,13 @@
 <br/>
  <div class='titlediv'>
-  <h1 class='newstitle'> Client : <TMPL_VAR NAME=clientname> (<TMPL_VAR NAME=label>)</h1>
+  <h1 class='newstitle'> Client : <TMPL_VAR clientname> (<TMPL_VAR label>)</h1>
  </div>
  <div class='bodydiv'>
-<form action='?'
-     <table id='id<TMPL_VAR NAME=ID>'></table>
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Not enough data' > &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
-     <img src="bgraph.pl?client=<TMPL_VAR NAME=clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
+<form action='?'>
+     <table id='id<TMPL_VAR ID>'></table>
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_duration;age=2592000;width=420;height=200" alt='Not enough data' > &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_rate;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
+     <img src="bgraph.pl?<TMPL_VAR grapharg>=<TMPL_VAR clientname>;graph=job_size;age=2592000;width=420;height=200" alt='Not enough data'> &nbsp;
 <!--   <div class="otherboxtitle">
           Actions &nbsp;
         </div>
@@ -28,17 +28,17 @@ var header = new Array("Name", "Nb Jobs", "Nb Bytes", "Nb Files", "Nb Errors");
 var data = new Array();
 
 data.push( 
-  new Array( "<TMPL_VAR NAME=clientname>", 
-            "<TMPL_VAR NAME=nb_jobs>",
-            human_size(<TMPL_VAR NAME=nb_bytes>),
-            "<TMPL_VAR NAME=nb_files>",
-            "<TMPL_VAR NAME=nb_err>"
+  new Array( "<TMPL_VAR clientname>", 
+            "<TMPL_VAR nb_jobs>",
+            human_size(<TMPL_VAR nb_bytes>),
+            "<TMPL_VAR nb_files>",
+            "<TMPL_VAR nb_err>"
              )
 ) ; 
 
 nrsTable.setup(
 {
- table_name:     "id<TMPL_VAR NAME=ID>",
+ table_name:     "id<TMPL_VAR ID>",
  table_header: header,
  table_data: data,
  up_icon: up_icon,
index b9ab74ee5eda715e6836f7a7561e6a8e47418b28..3600d4094d5ea99cad006c3e2eee5f4b607ac3e3 100644 (file)
      title='Supprimer' src='/bweb/remove.png'>&nbsp;
     <input type="image" name='action' value='groups_edit' title='Modify' src='/bweb/edit.png'>&nbsp;
 
-    <input type="image" name='action' value='groups' title='View'
-     src='/bweb/zoom.png'>
+    <input type="image" name='action' value='client' title='View members'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='job' title='View jobs'
+     src='/bweb/zoom.png'>&nbsp;
+    <input type="image" name='action' value='group_stats' title='Statistics' src='/bweb/chart.png'>&nbsp;
    </form>
  </div>
 
@@ -23,15 +26,15 @@ var header = new Array("Name","Selection");
 var data = new Array();
 var chkbox;
 
-<TMPL_LOOP groups>
+<TMPL_LOOP db_client_groups>
 
 chkbox = document.createElement('INPUT');
 chkbox.type  = 'radio';
 chkbox.name  = 'client_group';
-chkbox.value = '<TMPL_VAR client_group>';
+chkbox.value = '<TMPL_VAR name>';
 
 data.push( new Array(
-"<TMPL_VAR client_group>",
+"<TMPL_VAR name>",
 chkbox
  )
 );