Tidy up "load_balancer_pool" XHTML

Add SUMMARY to tables
Update PHP shorthand
Move "fbegin.inc" include between BODY and SCRIPT
Add CDATA section to scripts
Close INPUT tags
Update HTML Boolean operators
Move SELECT tag into the PHP IF statement
This commit is contained in:
Colin Fleming 2014-04-18 22:48:48 +01:00
parent 928dc66a43
commit 0e7aea24ca
2 changed files with 28 additions and 33 deletions

View File

@ -105,10 +105,10 @@ include("head.inc");
<form action="load_balancer_pool.php" method="post">
<?php if ($input_errors) print_input_errors($input_errors); ?>
<?php if ($savemsg) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('loadbalancer')): ?><p>
<?php if (is_subsystem_dirty('loadbalancer')): ?><br/>
<?php print_info_box_np(sprintf(gettext("The load balancer configuration has been changed%sYou must apply the changes in order for them to take effect."), "<br />"));?><br />
<?php endif; ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="load balancer pools">
<tr><td class="tabnavtbl">
<?php
/* active tabs */
@ -123,7 +123,7 @@ include("head.inc");
<tr>
<td>
<div id="mainarea">
<?
<?php
$t = new MainTable();
$t->edit_uri('load_balancer_pool_edit.php');
$t->my_uri('load_balancer_pool.php');

View File

@ -172,51 +172,54 @@ include("head.inc");
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
<?php include("fbegin.inc"); ?>
<script type="text/javascript">
//<![CDATA[
function clearcombo(){
for (var i=document.iform.serversSelect.options.length-1; i>=0; i--){
document.iform.serversSelect.options[i] = null;
}
document.iform.serversSelect.selectedIndex = -1;
}
//]]>
</script>
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
<script type="text/javascript" src="/javascript/suggestions.js"></script>
<?php include("fbegin.inc"); ?>
<?php if ($input_errors) print_input_errors($input_errors); ?>
<form action="load_balancer_pool_edit.php" method="post" name="iform" id="iform">
<table width="100%" border="0" cellpadding="6" cellspacing="0">
<table width="100%" border="0" cellpadding="6" cellspacing="0" summary="load balancer pool entry">
<tr>
<td colspan="2" valign="top" class="listtopic"><?=gettext("Add/edit Load Balancer - Pool entry"); ?></td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Name"); ?></td>
<td width="78%" class="vtable" colspan="2">
<input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16">
<input name="name" type="text" <?if(isset($pconfig['name'])) echo "value=\"{$pconfig['name']}\"";?> size="16" maxlength="16" />
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Mode"); ?></td>
<td width="78%" class="vtable" colspan="2">
<select id="mode" name="mode" onChange="enforceFailover(); checkPoolControls();">
<option value="loadbalance" <?if(!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "selected";?>><?=gettext("Load Balance");?></option>
<option value="failover" <?if($pconfig['mode'] == "failover") echo "selected";?>><?=gettext("Manual Failover");?></option>
<select id="mode" name="mode" onchange="enforceFailover(); checkPoolControls();">
<option value="loadbalance" <?if(!isset($pconfig['mode']) || ($pconfig['mode'] == "loadbalance")) echo "selected=\"selected\"";?>><?=gettext("Load Balance");?></option>
<option value="failover" <?if($pconfig['mode'] == "failover") echo "selected=\"selected\"";?>><?=gettext("Manual Failover");?></option>
</select>
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
<td width="78%" class="vtable" colspan="2">
<input name="descr" type="text" <?if(isset($pconfig['descr'])) echo "value=\"{$pconfig['descr']}\"";?>size="64">
<input name="descr" type="text" <?if(isset($pconfig['descr'])) echo "value=\"{$pconfig['descr']}\"";?> size="64" />
</td>
</tr>
<tr align="left">
<td width="22%" valign="top" id="monitorport_text" class="vncellreq"><?=gettext("Port"); ?></td>
<td width="78%" class="vtable" colspan="2">
<input class="formfldalias" id="port" name="port" type="text" <?if(isset($pconfig['port'])) echo "value=\"{$pconfig['port']}\"";?> size="16" maxlength="16"><br />
<input class="formfldalias" id="port" name="port" type="text" <?if(isset($pconfig['port'])) echo "value=\"{$pconfig['port']}\"";?> size="16" maxlength="16" /><br />
<div id="monitorport_desc">
<?=gettext("This is the port your servers are listening on."); ?><br />
<?=gettext("You may also specify a port alias listed in Firewall -&gt; Aliases here."); ?>
@ -232,7 +235,7 @@ function clearcombo(){
<tr align="left">
<td width="22%" valign="top" id="retry_text" class="vncell"><?=gettext("Retry"); ?></td>
<td width="78%" class="vtable" colspan="2">
<input name="retry" type="text" <?if(isset($pconfig['retry'])) echo "value=\"{$pconfig['retry']}\"";?> size="16" maxlength="16"><br />
<input name="retry" type="text" <?if(isset($pconfig['retry'])) echo "value=\"{$pconfig['retry']}\"";?> size="16" maxlength="16" /><br />
<div id="retry_desc"><?=gettext("Optionally specify how many times to retry checking a server before declaring it down."); ?></div>
</td>
</tr>
@ -250,7 +253,7 @@ function clearcombo(){
<?php
foreach ($config['load_balancer']['monitor_type'] as $monitor) {
if ($monitor['name'] == $pconfig['monitor']) {
$selected=" selected";
$selected=" selected=\"selected\"";
} else {
$selected = "";
}
@ -266,8 +269,8 @@ function clearcombo(){
<tr align="left">
<td width="22%" valign="top" class="vncellreq"><?=gettext("Server IP Address"); ?></td>
<td width="78%" class="vtable" colspan="2">
<input name="ipaddr" type="text" size="16" style="float: left;">
<input class="formbtn" type="button" name="button1" value="<?=gettext("Add to pool"); ?>" onclick="AddServerToPool(document.iform); enforceFailover(); checkPoolControls();"><br />
<input name="ipaddr" type="text" size="16" style="float: left;" />
<input class="formbtn" type="button" name="button1" value="<?=gettext("Add to pool"); ?>" onclick="AddServerToPool(document.iform); enforceFailover(); checkPoolControls();" /><br />
</td>
</tr>
<tr>
@ -279,24 +282,20 @@ function clearcombo(){
<tr>
<td width="22%" valign="top" class="vncellreq"><?=gettext("Members"); ?></td>
<td width="78%" class="vtable" colspan="2" valign="top">
<table>
<table summary="members">
<tbody>
<tr>
<td>
<center>
<td align="center">
<b><?=gettext("Pool Disabled"); ?></b>
<p/>
<select id="serversDisabledSelect" name="serversdisabled[]" multiple="true" size="5">
<?php
if (is_array($pconfig['serversdisabled'])) {
echo "<select id=\"serversDisabledSelect\" name=\"serversdisabled[]\" multiple=\"multiple\" size=\"5\">";
foreach($pconfig['serversdisabled'] as $svrent) {
if($svrent != '') echo " <option value=\"{$svrent}\">{$svrent}</option>\n";
}
}
echo "</select>";
}
?>
<p/>
<input class="formbtn" type="button" name="removeDisabled" value="<?=gettext("Remove"); ?>" onclick="RemoveServerFromPool(document.iform, 'serversdisabled[]');" />
</td>
@ -305,21 +304,17 @@ function clearcombo(){
<input class="formbtn" type="button" id="moveToDisabled" name="moveToDisabled" value="<" onclick="moveOptions(document.iform.serversSelect, document.iform.serversDisabledSelect); checkPoolControls();" />
</td>
<td>
<center>
<td align="center">
<b><?=gettext("Enabled (default)"); ?></b>
<p/>
<select id="serversSelect" name="servers[]" multiple="true" size="5">
<?php
if (is_array($pconfig['servers'])) {
echo "<select id=\"serversSelect\" name=\"servers[]\" multiple=\"multiple\" size=\"5\">";
foreach($pconfig['servers'] as $svrent) {
echo " <option value=\"{$svrent}\">{$svrent}</option>\n";
}
}
echo "</select>";
}
?>
<p/>
<input class="formbtn" type="button" name="removeEnabled" value="<?=gettext("Remove"); ?>" onclick="RemoveServerFromPool(document.iform, 'servers[]');" />
</td>
</tr>
@ -331,10 +326,10 @@ echo "</select>";
<td width="22%" valign="top">&nbsp;</td>
<td width="78%">
<br />
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onClick="AllServers('serversSelect', true); AllServers('serversDisabledSelect', true);">
<input type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()">
<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save"); ?>" onclick="AllServers('serversSelect', true); AllServers('serversDisabledSelect', true);" />
<input type="button" class="formbtn" value="<?=gettext("Cancel"); ?>" onclick="history.back()" />
<?php if (isset($id) && $a_pool[$id] && $_GET['act'] != 'dup'): ?>
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>">
<input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
<?php endif; ?>
</td>
</tr>