]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl add missing client_edit template
authorEric Bollengier <eric@eb.homelinux.org>
Thu, 14 Feb 2008 20:22:52 +0000 (20:22 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Thu, 14 Feb 2008 20:22:52 +0000 (20:22 +0000)
     cleanup some SQL

git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@6420 91ce42f0-d328-0410-95d8-f526ca767f89

gui/bweb/lang/en/tpl/client_edit.tpl [new file with mode: 0644]
gui/bweb/lang/es/tpl/client_edit.tpl [new file with mode: 0644]
gui/bweb/lang/fr/tpl/client_edit.tpl [new file with mode: 0644]
gui/bweb/lib/Bweb.pm
gui/bweb/technotes-2.3
gui/bweb/tpl/client_edit.tpl [new file with mode: 0644]

diff --git a/gui/bweb/lang/en/tpl/client_edit.tpl b/gui/bweb/lang/en/tpl/client_edit.tpl
new file mode 100644 (file)
index 0000000..4f69e4b
--- /dev/null
@@ -0,0 +1,60 @@
+<br/>
+ <div class='titlediv'>
+  <h1 class='newstitle'>Client <TMPL_VAR Name></h1>
+ </div>
+ <div class='bodydiv'>
+<form name="client" action='?' method='GET'>
+     <input type='hidden' name='client' value=<TMPL_VAR qclient>>
+     <table id='id<TMPL_VAR ID>'></table>
+       <div class="otherboxtitle">
+          Actions &nbsp;
+        </div>
+        <div class="otherbox">
+       <button type="submit" class="bp" name='action' value='client_save' title="Apply"> <img src='/bweb/apply.png' alt=''>Apply</button>
+        </div>
+
+</form>
+ </div>
+
+<script type="text/javascript" language="JavaScript">
+var header = new Array("Group Name", "Description", "Selection");
+
+var data = new Array();
+var radiobox ;
+
+<TMPL_LOOP client_group>
+radiobox = document.createElement('INPUT');
+radiobox.type  = 'radio';
+radiobox.name = 'client_group';
+radiobox.value = '<TMPL_VAR client_group_name>';
+radiobox.checked = <TMPL_IF here>1<TMPL_ELSE>0</TMPL_IF>;
+
+data.push( 
+  new Array( "<TMPL_VAR client_group_name>", 
+            "<TMPL_VAR comment>",
+             radiobox
+              )
+) ; 
+</TMPL_LOOP>
+
+nrsTable.setup(
+{
+ table_name:     "id<TMPL_VAR ID>",
+ table_header: header,
+ table_data: data,
+ up_icon: up_icon,
+ down_icon: down_icon,
+ prev_icon: prev_icon,
+ next_icon: next_icon,
+ rew_icon:  rew_icon,
+ fwd_icon:  fwd_icon,
+// natural_compare: false,
+ even_cell_color: even_cell_color,
+ odd_cell_color: odd_cell_color, 
+ header_color: header_color,
+ page_nav: true,
+ rows_per_page: rows_per_page,
+ disable_sorting: new Array(1)
+}
+);
+</script>
diff --git a/gui/bweb/lang/es/tpl/client_edit.tpl b/gui/bweb/lang/es/tpl/client_edit.tpl
new file mode 100644 (file)
index 0000000..4f69e4b
--- /dev/null
@@ -0,0 +1,60 @@
+<br/>
+ <div class='titlediv'>
+  <h1 class='newstitle'>Client <TMPL_VAR Name></h1>
+ </div>
+ <div class='bodydiv'>
+<form name="client" action='?' method='GET'>
+     <input type='hidden' name='client' value=<TMPL_VAR qclient>>
+     <table id='id<TMPL_VAR ID>'></table>
+       <div class="otherboxtitle">
+          Actions &nbsp;
+        </div>
+        <div class="otherbox">
+       <button type="submit" class="bp" name='action' value='client_save' title="Apply"> <img src='/bweb/apply.png' alt=''>Apply</button>
+        </div>
+
+</form>
+ </div>
+
+<script type="text/javascript" language="JavaScript">
+var header = new Array("Group Name", "Description", "Selection");
+
+var data = new Array();
+var radiobox ;
+
+<TMPL_LOOP client_group>
+radiobox = document.createElement('INPUT');
+radiobox.type  = 'radio';
+radiobox.name = 'client_group';
+radiobox.value = '<TMPL_VAR client_group_name>';
+radiobox.checked = <TMPL_IF here>1<TMPL_ELSE>0</TMPL_IF>;
+
+data.push( 
+  new Array( "<TMPL_VAR client_group_name>", 
+            "<TMPL_VAR comment>",
+             radiobox
+              )
+) ; 
+</TMPL_LOOP>
+
+nrsTable.setup(
+{
+ table_name:     "id<TMPL_VAR ID>",
+ table_header: header,
+ table_data: data,
+ up_icon: up_icon,
+ down_icon: down_icon,
+ prev_icon: prev_icon,
+ next_icon: next_icon,
+ rew_icon:  rew_icon,
+ fwd_icon:  fwd_icon,
+// natural_compare: false,
+ even_cell_color: even_cell_color,
+ odd_cell_color: odd_cell_color, 
+ header_color: header_color,
+ page_nav: true,
+ rows_per_page: rows_per_page,
+ disable_sorting: new Array(1)
+}
+);
+</script>
diff --git a/gui/bweb/lang/fr/tpl/client_edit.tpl b/gui/bweb/lang/fr/tpl/client_edit.tpl
new file mode 100644 (file)
index 0000000..ac2629f
--- /dev/null
@@ -0,0 +1,60 @@
+<br/>
+ <div class='titlediv'>
+  <h1 class='newstitle'>Client <TMPL_VAR Name></h1>
+ </div>
+ <div class='bodydiv'>
+<form name="client" action='?' method='GET'>
+     <input type='hidden' name='client' value=<TMPL_VAR qclient>>
+     <table id='id<TMPL_VAR ID>'></table>
+       <div class="otherboxtitle">
+          Actions &nbsp;
+        </div>
+        <div class="otherbox">
+       <button type="submit" class="bp" name='action' value='client_save' title="Appliquer"> <img src='/bweb/apply.png' alt=''>Appliquer</button>
+        </div>
+
+</form>
+ </div>
+
+<script type="text/javascript" language="JavaScript">
+var header = new Array("Group Name", "Description", "Sélection");
+
+var data = new Array();
+var radiobox ;
+
+<TMPL_LOOP client_group>
+radiobox = document.createElement('INPUT');
+radiobox.type  = 'radio';
+radiobox.name = 'client_group';
+radiobox.value = '<TMPL_VAR client_group_name>';
+radiobox.checked = <TMPL_IF here>1<TMPL_ELSE>0</TMPL_IF>;
+
+data.push( 
+  new Array( "<TMPL_VAR client_group_name>", 
+            "<TMPL_VAR comment>",
+             radiobox
+              )
+) ; 
+</TMPL_LOOP>
+
+nrsTable.setup(
+{
+ table_name:     "id<TMPL_VAR ID>",
+ table_header: header,
+ table_data: data,
+ up_icon: up_icon,
+ down_icon: down_icon,
+ prev_icon: prev_icon,
+ next_icon: next_icon,
+ rew_icon:  rew_icon,
+ fwd_icon:  fwd_icon,
+// natural_compare: false,
+ even_cell_color: even_cell_color,
+ odd_cell_color: odd_cell_color, 
+ header_color: header_color,
+ page_nav: true,
+ rows_per_page: rows_per_page,
+ disable_sorting: new Array(1)
+}
+);
+</script>
index fe6f7740621946af626a69fe6080d3d10d73fcda..7af3b5ad5966cf4a8745339d5c87ba9ee319e4c8 100644 (file)
@@ -1565,13 +1565,23 @@ sub client_edit
     my $f1 = $self->get_client_group_filter();
     my $f2 = $self->get_client_filter();
  
+# client_group_name | here 
+#-------------------+-----
+#      GROUP1       | 1
+#      GRP3         | 0
+
     my $query = "
-SELECT client_group_name, here
-  FROM client_group $f1
-  LEFT JOIN (SELECT 1 AS here, client_group_id
-               FROM Client JOIN client_group_member USING (ClientId) $f2
-              WHERE Name = $arg->{qclient}) AS temp USING (client_group_id)
-";
+SELECT client_group_name, max(here) AS here FROM (
+  SELECT client_group_name, 1 AS here
+    FROM client_group
+    JOIN client_group_member USING (client_group_id)
+    JOIN Client USING (ClientId) $f2
+   WHERE Name = $arg->{qclient}
+  UNION ALL
+  SELECT client_group_name, 0 
+    FROM client_group $f1
+) AS temp
+GROUP by client_group_name";
 
     my $all = $self->dbh_selectall_hashref($query, 'client_group_name');
     
@@ -3378,18 +3388,22 @@ sub display_user
 
 #  rolename  | userid
 #------------+--------
-# cancel_job |
-# restore    |
+# cancel_job |      0
+# restore    |      0
 # run_job    |      1
 
     my $role = $self->dbh_selectall_hashref("
-SELECT rolename, temp.userid
-     FROM bweb_role
-     LEFT JOIN (SELECT roleid, userid
-                  FROM bweb_user JOIN bweb_role_member USING (userid)
-                 WHERE username = $user) AS temp USING (roleid)
-ORDER BY rolename
-", 'rolename');
+SELECT rolename, max(here) AS userid FROM (
+        SELECT rolename, 1 AS here
+          FROM bweb_user 
+          JOIN bweb_role_member USING (userid)
+          JOIN bweb_role USING (roleid)
+          WHERE username = $user
+       UNION ALL
+       SELECT rolename, 0 
+         FROM bweb_role
+) AS temp
+GROUP by rolename", 'rolename');
 
     $arg = $self->get_form(qw/db_usernames db_client_groups/);    
 
index 776dde86be71f981db1d172175793e57b0149534..5613d7e4cf1efdd6bbdb2dcf717237d4d421ad14 100644 (file)
@@ -1,3 +1,6 @@
+14Feb08
+ebl  Cleanup some SQL
+
 13Feb08
 ebl  Can modify client list group for a specific client
 ebl  Disable use of Enabled flag in volume mgnt
diff --git a/gui/bweb/tpl/client_edit.tpl b/gui/bweb/tpl/client_edit.tpl
new file mode 100644 (file)
index 0000000..962e89c
--- /dev/null
@@ -0,0 +1,60 @@
+<br/>
+ <div class='titlediv'>
+  <h1 class='newstitle'>Client <TMPL_VAR Name></h1>
+ </div>
+ <div class='bodydiv'>
+<form name="client" action='?' method='GET'>
+     <input type='hidden' name='client' value=<TMPL_VAR qclient>>
+     <table id='id<TMPL_VAR ID>'></table>
+       <div class="otherboxtitle">
+          Actions &nbsp;
+        </div>
+        <div class="otherbox">
+       <button type="submit" class="bp" name='action' value='client_save' title="__Apply__"> <img src='/bweb/apply.png' alt=''>__Apply__</button>
+        </div>
+
+</form>
+ </div>
+
+<script type="text/javascript" language="JavaScript">
+var header = new Array("__Group Name__", "__Description__", "__Selection__");
+
+var data = new Array();
+var radiobox ;
+
+<TMPL_LOOP client_group>
+radiobox = document.createElement('INPUT');
+radiobox.type  = 'radio';
+radiobox.name = 'client_group';
+radiobox.value = '<TMPL_VAR client_group_name>';
+radiobox.checked = <TMPL_IF here>1<TMPL_ELSE>0</TMPL_IF>;
+
+data.push( 
+  new Array( "<TMPL_VAR client_group_name>", 
+            "<TMPL_VAR comment>",
+             radiobox
+              )
+) ; 
+</TMPL_LOOP>
+
+nrsTable.setup(
+{
+ table_name:     "id<TMPL_VAR ID>",
+ table_header: header,
+ table_data: data,
+ up_icon: up_icon,
+ down_icon: down_icon,
+ prev_icon: prev_icon,
+ next_icon: next_icon,
+ rew_icon:  rew_icon,
+ fwd_icon:  fwd_icon,
+// natural_compare: false,
+ even_cell_color: even_cell_color,
+ odd_cell_color: odd_cell_color, 
+ header_color: header_color,
+ page_nav: true,
+ rows_per_page: rows_per_page,
+ disable_sorting: new Array(1)
+}
+);
+</script>