diff options
author | jskyboo <jack@ron.hog.mooo.info> | 2017-01-25 19:22:08 -0800 |
---|---|---|
committer | jskyboo <jack@ron.hog.mooo.info> | 2017-01-25 19:22:08 -0800 |
commit | 5a1d67b17d485697e19ef49d66e8e5f91e7e884d (patch) | |
tree | 01b66f7a45e6a050cbb578048065c9c138044b27 /src | |
parent | 32dcdc7ce492cf1ce60e6e21fd9b8708ce8a65e3 (diff) | |
download | pfsense-5a1d67b17d485697e19ef49d66e8e5f91e7e884d.zip pfsense-5a1d67b17d485697e19ef49d66e8e5f91e7e884d.tar.gz |
Bug #7164 Limit NTP time source fields to the maximum number saved to configuration.
Diffstat (limited to 'src')
-rw-r--r-- | src/usr/local/www/js/pfSenseHelpers.js | 11 | ||||
-rw-r--r-- | src/usr/local/www/services_ntpd.php | 4 |
2 files changed, 13 insertions, 2 deletions
diff --git a/src/usr/local/www/js/pfSenseHelpers.js b/src/usr/local/www/js/pfSenseHelpers.js index 1dff7fa..f8aafe8 100644 --- a/src/usr/local/www/js/pfSenseHelpers.js +++ b/src/usr/local/www/js/pfSenseHelpers.js @@ -290,7 +290,16 @@ function checkLastRow() { function add_row() { // Find the last repeatable group - var lastRepeatableGroup = $('.repeatable:last'); + var lastRepeatableGroup = $('.repeatable:last'); + + // If the number of repeats exceeds the maximum, do not add another clone + if ($('.repeatable').length >= lastRepeatableGroup.attr('max_repeats')) { + // Alert user if alert message is specified + if (typeof lastRepeatableGroup.attr('max_repeats_alert') !== 'undefined') { + alert(lastRepeatableGroup.attr('max_repeats_alert')); + } + return; + } // Clone it var newGroup = lastRepeatableGroup.clone(); diff --git a/src/usr/local/www/services_ntpd.php b/src/usr/local/www/services_ntpd.php index ad25b1a..30626fa 100644 --- a/src/usr/local/www/services_ntpd.php +++ b/src/usr/local/www/services_ntpd.php @@ -227,7 +227,9 @@ $maxrows = max(count($timeservers), 1); $auto_pool_suffix = "pool.ntp.org"; for ($counter=0; $counter < $maxrows; $counter++) { $group = new Form_Group($counter == 0 ? 'Time Servers':''); - $group->addClass('repeatable'); + $group->addClass('repeatable'); + $group->setAttribute('max_repeats', NUMTIMESERVERS); + $group->setAttribute('max_repeats_alert', NUMTIMESERVERS . ' is the maximum number of configured servers.'); $group->add(new Form_Input( 'server' . $counter, |