- ability to choose which catalog to use (when more than 1 catalog areconfigured)
- some php code cleanup in index.php
var $driver;
- public $tpl;
- public $db_link; // Database link
+ public $tpl;
+ public $db_link; // Database link
private $config_file; // Config filename
private $config; // Loaded config from bacula.conf
private $catalogs = array(); // Catalog array
+ public $catalog_nb;
private $bwcfg;
function __construct()
// Checking if config file exist and is readable
if( !$this->bwcfg->Check_Config_File() )
die( "Unable to load configuration file" );
- else
+ else {
$this->bwcfg->Load_Config();
-
+ $this->catalog_nb = $this->bwcfg->Count_Catalogs();
+ }
+
// Select which catalog to connect to
if( isset( $_POST['catalog_id'] ) )
$dsn = $this->bwcfg->Get_Dsn( $_POST['catalog_id'] );
$this->init_tpl();
// Initialize smarty gettext function
$this->init_gettext();
+
+ // Catalog selection
+ if( $this->catalog_nb > 1 ) {
+ // Set current catalog in header template
+ if(isset( $_POST['catalog_id'] ) )
+ $this->tpl->assign( 'catalog_current', $_POST['catalog_id'] );
+
+ $this->tpl->assign( 'catalogs', $this->bwcfg->Get_Catalogs() );
+ }else
+ {
+
+ }
}
// Initialize Smarty template classe
$config['language'] = 'en_EN';
//MySQL bacula catalog
- $config[0]['label'] = 'Backup Server';
+ $config[0]['label'] = 'Backup/mysql';
$config[0]['host'] = 'localhost';
$config[0]['login'] = 'root';
$config[0]['password'] = 'p@ssw0rd';
$config[0]['db_port'] = '3306';
//MySQL bacula catalog
- $config[1]['label'] = 'Backup Server';
+ $config[1]['label'] = 'Backup/pgsql';
$config[1]['host'] = 'localhost';
$config[1]['login'] = 'bacula';
$config[1]['password'] = 'bacula';
$dbSql = new Bweb();
-$mode = "";
-
// Assign to template catalogs number
//$dbSql->tpl->assign( "dbs", $dbSql->bwcfg->Count_Catalogs() );
// Assign dbs
$smarty->assign("dbs_now", $_SESSION['DATABASE']);
}
*/
+// Catalog count
+$catalog_nb = $dbSql->catalog_nb;
+$dbSql->tpl->assign( 'catalog_nb', $catalog_nb );
// Stored files number
$totalfiles = $dbSql->GetStoredFiles( ALL );
width: 100%;
padding: 0px;
margin: 0px;
- margin-bottom: 15px;
+ margin-bottom: 0px;
background-color: #736F6E;
}
+
#header p {
margin: 0px;
padding: 5px;
margin: 0em;
padding: 0px;
border-bottom: 1px solid black;
+ height: 30px;
}
+
#subheader ul {
- height: 20px;
+ height: 30px;
margin: 0px;
+ /* margin-top: 5px; */
}
#subheader li {
display: inline;
float: right;
padding: 0px 10px 0px 10px;
+ margin-top: 5px;
+ vertical-align: middle;
}
#subheader li a {
<div id="subheader">
<ul>
<li> <a href="http://bacula-web.dflc.ch/bugs" target="_blank">Bugs</a> </li>
- <li><a href="http://bacula-web.dflc.ch" target="_blank">About</a> </li>
+ <li> <a href="http://bacula-web.dflc.ch" target="_blank">About</a> </li>
<!-- Condifitional catalog selection if more than 1 catalog is defined in the configuration -->
- {if $dbs > 1}
+ {if $catalog_nb > 1}
<li>
- <form method=post action=index.php>
- Catalog <select name=sel_database OnChange=submit()> {html_options values={$dbs} name=$selected_db=$dbs_now} </select>
+ <form method="post" action="index.php">
+ Catalog
+ <select name="catalog_id" OnChange="submit()">
+ {html_options options=$catalogs}
+ </select>
</form>
</li>
{/if}