]> git.sur5r.net Git - bacula/bacula/commitdiff
ebl Add menu to view only selected job or view and a menu to
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 1 Oct 2007 18:55:21 +0000 (18:55 +0000)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 1 Oct 2007 18:55:21 +0000 (18:55 +0000)
     see all file versions

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

gui/bweb/cgi/bresto.pl
gui/bweb/html/bresto.html
gui/bweb/html/bresto.js

index e8e355985ab3ab97d3f402567c8e0b1036e2c95d..78c8c8db943d8dd1fd7ad7a5c64556e3e2006615 100755 (executable)
@@ -731,13 +731,10 @@ my @jobid = grep { /^\d+$/ } CGI::param('jobid');
 
 if (!scalar(@jobid) and $args->{qdate} and $args->{client}) {
     @jobid = $bvfs->set_job_ids_for_date($args->{client}, $args->{qdate});    
-print join(",", $args->{qdate}, $args->{client}, @jobid), "\n";
-
 }
 
 $bvfs->set_curjobids(@jobid);
 
-
 $bvfs->set_limits($args->{limit}, $args->{offset});
 
 print CGI::header('application/x-javascript');
@@ -816,10 +813,13 @@ if ($action eq 'list_files') {
 
 } elsif ($action eq 'list_versions') {
 
+    my $vafv = CGI::param('vafv') || 'false'; # view all file versions
+    $vafv = ($vafv eq 'false')?0:1;
+
     print "[";
     #   0       1       2        3   4       5      6           7      8
     #($pathid,$fileid,$jobid, $fid, $mtime, $size, $inchanger, $md5, $volname);
-    my $files = $bvfs->get_all_file_versions($args->{pathid}, $args->{filenameid}, $args->{client}, 1);
+    my $files = $bvfs->get_all_file_versions($args->{pathid}, $args->{filenameid}, $args->{client}, $vafv);
     print join(',', 
               map { "[ $_->[3], $_->[1], $_->[0], $_->[2], '$_->[8]', $_->[6], '$_->[7]', $_->[5], $_->[4] ]" }
               @$files);
index 0c7f76afd5a8a44f1db6c0ae8c688b2c0682a738..5a5a7b2d7ee4c731bfea1cefed28f04c7c20e910 100644 (file)
@@ -16,6 +16,7 @@
        </head>
        <body>
 <div id="div-container"          >
+    <div id="div-main-menu"      >
     <div id="div-toolbar"        ></div>
     <div id="div-tb-sel"         ></div>
     <div id="div-files"          ></div>
index 493689d252b338237ebd649c905365468998910f..eecf8d93c9798a2497f43b77f5667ab0e6714a3d 100644 (file)
@@ -46,10 +46,14 @@ function rd_file_or_dir(val)
 
 Ext.namespace('Ext.brestore');
 
-Ext.brestore.jobid=0;
-Ext.brestore.client='';
-Ext.brestore.path='';
-Ext.brestore.root_path='';
+Ext.brestore.jobid=0;            // selected jobid
+Ext.brestore.jobdate='';         // selected date
+Ext.brestore.client='';          // selected client
+Ext.brestore.path='';            // current path (without user location)
+Ext.brestore.root_path='';       // user location
+
+Ext.brestore.option_vosb = false;
+Ext.brestore.option_vafv = false;
 
 
 function get_node_path(node)
@@ -68,12 +72,25 @@ function get_node_path(node)
 }
 
 
+function init_params(baseParams)
+{
+   baseParams['client']= Ext.brestore.client;
+
+   if (Ext.brestore.option_vosb) {        
+      baseParams['jobid'] = Ext.brestore.jobid;
+   } else {
+      baseParams['date'] = Ext.brestore.jobdate;
+   }
+   return baseParams;
+}
+
+
 function ext_init()
 {
 //////////////////////////////////////////////////////////////:
     var Tree = Ext.tree;
     var tree_loader = new Ext.tree.TreeLoader({
-            baseParams:{}, //action:'list_dirs', pathid:103, jobid:9 },
+            baseParams:{}, 
             dataUrl:'/cgi-bin/bweb/bresto.pl'
         });
 
@@ -101,9 +118,9 @@ function ext_init()
         Ext.brestore.path = get_node_path(node);
 
         file_store.removeAll();
-        file_store.load({params:{action: 'list_files',
-                                 jobid:Ext.brestore.jobid, 
-                                 node:node.id}
+       file_versions_store.removeAll();
+        file_store.load({params:init_params({action: 'list_files',
+                                             node:node.id})
                        });
         return true;
     });
@@ -120,7 +137,7 @@ function ext_init()
         proxy: new Ext.data.HttpProxy({
             url: '/cgi-bin/bweb/bresto.pl',
             method: 'GET',
-            params:{action: 'list_files', offset:0, limit:50 }
+            params:{}
         }),
 
         reader: new Ext.data.ArrayReader({
@@ -187,11 +204,11 @@ function ext_init()
     // TODO: selection only when using dblclick
     files_grid.selModel.on('rowselect', function(e,i,r) { 
         Ext.brestore.filename = r.json[3];
-        file_versions_store.load({params:{action: 'list_versions',
-                                          client: Ext.brestore.client,
-                                          pathid: r.json[2],
-                                          filenameid: r.json[1]
-                                         }
+        file_versions_store.load({params:init_params({action: 'list_versions',
+                                                    vafv: Ext.brestore.option_vafv,
+                                                    pathid: r.json[2],
+                                                    filenameid: r.json[1]
+                                                     })
                                  });
         return true;
     });
@@ -320,18 +337,7 @@ function ext_init()
            }
   
            return true;
-
-//         var sm=grid.getSelectionModel();
-//         var rows=sm.getSelections();
-//         var cindex=dd.getDragData(e).rowIndex;
-//         for(i = 0; i < rows.length; i++) {
-//                 rowData=ds.getById(rows[i].id);
-//                 if(!this.copy) 
-//                         ds.remove(ds.getById(rows[i].id));
-//                 ds.insert(cindex,rowData);
-//         };
-        }
-    });
+    }});
 
 
    file_selection_grid.on('enddrag', function(dd,e) { 
@@ -490,20 +496,48 @@ function ext_init()
         emptyText:'Select a job...',
         selectOnFocus:true,
         forceSelection: true,
-        width:300
+        width:350
     });
 
     job_combo.on('select', function(e,c) {
         // TODO: choose between date and jobid here (with a toolbar bp ?)
         Ext.brestore.jobid = c.json[0];
+       Ext.brestore.jobdate = c.json[1];
         Ext.brestore.root_path='';
         root.setText("Root");
-        tree_loader.baseParams = { action:'list_dirs',
-                                   init:1,
-                                   jobid:Ext.brestore.jobid };
+        tree_loader.baseParams = init_params({init:1, action: 'list_dirs'});
         root.reload();
     });
 
+////////////////////////////////////////////////////////////////
+
+    function sel_option(item, check)
+    {
+       if (item.id == 'id_vosb') {
+          Ext.brestore.option_vosb = check;
+       }
+       if (item.id == 'id_vafv') {
+          Ext.brestore.option_vafv = check;
+       }
+    }
+
+    var menu = new Ext.menu.Menu({
+        id: 'div-main-menu',
+        items: [ 
+          new Ext.menu.CheckItem({
+               id: 'id_vosb',
+                text: 'View only selected backup',
+                checked: Ext.brestore.option_vosb,
+                checkHandler: sel_option
+            }),
+          new Ext.menu.CheckItem({
+               id: 'id_vafv',
+                text: 'View all file versions',
+                checked: Ext.brestore.option_vafv,
+                checkHandler: sel_option
+            })
+        ]
+    });
 ////////////////////////////////////////////////////////////////:
 
     // create the primary toolbar
@@ -545,7 +579,7 @@ function ext_init()
     });
 
     var tb = new Ext.Toolbar('div-toolbar', [
-        client_combo,
+       client_combo,
         job_combo,
         '-',
         {
@@ -557,13 +591,17 @@ function ext_init()
                 var where = where_field.getValue();
                 Ext.brestore.root_path=where;
                 root.setText(where);
-                tree_loader.baseParams = { action:'list_dirs',
-                                           jobid:Ext.brestore.jobid,
-                                           path: where };
+                tree_loader.baseParams = init_params({ action:'list_dirs', path: where });
                 root.reload();
           }
         },
-        where_field
+        where_field,
+        '-',
+        {
+            cls: 'x-btn-text-icon bmenu', // icon and text class
+            text:'Options',
+            menu: menu  // assign menu by instance
+        }
     ]);
 
 ////////////////////////////////////////////////////////////////
@@ -592,7 +630,7 @@ layout.beginUpdate();
       fitToFrame: true, autoCreate:true,closable: false 
   }));
   layout.add('south', new Ext.ContentPanel('div-file-selection', {
-      toolbar: tb2,resizeEl:'div-container',
+      toolbar: tb2,resizeEl:'div-file-selection',
       fitToFrame: true, autoCreate:true,closable: false
   }));
   layout.add('east', new Ext.ContentPanel('div-file-versions', {