summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjskyboo <jack@ron.hog.mooo.info>2017-01-25 19:22:08 -0800
committerRenato Botelho <renato@netgate.com>2017-01-27 11:24:17 -0200
commit7533bdcff80a5b3643530fbb7b8a78e2ac201b30 (patch)
treefc9dca88c1f4b3edbc78ab34377a4d08d61c7936
parent20290428cc093d43d8ee15cd1eb75026d30d0a93 (diff)
downloadpfsense-7533bdcff80a5b3643530fbb7b8a78e2ac201b30.zip
pfsense-7533bdcff80a5b3643530fbb7b8a78e2ac201b30.tar.gz
Bug #7164 Limit NTP time source fields to the maximum number saved to configuration.
(cherry picked from commit 5a1d67b17d485697e19ef49d66e8e5f91e7e884d)
-rw-r--r--src/usr/local/www/js/pfSenseHelpers.js11
-rw-r--r--src/usr/local/www/services_ntpd.php4
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 e8898ba..80d3361 100644
--- a/src/usr/local/www/js/pfSenseHelpers.js
+++ b/src/usr/local/www/js/pfSenseHelpers.js
@@ -314,7 +314,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 0c18906..7d1fbd3 100644
--- a/src/usr/local/www/services_ntpd.php
+++ b/src/usr/local/www/services_ntpd.php
@@ -252,7 +252,9 @@ $timeservers = explode(' ', $config['system']['timeservers']);
$maxrows = max(count($timeservers), 1);
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,
OpenPOWER on IntegriCloud