diff options
author | Bill Marquette <billm@pfsense.org> | 2008-08-05 05:03:55 +0000 |
---|---|---|
committer | Bill Marquette <billm@pfsense.org> | 2008-08-05 05:03:55 +0000 |
commit | 50d86c13771164ab18c0de426f434f55c9b0cdce (patch) | |
tree | bd8ffe5404e37c26f4406c073cbec321700b5aaf /usr/local/www/load_balancer_virtual_server.php | |
parent | fbf672cbe9c241459579a83be00df9f20dd47dc0 (diff) | |
download | pfsense-50d86c13771164ab18c0de426f434f55c9b0cdce.zip pfsense-50d86c13771164ab18c0de426f434f55c9b0cdce.tar.gz |
Bring in new server load balancing code, this introduces:
* The ability to create your own monitors (tcp, http, https, send/expect)
* A new way of displaying 'standard tables' - MainTable class
* monitor_type array type
Diffstat (limited to 'usr/local/www/load_balancer_virtual_server.php')
-rwxr-xr-x | usr/local/www/load_balancer_virtual_server.php | 94 |
1 files changed, 37 insertions, 57 deletions
diff --git a/usr/local/www/load_balancer_virtual_server.php b/usr/local/www/load_balancer_virtual_server.php index 45ca5e9..4a4f98d 100755 --- a/usr/local/www/load_balancer_virtual_server.php +++ b/usr/local/www/load_balancer_virtual_server.php @@ -4,7 +4,7 @@ load_balancer_virtual_server.php part of pfSense (http://www.pfsense.com/) - Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>. + Copyright (C) 2005-2008 Bill Marquette <bill.marquette@gmail.com>. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -72,6 +72,21 @@ if ($_GET['act'] == "del") { } } +/* Index lbpool array for easy hyperlinking */ +$poodex = array(); +for ($i = 0; isset($config['load_balancer']['lbpool'][$i]); $i++) { + $poodex[$config['load_balancer']['lbpool'][$i]['name']] = $i; +} +for ($i = 0; isset($config['load_balancer']['virtual_server'][$i]); $i++) { + $a_vs[$i]['pool'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['pool']]}\">{$a_vs[$i]['pool']}</a>"; + if ($a_vs[$i]['sitedown'] != '') { + $a_vs[$i]['sitedown'] = "<a href=\"/load_balancer_pool_edit.php?id={$poodex[$a_vs[$i]['sitedown']]}\">{$a_vs[$i]['sitedown']}</a>"; + } else { + $a_vs[$i]['sitedown'] = 'none'; + } +} + + $pgtitle = array("Services","Load Balancer","Virtual Servers"); include("head.inc"); @@ -91,69 +106,34 @@ include("head.inc"); $tab_array = array(); $tab_array[] = array("Pools", false, "load_balancer_pool.php"); $tab_array[] = array("Virtual Servers", true, "load_balancer_virtual_server.php"); + $tab_array[] = array("Monitors", false, "load_balancer_monitor.php"); display_top_tabs($tab_array); ?> </td></tr> <tr> <td> <div id="mainarea"> - <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0"> - <tr> - <td width="10%" class="listhdrr">Name</td> - <td width="20%" class="listhdrr">Server address</td> - <td width="10%" class="listhdrr">Port</td> - <td width="20%" class="listhdrr">Pool</td> - <td width="30%" class="listhdr">Description</td> - <td width="10%" class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="load_balancer_virtual_server_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - <?php $i = 0; foreach ($a_vs as $vsent): ?> - <tr> - <td class="listlr" ondblclick="document.location='load_balancer_virtual_server_edit.php?id=<?=$i;?>';"> - <?=$vsent['name'];?> - </td> - <td class="listr" ondblclick="document.location='load_balancer_virtual_server_edit.php?id=<?=$i;?>';"> - <?=$vsent['ipaddr'];?> - </td> - <td class="listr" ondblclick="document.location='load_balancer_virtual_server_edit.php?id=<?=$i;?>';"> - <?=$vsent['port'];?> - <td class="listr" align="center" ondblclick="document.location='load_balancer_virtual_server_edit.php?id=<?=$i;?>';"> - <?=$vsent['pool'];?> - </td> - <td class="listbg" ondblclick="document.location='load_balancer_virtual_server_edit.php?id=<?=$i;?>';"> - <font color="#FFFFFF"><?=htmlspecialchars($vsent['desc']);?> - </td> - <td class="list" nowrap> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td valign="middle"><a href="load_balancer_virtual_server_edit.php?id=<?=$i;?>"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" width="17" height="17" border="0"></a></td> - <td valign="middle"><a href="load_balancer_virtual_server.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this entry?')"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - <?php $i++; endforeach; ?> - <tr> - <td class="list" colspan="5"></td> - <td class="list"> - <table border="0" cellspacing="0" cellpadding="1"> - <tr> - <td width="17"></td> - <td valign="middle"><a href="load_balancer_virtual_server_edit.php"><img src="/themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" width="17" height="17" border="0"></a></td> - </tr> - </table> - </td> - </tr> - </table> +<? + $t = new MainTable(); + $t->edit_uri('load_balancer_virtual_server_edit.php'); + $t->my_uri('load_balancer_virtual_server.php'); + $t->add_column('Name','name',10); + $t->add_column('IP Address','ipaddr',15); + $t->add_column('Port','port',10); + $t->add_column('Pool','pool',15); + $t->add_column('Fall Back Pool','sitedown',15); + $t->add_column('Description','desc',30); + $t->add_button('edit'); + $t->add_button('dup'); + $t->add_button('del'); + $t->add_content_array($a_vs); + $t->display(); +?> </div> - </table> - </form> + </td> + </tr> +</table> +</form> <?php include("fend.inc"); ?> </body> </html> |