--- trunk/lib/BackupPC/SearchLib.pm 2005/07/11 14:32:40 19 +++ trunk/lib/BackupPC/SearchLib.pm 2005/07/29 17:30:25 26 @@ -4,7 +4,6 @@ use strict; use BackupPC::CGI::Lib qw(:all); use BackupPC::Attrib qw(:all); -use Data::Dumper; use DBI; sub getUnits() { @@ -53,7 +52,7 @@ push( @conditions, ' backups.hostID = ' . $param->{'search_host'} ) if ($param->{'search_host'}); - push (@conditions, " files.name LIKE '".$param->{'search_filename'}."%'") if ($param->{'search_filename'}); + push (@conditions, " upper(files.name) LIKE upper('%".$param->{'search_filename'}."%')") if ($param->{'search_filename'}); return ( join(" and ", @conditions), @@ -87,7 +86,7 @@ FROM files INNER JOIN shares ON files.shareID=shares.ID INNER JOIN hosts ON hosts.ID = shares.hostID - INNER JOIN backups ON backups.num = files.backupNum + INNER JOIN backups ON backups.num = files.backupNum and backups.hostID = hosts.ID LEFT JOIN dvds ON dvds.ID = files.dvdid }; @@ -279,12 +278,12 @@ $retHTML .= qq{ - - + - - - + + + + }; @@ -297,17 +296,22 @@ return $html; } - foreach $file (@files) { - my $ftype = "file"; - $ftype = "dir" if ($file->{'type'} == BPC_FTYPE_DIR); + sub restore_link($$$$$$) { + my $type = shift; + my $action = 'RestoreFile'; + $action = 'browse' if (lc($type) eq 'dir'); + return sprintf(qq{%s}, $action, @_); + } + foreach $file (@files) { + my $typeStr = BackupPC::Attrib::fileType2Text(undef, $file->{'type'}); $retHTML .= ""; foreach my $v (( - $file->{'hname'}, - $ftype, - hilite_html( $file->{'fpath'}, $hilite ), - $file->{'backupno'}, + $file->{'sharename'}, + qq{ } . hilite_html( $file->{'fpath'}, $hilite ), + $typeStr, + restore_link( $typeStr, $file->{'hname'}, $file->{'backupno'}, $file->{'sname'}, $file->{'fpath'}, $file->{'backupno'} ), $file->{'size'}, $file->{'date'}, $file->{'dvd'}
HostTypeShare Namebackup no.sizedateType#SizeDate Media