require_once "paths.php";
require_once "DB.php"; // Pear DB
+require_once "config.inc.php";
require_once($smarty_path."Config_File.class.php");
if (!function_exists('array_fill')) { // For PHP < 4.2.0 users
return $volumes;
} // end function GetVolumeList()
+ public function GetLastJobs( $delay = LAST_DAY )
+ {
+ switch( $this->driver )
+ {
+ case 'mysql':
+ $query = "SELECT JobId, Name, EndTime, JobStatus ";
+ $query .= "FROM Job ";
+ $query .= "WHERE EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-86400 and JobStatus!='T'";
+ break;
+ case 'pgsql':
+ $query = "SELECT JobId, Name, EndTime, JobStatus ";
+ $query .= "FROM Job ";
+ $query .= "WHERE EndTime <= NOW() and EndTime >NOW() - 86400 * interval '1 second' and JobStatus!= 'T'";
+ break;
+ }
+
+ $lastjobstatus = $this->db_link->query( $query );
+
+ if (PEAR::isError( $lastjobstatus ) ) {
+ die( "Unable to get last job status from catalog<br />" . $status->getMessage() );
+ }else {
+ //echo "numrows = " . $lastjobstatus->numRows() . "<br />";
+ return $lastjobstatus->numRows();
+ }
+ } // end function GetLastJobStatus()
+
} // end class Bweb
class BGraph {
[.DATABASE]
host = localhost ; Database host or IP
login = root ; Database account name
-pass = p@ssw0rd ; Database account password
+pass = p@ssw0rd ; Database account password
db_name = bacula ; Database name
db_type = mysql ; Database type
;db_port = 3306 ; Uncomment if not standard port
; If you want to configure more than 1 Bacula catalog in Bacula-Web, simply copy the previous line (See example below)
; Don't forget the change the name of the section (DATABASE2 in this case)
-[.DATABASE2]
-host = 192.168.2.55
-login = bacula
-pass =
-db_name = bacula
-db_type = mysql
+;[.DATABASE2]
+;host = 192.168.2.55
+;login = bacula
+;pass =
+;db_name = bacula
+;db_type = mysql
die( "Unable to get Total Job Bytes from catalog" . $last24bytes->getMessage() );
}else {
$tmp = $last24bytes->fetchRow();
- var_dump( $tmp );
+ //var_dump( $tmp );
// Transfered bytes since last 24 hours
$smarty->assign('bytes_totales', $dbSql->human_file_size( $tmp[0] ) );
// Get volumes list (volumes.tpl)
$smarty->assign('pools',$dbSql->GetVolumeList() );
+// Last job status (default is last 24 hours)
+$smarty->assign( 'lastjobs', $dbSql->GetLastJobs() );
+
// last_run_report.tpl
if ( $mode == "Lite" && $_GET['Full_popup'] == "yes" ) {
$tmp = array();
or die ( "Error: query at row 98" );
*/
$smarty->assign('status', $status->numRows() );
+
if ( $status->numRows() ) {
- while ( $res = $status->fetchRow() )
- array_push($tmp, $res);
- $smarty->assign('errors_array',$tmp);
- }
+ echo "status nomrow -> " . $status->numRows() . "<br />";
+ while ( $res = $status->fetchRow() ) {
+ array_push($tmp, $res);
+ }
+
+ $smarty->assign('errors_array',$tmp);
+ }else {
+ //echo "status pas marche ...<br />";
+ }
$status->free();
// Total Elapsed Time. Only for single Job.
margin: 0px;
}
+.box table
+{
+ margin-left: 5px;
+ margin-right: 5px;
+}
+.box table tr td
+{
+ padding: 2px;
+}
+.box table tr td.label
+{
+ font-weight: bold;
+ width: 150px;
+ text-align: left;
+}
+
table {
width: 100%;
margin: 0px;
</td>
</tr>
</table>
-</div> <!-- end div box -->
\ No newline at end of file
+</div>
+<!-- end div box -->
\ No newline at end of file
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
+<title>bacula-web</title>
+<link rel="stylesheet" type="text/css" href="style/default.css">
{literal}
<script type="text/javascript">
function OpenWin(URL,wid,hei) {
}
</script>
{/literal}
-<link rel="stylesheet" type="text/css" href="style/default.css" />
-<title>bacula-web</title>
+
</head>
<body>
{popup_init src='./js/overlib.js'}
{include file=header.tpl}
<div id="main_left">
-{include file=generaldata.tpl}
-<br />
{include file=volumes.tpl}
</div>
<div id="main_right">
- {include file="$last_report"}
+ <!-- General information -->
+ <div class="box">
+ <p class="title">General informations</p>
+ <table>
+ <tr>
+ <td class="label">{t}Clients{/t}</td> <td>{$clientes_totales}</td>
+ </tr>
+ <tr>
+ <td class="label">{t}Total bytes stored{/t}:</td> <td>{$bytes_stored}</td>
+ </tr>
+ <tr>
+ <td class="label">{t}Total files:{/t}</td> <td>{$files_totales}</td>
+ </tr>
+ <tr>
+ <td class="label">{t}Database size{/t}:</td> <td>{$database_size}</td>
+ </tr>
+ <tr>
+ <td colspan=2 align=center>
+ <a href="javascript:OpenWin('index.php?pop_graph1=yes','600','400')">{t}Last month, bytes transferred{/t}</a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan=2 align=center>
+ <a href="javascript:OpenWin('index.php?pop.graph2=yes','600','400')">{t}Last month, bytes transferred (pie){/t}</a>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ {include file="$last_report"}
-<!-- <table class=genmed cellspacing="1" cellpadding="3" border=0 align="center">
- <tr>
- <td>
--->
- <div class="box">
- <p class="title">General report</p>
- {if $server==""}
- <img src="stats.php?server={$server}&tipo_dato=69&title=General%20report&modo_graph=bars&sizex=420&sizey=250&MBottom=20&legend=1" alt="" />
- {else}
- <img src="stats.php?server={$server}&tipo_dato=3&title={$server}&modo_graph=bars" alt="" />
- {/if}
- </div> <!-- end div box -->
-<!--
- </td>
- </tr>
- </table>
--->
-</div>
+ <div class="box">
+ <p class="title">General report</p>
+ {if $server==""}
+ <img src="stats.php?server={$server}&tipo_dato=69&title=General%20report&modo_graph=bars&sizex=420&sizey=250&MBottom=20&legend=1" alt="" />
+ {else}
+ <img src="stats.php?server={$server}&tipo_dato=3&title={$server}&modo_graph=bars" alt="" />
+ {/if}
+ </div> <!-- end div box -->
+
+</div> <!-- end div main_right -->
{include file="footer.tpl"}
\ No newline at end of file
<p class="title">Detailled report</p>
<form method="get" action="report.php" target="_blank">
- <table>
-
- <tr>
- <td align=right colspan=2 valign=bottom>
-
- <table width="100%" cellpadding="0" cellspacing="3" border="0">
+ <table width="100%" cellpadding="0" cellspacing="3" border="0">
+<!--
<tr bgcolor=white>
<td colspan="3" style="text-align: center; background-image: url('style/images/bg1.png'); font-size: 12px; font-weight: bold;">
Detailed report
</td>
</tr>
-
- <tr>
- <td align=left>
- {t}Select a job:{/t}
- </td>
- <td align=right>
- <input type=hidden name="default" value="1">
- <select name=server>
- {if $smarty.get.server!=""}
- {html_options values=$smarty.get.server output=$smarty.get.server}
- {else}
- {html_options values=$total_name_jobs output=$total_name_jobs}
- {/if}
- </select>
- </td>
- <td>
- <input type=submit value="{t}go{/t}">
- </td>
-
- </tr>
- </table>
- </form>
+-->
+ <tr>
+ <td class="label">{t}Select a job:{/t}</td>
+ <td align=center>
+ <input type=hidden name="default" value="1">
+ <select name=server>
+ {if $smarty.get.server != ""}
+ {html_options values=$smarty.get.server output=$smarty.get.server}
+ {else}
+ {html_options values=$total_name_jobs output=$total_name_jobs}
+ {/if}
+ </select>
+ <input type=submit value="{t}go{/t}">
+ </td>
+ </tr>
+ </table>
+ </form>
{else if #mode# == "Full" || $smarty.get.Full_popup == "yes"}
<table>
<tr class="tbl_header1">
<!-- volumes.tpl -->
<div class="box">
- <p class="title">Pools</p>
-<!--
-<table border=0 width=100% class=code cellspacing=0 cellpadding=0>
-<tr align=center width=100%>
- <td class=tbl_header2 background="style/images/bg4.png"><b>Pools</b></td>
- <td class=tbl_header2 background="style/images/end4.png"><img src="style/images/empty.png"></td>
-</tr>
--->
-<table border=0 width="100%" class=code cellspacing=0 cellpadding=0>
+ <p class="title">Pools</p>
+
+ <table width="100%">
{foreach from=$pools item=pool key=pool_name}
<tr>
<th colspan="6" style="font-size: 10pt; text-align: center; background-color: #E0C8E5; color: black; padding: 3px;">
{/foreach}
</tr>
{/foreach}
-</table>
+ </table>
</div> <!-- end div box -->