diff options
author | sullrich <sullrich@pfsense.org> | 2009-12-03 15:17:10 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-12-03 15:17:10 -0500 |
commit | 0239d8ee4aef436448db9db96a492e9ab2a620f8 (patch) | |
tree | c14634466ee5c13d5dd2fe45b995bd894696ee08 | |
parent | 2816a08958640b9b83aeeab09309f78154fefaba (diff) | |
download | pfsense-0239d8ee4aef436448db9db96a492e9ab2a620f8.zip pfsense-0239d8ee4aef436448db9db96a492e9ab2a620f8.tar.gz |
Make xmlrpc sync, schedule, gateway, in/out, ackqueue and layer7 all advanced type buttons simplifying the firewall rule edit form for 99% of the cases
-rwxr-xr-x | usr/local/www/firewall_rules_edit.php | 235 | ||||
-rw-r--r-- | usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js | 26 |
2 files changed, 155 insertions, 106 deletions
diff --git a/usr/local/www/firewall_rules_edit.php b/usr/local/www/firewall_rules_edit.php index d647ae7..3028797 100755 --- a/usr/local/www/firewall_rules_edit.php +++ b/usr/local/www/firewall_rules_edit.php @@ -962,8 +962,13 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell">No XMLRPC Sync</td> <td width="78%" class="vtable"> - <input type="checkbox" name="nosync"<?php if($pconfig['nosync']) echo " CHECKED"; ?>><br> - HINT: This prevents the rule from automatically syncing to other carp members. + <div id="showadvnoxmlrpcsyncbox"> + <input type="button" onClick="show_advanced_noxmlrpc()" value="Advanced"></input> - Show state</a> + </div> + <div id="shownoxmlrpcadv" style="display:none"> + <input type="checkbox" name="nosync"<?php if($pconfig['nosync']) echo " CHECKED"; ?>><br> + HINT: This prevents the rule from automatically syncing to other carp members. + </div> </td> </tr> <?php @@ -980,22 +985,28 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell">Schedule</td> <td width="78%" class="vtable"> - <select name='sched'> + <div id="showadvschedulebox"> + <input type="button" onClick="show_advanced_schedule()" value="Advanced"></input> - Show state</a> + </div> + <div id="showscheduleadv" style="display:none"> + <select name='sched'> <?php - foreach($schedules as $schedule) { - if($schedule == $pconfig['sched']) { - $selected = " SELECTED"; - } else { - $selected = ""; - } - if ($schedule == "none") { - echo "<option value=\"\" {$selected}>{$schedule}</option>\n"; - } else { - echo "<option value=\"{$schedule}\" {$selected}>{$schedule}</option>\n"; + foreach($schedules as $schedule) { + if($schedule == $pconfig['sched']) { + $selected = " SELECTED"; + } else { + $selected = ""; + } + if ($schedule == "none") { + echo "<option value=\"\" {$selected}>{$schedule}</option>\n"; + } else { + echo "<option value=\"{$schedule}\" {$selected}>{$schedule}</option>\n"; + } } - }?> - </select> - <p>Leave as 'none' to leave the rule enabled all the time.</p> +?> + </select> + <p>Leave as 'none' to leave the rule enabled all the time.</p> + </div> </td> </tr> @@ -1014,51 +1025,56 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell">Gateway</td> <td width="78%" class="vtable"> - <select name='gateway'> + <div id="showadvgatewaybox"> + <input type="button" onClick="show_advanced_gateway()" value="Advanced"></input> - Show state</a> + </div> + <div id="showgatewayadv" style="display:none"> + <select name='gateway'> <?php - foreach($gateways as $gw) { - if($gw == "") - continue; - if($gw == $pconfig['gateway']) { - $selected = " SELECTED"; - } else { - $selected = ""; - } - if ($gw == "default") { - echo "<option value=\"\" {$selected}>{$gw}</option>\n"; - } else { - $gwip = lookup_gateway_ip_by_name($gw); - echo "<option value=\"{$gw}\" {$selected}>{$gw} - {$gwip}</option>\n"; - } - } - /* add gateway groups to the list */ - if (is_array($config['gateways']['gateway_group'])) { - foreach($config['gateways']['gateway_group'] as $gw_group) { - if($gw_group['name'] == "") + foreach($gateways as $gw) { + if($gw == "") continue; - if($pconfig['gateway'] == $gw_group['name']) { - echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n"; - } else { - echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n"; - } - } - } - $iflist = get_configured_interface_with_descr(); - foreach ($iflist as $ifent => $ifdesc) { - if (in_array($config['interfaces'][$ifent]['ipaddr'], - array("dhcp", "pppoe", "pptp"))) { - if ($pconfig['gateway'] == $ifent) { + if($gw == $pconfig['gateway']) { $selected = " SELECTED"; } else { $selected = ""; } - if($ifdesc <> "") - echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($if)." - {$ifdesc}</option>\n"; + if ($gw == "default") { + echo "<option value=\"\" {$selected}>{$gw}</option>\n"; + } else { + $gwip = lookup_gateway_ip_by_name($gw); + echo "<option value=\"{$gw}\" {$selected}>{$gw} - {$gwip}</option>\n"; + } + } + /* add gateway groups to the list */ + if (is_array($config['gateways']['gateway_group'])) { + foreach($config['gateways']['gateway_group'] as $gw_group) { + if($gw_group['name'] == "") + continue; + if($pconfig['gateway'] == $gw_group['name']) { + echo "<option value=\"{$gw_group['name']}\" SELECTED>{$gw_group['name']}</option>\n"; + } else { + echo "<option value=\"{$gw_group['name']}\">{$gw_group['name']}</option>\n"; + } + } + } + $iflist = get_configured_interface_with_descr(); + foreach ($iflist as $ifent => $ifdesc) { + if (in_array($config['interfaces'][$ifent]['ipaddr'], + array("dhcp", "pppoe", "pptp"))) { + if ($pconfig['gateway'] == $ifent) { + $selected = " SELECTED"; + } else { + $selected = ""; + } + if($ifdesc <> "") + echo "<option value=\"{$ifent}\" {$selected}>".strtoupper($if)." - {$ifdesc}</option>\n"; + } } - } ?> - </select> - <p><strong>Leave as 'default' to use the system routing table. Or choose a gateway to utilize policy based routing.</strong></p> + </select> + <p><strong>Leave as 'default' to use the system routing table. Or choose a gateway to utilize policy based routing.</strong></p> + </div> </td> </tr> <tr> @@ -1109,68 +1125,75 @@ include("head.inc"); <tr> <td width="22%" valign="top" class="vncell">Ackqueue/Queue</td> <td width="78%" class="vtable"> - <select name="ackqueue"> + <div id="showadvackqueuebox"> + <input type="button" onClick="show_advanced_ackqueue()" value="Advanced"></input> - Show state</a> + </div> + <div id="showackqueueadv" style="display:none"> + <select name="ackqueue"> <?php - if (!is_array($qlist)) - $qlist = array(); - echo "<option value=\"none\""; - if (!$qselected) echo " SELECTED"; - echo " >none</option>"; - foreach ($qlist as $q => $qkey) { - if($q == "") - continue; - echo "<option value=\"$q\""; - if ($q == $pconfig['ackqueue']) { - $qselected = 1; - echo " SELECTED"; + if (!is_array($qlist)) + $qlist = array(); + echo "<option value=\"none\""; + if (!$qselected) echo " SELECTED"; + echo " >none</option>"; + foreach ($qlist as $q => $qkey) { + if($q == "") + continue; + echo "<option value=\"$q\""; + if ($q == $pconfig['ackqueue']) { + $qselected = 1; + echo " SELECTED"; + } + echo ">{$q}</option>"; } - echo ">{$q}</option>"; - } ?> - </select> / - <select name="defaultqueue"> + </select> / + <select name="defaultqueue"> <?php - $qselected = 0; - echo "<option value=\"none\""; - if (!$qselected) echo " SELECTED"; - echo " >none</option>"; - foreach ($qlist as $q => $qkey) { - if($q == "") - continue; - echo "<option value=\"$q\""; - if ($q == $pconfig['defaultqueue']) { - $qselected = 1; - echo " SELECTED"; + $qselected = 0; + echo "<option value=\"none\""; + if (!$qselected) echo " SELECTED"; + echo " >none</option>"; + foreach ($qlist as $q => $qkey) { + if($q == "") + continue; + echo "<option value=\"$q\""; + if ($q == $pconfig['defaultqueue']) { + $qselected = 1; + echo " SELECTED"; + } + echo ">{$q}</option>"; } - echo ">{$q}</option>"; - } ?> - </select> - <br /> - <span class="vexpl">Choose the Acknowledge Queue only if you have selected Queue.</span> - </td> - </tr> - <tr> - <td width="22%" valign="top" class="vncell">Layer7</td> - <td width="78%" class="vtable"> - <select name="l7container"> + </select> + <br /> + <span class="vexpl">Choose the Acknowledge Queue only if you have selected Queue.</span> + </td> + </tr> + <tr> + <td width="22%" valign="top" class="vncell">Layer7</td> + <td width="78%" class="vtable"> + <select name="l7container"> <?php - if (!is_array($l7clist)) - $dnqlist = array(); - echo "<option value=\"none\""; - echo " >none</option>"; - foreach ($l7clist as $l7ckey) { - echo "<option value=\"{$l7ckey}\""; - if ($l7ckey == $pconfig['l7container']) { - echo " SELECTED"; - } - echo ">{$l7ckey}</option>"; - } + if (!is_array($l7clist)) + $dnqlist = array(); + echo "<option value=\"none\""; + echo " >none</option>"; + foreach ($l7clist as $l7ckey) { + echo "<option value=\"{$l7ckey}\""; + if ($l7ckey == $pconfig['l7container']) { + echo " SELECTED"; + } + echo ">{$l7ckey}</option>"; + } ?> - </select> + </select> <br/> - <span class="vexpl">Choose a Layer7 container to apply application protocol inspection rules. - This rule are valid for tcp and udp protocols for now.</span> + <span class="vexpl"> + Choose a Layer7 container to apply application protocol inspection rules. + This rule are valid for tcp and udp protocols for now. + </span> + </div> </td> </tr> <tr> diff --git a/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js b/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js index b6570b6..731e28d 100644 --- a/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js +++ b/usr/local/www/javascript/firewall_rules_edit/firewall_rules_edit.js @@ -131,6 +131,30 @@ function show_dsdiv() { dsdiv.style.display = "block"; } +function show_advanced_noxmlrpc() { + document.getElementById("showadvnoxmlrpcsyncbox").innerHTML=''; + aodiv = document.getElementById('shownoxmlrpcadv'); + aodiv.style.display = "block"; +} + +function show_advanced_schedule() { + document.getElementById("showadvschedulebox").innerHTML=''; + aodiv = document.getElementById('showscheduleadv'); + aodiv.style.display = "block"; +} + +function show_advanced_gateway() { + document.getElementById("showadvgatewaybox").innerHTML=''; + aodiv = document.getElementById('showgatewayadv'); + aodiv.style.display = "block"; +} + +function show_advanced_ackqueue() { + document.getElementById("showadvackqueuebox").innerHTML=''; + aodiv = document.getElementById('showackqueueadv'); + aodiv.style.display = "block"; +} + function show_advanced_state() { document.getElementById("showadvstatebox").innerHTML=''; aodiv = document.getElementById('showstateadv'); @@ -140,7 +164,9 @@ function show_advanced_state() { function src_rep_change() { document.iform.srcendport.selectedIndex = document.iform.srcbeginport.selectedIndex; } + function dst_rep_change() { document.iform.dstendport.selectedIndex = document.iform.dstbeginport.selectedIndex; } + //--> |