]> git.sur5r.net Git - bacula/bacula/blobdiff - gui/brestore/brestore.pl
ebl add see all versions
[bacula/bacula] / gui / brestore / brestore.pl
index fbe56b1e448452571888514d1a19a40fadc7669b..80fac3dd58c7ff6ef99d1882446bdd89c1acd40e 100755 (executable)
@@ -120,7 +120,8 @@ sub new
     my @v = DlgResto::get_all_file_versions($dbh, 
                                            "$path/", 
                                            $file,
-                                           $client);
+                                           $client,
+                                           1);
     for my $ver (@v) {
        my (undef,$fn,$jobid,$fileindex,$mtime,$size,$inchanger,$md5,$volname)
            = @{$ver};
@@ -137,6 +138,12 @@ sub new
     
     return $self;
 }
+
+sub on_forward_keypress
+{
+    return 0;
+}
+
 1;
 ################################################################
 package DlgWarn;
@@ -464,12 +471,13 @@ sub new
        use_ok_bkp_only => 1,   # dont use bad backup
        bweb     => 'http://localhost/cgi-bin/bweb/bweb.pl', # bweb url
        glade_file => $glade_file,
+       see_all_versions => 0,  # display all file versions in FileInfo
        mozilla  => 'mozilla',  # mozilla bin
        default_restore_job => 'restore', # regular expression to select default
                                   # restore job
 
        # keywords that are used to fill DlgPref
-       chk_keyword =>  [ qw/use_ok_bkp_only debug/ ],
+       chk_keyword =>  [ qw/use_ok_bkp_only debug see_all_versions/ ],
         entry_keyword => [ qw/username password bweb mozilla
                          connection_string default_restore_job
                          bconsole bsr_dest glade_file/],
@@ -1422,7 +1430,8 @@ sub fill_infoview
     my @v = get_all_file_versions($self->{dbh}, 
                                  "$path/", 
                                  $file,
-                                 $self->current_client);
+                                 $self->current_client,
+                                 $self->{pref}->{see_all_versions});
     for my $ver (@v) {
        my (undef,$fn,$jobid,$fileindex,$mtime,$size,$inchanger,$md5,$volname)
            = @{$ver};
@@ -2225,15 +2234,15 @@ sub create_filelist
        my $dbh = $self->{dbh};
        my %mediainfos;
        # This query gets all jobid/jobmedia/media combination.
-       my $query = 
-"SELECT Job.JobId, Job.VolsessionId, Job.VolsessionTime, JobMedia.StartFile, 
-        JobMedia.FirstIndex, JobMedia.LastIndex, JobMedia.StartBlock, 
-        JobMedia.EndBlock, JobMedia.VolIndex, Media.Volumename, Media.MediaType
- FROM Job, JobMedia, Media
- WHERE Job.JobId = JobMedia.JobId
-   AND JobMedia.MediaId = Media.MediaId
-   AND JobMedia.StartFile = JobMedia.EndFile
-   ORDER BY JobMedia.FirstIndex, JobMedia.LastIndex";
+       my $query = "
+SELECT Job.JobId, Job.VolsessionId, Job.VolsessionTime, JobMedia.StartFile, 
+       JobMedia.EndFile, JobMedia.FirstIndex, JobMedia.LastIndex,
+       JobMedia.StartBlock, JobMedia.EndBlock, JobMedia.VolIndex, 
+       Media.Volumename, Media.MediaType
+FROM Job, JobMedia, Media
+WHERE Job.JobId = JobMedia.JobId
+  AND JobMedia.MediaId = Media.MediaId
+  ORDER BY JobMedia.FirstIndex, JobMedia.LastIndex";
        
 
        my $result = $dbh->selectall_arrayref($query);
@@ -2242,10 +2251,16 @@ sub create_filelist
 
        foreach my $refrow (@$result)
        {
-               my ($jobid, $volsessionid, $volsessiontime, $startfile,
+               my ($jobid, $volsessionid, $volsessiontime, $startfile, $endfile,
                $firstindex, $lastindex, $startblock, $endblock,
                $volindex, $volumename, $mediatype) = @{$refrow};
 
+                # We just have to deal with the case where starfile != endfile
+                # In this case, we concatenate both, for the bsr
+                if ($startfile != $endfile) { 
+                     $startfile = $startfile . '-' . $endfile;
+               }
+
                my @tmparray = 
                ($jobid, $volsessionid, $volsessiontime, $startfile, 
                $firstindex, $lastindex, $startblock .'-'. $endblock,