From ed56c5222f56f3309370c531c61748255c18be61 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 26 Nov 2007 22:35:22 +0000 Subject: [PATCH] ebl Add media list to bresto git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@5992 91ce42f0-d328-0410-95d8-f526ca767f89 --- gui/bweb/cgi/bresto.pl | 6 +- gui/bweb/html/bresto.html | 1 + gui/bweb/html/bresto.js | 123 ++++++++++++++++++++++++++++---------- gui/bweb/technotes-2.3 | 1 + 4 files changed, 98 insertions(+), 33 deletions(-) diff --git a/gui/bweb/cgi/bresto.pl b/gui/bweb/cgi/bresto.pl index 9071a9e768..26724402bd 100755 --- a/gui/bweb/cgi/bresto.pl +++ b/gui/bweb/cgi/bresto.pl @@ -964,7 +964,7 @@ if ($action eq 'list_files') { } elsif ($action eq 'get_media') { my $jobid = join(',', @jobid); - my $fileid = join(',', grep { /^\d+$/ } CGI::param('fileid')); + my $fileid = join(',', grep { /^\d+(,\d+)*$/ } CGI::param('fileid')); my $q=" SELECT DISTINCT VolumeName, Enabled, InChanger @@ -974,7 +974,7 @@ if ($action eq 'list_files') { VolumeName, Enabled, Inchanger FROM JobMedia JOIN Media USING (MediaId) WHERE JobId IN ($jobid) - GROUP BY VolumeName, InChanger + GROUP BY VolumeName,Enabled,InChanger ) AS allmedia WHERE File.FileId IN ($fileid) AND File.FileIndex >= allmedia.FirstIndex @@ -982,7 +982,7 @@ if ($action eq 'list_files') { "; my $lst = $bvfs->dbh_selectall_arrayref($q); print "["; - print join(',', map { "['$_->[0]',$_->[1]],$_->[2]]" } @$lst); + print join(',', map { "['$_->[0]',$_->[1],$_->[2]]" } @$lst); print "]\n"; } diff --git a/gui/bweb/html/bresto.html b/gui/bweb/html/bresto.html index a996ee0312..b4f3cc588f 100644 --- a/gui/bweb/html/bresto.html +++ b/gui/bweb/html/bresto.html @@ -27,6 +27,7 @@ diff --git a/gui/bweb/html/bresto.js b/gui/bweb/html/bresto.js index c5561eb2e0..ae50afd27d 100644 --- a/gui/bweb/html/bresto.js +++ b/gui/bweb/html/bresto.js @@ -690,23 +690,85 @@ function ext_init() selectOnFocus:true, width:190 }); +//////////////////////////////////////////////////////////////// + var media_store = new Ext.data.Store({ + proxy: new Ext.data.HttpProxy({ + url: '/cgi-bin/bweb/bresto.pl', + method: 'GET', + params:{offset:0, limit:50 } + }), + + reader: new Ext.data.ArrayReader({ + }, Ext.data.Record.create([ + {name: 'volumename'}, + {name: 'enabled' }, + {name: 'inchanger' } + ])) + }); + + var media_cm = new Ext.grid.ColumnModel([{ + header: "InChanger", + dataIndex: 'inchanger', + width: 60, + renderer: rd_vol_is_online + }, { + header: "Volume", + id: 'volumename', + dataIndex: 'volumename', + width: 140 + } + ]); + + // create the grid + var media_grid = new Ext.grid.Grid('div-media', { + ds: media_store, + cm: media_cm, + enableDrag: false, + enableDrop: false, + loadMask: true, + width: 200, + enableColLock:false + }); + + media_grid.render(); + + var items = file_selection_store.data.items; + var tab_fileid=new Array(); + var tab_jobid=new Array(); + for(var i=0;i