summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-03-16 08:46:42 -0400
committerStephen Beaver <sbeaver@netgate.com>2016-03-16 08:46:42 -0400
commitcd52523d0939703112c08ba8417ce29b0c7ad163 (patch)
tree70f2f5bc5d25e12abc9744bb6ebd378e74d5eb87 /src
parent3218a579f3851d42d222ac4fbd49de98608a2593 (diff)
parentc0d1ceda2ced97fc9aefff5363b995c2103abd8c (diff)
downloadpfsense-cd52523d0939703112c08ba8417ce29b0c7ad163.zip
pfsense-cd52523d0939703112c08ba8417ce29b0c7ad163.tar.gz
Merge pull request #2748 from phil-davis/patch-3
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/services_ntpd.php112
1 files changed, 82 insertions, 30 deletions
diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php
index dd639ac..22af484 100644
--- a/src/usr/local/www/services_ntpd.php
+++ b/src/usr/local/www/services_ntpd.php
@@ -333,18 +333,18 @@ $section->addInput(new Form_Checkbox(
'<a href="status_logs.php?logfile=ntpd">' . 'Status > System Logs > NTP' . '</a>');
// Statistics logging section
-$btnadvstats = new Form_Button(
+$btnadv = new Form_Button(
'btnadvstats',
- 'Advanced',
+ 'Display Advanced',
null,
'fa-cog'
);
-$btnadvstats->addClass('btn-info btn-sm');
+$btnadv->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText(
'Statistics Logging',
- $btnadvstats
+ $btnadv
))->setHelp('Warning: These options will create persistent daily log files in /var/log/ntp.');
$section->addInput(new Form_Checkbox(
@@ -369,18 +369,18 @@ $section->addInput(new Form_Checkbox(
));
// Leap seconds section
-$btnleap = new Form_Button(
- 'btnleap',
- 'Advanced',
+$btnadv = new Form_Button(
+ 'btnadvleap',
+ 'Display Advanced',
null,
'fa-cog'
);
-$btnleap->addClass('btn-info btn-sm');
+$btnadv->addClass('btn-info btn-sm');
$section->addInput(new Form_StaticText(
'Leap seconds',
- $btnleap
+ $btnadv
))->setHelp('A leap second file allows NTP to advertize an upcoming leap second addition or subtraction. ' .
'Normally this is only useful if this server is a stratum 1 time server. ');
@@ -413,34 +413,86 @@ print($form);
//<![CDATA[
events.push(function() {
- // Make the ‘clear’ button a plain button, not a submit button
- $('#btnadvstats').prop('type','button');
+ // Show advanced stats options ============================================
+ var showadvstats = false;
- // On click, show the controls in the stats section
- $("#btnadvstats").click(function() {
- hideCheckbox('clockstats', false);
- hideCheckbox('loopstats', false);
- hideCheckbox('peerstats', false);
+ function show_advstats(ispageload) {
+ var text;
+ // On page load decide the initial state based on the data.
+ if (ispageload) {
+<?php
+ if (!$pconfig['clockstats'] && !$pconfig['loopstats'] && !$pconfig['peerstats']) {
+ $showadv = false;
+ } else {
+ $showadv = true;
+ }
+?>
+ showadvstats = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>;
+ } else {
+ // It was a click, swap the state.
+ showadvstats = !showadvstats;
+ }
+
+ hideCheckbox('clockstats', !showadvstats);
+ hideCheckbox('loopstats', !showadvstats);
+ hideCheckbox('peerstats', !showadvstats);
+
+ if (showadvstats) {
+ text = "<?=gettext('Hide Advanced');?>";
+ } else {
+ text = "<?=gettext('Display Advanced');?>";
+ }
+ $('#btnadvstats').html('<i class="fa fa-cog"></i> ' + text);
+ }
+
+ $('#btnadvstats').prop('type', 'button');
+
+ $('#btnadvstats').click(function(event) {
+ show_advstats();
});
- // Make the ‘clear’ button a plain button, not a submit button
- $('#btnadvrestr').prop('type','button');
+ // Show advanced leap second options ======================================
+ var showadvleap = false;
+
+ function show_advleap(ispageload) {
+ var text;
+ // On page load decide the initial state based on the data.
+ if (ispageload) {
+<?php
+ // Note: leapfile is not a field saved in the config, so no need to test for it here.
+ // leapsec is the encoded text in the config, leaptext is not a pconfig[] key.
+ if (empty($pconfig['leapsec'])) {
+ $showadv = false;
+ } else {
+ $showadv = true;
+ }
+?>
+ showadvleap = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>;
+ } else {
+ // It was a click, swap the state.
+ showadvleap = !showadvleap;
+ }
+
+ hideInput('leaptext', !showadvleap);
+ hideInput('leapfile', !showadvleap);
+
+ if (showadvleap) {
+ text = "<?=gettext('Hide Advanced');?>";
+ } else {
+ text = "<?=gettext('Display Advanced');?>";
+ }
+ $('#btnadvleap').html('<i class="fa fa-cog"></i> ' + text);
+ }
- // Make the ‘btnleap’ button a plain button, not a submit button
- $('#btnleap').prop('type','button');
+ $('#btnadvleap').prop('type', 'button');
- // On click, show the controls in the leap seconds section
- $("#btnleap").click(function() {
- hideInput('leaptext', false);
- hideInput('leapfile', false);
+ $('#btnadvleap').click(function(event) {
+ show_advleap();
});
- // Set intial states
- hideCheckbox('clockstats', true);
- hideCheckbox('loopstats', true);
- hideCheckbox('peerstats', true);
- hideInput('leaptext', true);
- hideInput('leapfile', true);
+ // Set initial states
+ show_advstats(true);
+ show_advleap(true);
// Suppress "Delete row" button if there are fewer than two rows
checkLastRow();
OpenPOWER on IntegriCloud