summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-03-15 11:31:50 -0400
committerStephen Beaver <sbeaver@netgate.com>2016-03-15 11:31:50 -0400
commit8f95aee6d75551d3eb212b8528d71052fab489fa (patch)
tree5baf4b8dde1933601379df700e76f671671d47da /src/usr
parent36e9994b110704d1220629141afe1a4e3ad0e0c5 (diff)
parentee1f18feeb1869a6c035ef10a28f9cd7a49e22a0 (diff)
downloadpfsense-8f95aee6d75551d3eb212b8528d71052fab489fa.zip
pfsense-8f95aee6d75551d3eb212b8528d71052fab489fa.tar.gz
Merge pull request #2742 from phil-davis/patch-6
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/system_gateways_edit.php101
1 files changed, 69 insertions, 32 deletions
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php
index 2a1b819..336776a 100644
--- a/src/usr/local/www/system_gateways_edit.php
+++ b/src/usr/local/www/system_gateways_edit.php
@@ -700,43 +700,25 @@ $section->addInput(new Form_Input(
$pconfig['descr']
))->setHelp('You may enter a description here for your reference (not parsed).');
-// If any of the advanced options are non-default, we will not show the "Advanced" button
-// and will display the advanced section
-if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) ||
- !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || !empty($pconfig['data_payload']) ||
- (isset($pconfig['weight']) && $pconfig['weight'] > 1) ||
- (isset($pconfig['interval']) && !($pconfig['interval'] == $dpinger_default['interval'])) ||
- (isset($pconfig['loss_interval']) && !($pconfig['loss_interval'] == $dpinger_default['loss_interval'])) ||
- (isset($pconfig['time_period']) && !($pconfig['time_period'] == $dpinger_default['time_period'])) ||
- (isset($pconfig['alert_interval']) && !($pconfig['alert_interval'] == $dpinger_default['alert_interval'])) ||
- (isset($pconfig['nonlocalgateway']) && $pconfig['nonlocalgateway']))) {
-
- $btnadvanced = new Form_Button(
- 'toggle-advanced',
- 'Advanced Options',
- null,
- 'fa-cog'
- );
-
- $advdflt = true;
+// Add a button to provide access to the advanced fields
+$btnadv = new Form_Button(
+ 'btnadvopts',
+ 'Display Advanced',
+ null,
+ 'fa-cog'
+);
- $btnadvanced->toggles('.advanced-options')->setAttribute('type', 'button');
- $btnadvanced->addClass('btn-info');
+$btnadv->addClass('btn-info btn-sm');
- $section->addInput(new Form_StaticText(
- null,
- $btnadvanced
- ));
-}
+$section->addInput(new Form_StaticText(
+ null,
+ $btnadv
+));
$form->add($section);
$section = new Form_Section('Advanced');
-if (isset($advdflt)) {
- $section->addClass('collapse');
-}
-
-$section->addClass('advanced-options');
+$section->addClass('adnlopts');
$section->addInput(new Form_Select(
'weight',
@@ -886,5 +868,60 @@ $section->addInput(new Form_Checkbox(
$form->add($section);
print $form;
+?>
+
+<script type="text/javascript">
+//<![CDATA[
+events.push(function() {
+
+ // Show advanced additional opts options ===========================================================================
+ var showadvopts = false;
+
+ function show_advopts(ispageload) {
+ var text;
+ // On page load decide the initial state based on the data.
+ if (ispageload) {
+<?php
+ if (!(!empty($pconfig['latencylow']) || !empty($pconfig['latencyhigh']) ||
+ !empty($pconfig['losslow']) || !empty($pconfig['losshigh']) || !empty($pconfig['data_payload']) ||
+ (isset($pconfig['weight']) && $pconfig['weight'] > 1) ||
+ (isset($pconfig['interval']) && !($pconfig['interval'] == $dpinger_default['interval'])) ||
+ (isset($pconfig['loss_interval']) && !($pconfig['loss_interval'] == $dpinger_default['loss_interval'])) ||
+ (isset($pconfig['time_period']) && !($pconfig['time_period'] == $dpinger_default['time_period'])) ||
+ (isset($pconfig['alert_interval']) && !($pconfig['alert_interval'] == $dpinger_default['alert_interval'])) ||
+ (isset($pconfig['nonlocalgateway']) && $pconfig['nonlocalgateway']))) {
+ $showadv = false;
+ } else {
+ $showadv = true;
+ }
+?>
+ showadvopts = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>;
+ } else {
+ // It was a click, swap the state.
+ showadvopts = !showadvopts;
+ }
+
+ hideClass('adnlopts', !showadvopts);
+
+ if (showadvopts) {
+ text = "<?=gettext('Hide Advanced');?>";
+ } else {
+ text = "<?=gettext('Display Advanced');?>";
+ }
+ $('#btnadvopts').html('<i class="fa fa-cog"></i> ' + text);
+ }
+
+ $('#btnadvopts').prop('type', 'button');
+
+ $('#btnadvopts').click(function(event) {
+ show_advopts();
+ });
+
+ // ---------- On initial page load ------------------------------------------------------------
+
+ show_advopts(true);
+});
+//]]>
+</script>
-include("foot.inc");
+<?php include("foot.inc");
OpenPOWER on IntegriCloud