add a Storage Area dropdown to set where this monitor will storage it's events

This commit is contained in:
Isaac Connor 2015-12-15 11:13:00 -05:00
parent 9ffbaabde5
commit 14dc447145
1 changed files with 15 additions and 9 deletions

View File

@ -19,6 +19,7 @@
// //
require_once( 'includes/Server.php'); require_once( 'includes/Server.php');
require_once( 'includes/Storage.php');
if ( !canView( 'Monitors' ) ) if ( !canView( 'Monitors' ) )
{ {
@ -29,7 +30,6 @@ if ( !canView( 'Monitors' ) )
$tabs = array(); $tabs = array();
$tabs["general"] = translate('General'); $tabs["general"] = translate('General');
$tabs["source"] = translate('Source'); $tabs["source"] = translate('Source');
$tabs["storage"] = translate('Storage');
$tabs["timestamp"] = translate('Timestamp'); $tabs["timestamp"] = translate('Timestamp');
$tabs["buffers"] = translate('Buffers'); $tabs["buffers"] = translate('Buffers');
if ( ZM_OPT_CONTROL && canView( 'Control' ) ) if ( ZM_OPT_CONTROL && canView( 'Control' ) )
@ -576,7 +576,7 @@ if ( $tab != 'source' || ($newMonitor['Type'] != 'Remote' && $newMonitor['Protoc
} }
if ( $tab != 'storage' ) { if ( $tab != 'storage' ) {
?> ?>
<input type="hidden" name="newMonitor[storage_id]" value="<?= validHtmlStr($newMonitor['storage_id']) ?>"/> <input type="hidden" name="newMonitor[StorageId]" value="<?= validHtmlStr($newMonitor['StorageId']) ?>"/>
<?php <?php
} }
if ( $tab != 'timestamp' ) if ( $tab != 'timestamp' )
@ -661,8 +661,19 @@ switch ( $tab )
foreach ( $results as $row => $server_obj ) { foreach ( $results as $row => $server_obj ) {
$servers[$server_obj->Id] = $server_obj->Name(); $servers[$server_obj->Id] = $server_obj->Name();
} }
echo buildSelect( "newMonitor[ServerId]", $servers );
?>
</td></tr>
<tr><td><?php echo translate('StorageArea') ?></td><td>
<?php
$storage_areas = array(''=>'Default');
$result = dbQuery( 'SELECT * FROM Storage ORDER BY Name');
$results = $result->fetchALL(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Storage' );
foreach ( $results as $row => $storage_obj ) {
$storage_areas[$storage_obj->Id] = $storage_obj->Name();
}
echo buildSelect( "newMonitor[StorageId]", $storage_areas );
?> ?>
<?php echo buildSelect( "newMonitor[ServerId]", $servers ); ?>
</td></tr> </td></tr>
<tr><td><?php echo translate('SourceType') ?></td><td><?php echo buildSelect( "newMonitor[Type]", $sourceTypes ); ?></td></tr> <tr><td><?php echo translate('SourceType') ?></td><td><?php echo buildSelect( "newMonitor[Type]", $sourceTypes ); ?></td></tr>
<tr><td><?php echo translate('Function') ?></td><td><select name="newMonitor[Function]"> <tr><td><?php echo translate('Function') ?></td><td><select name="newMonitor[Function]">
@ -853,11 +864,6 @@ switch ( $tab )
?> ?>
<?php <?php
break; break;
} case 'storage' : {
$areas = dbFetchAll( 'SELECT Id, Name FROM Storage ORDER BY Name' );
?>
<tr><td?<?= $SLANG['StorageArea'] ?></td><td><?= buildSelect( "newMonitor[storage_id]", $areas ); ?></td></tr>
<?php
} }
case 'timestamp' : case 'timestamp' :
{ {