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 |
|
|
58 |
sub mk_epoch_date($$) { |
sub mk_epoch_date($$) { |
59 |
my ($name,$suffix) = @_; |
my ($name,$suffix) = @_; |
60 |
|
|
61 |
my $yyyy = $param->{ $name . '_year_' . $suffix} || return; |
my $yyyy = $param->{ $name . '_year_' . $suffix} || return undef; |
62 |
my $mm .= $param->{ $name . '_month_' . $suffix} || |
my $mm .= $param->{ $name . '_month_' . $suffix} || |
63 |
( $suffix eq 'from' ? 1 : 12); |
( $suffix eq 'from' ? 1 : 12); |
64 |
my $dd .= $param->{ $name . '_day_' . $suffix} || |
my $dd .= $param->{ $name . '_day_' . $suffix} || |
65 |
( $suffix eq 'from' ? 1 : 31); |
( $suffix eq 'from' ? 1 : 31); |
66 |
|
|
67 |
|
$yyyy =~ s/\D//g; |
68 |
|
$mm =~ s/\D//g; |
69 |
|
$dd =~ s/\D//g; |
70 |
|
|
71 |
my $dt = new DateTime( |
my $dt = new DateTime( |
72 |
year => $yyyy, |
year => $yyyy, |
73 |
month => $mm, |
month => $mm, |
74 |
day => $dd |
day => $dd |
75 |
); |
); |
76 |
|
print STDERR "mk_epoch_date($name,$suffix) [$yyyy-$mm-$dd] = " . $dt->ymd . " " . $dt->hms . "\n"; |
77 |
return $dt->epoch || 'NULL'; |
return $dt->epoch || 'NULL'; |
78 |
} |
} |
79 |
|
|
80 |
return ( |
my @ret = ( |
81 |
mk_epoch_date('search_backup', 'from'), |
mk_epoch_date('search_backup', 'from'), |
82 |
mk_epoch_date('search_backup', 'to'), |
mk_epoch_date('search_backup', 'to'), |
83 |
mk_epoch_date('search', 'from'), |
mk_epoch_date('search', 'from'), |
84 |
mk_epoch_date('search', 'to'), |
mk_epoch_date('search', 'to'), |
85 |
); |
); |
86 |
|
|
87 |
|
return @ret; |
88 |
|
|
89 |
} |
} |
90 |
|
|
91 |
|
|
109 |
} |
} |
110 |
|
|
111 |
|
|
112 |
sub getFiles($$) { |
sub getFiles($) { |
113 |
my ($param, $offset) = @_; |
my ($param) = @_; |
114 |
|
|
115 |
|
my $offset = $param->{'offset'} || 0; |
116 |
|
$offset *= $on_page; |
117 |
|
|
118 |
my $dbh = get_dbh(); |
my $dbh = get_dbh(); |
119 |
|
|
121 |
files.id AS fid, |
files.id AS fid, |
122 |
hosts.name AS hname, |
hosts.name AS hname, |
123 |
shares.name AS sname, |
shares.name AS sname, |
|
-- shares.share AS sharename, |
|
124 |
files.backupnum AS backupnum, |
files.backupnum AS backupnum, |
|
-- files.name AS filename, |
|
125 |
files.path AS filepath, |
files.path AS filepath, |
126 |
files.date AS date, |
files.date AS date, |
127 |
files.type AS type, |
files.type AS type, |
128 |
files.size AS size, |
files.size AS size |
|
-- dvds.name AS dvd |
|
|
null AS dvd |
|
129 |
}; |
}; |
130 |
|
|
131 |
my $sql_from = qq{ |
my $sql_from = qq{ |
132 |
FROM files |
FROM files |
133 |
INNER JOIN shares ON files.shareID=shares.ID |
INNER JOIN shares ON files.shareID=shares.ID |
134 |
INNER JOIN hosts ON hosts.ID = shares.hostID |
INNER JOIN hosts ON hosts.ID = shares.hostID |
135 |
INNER JOIN backups ON backups.num = files.backupnum and backups.hostID = hosts.ID AND backups.shareID = shares.ID |
INNER JOIN backups ON backups.num = files.backupnum and backups.hostID = hosts.ID AND backups.shareID = files.shareID |
|
}; |
|
|
|
|
|
my $sql_dvd_from = qq{ |
|
|
-- LEFT JOIN dvds ON dvds.ID = files.dvdid |
|
136 |
}; |
}; |
137 |
|
|
138 |
my $sql_where; |
my $sql_where; |
146 |
}; |
}; |
147 |
|
|
148 |
my $sql_count = qq{ select count(files.id) $sql_from $sql_where }; |
my $sql_count = qq{ select count(files.id) $sql_from $sql_where }; |
149 |
my $sql_results = qq{ select $sql_cols $sql_from $sql_dvd_from $sql_where $sql_order }; |
my $sql_results = qq{ select $sql_cols $sql_from $sql_where $sql_order }; |
|
|
|
|
$offset ||= 0; |
|
|
$offset = ($offset * $on_page); |
|
150 |
|
|
151 |
my $sth = $dbh->prepare($sql_count); |
my $sth = $dbh->prepare($sql_count); |
152 |
$sth->execute(); |
$sth->execute(); |
171 |
return ($results, \@ret); |
return ($results, \@ret); |
172 |
} |
} |
173 |
|
|
174 |
sub getFilesHyperEstraier($$) { |
sub getHyperEstraier_url($) { |
175 |
my ($param, $offset) = @_; |
my ($use_hest) = @_; |
176 |
|
|
177 |
die "no index_path?" unless ($index_path); |
return unless $use_hest; |
178 |
|
|
179 |
use HyperEstraier; |
use HyperEstraier; |
180 |
|
my ($index_path, $index_node_url); |
181 |
|
|
182 |
|
if ($use_hest =~ m#^http://#) { |
183 |
|
$index_node_url = $use_hest; |
184 |
|
} else { |
185 |
|
$index_path = $TopDir . '/' . $index_path; |
186 |
|
$index_path =~ s#//#/#g; |
187 |
|
} |
188 |
|
return ($index_path, $index_node_url); |
189 |
|
} |
190 |
|
|
191 |
|
sub getFilesHyperEstraier($) { |
192 |
|
my ($param) = @_; |
193 |
|
|
194 |
|
my $offset = $param->{'offset'} || 0; |
195 |
|
$offset *= $on_page; |
196 |
|
|
197 |
|
die "no index_path?" unless ($hest_index_path); |
198 |
|
|
199 |
|
use HyperEstraier; |
200 |
|
|
201 |
|
my ($index_path, $index_node_url) = getHyperEstraier_url($hest_index_path); |
202 |
|
|
203 |
# open the database |
# open the database |
204 |
my $db = HyperEstraier::Database->new(); |
my $db; |
205 |
$db->open($index_path, $HyperEstraier::ESTDBREADER); |
if ($index_path) { |
206 |
|
$db = HyperEstraier::Database->new(); |
207 |
|
$db->open($index_path, $HyperEstraier::ESTDBREADER); |
208 |
|
} elsif ($index_node_url) { |
209 |
|
$db ||= HyperEstraier::Node->new($index_node_url); |
210 |
|
$db->set_auth('admin', 'admin'); |
211 |
|
} else { |
212 |
|
die "BUG: unimplemented"; |
213 |
|
} |
214 |
|
|
215 |
# create a search condition object |
# create a search condition object |
216 |
my $cond = HyperEstraier::Condition->new(); |
my $cond = HyperEstraier::Condition->new(); |
218 |
my $q = $param->{'search_filename'}; |
my $q = $param->{'search_filename'}; |
219 |
my $shareid = $param->{'search_share'}; |
my $shareid = $param->{'search_share'}; |
220 |
|
|
221 |
if ($q) { |
if (length($q) > 0) { |
222 |
$q =~ s/(.)/$1 /g; |
# exact match |
223 |
|
$cond->add_attr("filepath ISTRINC $q"); |
224 |
|
|
225 |
|
$q =~ s/(.)/$1 /g; |
226 |
# set the search phrase to the search condition object |
# set the search phrase to the search condition object |
227 |
$cond->set_phrase($q); |
$cond->set_phrase($q); |
228 |
|
} |
229 |
|
|
230 |
my ($backup_from, $backup_to, $files_from, $files_to) = dates_from_form($param); |
my ($backup_from, $backup_to, $files_from, $files_to) = dates_from_form($param); |
231 |
|
|
232 |
$cond->add_attr("backup_date NUMGE $backup_from") if ($backup_from); |
$cond->add_attr("backup_date NUMGE $backup_from") if ($backup_from); |
233 |
$cond->add_attr("backup_date NUMLE $backup_to") if ($backup_to); |
$cond->add_attr("backup_date NUMLE $backup_to") if ($backup_to); |
234 |
|
|
235 |
$cond->add_attr("date NUMGE $files_from") if ($files_from); |
$cond->add_attr("date NUMGE $files_from") if ($files_from); |
236 |
$cond->add_attr("date NUMLE $files_to") if ($files_to); |
$cond->add_attr("date NUMLE $files_to") if ($files_to); |
237 |
|
|
238 |
$cond->add_attr("shareid NUMEQ $shareid") if ($shareid); |
$cond->add_attr("shareid NUMEQ $shareid") if ($shareid); |
|
} |
|
|
|
|
|
$offset ||= 0; |
|
|
$offset = ($offset * $on_page); |
|
239 |
|
|
240 |
# $cond->set_max( $offset + $on_page ); |
# $cond->set_max( $offset + $on_page ); |
241 |
$cond->set_options( $HyperEstraier::Condition::SURE ); |
$cond->set_options( $HyperEstraier::Condition::SURE ); |
242 |
$cond->set_order( 'date NUMA' ); |
$cond->set_order( 'date NUMA' ); |
243 |
|
|
244 |
# get the result of search |
# get the result of search |
|
my $result = $db->search($cond, 0); |
|
|
$result->get(0); |
|
|
|
|
245 |
my @res; |
my @res; |
246 |
my $hits = $result->size; |
my ($result, $hits); |
247 |
|
|
248 |
|
if ($index_path) { |
249 |
|
$result = $db->search($cond, 0); |
250 |
|
$hits = $result->size; |
251 |
|
} elsif ($index_node_url) { |
252 |
|
$result = $db->search($cond, 0); |
253 |
|
$hits = $result->doc_num; |
254 |
|
} else { |
255 |
|
die "BUG: unimplemented"; |
256 |
|
} |
257 |
|
|
258 |
# for each document in result |
# for each document in result |
259 |
for my $i ($offset .. $result->size-1) { |
for my $i ($offset .. ($offset + $on_page - 1)) { |
260 |
my $id = $result->get($i); |
last if ($i >= $hits); |
261 |
my $doc = $db->get_doc($id, 0); |
|
262 |
|
my $doc; |
263 |
|
if ($index_path) { |
264 |
|
my $id = $result->get($i); |
265 |
|
$doc = $db->get_doc($id, 0); |
266 |
|
} elsif ($index_node_url) { |
267 |
|
$doc = $result->get_doc($i); |
268 |
|
} else { |
269 |
|
die "BUG: unimplemented"; |
270 |
|
} |
271 |
|
|
272 |
my $row; |
my $row; |
273 |
foreach my $c (qw/fid hname sname backupnum fiilename filepath date type size/) { |
foreach my $c (qw/fid hname sname backupnum fiilename filepath date type size/) { |
279 |
return ($hits, \@res); |
return ($hits, \@res); |
280 |
} |
} |
281 |
|
|
282 |
|
sub getGzipName($$$) |
283 |
|
{ |
284 |
|
my ($host, $share, $backupnum) = @_; |
285 |
|
my $ret = $Conf{GzipSchema}; |
286 |
|
|
287 |
|
$share =~ s/\//_/g; |
288 |
|
$ret =~ s/\\h/$host/ge; |
289 |
|
$ret =~ s/\\s/$share/ge; |
290 |
|
$ret =~ s/\\n/$backupnum/ge; |
291 |
|
|
292 |
|
return $ret; |
293 |
|
|
294 |
|
} |
295 |
|
|
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 |
backups.num AS backupnum, |
hosts.name AS host, |
304 |
min(backups.type) AS type, |
shares.name AS share, |
305 |
min(backups.date) AS date, |
backups.id AS backupnum, |
306 |
min(backups.size) AS size |
backups.type AS type, |
307 |
FROM files |
backups.date AS date, |
308 |
INNER JOIN shares ON files.shareID=shares.ID |
backups.size AS size |
309 |
INNER JOIN hosts ON hosts.ID = shares.hostID |
FROM backups |
310 |
INNER JOIN backups ON backups.num = files.backupnum and backups.hostID = hosts.ID AND backups.shareID = shares.ID |
INNER JOIN shares ON backups.shareID=shares.ID |
311 |
WHERE |
INNER JOIN hosts ON backups.hostID = hosts.ID |
312 |
files.dvdid IS NULL |
LEFT OUTER JOIN archive_backup ON archive_backup.backup_id = backups.id AND archive_backup.backup_id IS NULL |
313 |
GROUP BY |
WHERE backups.size > 0 |
314 |
backups.hostID, backups.num |
GROUP BY |
315 |
ORDER BY min(backups.date) |
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; |
330 |
while ( my $row = $sth->fetchrow_hashref() ) { |
while ( my $row = $sth->fetchrow_hashref() ) { |
331 |
$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ); |
$row->{'age'} = sprintf("%0.1f", ( (time() - $row->{'date'}) / 86400 ) ); |
332 |
$row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024); |
$row->{'size'} = sprintf("%0.2f", $row->{'size'} / 1024 / 1024); |
333 |
|
my (undef,undef,undef,undef,undef,undef,undef,$fs_size,undef,undef,undef,undef,undef) = |
334 |
|
stat( $Conf{InstallDir}.'/'.$Conf{GzipTempDir}.'/'. |
335 |
|
getGzipName($row->{'host'}, $row->{share}, $row->{'backupnum'})); |
336 |
|
$row->{'fs_size'} = $fs_size; |
337 |
push @ret, $row; |
push @ret, $row; |
338 |
} |
} |
339 |
|
|
340 |
return @ret; |
return @ret; |
341 |
} |
} |
342 |
|
|
343 |
sub displayBackupsGrid() |
sub displayBackupsGrid() { |
|
{ |
|
|
my $retHTML = ""; |
|
|
my $addForm = 1; |
|
|
|
|
|
if ($addForm) { |
|
344 |
|
|
345 |
$retHTML .= <<EOF3; |
my $retHTML .= q{ |
346 |
<script language="javascript" type="text/javascript"> |
<form id="forma" method="POST" action=}; |
347 |
|
$retHTML .= "\"".$MyURL."\""; |
348 |
|
$retHTML .= q{?action=burn> |
349 |
|
}; |
350 |
|
|
351 |
|
$retHTML .= <<'EOF3'; |
352 |
|
<style> |
353 |
<!-- |
<!-- |
354 |
|
|
355 |
function checkAll(location) |
div#fixedBox |
356 |
|
{ |
357 |
|
position: absolute; |
358 |
|
bottom: 1em; |
359 |
|
left: 0.5em; |
360 |
|
padding: 0.5em; |
361 |
|
width: 10em; |
362 |
|
background: #e0f0e0; |
363 |
|
border: 1px solid #00ff00; |
364 |
|
} |
365 |
|
@media screen |
366 |
|
{ |
367 |
|
div#fixedBox |
368 |
{ |
{ |
369 |
for (var i=0;i<document.forma.elements.length;i++) |
position: fixed; |
|
{ |
|
|
var e = document.forma.elements[i]; |
|
|
if ((e.checked || !e.checked) && e.name != \'all\') { |
|
|
if (eval("document.forma."+location+".checked")) { |
|
|
e.checked = true; |
|
|
} else { |
|
|
e.checked = false; |
|
|
} |
|
|
} |
|
|
} |
|
370 |
} |
} |
371 |
//--> |
/* Don't do this at home */ |
372 |
</script> |
* html |
373 |
EOF3 |
{ |
374 |
$retHTML .= q{<form name="forma" method="GET" action="}."$MyURL"."?action=burn\""; |
overflow-y: hidden; |
375 |
$retHTML.= q{<input type="hidden" value="burn" name="action">}; |
} |
376 |
$retHTML .= q{<input type="hidden" value="results" name="search_results">}; |
* html body |
377 |
|
{ |
378 |
|
overflow-y: auto; |
379 |
|
height: 100%; |
380 |
|
padding: 0 1em 0 12em; |
381 |
|
font-size: 100%; |
382 |
|
} |
383 |
|
* html div#fixedBox |
384 |
|
{ |
385 |
|
position: absolute; |
386 |
|
} |
387 |
|
/* All done. */ |
388 |
|
} |
389 |
|
|
390 |
|
--> |
391 |
|
</style> |
392 |
|
<script language="javascript" type="text/javascript"> |
393 |
|
<!-- |
394 |
|
|
395 |
|
var debug_div = null; |
396 |
|
|
397 |
|
function debug(msg) { |
398 |
|
// return; // Disable debugging |
399 |
|
|
400 |
|
if (! debug_div) debug_div = document.getElementById('debug'); |
401 |
|
|
402 |
|
// this will create debug div if it doesn't exist. |
403 |
|
if (! debug_div) { |
404 |
|
debug_div = document.createElement('div'); |
405 |
|
if (document.body) document.body.appendChild(debug_div); |
406 |
|
else debug_div = null; |
407 |
|
} |
408 |
|
if (debug_div) { |
409 |
|
debug_div.appendChild(document.createTextNode(msg)); |
410 |
|
debug_div.appendChild(document.createElement("br")); |
411 |
} |
} |
412 |
$retHTML .= qq{ |
} |
413 |
<table style="fview" border="1" cellspacing="0" cellpadding="3"> |
|
414 |
<tr class="tableheader"> |
|
415 |
}; |
var element_id_cache = Array(); |
416 |
|
|
417 |
if ($addForm) { |
function element_id(name,element) { |
418 |
$retHTML .= "<td class=\"tableheader\"><input type=\"checkbox\" name=\"allFiles\" onClick=\"checkAll('allFiles');\"></td>"; |
if (! element_id_cache[name]) { |
419 |
|
element_id_cache[name] = self.document.getElementById(name); |
420 |
} |
} |
421 |
$retHTML .= qq{ |
return element_id_cache[name]; |
422 |
<td align="center">Host</td> |
} |
|
<td align="center">Backup no</td> |
|
|
<td align="center">Type</td> |
|
|
<td align="center">date</td> |
|
|
<td align="center">age/days</td> |
|
|
<td align="center">size/MB</td> |
|
|
</tr> |
|
|
}; |
|
423 |
|
|
424 |
my @backups = getBackupsNotBurned(); |
function checkAll(location) { |
425 |
my $backup; |
var len = element_id('forma').elements.length; |
426 |
|
var check_all = element_id('allFiles'); |
427 |
|
|
428 |
|
for (var i = 0; i < len; i++) { |
429 |
|
|
430 |
|
var e = element_id('forma').elements[i]; |
431 |
|
if ((e.checked || !e.checked) && e.name != 'all') { |
432 |
|
if (check_all.checked) { |
433 |
|
e.checked = true; |
434 |
|
} else { |
435 |
|
e.checked = false; |
436 |
|
} |
437 |
|
} |
438 |
|
} |
439 |
|
|
440 |
if ($addForm) { |
sumiraj(); |
441 |
$retHTML .= qq{ |
} |
442 |
<tr><td colspan=7 style="tableheader"> |
|
443 |
<input type="submit" value="Burn selected backups on medium" name="submitBurner"> |
function sumiraj(e) { |
444 |
</td></tr> |
var suma = parseInt(element_id('forma').totalsize.value) || 0; |
445 |
}; |
var len = element_id('forma').elements.length; |
446 |
|
if (e) { |
447 |
|
var size = parseInt( element_id("fss" + e.name.substr(3)).value ); |
448 |
|
if (e.checked) { |
449 |
|
suma += size; |
450 |
|
} else { |
451 |
|
suma -= size; |
452 |
|
} |
453 |
|
} else { |
454 |
|
suma = 0; |
455 |
|
for (var i = 0; i < len; i++) { |
456 |
|
var e = element_id('forma').elements[i]; |
457 |
|
if (e.name != 'all' && e.checked && e.name.substr(0,3) == 'fcb') { |
458 |
|
var el = element_id("fss" + e.name.substr(3)); |
459 |
|
if (el && el.value) suma += parseInt(el.value) || 0; |
460 |
|
} |
461 |
|
} |
462 |
} |
} |
463 |
|
element_id('forma').totalsize.value = suma; |
464 |
|
debug('total size: '+suma); |
465 |
|
return suma; |
466 |
|
} |
467 |
|
|
468 |
|
if (!self.body) self.body = new Object(); |
469 |
|
self.onload = self.document.onload = self.body.onload = function() { |
470 |
|
sumiraj(); |
471 |
|
} |
472 |
|
|
473 |
|
//--> |
474 |
|
</script> |
475 |
|
<div id="fixedBox"> |
476 |
|
|
477 |
|
Size: |
478 |
|
<input type="text" name="totalsize" size="7" readonly> |
479 |
|
<br/> |
480 |
|
Note: |
481 |
|
<br/> |
482 |
|
<textarea name="note" cols="10" rows="5"> |
483 |
|
</textarea> |
484 |
|
<br/> |
485 |
|
<input type="submit" value="Burn selected" name="submitBurner"> |
486 |
|
|
487 |
|
</div> |
488 |
|
<div id="debug" style="float: right; width: 10em; border: 1px #ff0000 solid; background-color: #ffe0e0; -moz-opacity: 0.7;"> |
489 |
|
no debug output yet |
490 |
|
</div> |
491 |
|
EOF3 |
492 |
|
$retHTML .= q{ |
493 |
|
<input type="hidden" value="burn" name="action"> |
494 |
|
<input type="hidden" value="results" name="search_results"> |
495 |
|
<table style="fview" border="0" cellspacing="0" cellpadding="2"> |
496 |
|
<tr class="tableheader"> |
497 |
|
<td class="tableheader"> |
498 |
|
<input type="checkbox" name="allFiles" id="allFiles" onClick="checkAll('allFiles');"> |
499 |
|
</td> |
500 |
|
<td align="center">Share</td> |
501 |
|
<td align="center">Backup no</td> |
502 |
|
<td align="center">Type</td> |
503 |
|
<td align="center">date</td> |
504 |
|
<td align="center">age/days</td> |
505 |
|
<td align="center">size/MB</td> |
506 |
|
<td align="center">gzip size</td> |
507 |
|
</tr> |
508 |
|
|
509 |
|
}; |
510 |
|
|
511 |
|
my @color = (' bgcolor="#e0e0e0"', ''); |
512 |
|
|
513 |
foreach $backup(@backups) { |
my $i = 0; |
514 |
|
my $host = ''; |
515 |
|
|
516 |
|
foreach my $backup ( getBackupsNotBurned() ) { |
517 |
|
|
518 |
|
if ($host ne $backup->{'host'}) { |
519 |
|
$i++; |
520 |
|
$host = $backup->{'host'}; |
521 |
|
} |
522 |
my $ftype = ""; |
my $ftype = ""; |
|
|
|
|
$retHTML .= "<tr>"; |
|
|
if ($addForm) { |
|
|
$retHTML .= '<td class="fview"><input type="checkbox" name="fcb' . |
|
|
$backup->{'hostid'}.'_'.$backup->{'backupnum'} . |
|
|
'" value="' . $backup->{'hostid'}.'_'.$backup->{'backupnum'} . |
|
|
'"></td>'; |
|
|
} |
|
|
|
|
|
$retHTML .= '<td class="fviewborder">' . $backup->{'host'} . '</td>' . |
|
|
'<td class="fviewborder">' . $backup->{'backupnum'} . '</td>' . |
|
|
'<td class="fviewborder">' . $backup->{'type'} . '</td>' . |
|
|
'<td class="fviewborder">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
|
|
'<td class="fviewborder">' . $backup->{'age'} . '</td>' . |
|
|
'<td class="fviewborder">' . $backup->{'size'} . '</td>' . |
|
|
'</tr>'; |
|
|
} |
|
523 |
|
|
524 |
$retHTML .= "</table>"; |
$retHTML .= |
525 |
|
'<tr' . $color[$i %2 ] . '> |
526 |
|
<td class="fview">'; |
527 |
|
# FIXME |
528 |
|
#$backup->{'fs_size'} = int($backup->{'size'} * 1024); |
529 |
|
if (($backup->{'fs_size'} || 0) > 0) { |
530 |
|
$retHTML .= ' |
531 |
|
<input type="checkbox" name="fcb' . |
532 |
|
$backup->{'hostid'}.'_'.$backup->{'backupnum'} . |
533 |
|
'" value="' . $backup->{'hostid'}.'_'.$backup->{'backupnum'} . |
534 |
|
'" onClick="sumiraj(this);">'; |
535 |
|
} |
536 |
|
$retHTML .= |
537 |
|
'</td>' . |
538 |
|
'<td align="right">' . $backup->{'host'} . ':' . $backup->{'share'} . '</td>' . |
539 |
|
'<td align="center">' . $backup->{'backupnum'} . '</td>' . |
540 |
|
'<td align="center">' . $backup->{'type'} . '</td>' . |
541 |
|
'<td align="center">' . epoch_to_iso( $backup->{'date'} ) . '</td>' . |
542 |
|
'<td align="center">' . $backup->{'age'} . '</td>' . |
543 |
|
'<td align="right">' . $backup->{'size'} . '</td>' . |
544 |
|
'<td align="right">' . $backup->{'fs_size'} . |
545 |
|
'<input type="hidden" iD="fss'.$backup->{'hostid'}.'_'.$backup->{'backupnum'} . '" value="'. $backup->{'fs_size'} .'"></td>' . |
546 |
|
|
547 |
if ($addForm) { |
"</tr>\n"; |
|
$retHTML .= "</form>"; |
|
548 |
} |
} |
549 |
|
|
550 |
|
$retHTML .= "</table>"; |
551 |
|
$retHTML .= "</form>"; |
552 |
|
|
553 |
return $retHTML; |
return $retHTML; |
554 |
} |
} |
564 |
my $start_t = time(); |
my $start_t = time(); |
565 |
|
|
566 |
my ($results, $files); |
my ($results, $files); |
567 |
if ($param->{'use_hest'}) { |
if ($param->{'use_hest'} && length($hilite) > 0) { |
568 |
($results, $files) = getFilesHyperEstraier($param, $offset); |
($results, $files) = getFilesHyperEstraier($param); |
569 |
} else { |
} else { |
570 |
($results, $files) = getFiles($param, $offset); |
($results, $files) = getFiles($param); |
571 |
} |
} |
572 |
|
|
573 |
my $dur_t = time() - $start_t; |
my $dur_t = time() - $start_t; |
593 |
</div> |
</div> |
594 |
<table style="fview" width="100%" border="0" cellpadding="2" cellspacing="0"> |
<table style="fview" width="100%" border="0" cellpadding="2" cellspacing="0"> |
595 |
<tr class="fviewheader"> |
<tr class="fviewheader"> |
596 |
|
<td></td> |
597 |
<td align="center">Share</td> |
<td align="center">Share</td> |
598 |
<td align="center">Type and Name</td> |
<td align="center">Type and Name</td> |
599 |
<td align="center">#</td> |
<td align="center">#</td> |
618 |
return sprintf(qq{<a href="?action=%s&host=%s&num=%d&share=%s&dir=%s">%s</a>}, $action, @_); |
return sprintf(qq{<a href="?action=%s&host=%s&num=%d&share=%s&dir=%s">%s</a>}, $action, @_); |
619 |
} |
} |
620 |
|
|
621 |
|
my $i = $offset * $on_page; |
622 |
|
|
623 |
foreach $file (@{ $files }) { |
foreach $file (@{ $files }) { |
624 |
|
$i++; |
625 |
|
|
626 |
my $typeStr = BackupPC::Attrib::fileType2Text(undef, $file->{'type'}); |
my $typeStr = BackupPC::Attrib::fileType2Text(undef, $file->{'type'}); |
627 |
$retHTML .= qq{<tr class="fviewborder">}; |
$retHTML .= qq{<tr class="fviewborder">}; |
628 |
|
|
629 |
|
$retHTML .= qq{<td class="fviewborder">$i</td>}; |
630 |
|
|
631 |
$retHTML .= |
$retHTML .= |
632 |
qq{<td class="fviewborder" align="right">} . $file->{'hname'} . ':' . $file->{'sname'} . qq{</td>} . |
qq{<td class="fviewborder" align="right">} . $file->{'hname'} . ':' . $file->{'sname'} . qq{</td>} . |
633 |
qq{<td class="fviewborder"><img src="$Conf{CgiImageDirURL}/icon-$typeStr.gif" alt="$typeStr" align="middle"> } . hilite_html( $file->{'filepath'}, $hilite ) . qq{</td>} . |
qq{<td class="fviewborder"><img src="$Conf{CgiImageDirURL}/icon-$typeStr.gif" alt="$typeStr" align="middle"> } . hilite_html( $file->{'filepath'}, $hilite ) . qq{</td>} . |
634 |
qq{<td class="fviewborder" align="center">} . restore_link( $typeStr, ${EscURI( $file->{'hname'} )}, $file->{'backupnum'}, ${EscURI( $file->{'sname'})}, ${EscURI( $file->{'filepath'} )}, $file->{'backupnum'} ) . qq{</td>} . |
qq{<td class="fviewborder" align="center">} . restore_link( $typeStr, ${EscURI( $file->{'hname'} )}, $file->{'backupnum'}, ${EscURI( $file->{'sname'})}, ${EscURI( $file->{'filepath'} )}, $file->{'backupnum'} ) . qq{</td>} . |
635 |
qq{<td class="fviewborder" align="right">} . $file->{'size'} . qq{</td>} . |
qq{<td class="fviewborder" align="right">} . $file->{'size'} . qq{</td>} . |
636 |
qq{<td class="fviewborder">} . epoch_to_iso( $file->{'date'} ) . qq{</td>} . |
qq{<td class="fviewborder">} . epoch_to_iso( $file->{'date'} ) . qq{</td>} . |
637 |
qq{<td class="fviewborder">} . $file->{'dvd'} . qq{</td>}; |
qq{<td class="fviewborder">} . '?' . qq{</td>}; |
638 |
|
|
639 |
$retHTML .= "</tr>"; |
$retHTML .= "</tr>"; |
640 |
} |
} |