/[BackupPC]/trunk/lib/BackupPC/CGI/SearchArchives.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

Annotation of /trunk/lib/BackupPC/CGI/SearchArchives.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 91 - (hide annotations)
Sun Aug 28 17:53:46 2005 UTC (18 years, 10 months ago) by dpavlin
File size: 2302 byte(s)
bug fix: require search string to be in filepath to produce same
results from HyperEstraier as from RDBMS.

1 dpavlin 4 ####################################################################
2     # SearchArchives.pm - module for searching through archived files #
3     # via a sqlite database #
4     ####################################################################
5     package BackupPC::CGI::SearchArchives;
6    
7    
8     use strict;
9     use BackupPC::CGI::Lib qw(:all);
10     use BackupPC::SearchLib;
11     use Data::Dumper;
12 dpavlin 59 use HTML::FillInForm;
13 dpavlin 4 use vars qw($Cgi %In $MyURL $User %Conf $TopDir $BinDir $bpc);
14    
15     sub action() {
16 dpavlin 59 my $hosts_html = "";
17 dpavlin 4
18    
19 dpavlin 59 BackupPC::CGI::Lib::NewRequest();
20     my @hosts = BackupPC::SearchLib::getUnits();
21 dpavlin 4
22 dpavlin 59 foreach my $host (@hosts) {
23     $hosts_html .= "<option value=" . $host->{'id'} . "> " . $host->{'share'} . " </option>\n";
24 dpavlin 4 }
25    
26 dpavlin 17 sub date_from_to_html {
27     my $name = shift || return;
28     return qq{
29 dpavlin 63 <input type="text" name="${name}_year_from" size="4">
30     <input type="text" name="${name}_month_from" size="2">
31 dpavlin 59 <input type="text" name="${name}_day_from" size="2">
32     -
33 dpavlin 63 <input type="text" name="${name}_year_to" size="4">
34     <input type="text" name="${name}_month_to" size="2">
35 dpavlin 59 <input type="text" name="${name}_day_to" size="2">
36 dpavlin 17 };
37     }
38    
39 dpavlin 59 my $form .= qq{
40 dpavlin 17 <form name="searchForm" method="GET" action="$MyURL">
41 dpavlin 59 <p>
42     Filename:
43     <input type="text" name="search_filename" size="50">
44     &nbsp;
45     on share
46     &nbsp;
47 dpavlin 60 <select name="search_share">$hosts_html</select>
48 dpavlin 59 &nbsp;&nbsp;&nbsp;
49     <input type="submit" value="Search">
50     </p>
51 dpavlin 17
52 dpavlin 59 <p style="color:gray;">
53     file(s) between:
54     } . date_from_to_html('search') . qq{
55     &nbsp;&nbsp;
56     backups between:
57     } . date_from_to_html('search_backup') . qq{
58     (yyyy-mm-dd)
59     </p>
60    
61 dpavlin 86 <p style="color: gray;">
62 dpavlin 91 <input type="checkbox" name="use_hest"> use faster full-text search engine
63 dpavlin 86 </p>
64    
65 dpavlin 17 <input type="hidden" value="search" name="action">
66     <input type="hidden" value="results" name="search_results">
67     </form>
68     };
69 dpavlin 4
70 dpavlin 59 my $html = eval(q{ ${h1("Search")}});
71 dpavlin 19
72 dpavlin 59 if ( !defined($In{search_results}) ) {
73     $html .= eval(q{ ${h2("Search criteria")}});
74 dpavlin 83
75 dpavlin 59 $html .= $form;
76     } else {
77     $html .= eval(q{ ${h2("Search results")}});
78 dpavlin 83
79 dpavlin 59 my $fif = new HTML::FillInForm;
80     $html .= $fif->fill(scalarref => \$form, fdat => \%In);
81 dpavlin 19
82 dpavlin 86 $html .= BackupPC::SearchLib::displayGrid( \%In );
83 dpavlin 59 }
84    
85     Header( eval("qq{$Lang->{Search_archive}}"), "", 1, "", $html );
86     Trailer();
87 dpavlin 4 }
88    
89     1;

  ViewVC Help
Powered by ViewVC 1.1.26