/[BackupPC]/trunk/lib/BackupPC/SearchLib.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/BackupPC/SearchLib.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 117 by dpavlin, Sun Sep 11 13:05:06 2005 UTC revision 123 by dpavlin, Mon Sep 19 11:07:31 2005 UTC
# Line 15  my $pager_pages = 10; Line 15  my $pager_pages = 10;
15  my $dsn = $Conf{SearchDSN};  my $dsn = $Conf{SearchDSN};
16  my $db_user = $Conf{SearchUser} || '';  my $db_user = $Conf{SearchUser} || '';
17    
18  my $index_path = $Conf{HyperEstraierIndex};  my $hest_index_path = $Conf{HyperEstraierIndex};
 if ($index_path) {  
         $index_path = $TopDir . '/' . $index_path;  
         $index_path =~ s#//#/#g;  
 }  
19    
20  my $dbh;  my $dbh;
21    
# Line 198  sub getFilesHyperEstraier($) { Line 194  sub getFilesHyperEstraier($) {
194          my $offset = $param->{'offset'} || 0;          my $offset = $param->{'offset'} || 0;
195          $offset *= $on_page;          $offset *= $on_page;
196    
197          die "no index_path?" unless ($index_path);          die "no index_path?" unless ($hest_index_path);
198    
199          use HyperEstraier;          use HyperEstraier;
200    
201          my ($index_path, $index_node_url) = getHyperEstraier_url($index_path);          my ($index_path, $index_node_url) = getHyperEstraier_url($hest_index_path);
202    
203          # open the database          # open the database
204          my $db;          my $db;
# Line 300  sub getGzipName($$$) Line 296  sub getGzipName($$$)
296  sub getBackupsNotBurned() {  sub getBackupsNotBurned() {
297    
298          my $dbh = get_dbh();          my $dbh = get_dbh();
299          my $sql = q{  
300          SELECT          my $sql = q{
301                  backups.hostID          AS hostid,                  SELECT
302                  min(hosts.name)         AS host,                          backups.hostID AS hostID,
303                  min(shares.name)        AS share,                          hosts.name AS host,
304                  backups.num             AS backupnum,                          shares.name AS share,
305                  min(backups.type)       AS type,                          backups.id AS backupnum,
306                  min(backups.date)       AS date,                          backups.type AS type,
307                  min(backups.size)       AS size                          backups.date AS date,
308          FROM files                          backups.size AS size
309                  INNER JOIN shares       ON files.shareID=shares.ID                  FROM backups
310                  INNER JOIN hosts        ON hosts.ID = shares.hostID                  INNER JOIN shares       ON backups.shareID=shares.ID
311                  INNER JOIN backups      ON backups.num = files.backupnum and backups.hostID = hosts.ID AND backups.shareID = shares.ID                  INNER JOIN hosts        ON backups.hostID = hosts.ID
312          GROUP BY                  LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id AND archive_backup.backup_id IS NULL
313                  backups.hostID, backups.num, backups.shareid                  WHERE backups.size > 0
314          ORDER BY min(backups.date)                  GROUP BY
315                            backups.hostID,
316                            hosts.name,
317                            shares.name,
318                            backups.num,
319                            backups.shareid,
320                            backups.id,
321                            backups.type,
322                            backups.date,
323                            backups.size
324                    ORDER BY backups.date
325          };          };
326          my $sth = $dbh->prepare( $sql );          my $sth = $dbh->prepare( $sql );
327          my @ret;          my @ret;
# Line 356  sub displayBackupsGrid() Line 362  sub displayBackupsGrid()
362          }          }
363        }        }
364      }      }
365        
366        function sumiraj()
367        {
368            var suma = 0;
369            for (var i = 0; i < document.forma.elements.length; i++)    
370                    {
371                            var e = document.forma.elements[i];
372                            if ((e.checked || !e.checked) && e.name != \'all\')
373                            {
374                                    if (e.checked)
375                                    {
376                                            var ret = e.name.match("fcb(.*)");
377                                            suma += parseInt(eval("document.forma.fss"+ret[1]+".value"));
378                                            
379                                    }
380                            }
381            }
382            document.forma.totalsize.value = suma;
383            return suma;
384        }
385  //-->  //-->
386  </script>        </script>      
387  EOF3  EOF3
388          $retHTML .= q{          $retHTML .= q{
389                  <form name="forma" method="GET" action="$MyURL?action=burn">                  <form name="forma" method="GET" action=};
390                  <input type="hidden" value="burn" name="action">                  $retHTML .= "\"".$MyURL."\"";
391                  <input type="hidden" value="results" name="search_results">                  $retHTML .= q{?action=burn>
392                  <table style="fview" border="0" cellspacing="0" cellpadding="2">                          <input type="hidden" value="burn" name="action">
393                  <tr class="tableheader">                          <input type="hidden" value="results" name="search_results">
394                  <td class="tableheader">                          <table style="fview" border="0" cellspacing="0" cellpadding="2">
395                          <input type="checkbox" name="allFiles" onClick="checkAll('allFiles');">                          <tr class="tableheader">
396                  </td>                          <td class="tableheader">
397                  <td align="center">Share</td>                                  <input type="checkbox" name="allFiles" onClick="checkAll('allFiles');">
398                  <td align="center">Backup no</td>                          </td>
399                  <td align="center">Type</td>                          <td align="center">Share</td>
400                  <td align="center">date</td>                          <td align="center">Backup no</td>
401                  <td align="center">age/days</td>                          <td align="center">Type</td>
402                  <td align="center">size/MB</td>                          <td align="center">date</td>
403                  <td align="center">gzip size</td>                          <td align="center">age/days</td>
404                  </tr>                          <td align="center">size/MB</td>
405                            <td align="center">gzip size</td>
406                  <tr><td colspan=7 style="tableheader">                          </tr>
407                  <input type="submit" value="Burn selected backups on medium" name="submitBurner">  
408                  </td></tr>                          <tr><td colspan=7 style="tableheader">
409                            <input type="submit" value="Burn selected backups on medium" name="submitBurner">
410                            </td></tr>
411          };          };
412    
413          my @color = (' bgcolor="#e0e0e0"', '');          my @color = (' bgcolor="#e0e0e0"', '');
# Line 397  EOF3 Line 425  EOF3
425                            
426                  $retHTML .= "<tr" . $color[$i %2 ] . ">";                  $retHTML .= "<tr" . $color[$i %2 ] . ">";
427                  $retHTML .= '<td class="fview"><input type="checkbox" name="fcb' .                  $retHTML .= '<td class="fview"><input type="checkbox" name="fcb' .
428                                  $backup->{'hostid'}.'_'.$backup->{'backupnum'} .                                                                                          $backup->{'hostid'}.'_'.$backup->{'backupnum'} .
429                                  '" value="' . $backup->{'hostid'}.'_'.$backup->{'backupnum'} .                                                                                          '" value="' . $backup->{'hostid'}.'_'.$backup->{'backupnum'} .
430                                  '"></td>';                                                                                          '" onClick="sumiraj();"></td>';
431                            
432                  $retHTML .=                  $retHTML .=
433                          '<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' .                          '<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' .
# Line 408  EOF3 Line 436  EOF3
436                          '<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' .                          '<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' .
437                          '<td align="center">' . $backup->{'age'} . '</td>' .                          '<td align="center">' . $backup->{'age'} . '</td>' .
438                          '<td align="right">' . $backup->{'size'} . '</td>' .                          '<td align="right">' . $backup->{'size'} . '</td>' .
439                          '<td align="right">' . $backup->{'fs_size'} .'</td>' .                          '<td align="right">' . $backup->{'fs_size'} .
440                            '<input type="hidden" name="fss'.$backup->{'hostid'}.'_'.$backup->{'backupnum'} . '"'.
441                            'value="'. $backup->{'fs_size'} .'"'.'</td>' .
442                          "</tr>\n";                          "</tr>\n";
443    
444    
445          }          }
446    
447          $retHTML .= "</table>";          $retHTML .= "</table>";
448            $retHTML .= "total gzip size:<input type=\"text\" name=\"totalsize\"><br>";
449            $retHTML .= "Note:<input type=\"text\" name=\"note\">";
450          $retHTML .= "</form>";          $retHTML .= "</form>";
451                
452          return $retHTML;          return $retHTML;

Legend:
Removed from v.117  
changed lines
  Added in v.123

  ViewVC Help
Powered by ViewVC 1.1.26